LibreOffice LibreOffice 26.2 SDK API Reference

Exported Interfaces | Public Member Functions | List of all members
XGridColumnModel Interface Referencepublished

An instance of this interface is used by the UnoControlGrid to retrieve the column structure that is displayed in the actual control. More...

`import"XGridColumnModel.idl";`

Inheritance diagram for XGridColumnModel:

## Exported Interfaces
interface | ::com::sun::star::lang::XComponent
| implements life time control for the component More...
interface | ::com::sun::star::container::XContainer
| allows to register listeners to be notified when columns are inserted or removed More...
interface | ::com::sun::star::util::XCloneable
| allows cloning the complete column model More...

## Public Member Functions
long | getColumnCount ()
| Returns the number of columns. More...
XGridColumn | createColumn ()
| creates a new column for use with the column model. More...
long | addColumn ([in] XGridColumn column) raises ( ::com::sun::star::lang::IllegalArgumentException )
| Adds a column to the model. More...
void | removeColumn ([in] long ColumnIndex) raises ( ::com::sun::star::lang::IndexOutOfBoundsException )
| removes a column from the model More...
sequence< XGridColumn > | getColumns ()
| Returns all columns of the model. More...
XGridColumn | getColumn ([in] long index) raises ( ::com::sun::star::lang::IndexOutOfBoundsException )
| Returns a specific column. More...
void | setDefaultColumns ([in] long elements)
| Fills the model with the given number of default columns. More...
Public Member Functions inherited from XComponent
void | dispose ()
| The owner of an object calls this method to explicitly free all resources kept by this object and thus break cyclic references. More...
void | addEventListener ([in] XEventListener xListener)
| adds an event listener to the object. More...
void | removeEventListener ([in] XEventListener aListener)
| removes an event listener from the listener list. More...
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object. More...
void | acquire ()
| increases the reference counter by one. More...
void | release ()
| decreases the reference counter by one. More...
Public Member Functions inherited from XContainer
void | addContainerListener ([in] com::sun::star::container::XContainerListener xListener)
| adds the specified listener to receive events when elements are inserted or removed. More...
void | removeContainerListener ([in] com::sun::star::container::XContainerListener xListener)
| removes the specified listener so it does not receive any events from this container. More...
Public Member Functions inherited from XCloneable
com::sun::star::util::XCloneable | createClone ()
| creates a copy of the object. More...

## Detailed Description

An instance of this interface is used by the UnoControlGrid to retrieve the column structure that is displayed in the actual control.

If you do not need your own model implementation, you can also use the DefaultGridColumnModel.

Since
  OOo 3.3

## Exported Interfaces

## ◆ ::com::sun::star::container::XContainer

interface ::com::sun::star::container::XContainer

allows to register listeners to be notified when columns are inserted or removed

## ◆ ::com::sun::star::lang::XComponent

interface ::com::sun::star::lang::XComponent

implements life time control for the component

## ◆ ::com::sun::star::util::XCloneable

interface ::com::sun::star::util::XCloneable

allows cloning the complete column model

## Member Function Documentation

## ◆ addColumn()

long addColumn | ( | [in] XGridColumn | column | ) |
raises | ( | ::com::sun::star::lang::IllegalArgumentException
| ) |  |

Adds a column to the model.

You should use the createColumn() member to create a new column. This gives implementations of the `XGridColumnModel` interface the possibility to provide own column implementations which extend the basic GridColumn type.

As soon as the column has been inserted into the model, the model takes ownership of it. This means when the column is removed, or when the column model is disposed, the grid column is disposed as well.

Parameters

  column | the column to add to the model.

Returns
  the index of new created column.

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the given column is not a valid element for the column container, or if it is `NULL`.

## ◆ createColumn()

XGridColumn createColumn | ( |  | ) |

creates a new column for use with the column model.

The newly created column is not yet inserted into the column container, you need to call addColumn() after you initialized the column object.

## ◆ getColumn()

XGridColumn getColumn | ( | [in] long | index | ) |
raises | ( | ::com::sun::star::lang::IndexOutOfBoundsException
| ) |  |

Returns a specific column.

Parameters

  index | the position of the requested column.

Returns
  the requested column.

## ◆ getColumnCount()

long getColumnCount | ( |  | ) |

Returns the number of columns.

Returns
  the number of columns.

## ◆ getColumns()

sequence< XGridColumn > getColumns | ( |  | ) |

Returns all columns of the model.

Returns
  all columns associated with the model in a sequence of XGridColumn.

## ◆ removeColumn()

void removeColumn | ( | [in] long | ColumnIndex | ) |
raises | ( | ::com::sun::star::lang::IndexOutOfBoundsException
| ) |  |

removes a column from the model

The column object will be disposed upon removal.

Parameters

  ColumnIndex | denotes the index of the column to remove

Exceptions

  com::sun::star::lang::IndexOutOfBoundsException | if `ColumnIndex` does not denote a valid column index.

## ◆ setDefaultColumns()

void setDefaultColumns | ( | [in] long | elements | ) |

Fills the model with the given number of default columns.

Existing columns will be removed before adding new columns. Listeners at the column model will be notified one com::sun::star::container::XContainerListener::elementRemoved() event for each removed column, and one com::sun::star::container::XContainerListener::elementInserted() event for each insertion.

Parameters

  elements | the number of default columns that should be set.

The documentation for this interface was generated from the following file:

- com/sun/star/awt/grid/XGridColumnModel.idl