tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / include / cppuhelper / factory.hxx
blobe6a9ee2f10997067b0d9196bdabe42780fc10d96
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 .
21 * This file is part of LibreOffice published API.
23 #ifndef INCLUDED_CPPUHELPER_FACTORY_HXX
24 #define INCLUDED_CPPUHELPER_FACTORY_HXX
26 #include "sal/config.h"
28 #include <cstddef>
30 #include "rtl/ustring.hxx"
31 #include "rtl/unload.h"
33 #include "com/sun/star/uno/Reference.h"
34 #include "cppuhelper/cppuhelperdllapi.h"
36 namespace com { namespace sun { namespace star { namespace lang { class XMultiServiceFactory; } } } }
37 namespace com { namespace sun { namespace star { namespace lang { class XSingleComponentFactory; } } } }
38 namespace com { namespace sun { namespace star { namespace lang { class XSingleServiceFactory; } } } }
39 namespace com { namespace sun { namespace star { namespace registry { class XRegistryKey; } } } }
40 namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } }
41 namespace com { namespace sun { namespace star { namespace uno { class XInterface; } } } }
42 namespace com { namespace sun { namespace star { namespace uno { template <class E> class Sequence; } } } }
44 #define COMPONENT_GETENV "component_getImplementationEnvironment"
45 #define COMPONENT_GETENVEXT "component_getImplementationEnvironmentExt"
46 #define COMPONENT_WRITEINFO "component_writeInfo"
47 #define COMPONENT_GETFACTORY "component_getFactory"
49 typedef struct _uno_Environment uno_Environment;
51 /** Function pointer declaration.
52 Function determines the environment of the component implementation, i.e. which compiler
53 compiled it. If the environment is NOT session specific (needs no additional context),
54 then this function should return the environment type name and leave ppEnv (to 0).
56 @param ppEnvTypeName environment type name; string must be constant
57 @param ppEnv function returns its environment if the environment is session specific,
58 i.e. has special context
60 typedef void (SAL_CALL * component_getImplementationEnvironmentFunc)(
61 const char ** ppEnvTypeName, uno_Environment ** ppEnv );
63 /** Function pointer declaration.
64 Function determines the environment of the component implementation, i.e. the compiler.
65 If the environment is NOT session specific (needs no additional context),
66 then this function should return the environment type name and leave ppEnv (to 0).
68 @param ppEnvTypeName environment type name; string must be a constant
69 @param ppEnv function returns an environment if the environment is session specific,
70 i.e. has special context
71 @param pImplName
73 typedef void (SAL_CALL * component_getImplementationEnvironmentExtFunc)(
74 char const ** ppEnvTypeName,
75 uno_Environment ** ppEnv,
76 char const * pImplName,
77 uno_Environment * pTargetEnv
80 /** Function pointer declaration.
81 Function retrieves a component description.
83 @return an XML formatted string containing a short component description
84 @deprecated
86 typedef const char * (SAL_CALL * component_getDescriptionFunc)(void);
88 /** Function pointer declaration.
90 @deprecated component_writeInfo should no longer be used in new components
92 Function writes component registry info, at least writing the supported service names.
94 @param pServiceManager
95 a service manager (the type is an XMultiServiceFactory that can be used
96 by the environment returned by component_getImplementationEnvironment)
97 @param pRegistryKey a registry key
98 (the type is XRegistryKey that can be used by the environment
99 returned by component_getImplementationEnvironment)
100 @return true if everything went fine
102 typedef sal_Bool (SAL_CALL * component_writeInfoFunc)(
103 void * pServiceManager, void * pRegistryKey );
105 /** Function pointer declaration.
106 Retrieves a factory to create component instances.
108 @param pImplName
109 desired implementation name
110 @param pServiceManager
111 a service manager (the type is XMultiServiceFactory that can be used by the environment
112 returned by component_getImplementationEnvironment)
113 @param pRegistryKey
114 a registry key (the type is XRegistryKey that can be used by the environment
115 returned by component_getImplementationEnvironment)
116 @return acquired component factory
117 (the type is lang::XSingleComponentFactory or lang::XSingleServiceFactory to be used by the
118 environment returned by component_getImplementationEnvironment)
120 typedef void * (SAL_CALL * component_getFactoryFunc)(
121 const char * pImplName, void * pServiceManager, void * pRegistryKey );
124 namespace cppu
127 /** Function pointer declaration.
128 Function creates component instance passing the component context to be used.
130 @param xContext component context to be used
131 @return component instance
133 typedef css::uno::Reference< css::uno::XInterface >(
134 SAL_CALL * ComponentFactoryFunc)(
135 css::uno::Reference< css::uno::XComponentContext > const & xContext );
137 /** Creates a single component factory supporting the XSingleComponentFactory interface.
139 @param fptr function pointer for instantiating the object
140 @param rImplementationName implementation name of service
141 @param rServiceNames supported services
142 @param pModCount a backwards-compatibility remainder of a removed library
143 unloading feature; always set to null
145 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory >
146 SAL_CALL createSingleComponentFactory(
147 ComponentFactoryFunc fptr,
148 ::rtl::OUString const & rImplementationName,
149 css::uno::Sequence< ::rtl::OUString > const & rServiceNames,
150 rtl_ModuleCount * pModCount = NULL );
152 /** Creates a single service factory which holds the instance created only once.
154 @param fptr function pointer for instantiating the object
155 @param rImplementationName implementation name of service
156 @param rServiceNames supported services
157 @param pModCount a backwards-compatibility remainder of a removed library
158 unloading feature; always set to null
160 @see createSingleComponentFactory
162 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleComponentFactory > SAL_CALL
163 createOneInstanceComponentFactory(
164 ComponentFactoryFunc fptr,
165 ::rtl::OUString const & rImplementationName,
166 css::uno::Sequence< ::rtl::OUString > const & rServiceNames,
167 rtl_ModuleCount * pModCount = NULL );
169 /** Deprecated. The type of the instantiate function used as argument of the create*Factory functions.
171 @see createSingleFactory
172 @see createOneInstanceFactory
173 @deprecated
175 typedef css::uno::Reference< css::uno::XInterface >(SAL_CALL * ComponentInstantiation)(
176 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager );
178 /** Deprecated. Creates a single service factory.
180 @param rServiceManager the service manager used by the implementation.
181 @param rImplementationName the implementation name. An empty string is possible.
182 @param pCreateFunction the function pointer to create an object.
183 @param rServiceNames the service supported by the implementation.
184 @param pModCount a backwards-compatibility remainder of a removed library
185 unloading feature; always set to null.
186 @return a factory that support the interfaces XServiceProvider, XServiceInfo
187 XSingleServiceFactory and XComponent.
189 @see createOneInstanceFactory
190 @deprecated
192 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
193 createSingleFactory(
194 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
195 const ::rtl::OUString & rImplementationName,
196 ComponentInstantiation pCreateFunction,
197 const css::uno::Sequence< ::rtl::OUString > & rServiceNames,
198 rtl_ModuleCount * pModCount = NULL );
200 /** Deprecated. Creates a factory wrapping another one.
201 This means the methods of the interfaces XServiceProvider, XServiceInfo and
202 XSingleServiceFactory are forwarded.
203 @attention
204 The XComponent interface is not supported!
206 @param rServiceManager the service manager used by the implementation.
207 @param rFactory the wrapped service factory.
208 @return a factory that support the interfaces XServiceProvider, XServiceInfo
209 XSingleServiceFactory.
211 @see createSingleFactory
212 @deprecated
214 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
215 createFactoryProxy(
216 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
217 const css::uno::Reference< css::lang::XSingleServiceFactory > & rFactory );
219 /** Deprecated. Creates a single service factory which holds the instance created only once.
221 @param rServiceManager the service manager used by the implementation.
222 @param rComponentName the implementation name. An empty string is possible.
223 @param pCreateFunction the function pointer to create an object.
224 @param rServiceNames the service supported by the implementation.
225 @param pModCount a backwards-compatibility remainder of a removed library
226 unloading feature; always set to null.
227 @return a factory that support the interfaces XServiceProvider, XServiceInfo
228 XSingleServiceFactory and XComponent.
230 @see createSingleFactory
231 @deprecated
233 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
234 createOneInstanceFactory(
235 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
236 const ::rtl::OUString & rComponentName,
237 ComponentInstantiation pCreateFunction,
238 const css::uno::Sequence< ::rtl::OUString > & rServiceNames,
239 rtl_ModuleCount * pModCount = NULL );
241 /** Deprecated. Creates a single service factory based on a registry.
243 @param rServiceManager the service manager used by the implementation.
244 @param rImplementationName the implementation name. An empty string is possible.
245 @param rImplementationKey the registry key of the implementation section.
246 @return a factory that support the interfaces XServiceProvider, XServiceInfo
247 XSingleServiceFactory and XComponent.
248 @deprecated
250 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
251 createSingleRegistryFactory(
252 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
253 const ::rtl::OUString & rImplementationName,
254 const css::uno::Reference< css::registry::XRegistryKey > & rImplementationKey );
256 /** Deprecated. Creates a single service factory which holds the instance created only once
257 based on a registry.
259 @param rServiceManager the service manager used by the implementation.
260 @param rComponentName the implementation name. An empty string is possible.
261 @param rImplementationKey the registry key of the implementation section.
262 @return a factory that support the interfaces XServiceProvider, XServiceInfo
263 XSingleServiceFactory and XComponent.
265 @see createSingleRegistryFactory
266 @deprecated
268 CPPUHELPER_DLLPUBLIC css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL
269 createOneInstanceRegistryFactory(
270 const css::uno::Reference< css::lang::XMultiServiceFactory > & rServiceManager,
271 const ::rtl::OUString & rComponentName,
272 const css::uno::Reference< css::registry::XRegistryKey > & rImplementationKey );
276 #endif
278 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */