Difference between revisions of "Documentation/DevGuide/OfficeDev/Using the Component Framework"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (1 revision(s))
(4 intermediate revisions by 2 users not shown)
Line 6: Line 6:
 
|NextPage=Documentation/DevGuide/OfficeDev/Component/Getting Frames, Controllers and Models from Each Other
 
|NextPage=Documentation/DevGuide/OfficeDev/Component/Getting Frames, Controllers and Models from Each Other
 
}}
 
}}
{{DISPLAYTITLE:Using the Component Framework}}
+
{{Documentation/DevGuideLanguages|Documentation/DevGuide/OfficeDev/{{SUBPAGENAME}}}}
 +
{{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 {{PRODUCTNAME}} 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.
 
The component framework comprises the interfaces of frames, controllers and models used to manage components in the {{PRODUCTNAME}} 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>:
 
+
<source lang="idl">
 
   void dispose ()
 
   void dispose ()
 
   void addEventListener ( [in] com::sun::star::lang::XEventListener xListener)
 
   void addEventListener ( [in] com::sun::star::lang::XEventListener xListener)
 
   void removeEventListener ( [in] com::sun::star::lang::XEventListener aListener)
 
   void removeEventListener ( [in] com::sun::star::lang::XEventListener aListener)
 
+
</source>
The process to resolve the circular dependencies of the component framework is a 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 [[Documentation/DevGuide/OfficeDev/Closing Documents|Closing Documents]] for additional details.
+
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 [[Documentation/DevGuide/OfficeDev/Closing Documents|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.  
 
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.  
Line 39: Line 40:
  
 
{{PDL1}}
 
{{PDL1}}
[[Category: Office Development]]
+
 
 +
[[Category:Documentation/Developer's Guide/Office Development]]

Revision as of 07:58, 15 September 2011



The component framework comprises the interfaces of frames, controllers and models used to manage components in the OpenOffice.org 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