Difference between revisions of "Documentation/DevGuide/WritingUNO/C++/Storing the Service Manager for Further Use"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Automated text replacement (-Category:Documentation/Developers Guide/Professional UNO +Category:Documentation/Developers Guide/Writing UNO))
m (Robot: Changing Category:Documentation/Developers Guide/Writing UNO)
Line 18: Line 18:
 
{{PDL1}}
 
{{PDL1}}
  
[[Category:Documentation/Developers Guide/Writing UNO]]
+
[[Category:Documentation/Developers Guide/Writing UNO Components]]

Revision as of 07:41, 4 June 2008



The single factories expect a static create_< ImplementationClass> () function. For instance, create_MyService1Impl() takes a reference to the component context and instantiates the implementation class using new ImplementationClass(). A constructor can be written for <ImplementationClass> that expects a reference to an com.sun.star.uno.XComponentContext and stores the reference in the instance for further use.

  static Reference< XInterface > SAL_CALL create_MyService2Impl(
      Reference< XComponentContext > const & xContext )
      SAL_THROW( () )
  {
      // passing the component context to the constructor of MyService2Impl
      return static_cast< lang::XTypeProvider * >( new MyService2Impl( xContext ) );
  }
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools