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