Using the Component Framework

From Apache OpenOffice Wiki
Jump to: navigation, search



The component framework comprises the interfaces of frames, controllers and models used to manage components in the Apache OpenOffice desktop environment. In our context, everything that "dwells" in a frame of the desktop environment is called a component, because the interface com.sun.star.lang.XComponent is the common denominator for objects that are loaded into frames.

Frames, controllers and models hold references to each other. The frame is by definition the default owner of the controller and the model, that is, it is responsible to call dispose() on the controller and model when it is destroyed itself. Other objects that are to hold references to the frame, controller, or model must register as listeners to be informed when these references become invalid. Therefore XModel, XController and XFrame inherit from XComponent:

  void dispose ()
  void addEventListener ( [in] com::sun::star::lang::XEventListener xListener)
  void removeEventListener ( [in] com::sun::star::lang::XEventListener aListener)

The process to resolve the circular dependencies of the component framework is complex. For instance, the objects involved in the process may be in a condition where they may not be disposed of. Refer to the section Closing Documents for additional details.

Theoretically every UNO object could exist in a frame, as long as it is willing to let the frame control its existence when it ends.

A trivial component (XWindow only) is enough for simple viewing purposes, where no activation of a component and related actions like cursor positioning or user interactions are necessary.

If the component participates in more complex interactions, it must implement the controller service.

Many features of the desktop environment are only available if the URL of a component is known. For example:

  • Presenting the URL or title of the document.
  • Inserting the document into the autosave queue.
  • Preventing the desktop environment from loading documents twice.
  • Allow for participation in the global document event handling.

In this case, com.sun.star.frame.XModel comes into operation, since it has methods to handle URLs, among others.

So a complete office component is made up of

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages