Class CalcCellCursor

class ooodev.calc.CalcCellCursor(owner, cursor, lo_inst=None)[source]

Bases: LoInstPropsPartial, SheetCellCursorComp, QiPartial, PropPartial, StylePartial, ServicePartial, CalcDocPropPartial, CalcSheetPropPartial, TheDictionaryPartial

Parameters:
  • owner (CalcSheet) –

  • cursor (XSheetCellCursor) –

  • lo_inst (LoInst | None) –

__init__(owner, cursor, lo_inst=None)[source]

Constructor.

Parameters:
  • lo_inst (LoInst, optional) – Lo instance.

  • owner (CalcSheet) –

  • cursor (XSheetCellCursor) –

Return type:

None

add_event_chart_data_change_event_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_chart_data_changed(cb)

Adds a listener for an event.

Event is invoked when chart data changes in value or structure.

The callback EventArgs.event_data will contain a UNO com.sun.star.chart.ChartDataChangeEvent struct.

Return type:

None

Parameters:

cb (Any) –

add_event_modified(cb)

Adds a listener for an event.

Event is invoked when something changes in the object.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_modify_events_disposing(cb)

Adds a listener for an event.

Event is invoked when the broadcaster is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Return type:

None

Parameters:

cb (Any) –

add_event_property_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_property_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_vetoable_change(name, cb)

Adds a listener for an event.

Event is invoked when property is changed.

The callback EventArgs.event_data will contain a com.sun.star.beans.PropertyChangeEvent struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

add_event_vetoable_change_events_disposing(name, cb)

Adds a listener for an event.

Event is invoked when the property listener is about to be disposed.

The callback EventArgs.event_data will contain a UNO com.sun.star.lang.EventObject struct.

Parameters:
  • name (str) – Property Name

  • cb (EventArgsCallbackT) – Callback

Return type:

None

apply_styles(*styles, **kwargs)

Applies style to component.

Parameters:
  • obj. (styles expandable list of styles object such as Font to apply to) –

  • kwargs (Any, optional) – Expandable list of key value pairs.

  • styles (StyleT) –

Return type:

None

find_used_cursor()[source]

Find used cursor

Raises:

MissingInterfaceError – if unable to find interface

Returns:

Cell range

Return type:

CalcCellRange

find_used_range_obj(content_flags=23)[source]

Finds used range object.

The used range is found by querying the current range for content specified by the content_flags.

Parameters:

content_flags (int, optional) – CellFlags. Defaults to 23.

Raises:

CellRangeError – If unable to get used range object

Returns:

The Range object that represents the used range.

Return type:

RangeObj

Note

Default CellFlags is: CellFlags.FORMULA | CellFlags.VALUE | CellFlags.DATETIME | CellFlags.STRING

CellFlags can be imported from com.sun.star.sheet.

See also

API CellFlags

New in version 0.47.7.

get_calc_cell_range()[source]

Get calc cell range

Returns:

Cell range

Return type:

CalcCellRange

get_cell_by_position()[source]
get_cell_by_position(cell_name: str)
get_cell_by_position(addr: com.sun.star.table.CellAddress)
get_cell_by_position(cell: com.sun.star.table.XCell)
get_cell_by_position(cell_obj: ooodev.utils.data_type.cell_obj.CellObj)
get_cell_by_position(col: int, row: int)
get_cell_by_position(*args, **kwargs)

Get cell by position

Parameters:
  • cell_name (str) – Cell name.

  • addr (CellAddress) – Cell Address.

  • cell (XCell) – Cell.

  • cell_obj (CellObj) – Cell Object. If passed in the same CellObj is returned.

  • col (int) – Zero-based column index.

  • row (int) – Zero-based row index.

Returns:

Cell

Return type:

CalcCell

get_property(name, default=<object object>)

Get property value

Parameters:
  • name (str) – Property Name.

  • default (Any, optional) – Return value if property value is None.

Returns:

Property value or default.

Return type:

Any

get_services()

Gets service names for the instance.

Returns:

service names

Return type:

List[str]

go_to_end()[source]

Go to end.

Points the cursor to a single cell which is the end of a contiguous series of (filled) cells.

Returns:

New instance of CalcCellCursor

Return type:

CalcCellCursor

go_to_end_of_used_area(expand=False)[source]

Go to end.

points the cursor to the end of the used area.

Parameters:

expand (bool) – If True then the used area is expanded to the right and down if necessary. False``sets size of the cursor to a single cell. Default is ``False.

Returns:

New instance of CalcCellCursor

Return type:

CalcCellCursor

go_to_next()[source]

Go to next.

Points the cursor to the next unprotected cell. If the sheet is not protected, this is the next cell to the right.

Returns:

New instance of CalcCellCursor

Return type:

CalcCellCursor

go_to_offset(col_offset, row_offset)[source]

Go to next.

Moves the origin of the cursor relative to the current position.

Returns:

New instance of CalcCellCursor

Return type:

CalcCellCursor

Parameters:
  • col_offset (int) –

  • row_offset (int) –

go_to_previous()[source]

Go to next.

Points the cursor to the previous unprotected cell. If the sheet is not protected, this is the next cell to the left.

Returns:

New instance of CalcCellCursor

Return type:

CalcCellCursor

go_to_start()[source]

Go to start.

Points the cursor to a single cell which is the beginning of a contiguous series of (filled) cells.

Returns:

New instance of CalcCellCursor

Return type:

CalcCellCursor

go_to_start_of_used_area(expand=False)[source]

Go to end.

points the cursor to the start of the used area.

Parameters:

expand (bool) – If True then the used area is expanded to the left and up if necessary. False``sets size of the cursor to a single cell. Default is ``False.

Returns:

New instance of CalcCellCursor

Return type:

CalcCellCursor

qi(atype, raise_err=False)

Generic method that get an interface instance from an object.

Parameters:
  • atype (T) – Interface type to query obj for. Any Uno class that starts with ‘X’ such as XInterface

  • raise_err (bool, optional) – If True then raises MissingInterfaceError if result is None. Default False

Raises:

MissingInterfaceError – If ‘raise_err’ is ‘True’ and result is None

Returns:

instance of interface if supported; Otherwise, None

Return type:

T | None

Note

When raise_err=True return value will never be None.

remove_event_chart_data_change_event_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_chart_data_changed(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_modified(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_modify_events_disposing(cb)

Removes a listener for an event

Return type:

None

Parameters:

cb (Any) –

remove_event_property_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_property_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_vetoable_change(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

remove_event_vetoable_change_events_disposing(name)

Removes a listener for an event

Parameters:

name (str) – Property Name

Return type:

None

set_property(**kwargs)

Set property value

Parameters:

**kwargs (Any) – Variable length Key value pairs used to set properties.

Return type:

None

support_service(*service)

Gets if instance supports a service.

Parameters:

*service (str) – Variable length argument list of UNO namespace strings such as com.sun.star.configuration.GroupAccess

Returns:

True if instance supports any passed in service; Otherwise, False

Return type:

bool

property calc_doc: CalcDoc

Calc Document.

Return type:

CalcDoc

property calc_sheet: CalcSheet

Calc Sheet.

Return type:

CalcSheet

property component: com.sun.star.sheet.SheetCellCursor

Sheet Cell Cursor Component

Return type:

SheetCellCursor

property events_listener_chart_data_change_event: ChartDataChangeEventListener

Returns listener

Return type:

ChartDataChangeEventListener

property events_listener_modify: ModifyListener

Returns listener

Return type:

ModifyListener

property extra_data: TheDict

Extra Data Key Value Pair Dictionary.

Properties can be assigned properties and access like a dictionary and with dot notation.

Note

This is a dictionary object that can be used to store key value pairs. Generally speaking this data is not part of the object’s main data structure and is not saved with the object (document).

This property is used to store data that is not part of the object’s main data structure and can be used however the developer sees fit.

Return type:

TheDict

property lo_inst: LoInst

Lo Instance

Return type:

LoInst

property office_doc: OfficeDocumentT

Office Document.

Return type:

OfficeDocumentT