Class ModelGrid

class ooodev.dialog.dl_control.model.model_grid.ModelGrid(model)[source]

Bases: ModelPropPartial, UnoControlGridModelPartial, ModelDialogElementPartial

__init__(model)[source]

Constructor

Parameters:
  • component (UnoControlModel) – UNO Component that implements com.sun.star.awt.UnoControlModel service.

  • model (com.sun.star.awt.UnoControlModel) –

Return type:

None

add_event_listener(listener)

Adds an event listener to the component.

Parameters:

listener (XEventListener) – The event listener to be added.

Return type:

None

add_property_change_listener(name, listener)

Adds a listener for property changes.

Parameters:
  • name (str) – The name of the property.

  • listener (Any) – The listener to be added.

Return type:

None

add_vetoable_change_listener(name, listener)

Adds a listener for vetoable changes.

Parameters:
  • name (str) – The name of the property.

  • listener (Any) – The listener to be added.

Return type:

None

create_clone()

Creates a clone of the object.

Returns:

The clone.

Return type:

XCloneable

dispose()

Disposes the component.

Return type:

None

get_property_set_info()

Returns the property set info.

Returns:

The property set info.

Return type:

XPropertySetInfo

get_property_value(name)

Returns the value of a property.

Parameters:

name (str) – The name of the property.

Returns:

The value of the property.

Return type:

Any

remove_event_listener(listener)

Removes an event listener from the component.

Parameters:

listener (XEventListener) – The event listener to be removed.

Return type:

None

remove_property_change_listener(name, listener)

Removes a listener for property changes.

Parameters:
  • name (str) – The name of the property.

  • listener (Any) – The listener to be removed.

Return type:

None

remove_vetoable_change_listener(name, listener)

Removes a listener for vetoable changes.

Parameters:
  • name (str) – The name of the property.

  • listener (Any) – The listener to be removed.

Return type:

None

set_font_descriptor(font_descriptor)

Sets the font descriptor of the control.

Parameters:

font_descriptor (FontDescriptor, FontDescriptorStructComp) – UNO Struct - Font descriptor to set.

Return type:

None

Note

The font_descriptor property can also be used to set the font descriptor.

Hint

  • FontDescriptor can be imported from ooo.dyn.awt.font_descriptor.

Return type:

None

Parameters:

font_descriptor (FontDescriptor | FontDescriptorStructComp) –

set_property_value(name, value)

Sets the value of a property.

Parameters:
  • name (str) – The name of the property.

  • value (Any) – The value of the property.

Return type:

None

property active_selection_background_color: Color | None

Gets/Sets the color to be used when drawing the background of selected cells, while the control has the focus.

If this property has a value of None, the grid control renderer will use some default color, depending on the control’s style settings.

Returns:

Color to be used when drawing the background of selected cells, while the control has the focus.

Return type:

Color | None

property active_selection_text_color: Color | None

Gets the color to be used when drawing the text of selected cells, while the control has the focus.

If this property has a value of VOID, the grid control renderer will use some default color, depending on the control’s style settings.

Returns:

Color or None if not set.

Return type:

Color | None

property column_header_height: UnitAppFontHeight | None

Gets/Sets the height of the column header row, if applicable.

The height is specified in application font units.

The value given here is ignored if ShowColumnHeader is False.

If the property is None, the grid control shall automatically determine a height which conveniently allows, according to the used font, to display one line of text.

When setting the property the value can be set with UnitT or float in AppFont units.

Return type:

UnitAppFontHeight | None

property column_model: com.sun.star.awt.grid.XGridColumnModel

Specifies the XGridColumnModel that is providing the column structure.

You can implement your own instance of XGridColumnModel or use the DefaultGridColumnModel.

The column model is in the ownership of the grid model: When you set a new column model, or dispose the grid model, then the (old) column model is disposed, too.

The default for this property is an empty instance of the DefaultGridColumnModel.

Return type:

XGridColumnModel

property context_writing_mode: int

Get or set the context_writing_mode property.

Return type:

int

property enable_visible: bool

Get or set the enable_visible property.

Return type:

bool

property font_descriptor: FontDescriptorStructComp

Gets/Sets the Font Descriptor.

Setting value can be done with a FontDescriptor or FontDescriptorStructComp object.

Returns:

Font Descriptor

Return type:

FontDescriptorStructComp

Hint

  • FontDescriptor can be imported from ooo.dyn.awt.font_descriptor.

property font_emphasis_mark: FontEmphasisEnum

Gets/Sets the FontEmphasis value of the text in the control.

Note

Value can be set with FontEmphasisEnum or int.

Hint

  • FontEmphasisEnum can be imported from ooo.dyn.text.font_emphasis.

Return type:

FontEmphasisEnum

property font_relief: FontReliefEnum

Gets/Sets FontRelief value of the text in the control.

Note

Value can be set with FontReliefEnum or int.

Hint

  • FontReliefEnum can be imported from ooo.dyn.text.font_relief.

Return type:

FontReliefEnum

property grid_line_color: Color | None

Gets/Sets the color to be used when drawing lines between cells

If this property has a value of None, the grid control renderer will use some default color, depending on the control’s style settings.

Returns:

Color or None if not set.

Return type:

Color | None

property h_scroll: bool

Gets/Sets the vertical scrollbar mode.

The default value is False

Return type:

bool

property header_background_color: Color | None

Gets/Sets the color to be used when drawing the background of row or column headers

If this property has a value of None, the grid control renderer will use some default color, depending on the control’s style settings.

Returns:

Color or None if not set.

Return type:

Color | None

property header_text_color: Color | None

Gets/Sets the color to be used when drawing the text within row or column headers

If this property has a value of None, the grid control renderer will use some default color, depending on the control’s style settings.

Returns:

Color or None if not set.

Return type:

Color | None

property help_text: str

Get/Sets the help text of the control.

Return type:

str

property help_url: str

Gets/Sets the help URL of the control.

Return type:

str

property inactive_selection_background_color: Color | None

Gets/Sets the color to be used when drawing the background of selected cells, while the control does not have the focus.

If this property has a value of None, the grid control renderer will use some default color, depending on the control’s style settings.

Returns:

Color or None if not set.

Return type:

Color | None

property inactive_selection_text_color: Color | None

Gets/Sets the color to be used when drawing the text of selected cells, while the control does not have the focus.

If this property has a value of None, the grid control renderer will use some default color, depending on the control’s style settings.

Returns:

Color or None if not set.

Return type:

Color | None

property model: com.sun.star.awt.UnoControlModel

Uno Control Model

Return type:

UnoControlModel

property picture: str

Gets/Sets the picture for the control

When setting the value it can be a string or a Path object. If a string is passed it can be a URL or a path to a file. Value such as file:///path/to/image.png and /path/to/image.png are valid. Relative paths are supported.

Returns:

The picture URL in the format of file:///path/to/image.png or empty string if no picture is set.

Return type:

str

property row_background_colors: Tuple[Color, ...]

Gets/Sets the colors to be used as background for data rows.

If this sequence is non-empty, the data rows will be rendered with alternating background colors: Assuming the sequence has n elements, each row will use the background color as specified by its number’s remainder modulo n.

If this sequence is empty, all rows will use the same background color as the control as whole.

If this property is empty, rows will be painted in alternating background colors, every second row having a background color derived from the control’s selection color.

Returns:

Tuple of ~ooodev.utils.color.Color objects.

Return type:

Tuple[Color, …]

property row_header_width: UnitAppFontWidth | None

Gets/Sets the width of the row header column, if applicable.

The width is specified in application font units.

The value given here is ignored if show_row_header is False.

When setting the property the value can be set with UnitT or float in AppFont units.

Return type:

UnitAppFontWidth | None

property row_height: UnitAppFontHeight | None

Gets/Sets the height of rows in the grid control.

The height is specified in application font units.

When setting the property the value can be set with UnitT or float in AppFont units.

Return type:

UnitAppFontHeight | None

property selection_model: SelectionType

Gets/Sets the selection mode that is enabled for this grid control.

The default value is com.sun.star.view.SelectionType.SINGLE

Hint

  • SelectionType can be imported from ooo.dyn.view.selection_type

Return type:

SelectionType

property show_column_header: bool

Gets/Sets whether the grid control should display a title row.

The default value is True.

Return type:

bool

property show_row_header: bool

Gets/Sets whether the grid control should display a special header column.

The default value is False.

Return type:

bool

property tabstop: bool

Gets/Sets - that the control can be reached with the TAB key.

Return type:

bool

property text_color: Color

Gets/Sets the text color of the control.

Returns:

Text color.

Return type:

Color

property text_line_color: Color

Gets/Sets the text line color of the control.

Returns:

Text line color.

Return type:

Color

property use_grid_lines: bool

Gets/Sets whether or not to paint horizontal and vertical lines between the grid cells.

Return type:

bool

property v_scroll: bool

Gets/Sets the horizontal scrollbar mode.

The default value is False.

Return type:

bool

property vertical_align: VerticalAlignment

Gets/Sets the vertical alignment of the text in the control.

optional

Hint

  • VerticalAlignment can be imported from ooo.dyn.style.vertical_alignment

Return type:

VerticalAlignment