From Apache OpenOffice Wiki
Jump to: navigation, search

The text controller has a visible cursor that is used in the GUI. Get the com.sun.star.text.TextViewCursor by calling getTextViewCursor() at the com.sun.star.text.XTextViewCursorSupplier interface of the current text document controller.

It supports the following cursor capabilities that depend on having the necessary information about the current layout state, therefore it is not supported by the model cursor.


 boolean jumpToFirstPage()
 boolean jumpToLastPage()
 boolean jumpToPage( [in] long pageNo)
 long getPage()
 boolean jumpToNextPage()
 boolean jumpToPreviousPage()
 boolean jumpToEndOfPage()
 boolean jumpToStartOfPage()


 boolean screenDown()
 boolean screenUp()


 boolean goDown( [in] long lines, [in] boolean bExpand)
 boolean goUp( [in] long lines, [in] boolean bExpand)
 boolean isAtStartOfLine()
 boolean isAtEndOfLine()
 void gotoEndOfLine( [in] boolean bExpand)
 void gotoStartOfLine( [in] boolean bExpand)


 boolean goLeft( [in] long characters, [in] boolean bExpand)
 boolean goRight( [in] long characters, [in] boolean bExpand)
 boolean goDown( [in] long characters, [in] boolean bExpand)
 boolean goUp( [in] long characters, [in] boolean bExpand)

Additionally the interface com.sun.star.beans.XPropertySet is supported.

Currently, the view cursor does not have the capabilities as the document cursor does. Therefore, it is necessary to create a document cursor to have access to the full text cursor functionality. The method createTextCursorByRange() is used:

 XText xCrsrText = xViewCursor.getText();
 // Create a TextCursor over the view cursor's contents
 XTextCursor xDocumentCursor = xViewText.createTextCursorByRange(xViewCursor.getStart());
 xDocumentCursor.gotoRange(xViewCursor.getEnd(), true);
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages