1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 #include "SwXFilterOptions.hxx"
27 #include "sal/types.h"
28 #include <osl/diagnose.h>
29 #include <uno/lbnames.h>
30 #include <cppuhelper/factory.hxx>
31 #include <sfx2/sfxmodelfactory.hxx>
32 #ifndef INCLUDED_STRING_H
33 #include <string.h>
34 #define INCLUDED_STRING_H
35 #endif
36
37 using namespace rtl;
38 using namespace ::com::sun::star;
39 using namespace ::com::sun::star::lang;
40
41 // module
42 extern uno::Sequence< OUString > SAL_CALL SwUnoModule_getSupportedServiceNames() throw();
43 extern OUString SAL_CALL SwUnoModule_getImplementationName() throw();
44 extern uno::Reference< uno::XInterface > SAL_CALL SwUnoModule_createInstance( const uno::Reference< XMultiServiceFactory > &rSMgr ) throw( uno::Exception );
45
46 // writer documents
47 extern uno::Sequence< OUString > SAL_CALL SwTextDocument_getSupportedServiceNames() throw();
48 extern OUString SAL_CALL SwTextDocument_getImplementationName() throw();
49 extern uno::Reference< uno::XInterface > SAL_CALL SwTextDocument_createInstance( const uno::Reference< XMultiServiceFactory > &rSMgr, const sal_uInt64 _nCreationFlags ) throw( uno::Exception );
50 extern uno::Sequence< OUString > SAL_CALL SwWebDocument_getSupportedServiceNames() throw();
51 extern OUString SAL_CALL SwWebDocument_getImplementationName() throw();
52 extern uno::Reference< uno::XInterface > SAL_CALL SwWebDocument_createInstance( const uno::Reference< XMultiServiceFactory > &rSMgr ) throw( uno::Exception );
53 extern uno::Sequence< OUString > SAL_CALL SwGlobalDocument_getSupportedServiceNames() throw();
54 extern OUString SAL_CALL SwGlobalDocument_getImplementationName() throw();
55 extern uno::Reference< uno::XInterface > SAL_CALL SwGlobalDocument_createInstance( const uno::Reference< XMultiServiceFactory > &rSMgr ) throw( uno::Exception );
56
57 // xml import
58 extern uno::Sequence< OUString > SAL_CALL SwXMLImport_getSupportedServiceNames() throw();
59 extern OUString SAL_CALL SwXMLImport_getImplementationName() throw();
60 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImport_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
61 extern uno::Sequence< OUString > SAL_CALL SwXMLImportStyles_getSupportedServiceNames() throw();
62 extern OUString SAL_CALL SwXMLImportStyles_getImplementationName() throw();
63 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImportStyles_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
64 extern uno::Sequence< OUString > SAL_CALL SwXMLImportContent_getSupportedServiceNames() throw();
65 extern OUString SAL_CALL SwXMLImportContent_getImplementationName() throw();
66 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImportContent_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
67
68 extern uno::Sequence< OUString > SAL_CALL SwXMLImportMeta_getSupportedServiceNames() throw();
69 extern OUString SAL_CALL SwXMLImportMeta_getImplementationName() throw();
70 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImportMeta_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
71
72 extern uno::Sequence< OUString > SAL_CALL SwXMLImportSettings_getSupportedServiceNames() throw();
73 extern OUString SAL_CALL SwXMLImportSettings_getImplementationName() throw();
74 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLImportSettings_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
75
76 // xml export (OOo)
77 extern uno::Sequence< OUString > SAL_CALL SwXMLExportOOO_getSupportedServiceNames() throw();
78 extern OUString SAL_CALL SwXMLExportOOO_getImplementationName() throw();
79 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
80 extern uno::Sequence< OUString > SAL_CALL SwXMLExportContentOOO_getSupportedServiceNames() throw();
81 extern OUString SAL_CALL SwXMLExportContentOOO_getImplementationName() throw();
82 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportContentOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
83 extern uno::Sequence< OUString > SAL_CALL SwXMLExportStylesOOO_getSupportedServiceNames() throw();
84 extern OUString SAL_CALL SwXMLExportStylesOOO_getImplementationName() throw();
85 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportStylesOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
86 extern uno::Sequence< OUString > SAL_CALL SwXMLExportMetaOOO_getSupportedServiceNames() throw();
87 extern OUString SAL_CALL SwXMLExportMetaOOO_getImplementationName() throw();
88 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportMetaOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
89 extern uno::Sequence< OUString > SAL_CALL SwXMLExportSettingsOOO_getSupportedServiceNames() throw();
90 extern OUString SAL_CALL SwXMLExportSettingsOOO_getImplementationName() throw();
91 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportSettingsOOO_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
92
93 // xml export (OASIS)
94 extern uno::Sequence< OUString > SAL_CALL SwXMLExport_getSupportedServiceNames() throw();
95 extern OUString SAL_CALL SwXMLExport_getImplementationName() throw();
96 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExport_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
97 extern uno::Sequence< OUString > SAL_CALL SwXMLExportContent_getSupportedServiceNames() throw();
98 extern OUString SAL_CALL SwXMLExportContent_getImplementationName() throw();
99 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportContent_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
100 extern uno::Sequence< OUString > SAL_CALL SwXMLExportStyles_getSupportedServiceNames() throw();
101 extern OUString SAL_CALL SwXMLExportStyles_getImplementationName() throw();
102 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportStyles_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
103 extern uno::Sequence< OUString > SAL_CALL SwXMLExportMeta_getSupportedServiceNames() throw();
104 extern OUString SAL_CALL SwXMLExportMeta_getImplementationName() throw();
105 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportMeta_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
106 extern uno::Sequence< OUString > SAL_CALL SwXMLExportSettings_getSupportedServiceNames() throw();
107 extern OUString SAL_CALL SwXMLExportSettings_getImplementationName() throw();
108 extern uno::Reference< uno::XInterface > SAL_CALL SwXMLExportSettings_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
109
110 //API objects
111 extern uno::Sequence< OUString > SAL_CALL SwXAutoTextContainer_getSupportedServiceNames() throw();
112 extern OUString SAL_CALL SwXAutoTextContainer_getImplementationName() throw();
113 extern uno::Reference< uno::XInterface > SAL_CALL SwXAutoTextContainer_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
114
115 extern uno::Sequence< OUString > SAL_CALL SwXModule_getSupportedServiceNames() throw();
116 extern OUString SAL_CALL SwXModule_getImplementationName() throw();
117 extern uno::Reference< uno::XInterface > SAL_CALL SwXModule_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
118
119 extern uno::Sequence< OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw();
120 extern OUString SAL_CALL SwXMailMerge_getImplementationName() throw();
121 extern uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
122
123 extern uno::Sequence< OUString > SAL_CALL SwXMailMerge_getSupportedServiceNames() throw();
124 extern OUString SAL_CALL SwXMailMerge_getImplementationName() throw();
125 extern uno::Reference< uno::XInterface > SAL_CALL SwXMailMerge_createInstance(const uno::Reference< XMultiServiceFactory > & rSMgr) throw( uno::Exception );
126
127 #include "cppuhelper/implementationentry.hxx"
128 namespace comp_FinalThreadManager {
129
130 // component and service helper functions:
131 ::rtl::OUString SAL_CALL _getImplementationName();
132 com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
133 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL _create(
134 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const & context );
135
136 }
137
138 #include "SwPanelFactory.hxx"
139
140 //
141 #ifdef __cplusplus
142 extern "C"
143 {
144 #endif
145
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)146 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
147 const sal_Char ** ppEnvTypeName,
148 uno_Environment ** /*ppEnv*/ )
149 {
150 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
151 }
152
153 static ::cppu::ImplementationEntry const entries[] = {
154 { &comp_FinalThreadManager::_create,
155 &comp_FinalThreadManager::_getImplementationName,
156 &comp_FinalThreadManager::_getSupportedServiceNames,
157 &::cppu::createSingleComponentFactory, 0, 0 },
158 { 0, 0, 0, 0, 0, 0 }
159 };
160
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void * pRegistryKey)161 SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
162 const sal_Char * pImplName,
163 void * pServiceManager,
164 void * pRegistryKey )
165 {
166 void * pRet = 0;
167 if( pServiceManager )
168 {
169 uno::Reference< XMultiServiceFactory > xMSF(
170 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
171
172 uno::Reference< XSingleServiceFactory > xFactory;
173
174 const sal_Int32 nImplNameLen = strlen( pImplName );
175 if( SwXMLImport_getImplementationName().equalsAsciiL( pImplName,
176 nImplNameLen ) )
177 {
178 xFactory = ::cppu::createSingleFactory( xMSF,
179 SwXMLImport_getImplementationName(),
180 SwXMLImport_createInstance,
181 SwXMLImport_getSupportedServiceNames() );
182 }
183 else if( SwXMLImportStyles_getImplementationName().equalsAsciiL(
184 pImplName, nImplNameLen ) )
185 {
186 xFactory = ::cppu::createSingleFactory( xMSF,
187 SwXMLImportStyles_getImplementationName(),
188 SwXMLImportStyles_createInstance,
189 SwXMLImportStyles_getSupportedServiceNames() );
190 }
191 else if( SwXMLImportContent_getImplementationName().equalsAsciiL(
192 pImplName, nImplNameLen ) )
193 {
194 xFactory = ::cppu::createSingleFactory( xMSF,
195 SwXMLImportContent_getImplementationName(),
196 SwXMLImportContent_createInstance,
197 SwXMLImportContent_getSupportedServiceNames() );
198 }
199 else if( SwXMLImportMeta_getImplementationName().equalsAsciiL(
200 pImplName, nImplNameLen ) )
201 {
202 xFactory = ::cppu::createSingleFactory( xMSF,
203 SwXMLImportMeta_getImplementationName(),
204 SwXMLImportMeta_createInstance,
205 SwXMLImportMeta_getSupportedServiceNames() );
206 }
207 else if( SwXMLImportSettings_getImplementationName().equalsAsciiL(
208 pImplName, nImplNameLen ) )
209 {
210 xFactory = ::cppu::createSingleFactory( xMSF,
211 SwXMLImportSettings_getImplementationName(),
212 SwXMLImportSettings_createInstance,
213 SwXMLImportSettings_getSupportedServiceNames() );
214 }
215 else if( SwXMLExportOOO_getImplementationName().equalsAsciiL( pImplName,
216 nImplNameLen ) )
217 {
218 xFactory = ::cppu::createSingleFactory( xMSF,
219 SwXMLExportOOO_getImplementationName(),
220 SwXMLExportOOO_createInstance,
221 SwXMLExportOOO_getSupportedServiceNames() );
222 }
223 else if( SwXMLExportStylesOOO_getImplementationName().equalsAsciiL(
224 pImplName, nImplNameLen ) )
225 {
226 xFactory = ::cppu::createSingleFactory( xMSF,
227 SwXMLExportStylesOOO_getImplementationName(),
228 SwXMLExportStylesOOO_createInstance,
229 SwXMLExportStylesOOO_getSupportedServiceNames() );
230 }
231 else if( SwXMLExportContentOOO_getImplementationName().equalsAsciiL(
232 pImplName, nImplNameLen ) )
233 {
234 xFactory = ::cppu::createSingleFactory( xMSF,
235 SwXMLExportContentOOO_getImplementationName(),
236 SwXMLExportContentOOO_createInstance,
237 SwXMLExportContentOOO_getSupportedServiceNames() );
238 }
239 else if( SwXMLExportMetaOOO_getImplementationName().equalsAsciiL(
240 pImplName, nImplNameLen ) )
241 {
242 xFactory = ::cppu::createSingleFactory( xMSF,
243 SwXMLExportMetaOOO_getImplementationName(),
244 SwXMLExportMetaOOO_createInstance,
245 SwXMLExportMetaOOO_getSupportedServiceNames() );
246 }
247 else if( SwXMLExportSettingsOOO_getImplementationName().equalsAsciiL(
248 pImplName, nImplNameLen ) )
249 {
250 xFactory = ::cppu::createSingleFactory( xMSF,
251 SwXMLExportSettingsOOO_getImplementationName(),
252 SwXMLExportSettingsOOO_createInstance,
253 SwXMLExportSettingsOOO_getSupportedServiceNames() );
254 }
255 else if( SwXMLExport_getImplementationName().equalsAsciiL( pImplName,
256 nImplNameLen ) )
257 {
258 xFactory = ::cppu::createSingleFactory( xMSF,
259 SwXMLExport_getImplementationName(),
260 SwXMLExport_createInstance,
261 SwXMLExport_getSupportedServiceNames() );
262 }
263 else if( SwXMLExportStyles_getImplementationName().equalsAsciiL(
264 pImplName, nImplNameLen ) )
265 {
266 xFactory = ::cppu::createSingleFactory( xMSF,
267 SwXMLExportStyles_getImplementationName(),
268 SwXMLExportStyles_createInstance,
269 SwXMLExportStyles_getSupportedServiceNames() );
270 }
271 else if( SwXMLExportContent_getImplementationName().equalsAsciiL(
272 pImplName, nImplNameLen ) )
273 {
274 xFactory = ::cppu::createSingleFactory( xMSF,
275 SwXMLExportContent_getImplementationName(),
276 SwXMLExportContent_createInstance,
277 SwXMLExportContent_getSupportedServiceNames() );
278 }
279 else if( SwXMLExportMeta_getImplementationName().equalsAsciiL(
280 pImplName, nImplNameLen ) )
281 {
282 xFactory = ::cppu::createSingleFactory( xMSF,
283 SwXMLExportMeta_getImplementationName(),
284 SwXMLExportMeta_createInstance,
285 SwXMLExportMeta_getSupportedServiceNames() );
286 }
287 else if( SwXMLExportSettings_getImplementationName().equalsAsciiL(
288 pImplName, nImplNameLen ) )
289 {
290 xFactory = ::cppu::createSingleFactory( xMSF,
291 SwXMLExportSettings_getImplementationName(),
292 SwXMLExportSettings_createInstance,
293 SwXMLExportSettings_getSupportedServiceNames() );
294 }
295 else if( SwXAutoTextContainer_getImplementationName().equalsAsciiL(
296 pImplName, nImplNameLen ) )
297 {
298 xFactory = ::cppu::createSingleFactory( xMSF,
299 SwXAutoTextContainer_getImplementationName(),
300 SwXAutoTextContainer_createInstance,
301 SwXAutoTextContainer_getSupportedServiceNames() );
302 }
303 else if( SwXModule_getImplementationName().equalsAsciiL(
304 pImplName, nImplNameLen ) )
305 {
306 xFactory = ::cppu::createSingleFactory( xMSF,
307 SwXModule_getImplementationName(),
308 SwXModule_createInstance,
309 SwXModule_getSupportedServiceNames() );
310 }
311 else if( SwXMailMerge_getImplementationName().equalsAsciiL(
312 pImplName, nImplNameLen ) )
313 {
314 xFactory = ::cppu::createSingleFactory( xMSF,
315 SwXMailMerge_getImplementationName(),
316 SwXMailMerge_createInstance,
317 SwXMailMerge_getSupportedServiceNames() );
318 }
319 else if( SwXFilterOptions::getImplementationName_Static().equalsAsciiL(
320 pImplName, nImplNameLen ) )
321 {
322 xFactory = ::cppu::createSingleFactory( xMSF,
323 SwXFilterOptions::getImplementationName_Static(),
324 SwXFilterOptions_createInstance,
325 SwXFilterOptions::getSupportedServiceNames_Static() );
326 }
327 else if( SwTextDocument_getImplementationName().equalsAsciiL(
328 pImplName, nImplNameLen ) )
329 {
330 xFactory = ::sfx2::createSfxModelFactory( xMSF,
331 SwTextDocument_getImplementationName(),
332 SwTextDocument_createInstance,
333 SwTextDocument_getSupportedServiceNames() );
334 }
335 else if( SwWebDocument_getImplementationName().equalsAsciiL(
336 pImplName, nImplNameLen ) )
337 {
338 xFactory = ::cppu::createSingleFactory( xMSF,
339 SwWebDocument_getImplementationName(),
340 SwWebDocument_createInstance,
341 SwWebDocument_getSupportedServiceNames() );
342 }
343 else if( SwGlobalDocument_getImplementationName().equalsAsciiL(
344 pImplName, nImplNameLen ) )
345 {
346 xFactory = ::cppu::createSingleFactory( xMSF,
347 SwGlobalDocument_getImplementationName(),
348 SwGlobalDocument_createInstance,
349 SwGlobalDocument_getSupportedServiceNames() );
350 }
351 else if( SwUnoModule_getImplementationName().equalsAsciiL(
352 pImplName, nImplNameLen ) )
353 {
354 xFactory = ::cppu::createSingleFactory( xMSF,
355 SwUnoModule_getImplementationName(),
356 SwUnoModule_createInstance,
357 SwUnoModule_getSupportedServiceNames() );
358 }
359 else if ( ::sw::sidebar::SwPanelFactory::getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
360 {
361 xFactory = ::cppu::createSingleFactory( xMSF,
362 ::sw::sidebar::SwPanelFactory::getImplementationName(),
363 ::sw::sidebar::SwPanelFactory::createInstance,
364 ::sw::sidebar::SwPanelFactory::getSupportedServiceNames() );
365 }
366 else if( comp_FinalThreadManager::_getImplementationName().equalsAsciiL(
367 pImplName, nImplNameLen ) )
368 {
369 pRet = ::cppu::component_getFactoryHelper(
370 pImplName, pServiceManager, pRegistryKey, entries);
371 }
372
373 if( xFactory.is())
374 {
375 xFactory->acquire();
376 pRet = xFactory.get();
377 }
378 }
379 return pRet;
380 }
381
382 #ifdef __cplusplus
383 }
384 #endif
385