bump product version to 6.3.0.0.beta1
[LibreOffice.git] / include / cppuhelper / factory.hxx
blobedcbc9d6e3757e6e0f9ec9b3082c4b5f62c816eb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CPPUHELPER_FACTORY_HXX
20 #define INCLUDED_CPPUHELPER_FACTORY_HXX
22 #include "sal/config.h"
24 #include <cstddef>
26 #include "rtl/ustring.hxx"
27 #include "rtl/unload.h"
29 #include "com/sun/star/uno/Reference.h"
30 #include "cppuhelper/cppuhelperdllapi.h"
32 namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } }
33 namespace com { namespace sun { namespace star { namespace lang { class XSingleComponentFactory; } } } }
34 namespace com { namespace sun { namespace star { namespace lang { class XSingleServiceFactory; } } } }
35 namespace com { namespace sun { namespace star { namespace registry { class XRegistryKey; } } } }
36 namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
37 namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } }
38 namespace com { namespace sun { namespace star { namespace uno { template <class E> class Sequence; } } } }
40 #define COMPONENT_GETENV "component_getImplementationEnvironment"
41 #define COMPONENT_GETENVEXT "component_getImplementationEnvironmentExt"
42 #define COMPONENT_WRITEINFO "component_writeInfo"
43 #define COMPONENT_GETFACTORY "component_getFactory"
45 typedef struct _uno_Environment uno_Environment;
47 /** Function pointer declaration.
48 Function determines the environment of the component implementation, i.e. which compiler
49 compiled it. If the environment is NOT session specific (needs no additional context),
50 then this function should return the environment type name and leave ppEnv (to 0).
52 @param ppEnvTypeName environment type name; string must be constant
53 @param ppEnv function returns its environment if the environment is session specific,
54 i.e. has special context
56 typedef void (SAL_CALL * component_getImplementationEnvironmentFunc)(
57 const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv );
59 /** Function pointer declaration.
60 Function determines the environment of the component implementation, i.e. the compiler.
61 If the environment is NOT session specific (needs no additional context),
62 then this function should return the environment type name and leave ppEnv (to 0).
64 @param ppEnvTypeName environment type name; string must be a constant
65 @param ppEnv function returns an environment if the environment is session specific,
66 i.e. has special context
67 @param pImplName
69 typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)(
70 sal_Char const ** ppEnvTypeName,
71 uno_Environment ** ppEnv,
72 sal_Char const * pImplName,
73 uno_Environment * pTargetEnv
76 /** Function pointer declaration.
77 Function retrieves a component description.
79 @return an XML formatted string containing a short component description
80 @deprecated
82 typedef const sal_Char * (SAL_CALL * component_getDescriptionFunc)(void);
84 /** Function pointer declaration.
86 @deprecated component_writeInfo should no longer be used in new components
88 Function writes component registry info, at least writing the supported service names.
90 @param pServiceManager
91 a service manager (the type is an XMultiServiceFactory that can be used
92 by the environment returned by component_getImplementationEnvironment)
93 @param pRegistryKey a registry key
94 (the type is XRegistryKey that can be used by the environment
95 returned by component_getImplementationEnvironment)
96 @return true if everything went fine
98 typedef sal_Bool (SAL_CALL * component_writeInfoFunc)(
99 void * pServiceManager, void * pRegistryKey );
101 /** Function pointer declaration.
102 Retrieves a factory to create component instances.
104 @param pImplName
105 desired implementation name
106 @param pServiceManager
107 a service manager (the type is XMultiServiceFactory that can be used by the environment
108 returned by component_getImplementationEnvironment)
109 @param pRegistryKey
110 a registry key (the type is XRegistryKey that can be used by the environment
111 returned by component_getImplementationEnvironment)
112 @return acquired component factory
113 (the type is lang::XSingleComponentFactory or lang::XSingleServiceFactory to be used by the
114 environment returned by component_getImplementationEnvironment)
116 typedef void * (SAL_CALL * component_getFactoryFunc)(
117 const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey );
120 namespace cppu
123 /** Function pointer declaration.
124 Function creates component instance passing the component context to be used.
126 @param xContext component context to be used
127 @return component instance
129 typedef css::uno::Reference< css::uno::XInterface >(
130 SAL_CALL * ComponentFactoryFunc)(
131 css::uno::Reference< css::uno::XComponentContext > const & xContext );
133 /** Creates a single component factory supporting the XSingleComponentFactory interface.
135 @param fptr function pointer for instantiating the object
136 @param rImplementationName implementation name of service
137 @param rServiceNames supported services
138 @param pModCount a backwards-compatibility remainder of a removed library
139 unloading feature; always set to null
141 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory >
142 SAL_CALL createSingleComponentFactory(
143 ComponentFactoryFunc fptr,
144 ::rtl::OUString const & rImplementationName,
145 css::uno::Sequence< ::rtl::OUString > const & rServiceNames,
146 rtl_ModuleCount * pModCount = NULL );
148 /** Creates a single service factory which holds the instance created only once.
150 @param fptr function pointer for instantiating the object
151 @param rImplementationName implementation name of service
152 @param rServiceNames supported services
153 @param pModCount a backwards-compatibility remainder of a removed library
154 unloading feature; always set to null
156 @see createSingleComponentFactory
158 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL
159 createOneInstanceComponentFactory(
160 ComponentFactoryFunc fptr,
161 ::rtl::OUString const & rImplementationName,
162 css::uno::Sequence< ::rtl::OUString > const & rServiceNames,
163 rtl_ModuleCount * pModCount = NULL );
165 /** Deprecated. The type of the instantiate function used as argument of the create*Factory functions.
167 @see createSingleFactory
168 @see createOneInstanceFactory
169 @deprecated
171 typedef css::uno::Reference< css::uno::XInterface >(SAL_CALL * ComponentInstantiation)(
172 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager );
174 /** Deprecated. Creates a single service factory.
176 @param rServiceManager the service manager used by the implementation.
177 @param rImplementationName the implementation name. An empty string is possible.
178 @param pCreateFunction the function pointer to create an object.
179 @param rServiceNames the service supported by the implementation.
180 @param pModCount a backwards-compatibility remainder of a removed library
181 unloading feature; always set to null.
182 @return a factory that support the interfaces XServiceProvider, XServiceInfo
183 XSingleServiceFactory and XComponent.
185 @see createOneInstanceFactory
186 @deprecated
188 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
189 createSingleFactory(
190 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
191 const ::rtl::OUString & rImplementationName,
192 ComponentInstantiation pCreateFunction,
193 const css::uno::Sequence< ::rtl::OUString > & rServiceNames,
194 rtl_ModuleCount * pModCount = NULL );
196 /** Deprecated. Creates a factory wrapping another one.
197 This means the methods of the interfaces XServiceProvider, XServiceInfo and
198 XSingleServiceFactory are forwarded.
199 @attention
200 The XComponent interface is not supported!
202 @param rServiceManager the service manager used by the implementation.
203 @param rFactory the wrapped service factory.
204 @return a factory that support the interfaces XServiceProvider, XServiceInfo
205 XSingleServiceFactory.
207 @see createSingleFactory
208 @deprecated
210 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
211 createFactoryProxy(
212 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
213 const css::uno::Reference< css::lang::XSingleServiceFactory > & rFactory );
215 /** Deprecated. Creates a single service factory which holds the instance created only once.
217 @param rServiceManager the service manager used by the implementation.
218 @param rComponentName the implementation name. An empty string is possible.
219 @param pCreateFunction the function pointer to create an object.
220 @param rServiceNames the service supported by the implementation.
221 @param pModCount a backwards-compatibility remainder of a removed library
222 unloading feature; always set to null.
223 @return a factory that support the interfaces XServiceProvider, XServiceInfo
224 XSingleServiceFactory and XComponent.
226 @see createSingleFactory
227 @deprecated
229 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
230 createOneInstanceFactory(
231 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
232 const ::rtl::OUString & rComponentName,
233 ComponentInstantiation pCreateFunction,
234 const css::uno::Sequence< ::rtl::OUString > & rServiceNames,
235 rtl_ModuleCount * pModCount = NULL );
237 /** Deprecated. Creates a single service factory based on a registry.
239 @param rServiceManager the service manager used by the implementation.
240 @param rImplementationName the implementation name. An empty string is possible.
241 @param rImplementationKey the registry key of the implementation section.
242 @return a factory that support the interfaces XServiceProvider, XServiceInfo
243 XSingleServiceFactory and XComponent.
244 @deprecated
246 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
247 createSingleRegistryFactory(
248 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
249 const ::rtl::OUString & rImplementationName,
250 const css::uno::Reference< css::registry::XRegistryKey > & rImplementationKey );
252 /** Deprecated. Creates a single service factory which holds the instance created only once
253 based on a registry.
255 @param rServiceManager the service manager used by the implementation.
256 @param rComponentName the implementation name. An empty string is possible.
257 @param rImplementationKey the registry key of the implementation section.
258 @return a factory that support the interfaces XServiceProvider, XServiceInfo
259 XSingleServiceFactory and XComponent.
261 @see createSingleRegistryFactory
262 @deprecated
264 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
265 createOneInstanceRegistryFactory(
266 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
267 const ::rtl::OUString & rComponentName,
268 const css::uno::Reference< css::registry::XRegistryKey > & rImplementationKey );
272 #endif
274 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */