LibreOffice LibreOffice 25.8 SDK API Reference

Public Member Functions | List of all members
XModel Interface Referencepublished

represents a component which is created from a URL and arguments. More...

`import"XModel.idl";`

Inheritance diagram for XModel:

## Public Member Functions
boolean | attachResource ([in] string URL, [in] sequence< com::sun::star::beans::PropertyValue > Arguments)
| informs a model about its resource description. More...
string | getURL ()
| provides information about the location of this model More...
sequence< com::sun::star::beans::PropertyValue > | getArgs ()
| provides read access on currently representation of the com::sun::star::document::MediaDescriptor of this model which describes the model and its state More...
void | connectController ([in] XController Controller)
| is called whenever a new controller is created for this model. More...
void | disconnectController ([in] XController Controller)
| is called whenever an existing controller should be deregistered at this model. More...
void | lockControllers ()
| suspends some notifications to the controllers which are used for display updates. More...
void | unlockControllers ()
| resumes the notifications which were suspended by XModel::lockControllers(). More...
boolean | hasControllersLocked ()
| determines if there is at least one lock remaining. More...
XController | getCurrentController ()
| provides access to the controller which currently controls this model More...
void | setCurrentController ([in] XController Controller) raises ( com::sun::star::container::NoSuchElementException )
| sets a registered controller as the current controller. More...
com::sun::star::uno::XInterface | getCurrentSelection ()
| provides read access on current selection on controller 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...

## Detailed Description

represents a component which is created from a URL and arguments.

It is a representation of a resource in the sense that it was created/loaded from the resource. The arguments are passed to the loader to modify its behavior. An example for such an argument is "AsTemplate", which loads the resource as a template for a new document. (see com::sun::star::document::MediaDescriptor for further details)

Models can be controlled by controller components, which are usually views of the model. (see Controller for further details)

If there is at least one controller, there is by definition a current controller. And if that controller supports the interface com::sun::star::view::XSelectionSupplier, it has a current selection too.

See also
  com::sun::star::document::MediaDescriptor
  Controller
  com::sun::star::view::XSelectionSupplier

Developers Guide
  Office Development - Component - Models - XModel
  Office Development - Component - Getting Frames, Controllers and Models from Each Other
  Text Documents - Text Document Controller
  Office Development - Component - Models
  Office Development - Frame-Controller-Model Paradigm in LibreOffice

## Member Function Documentation

## ◆ attachResource()

boolean attachResource | ( | [in] string | URL,
|  | [in] sequence< com::sun::star::beans::PropertyValue > | Arguments
| ) |  |

informs a model about its resource description.

Parameters

  URL | specifies the resource
  Arguments | are optional arguments for that resource (see com::sun::star::document::MediaDescriptor)

Returns
  `TRUE` for success
  `FALSE` otherwise

## ◆ connectController()

void connectController | ( | [in] XController | Controller | ) |

is called whenever a new controller is created for this model.

The com::sun::star::lang::XComponent interface of the controller must be used to recognize when it is deleted.

Parameters

  Controller | a new controller for this model

See also
  XModel::disconnectController()

## ◆ disconnectController()

void disconnectController | ( | [in] XController | Controller | ) |

is called whenever an existing controller should be deregistered at this model.

The com::sun::star::lang::XComponent interface of the controller must be used to recognize when it is deleted.

Parameters

  Controller | the existing controller which should be deregistered

See also
  XModel::connectController()

## ◆ getArgs()

sequence< com::sun::star::beans::PropertyValue > getArgs | ( |  | ) |

provides read access on currently representation of the com::sun::star::document::MediaDescriptor of this model which describes the model and its state

Returns
  the arguments with which the model was originally created or stored the last time.

## ◆ getCurrentController()

XController getCurrentController | ( |  | ) |

provides access to the controller which currently controls this model

Returns
  If the controller which is active is a controller of this model, it will be returned. If not, the controller which was the last active of this model is returned. If no controller of this model ever was active, the controller first registered is returned. If no controller is registered for this model, `NULL` is returned.

## ◆ getCurrentSelection()

com::sun::star::uno::XInterface getCurrentSelection | ( |  | ) |

provides read access on current selection on controller

Returns
  the current selection in the current controller. If there is no current controller, it returns `NULL`.

## ◆ getURL()

string getURL | ( |  | ) |

provides information about the location of this model

Returns
  the URL of the resource which is represented by this model.

See also
  XStorable::getLocation()

## ◆ hasControllersLocked()

boolean hasControllersLocked | ( |  | ) |

determines if there is at least one lock remaining.

While there is at least one lock remaining, some notifications for display updates are not broadcasted to the controllers.

Returns
  `TRUE` if any lock exist
  `FALSE` otherwise

## ◆ lockControllers()

void lockControllers | ( |  | ) |

suspends some notifications to the controllers which are used for display updates.

The calls to XModel::lockControllers() and XModel::unlockControllers() may be nested and even overlapping, but they must be in pairs. While there is at least one lock remaining, some notifications for display updates are not broadcasted.

## ◆ setCurrentController()

void setCurrentController | ( | [in] XController | Controller | ) |
raises | ( | com::sun::star::container::NoSuchElementException
| ) |  |

sets a registered controller as the current controller.

Parameters

  Controller | reference to an already existing connected controller, which should be the new active one

Exceptions

  com::sun::star::container::NoSuchElementException | if xController isn't an already connected controller on this model

## ◆ unlockControllers()

void unlockControllers | ( |  | ) |

resumes the notifications which were suspended by XModel::lockControllers().

The calls to XModel::lockControllers() and XModel::unlockControllers() may be nested and even overlapping, but they must be in pairs. While there is at least one lock remaining, some notifications for display updates are not broadcasted.

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

- com/sun/star/frame/XModel.idl