ooodev.adapter.text.text_cursor_partial module

class ooodev.adapter.text.text_cursor_partial.TextCursorPartial(component, interface=com.sun.star.text.XTextCursor)[source]

Bases: TextRangePartial

Partial class for XTextCursor.

Parameters:
  • component (XTextCursor) –

  • interface (UnoInterface | None) –

__init__(component, interface=com.sun.star.text.XTextCursor)[source]

Constructor

Parameters:
  • component (XTextCursor) – UNO Component that implements com.sun.star.text.XTextCursor interface.

  • interface (UnoInterface, optional) – The interface to be validated. Defaults to XTextCursor.

Return type:

None

collapse_to_end()[source]

Sets the end of the position to the start.

Return type:

None

collapse_to_start()[source]

Sets the start of the position to the end.

Return type:

None

go_left(count, expand=False)[source]

Moves the cursor left by the given number of units.

Parameters:
  • count (int) – Number of units to move.

  • expand (bool, optional) – True to expand the selection. Defaults to False.

Returns:

True if the cursor was moved left, False otherwise.

Return type:

bool

Note

Even if the command was not completed successfully it may be completed partially. E.g. if it was required to move 5 characters but it is only possible to move 3 FALSE will be returned and the cursor moves only those 3 characters.

go_right(count, expand=False)[source]

Moves the cursor right by the given number of units.

Parameters:
  • count (int) – Number of units to move.

  • expand (bool, optional) – True to expand the selection. Defaults to False.

Returns:

True if the cursor was moved right, False otherwise.

Return type:

bool

Note

Even if the command was not completed successfully it may be completed partially. E.g. if it was required to move 5 characters but it is only possible to move 3 FALSE will be returned and the cursor moves only those 3 characters.

goto_end(expand=False)[source]

Moves the cursor to the end of the document.

Parameters:

expand (bool, optional) – True to expand the selection. Defaults to False.

Return type:

None

goto_range(range, expand=False)[source]

Moves or expands the cursor to a specified TextRange.

Parameters:
  • range (XTextRange) – Range to move to.

  • expand (bool, optional) – True to expand the selection. Defaults to False.

Return type:

None

goto_start(expand=False)[source]

Moves the cursor to the start of the document.

Parameters:

expand (bool, optional) – True to expand the selection. Defaults to False.

Return type:

None

is_collapsed()[source]

Returns True if the cursor is collapsed.

Return type:

bool