Difference between revisions of "Documentation/DevGuide/OfficeDev/Using the Component Framework"
Gerardo GR (Talk | contribs) |
m |
||
Line 9: | Line 9: | ||
{{DISPLAYTITLE:Using the Component Framework}} | {{DISPLAYTITLE:Using the Component Framework}} | ||
<!--<idltopic>com.sun.star.lang.XComponent</idltopic>--> | <!--<idltopic>com.sun.star.lang.XComponent</idltopic>--> | ||
− | The component framework comprises the interfaces of frames, controllers and models used to manage components in the {{ | + | The component framework comprises the interfaces of frames, controllers and models used to manage components in the {{AOo}} desktop environment. In our context, everything that "dwells" in a frame of the desktop environment is called a ''component'', because the interface <idl>com.sun.star.lang.XComponent</idl> 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 <code>XModel</code>, <code>XController</code> and <code>XFrame</code> inherit from <code>XComponent</code>: | 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 <code>XModel</code>, <code>XController</code> and <code>XFrame</code> inherit from <code>XComponent</code>: |
Revision as of 13:49, 14 December 2020
- Using the Desktop
- Using the Component Framework
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
- a controller object that presents the model or shows a view to the model that implements the com.sun.star.frame.Controller service, but publishes additional document-specific interfaces. For almost all OpenOffice.org document types there are document specific controller object specifications,such as com.sun.star.sheet.SpreadsheetView, and com.sun.star.drawing.DrawingDocumentDrawView. For controllers, refer to the section Controllers.
- a model object implementing the com.sun.star.document.OfficeDocument service. Refer to the section Models.
Content on this page is licensed under the Public Documentation License (PDL). |