1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: facreg.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
34 #include "sal/config.h"
36 #include "xmloff/dllapi.h"
39 #include <com/sun/star/container/XSet.hpp>
40 #include <com/sun/star/registry/XRegistryKey.hpp>
41 #include <osl/diagnose.h>
42 #include <tools/debug.hxx>
44 #include <cppuhelper/factory.hxx>
45 #include <uno/lbnames.h>
49 using namespace com::sun::star
;
51 #define SERVICE( className ) \
52 extern OUString SAL_CALL className##_getImplementationName() throw(); \
53 extern uno::Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw();\
54 extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance( \
55 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) \
56 throw( uno::Exception )
58 // impress oasis import
59 SERVICE( XMLImpressImportOasis
);
60 SERVICE( XMLImpressStylesImportOasis
);
61 SERVICE( XMLImpressContentImportOasis
);
62 SERVICE( XMLImpressMetaImportOasis
);
63 SERVICE( XMLImpressSettingsImportOasis
);
65 // impress oasis export
66 SERVICE( XMLImpressExportOasis
);
67 SERVICE( XMLImpressStylesExportOasis
);
68 SERVICE( XMLImpressContentExportOasis
);
69 SERVICE( XMLImpressMetaExportOasis
);
70 SERVICE( XMLImpressSettingsExportOasis
);
75 SERVICE( XMLImpressExportOOO
);
76 SERVICE( XMLImpressStylesExportOOO
);
77 SERVICE( XMLImpressContentExportOOO
);
78 SERVICE( XMLImpressMetaExportOOO
);
79 SERVICE( XMLImpressSettingsExportOOO
);
82 SERVICE( XMLDrawImportOasis
);
83 SERVICE( XMLDrawStylesImportOasis
);
84 SERVICE( XMLDrawContentImportOasis
);
85 SERVICE( XMLDrawMetaImportOasis
);
86 SERVICE( XMLDrawSettingsImportOasis
);
89 SERVICE( XMLDrawExportOasis
);
90 SERVICE( XMLDrawStylesExportOasis
);
91 SERVICE( XMLDrawContentExportOasis
);
92 SERVICE( XMLDrawMetaExportOasis
);
93 SERVICE( XMLDrawSettingsExportOasis
);
98 SERVICE( XMLDrawExportOOO
);
99 SERVICE( XMLDrawStylesExportOOO
);
100 SERVICE( XMLDrawContentExportOOO
);
101 SERVICE( XMLDrawMetaExportOOO
);
102 SERVICE( XMLDrawSettingsExportOOO
);
104 // impress animation import
105 SERVICE( AnimationsImport
);
107 // drawing layer export
108 SERVICE( XMLDrawingLayerExport
);
110 // impress xml clipboard export
111 SERVICE( XMLImpressClipboardExport
);
113 // chart oasis import
114 SERVICE( SchXMLImport
);
115 SERVICE( SchXMLImport_Meta
);
116 SERVICE( SchXMLImport_Styles
);
117 SERVICE( SchXMLImport_Content
);
119 // chart oasis export
120 SERVICE( SchXMLExport_Oasis
);
121 SERVICE( SchXMLExport_Oasis_Meta
);
122 SERVICE( SchXMLExport_Oasis_Styles
);
123 SERVICE( SchXMLExport_Oasis_Content
);
128 SERVICE( SchXMLExport
);
129 SERVICE( SchXMLExport_Styles
);
130 SERVICE( SchXMLExport_Content
);
132 // version list import/export
133 SERVICE( XMLVersionListPersistence
);
136 SERVICE( XMLMetaExportComponent
);
139 SERVICE( XMLMetaImportComponent
);
142 SERVICE( XMLMetaExportOOO
);
144 // writer autotext event export
145 SERVICE( XMLAutoTextEventExport
);
147 // writer autotext event import
148 SERVICE( XMLAutoTextEventImport
);
150 // writer autotext event export OOo
151 SERVICE( XMLAutoTextEventExportOOO
);
153 // writer autotext event import OOo
154 SERVICE( XMLAutoTextEventImportOOO
);
156 // Oasis2OOo transformer
157 SERVICE( Oasis2OOoTransformer
);
159 // OOo2Oasis transformer
160 SERVICE( OOo2OasisTransformer
);
168 XMLOFF_DLLPUBLIC
void SAL_CALL
component_getImplementationEnvironment( const sal_Char
** ppEnvTypeName
, uno_Environment
** )
170 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
173 void SAL_CALL
writeInfo( registry::XRegistryKey
* pRegistryKey
, const OUString
& rImplementationName
, const uno::Sequence
< OUString
>& rServices
)
175 uno::Reference
< registry::XRegistryKey
> xNewKey(
176 pRegistryKey
->createKey(
177 OUString( RTL_CONSTASCII_USTRINGPARAM("/") ) + rImplementationName
+ OUString(RTL_CONSTASCII_USTRINGPARAM( "/UNO/SERVICES") ) ) );
179 for( sal_Int32 i
= 0; i
< rServices
.getLength(); i
++ )
180 xNewKey
->createKey( rServices
.getConstArray()[i
]);
183 #define WRITEINFO(className)\
184 writeInfo( pKey, className##_getImplementationName(), className##_getSupportedServiceNames() )
186 XMLOFF_DLLPUBLIC sal_Bool SAL_CALL
component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey
)
192 registry::XRegistryKey
*pKey
= reinterpret_cast< registry::XRegistryKey
* >( pRegistryKey
);
194 // impress oasis import
195 WRITEINFO( XMLImpressImportOasis
);
196 WRITEINFO( XMLImpressStylesImportOasis
);
197 WRITEINFO( XMLImpressContentImportOasis
);
198 WRITEINFO( XMLImpressMetaImportOasis
);
199 WRITEINFO( XMLImpressSettingsImportOasis
);
201 // impress oasis export
202 WRITEINFO( XMLImpressExportOasis
);
203 WRITEINFO( XMLImpressStylesExportOasis
);
204 WRITEINFO( XMLImpressContentExportOasis
);
205 WRITEINFO( XMLImpressMetaExportOasis
);
206 WRITEINFO( XMLImpressSettingsExportOasis
);
209 WRITEINFO( AnimationsImport
);
211 // impress OOo export
212 WRITEINFO( XMLImpressExportOOO
);
213 WRITEINFO( XMLImpressStylesExportOOO
);
214 WRITEINFO( XMLImpressContentExportOOO
);
215 WRITEINFO( XMLImpressMetaExportOOO
);
216 WRITEINFO( XMLImpressSettingsExportOOO
);
219 WRITEINFO( XMLDrawImportOasis
);
220 WRITEINFO( XMLDrawStylesImportOasis
);
221 WRITEINFO( XMLDrawContentImportOasis
);
222 WRITEINFO( XMLDrawMetaImportOasis
);
223 WRITEINFO( XMLDrawSettingsImportOasis
);
226 WRITEINFO( XMLDrawExportOasis
);
227 WRITEINFO( XMLDrawStylesExportOasis
);
228 WRITEINFO( XMLDrawContentExportOasis
);
229 WRITEINFO( XMLDrawMetaExportOasis
);
230 WRITEINFO( XMLDrawSettingsExportOasis
);
233 WRITEINFO( XMLDrawExportOOO
);
234 WRITEINFO( XMLDrawStylesExportOOO
);
235 WRITEINFO( XMLDrawContentExportOOO
);
236 WRITEINFO( XMLDrawMetaExportOOO
);
237 WRITEINFO( XMLDrawSettingsExportOOO
);
239 // drawing layer export
240 WRITEINFO( XMLDrawingLayerExport
);
242 // impress xml clipboard export
243 WRITEINFO( XMLImpressClipboardExport
);
245 // chart oasis import
246 WRITEINFO( SchXMLImport
);
247 WRITEINFO( SchXMLImport_Meta
);
248 WRITEINFO( SchXMLImport_Styles
);
249 WRITEINFO( SchXMLImport_Content
);
251 // chart oasis export
252 WRITEINFO( SchXMLExport_Oasis
);
253 WRITEINFO( SchXMLExport_Oasis_Meta
);
254 WRITEINFO( SchXMLExport_Oasis_Styles
);
255 WRITEINFO( SchXMLExport_Oasis_Content
);
258 WRITEINFO( SchXMLExport
);
259 WRITEINFO( SchXMLExport_Styles
);
260 WRITEINFO( SchXMLExport_Content
);
263 WRITEINFO( XMLMetaImportComponent
);
264 WRITEINFO( XMLMetaExportComponent
);
266 WRITEINFO( XMLVersionListPersistence
);
269 WRITEINFO( XMLMetaExportOOO
);
271 // writer auto text events
272 WRITEINFO( XMLAutoTextEventExport
);
273 WRITEINFO( XMLAutoTextEventImport
);
274 WRITEINFO( XMLAutoTextEventExportOOO
);
276 catch (registry::InvalidRegistryException
&)
278 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
284 #define SINGLEFACTORY(classname)\
285 if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
287 xFactory = ::cppu::createSingleFactory( xMSF,\
288 classname##_getImplementationName(),\
289 classname##_createInstance,\
290 classname##_getSupportedServiceNames() );\
293 XMLOFF_DLLPUBLIC
void * SAL_CALL
component_getFactory( const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
296 if( pServiceManager
)
298 uno::Reference
< lang::XMultiServiceFactory
> xMSF( reinterpret_cast< lang::XMultiServiceFactory
* >( pServiceManager
) );
300 uno::Reference
< lang::XSingleServiceFactory
> xFactory
;
302 const sal_Int32 nImplNameLen
= strlen( pImplName
);
304 // impress oasis import
305 SINGLEFACTORY( XMLImpressImportOasis
)
306 else SINGLEFACTORY( XMLImpressStylesImportOasis
)
307 else SINGLEFACTORY( XMLImpressContentImportOasis
)
308 else SINGLEFACTORY( XMLImpressMetaImportOasis
)
309 else SINGLEFACTORY( XMLImpressSettingsImportOasis
)
311 // impress oasis export
312 else SINGLEFACTORY( XMLImpressExportOasis
)
313 else SINGLEFACTORY( XMLImpressStylesExportOasis
)
314 else SINGLEFACTORY( XMLImpressContentExportOasis
)
315 else SINGLEFACTORY( XMLImpressMetaExportOasis
)
316 else SINGLEFACTORY( XMLImpressSettingsExportOasis
)
318 else SINGLEFACTORY( AnimationsImport
)
320 // impress OOo export
321 else SINGLEFACTORY( XMLImpressExportOOO
)
322 else SINGLEFACTORY( XMLImpressStylesExportOOO
)
323 else SINGLEFACTORY( XMLImpressContentExportOOO
)
324 else SINGLEFACTORY( XMLImpressMetaExportOOO
)
325 else SINGLEFACTORY( XMLImpressSettingsExportOOO
)
328 else SINGLEFACTORY( XMLDrawImportOasis
)
329 else SINGLEFACTORY( XMLDrawStylesImportOasis
)
330 else SINGLEFACTORY( XMLDrawContentImportOasis
)
331 else SINGLEFACTORY( XMLDrawMetaImportOasis
)
332 else SINGLEFACTORY( XMLDrawSettingsImportOasis
)
335 else SINGLEFACTORY( XMLDrawExportOasis
)
336 else SINGLEFACTORY( XMLDrawStylesExportOasis
)
337 else SINGLEFACTORY( XMLDrawContentExportOasis
)
338 else SINGLEFACTORY( XMLDrawMetaExportOasis
)
339 else SINGLEFACTORY( XMLDrawSettingsExportOasis
)
342 else SINGLEFACTORY( XMLDrawExportOOO
)
343 else SINGLEFACTORY( XMLDrawStylesExportOOO
)
344 else SINGLEFACTORY( XMLDrawContentExportOOO
)
345 else SINGLEFACTORY( XMLDrawMetaExportOOO
)
346 else SINGLEFACTORY( XMLDrawSettingsExportOOO
)
348 // drawing layer export
349 else SINGLEFACTORY( XMLDrawingLayerExport
)
351 // impress xml clipboard export
352 else SINGLEFACTORY( XMLImpressClipboardExport
)
354 // chart oasis import
355 else SINGLEFACTORY( SchXMLImport
)
356 else SINGLEFACTORY( SchXMLImport_Meta
)
357 else SINGLEFACTORY( SchXMLImport_Styles
)
358 else SINGLEFACTORY( SchXMLImport_Content
)
360 // chart oasis export
361 else SINGLEFACTORY( SchXMLExport_Oasis
)
362 else SINGLEFACTORY( SchXMLExport_Oasis_Meta
)
363 else SINGLEFACTORY( SchXMLExport_Oasis_Styles
)
364 else SINGLEFACTORY( SchXMLExport_Oasis_Content
)
367 else SINGLEFACTORY( SchXMLExport
)
368 else SINGLEFACTORY( SchXMLExport_Styles
)
369 else SINGLEFACTORY( SchXMLExport_Content
)
371 // meta import/export
372 else SINGLEFACTORY( XMLMetaExportComponent
)
373 else SINGLEFACTORY( XMLMetaImportComponent
)
375 else SINGLEFACTORY( XMLVersionListPersistence
)
377 // meta import/export OOo
378 else SINGLEFACTORY( XMLMetaExportOOO
)
380 // auto text import/export
381 else SINGLEFACTORY( XMLAutoTextEventExport
)
382 else SINGLEFACTORY( XMLAutoTextEventImport
)
383 else SINGLEFACTORY( XMLAutoTextEventExportOOO
)
388 pRet
= xFactory
.get();