Difference between revisions of "Documentation/DevGuide/WritingUNO/C++/Storing the Service Manager for Further Use"
From Apache OpenOffice Wiki
< Documentation | DevGuide
OOoWikiBot (Talk | contribs) m (Robot: Changing Category:Documentation/Developers Guide/Writing UNO Components) |
m |
||
Line 5: | Line 5: | ||
|NextPage=Documentation/DevGuide/WritingUNO/C++/Create Instance with Arguments | |NextPage=Documentation/DevGuide/WritingUNO/C++/Create Instance with Arguments | ||
}} | }} | ||
+ | [[zh:Zh/Documentation/DevGuide/WritingUNO/C++/Storing the Service Manager for Further Use]] | ||
{{DISPLAYTITLE:Storing the Service Manager for Further Use}} | {{DISPLAYTITLE:Storing the Service Manager for Further Use}} | ||
The single factories expect a static <code>create_< ''ImplementationClass>'' ()</code> function. For instance, <code>create_MyService1Impl()</code> takes a reference to the component context and instantiates the implementation class using new <code>ImplementationClass()</code>. A constructor can be written for <code><ImplementationClass></code> that expects a reference to an <idl>com.sun.star.uno.XComponentContext</idl> and stores the reference in the instance for further use. | The single factories expect a static <code>create_< ''ImplementationClass>'' ()</code> function. For instance, <code>create_MyService1Impl()</code> takes a reference to the component context and instantiates the implementation class using new <code>ImplementationClass()</code>. A constructor can be written for <code><ImplementationClass></code> that expects a reference to an <idl>com.sun.star.uno.XComponentContext</idl> and stores the reference in the instance for further use. |
Revision as of 08:19, 30 July 2008
- Class Definition with Helper Template Classes
- Implementing your own Interfaces
- Providing a Single Factory Using a Helper Method
- Write Registration Info Using a Helper Method
- Provide Implementation Environment
- Implementing without Helpers
- Storing the Service Manager for Further Use
- Create Instance with Arguments
- Multiple Components in One Dynamic Link Library
- Building and Testing C++ Components
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). |