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