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