LibreOffice LibreOffice 26.2 SDK API Reference

Loading...
Searching...
No Matches
XModel2 Interface Reference

extends interface XModel. More...

`import "XModel2.idl";`

Inheritance diagram for XModel2:

## Public Member Functions
com::sun::star::container::XEnumeration | getControllers ()
| provides list of all currently connected controller objects.
sequence< string > | getAvailableViewControllerNames ()
| provides the available names of the factory to be used to create views.
com::sun::star::frame::XController2 | createDefaultViewController ([in] com::sun::star::frame::XFrame Frame) raises (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::Exception )
| creates the default view instance for this model.
com::sun::star::frame::XController2 | createViewController ([in] string ViewName, [in] sequence< com::sun::star::beans::PropertyValue > Arguments, [in] com::sun::star::frame::XFrame Frame) raises (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::Exception )
| creates a new view instance classified by the specified name and arguments.
void | setArgs ([in] sequence< com::sun::star::beans::PropertyValue > Arguments) raises (com::sun::star::lang::IllegalArgumentException, com::sun::star::util::InvalidStateException)
| Sets com::sun::star::document::MediaDescriptor properties of the current model during runtime.
Public Member Functions inherited from XModel
boolean | attachResource ([in] string URL, [in] sequence< com::sun::star::beans::PropertyValue > Arguments)
| informs a model about its resource description.
string | getURL ()
| provides information about the location of this model
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
void | connectController ([in] XController Controller)
| is called whenever a new controller is created for this model.
void | disconnectController ([in] XController Controller)
| is called whenever an existing controller should be deregistered at this model.
void | lockControllers ()
| suspends some notifications to the controllers which are used for display updates.
void | unlockControllers ()
| resumes the notifications which were suspended by XModel::lockControllers().
boolean | hasControllersLocked ()
| determines if there is at least one lock remaining.
XController | getCurrentController ()
| provides access to the controller which currently controls this model
void | setCurrentController ([in] XController Controller) raises ( com::sun::star::container::NoSuchElementException )
| sets a registered controller as the current controller.
com::sun::star::uno::XInterface | getCurrentSelection ()
| provides read access on current selection on controller
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.
void | addEventListener ([in] XEventListener xListener)
| adds an event listener to the object.
void | removeEventListener ([in] XEventListener aListener)
| removes an event listener from the listener list.
Public Member Functions inherited from XInterface
any | queryInterface ([in] type aType)
| queries for a new interface to an existing UNO object.
void | acquire ()
| increases the reference counter by one.
void | release ()
| decreases the reference counter by one.

## Detailed Description

extends interface XModel.

The following functions are added:

- enumeration of all currently connected controller objects. (not getCurrentController() only, which depends on focus)
- establish new view controller factory methods, which will make it possible to create new views for this model.

## Member Function Documentation

## ◆ createDefaultViewController()

com::sun::star::frame::XController2 createDefaultViewController | ( | [in] com::sun::star::frame::XFrame | Frame | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::uno::Exception ) |  |  |

creates the default view instance for this model.

Effectively, this method is equivalent to calling createView() with the `ViewName` being `"Default"`.

Parameters

  Frame | used to place the new created view there

Returns
  the new view controller instance

Exceptions

  com::sun::star::lang::IllegalArgumentException | if one of the given parameter was wrong
  com::sun::star::uno::Exception | if creation of a new view failed by other reasons

## ◆ createViewController()

com::sun::star::frame::XController2 createViewController | ( | [in] string | ViewName,
|  | [in] sequence< com::sun::star::beans::PropertyValue > | Arguments,
|  | [in] com::sun::star::frame::XFrame | Frame )
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::uno::Exception ) |  |  |

creates a new view instance classified by the specified name and arguments.

The newly created controller must not be connected with the document and the frame. That is, you should neither call XFrame::setComponent(), nor XController::attachFrame(), nor XController::attachModel(), nor XModel::connectController(), not XModel::setCurrentController(). All of this is the responsibility of the caller, which will do it in the proper order.

Parameters

  ViewName | classified name of instance
  Arguments | arguments used for creation
  Frame | used to place the new created view there

Returns
  the new view controller instance

Exceptions

  com::sun::star::lang::IllegalArgumentException | if one of the given parameter was wrong
  com::sun::star::uno::Exception | if creation of a new view failed by other reasons

## ◆ getAvailableViewControllerNames()

sequence< string > getAvailableViewControllerNames | ( |  | ) |

provides the available names of the factory to be used to create views.

The names are usually logical view names. The following names have a defined meaning, i.e. every concrete implementation which returns such a name must ensure it has the same meaning, and if a concrete implementation has a view with the given meaning, it must give it the name as defined here:

- Default specifies the default view of the document.
- Preview specifies a preview of the document. A minimal implementation of such a view is a Default view which is read-only.
- PrintPreview specifies a print preview of the document.

Implementations of this interface might decide to support additional view names, which then are documented in the respective service descriptions.

See also
  createView

Returns
  a sequence of names of all supported views for this document.

## ◆ getControllers()

com::sun::star::container::XEnumeration getControllers | ( |  | ) |

provides list of all currently connected controller objects.

Please note: Because this interface will might be used inside multi threaded environments those list can contain still disposed items or it new added controller will be missing (if they were added after this enumeration was created).

Returns
  list of controller objects. Enumeration can be empty but not NULL.

## ◆ setArgs()

void setArgs | ( | [in] sequence< com::sun::star::beans::PropertyValue > | Arguments | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::util::InvalidStateException ) |  |  |

Sets com::sun::star::document::MediaDescriptor properties of the current model during runtime.

Since
  LibreOffice 6.3

Parameters

  Arguments | Properties which should be set Supported properties: com::sun::star::document::MediaDescriptor::SuggestedSaveAsDir com::sun::star::document::MediaDescriptor::SuggestedSaveAsName com::sun::star::document::MediaDescriptor::LockContentExtraction com::sun::star::document::MediaDescriptor::LockExport com::sun::star::document::MediaDescriptor::LockPrint com::sun::star::document::MediaDescriptor::LockSave com::sun::star::document::MediaDescriptor::LockEditDoc com::sun::star::document::MediaDescriptor::EncryptionData (since LibreOffice 7.0)

Exceptions

  com::sun::star::lang::IllegalArgumentException | When trying to set an unsupported property
  com::sun::star::util::InvalidStateException | When the document model can not be retrieved

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

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