xref: /AOO41X/main/xmloff/source/core/facreg.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "sal/config.h"
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include "xmloff/dllapi.h"
34*cdf0e10cSrcweir 
35*cdf0e10cSrcweir #include <string.h>
36*cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
38*cdf0e10cSrcweir #include <osl/diagnose.h>
39*cdf0e10cSrcweir #include <tools/debug.hxx>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
42*cdf0e10cSrcweir #include <uno/lbnames.h>
43*cdf0e10cSrcweir #include "xmloff/xmlreg.hxx"
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir using namespace rtl;
46*cdf0e10cSrcweir using namespace com::sun::star;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #define SERVICE( className )										\
49*cdf0e10cSrcweir extern OUString SAL_CALL className##_getImplementationName() throw();	\
50*cdf0e10cSrcweir extern uno::Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw();\
51*cdf0e10cSrcweir extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance(			\
52*cdf0e10cSrcweir 		const uno::Reference< lang::XMultiServiceFactory > & rSMgr )				\
53*cdf0e10cSrcweir 	throw( uno::Exception )
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir // impress oasis import
56*cdf0e10cSrcweir SERVICE( XMLImpressImportOasis );
57*cdf0e10cSrcweir SERVICE( XMLImpressStylesImportOasis );
58*cdf0e10cSrcweir SERVICE( XMLImpressContentImportOasis );
59*cdf0e10cSrcweir SERVICE( XMLImpressMetaImportOasis );
60*cdf0e10cSrcweir SERVICE( XMLImpressSettingsImportOasis );
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir // impress oasis export
63*cdf0e10cSrcweir SERVICE( XMLImpressExportOasis );
64*cdf0e10cSrcweir SERVICE( XMLImpressStylesExportOasis );
65*cdf0e10cSrcweir SERVICE( XMLImpressContentExportOasis );
66*cdf0e10cSrcweir SERVICE( XMLImpressMetaExportOasis );
67*cdf0e10cSrcweir SERVICE( XMLImpressSettingsExportOasis );
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir // impress OOo import
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir // impress OOo export
72*cdf0e10cSrcweir SERVICE( XMLImpressExportOOO );
73*cdf0e10cSrcweir SERVICE( XMLImpressStylesExportOOO );
74*cdf0e10cSrcweir SERVICE( XMLImpressContentExportOOO );
75*cdf0e10cSrcweir SERVICE( XMLImpressMetaExportOOO );
76*cdf0e10cSrcweir SERVICE( XMLImpressSettingsExportOOO );
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir // draw oasis import
79*cdf0e10cSrcweir SERVICE( XMLDrawImportOasis );
80*cdf0e10cSrcweir SERVICE( XMLDrawStylesImportOasis );
81*cdf0e10cSrcweir SERVICE( XMLDrawContentImportOasis );
82*cdf0e10cSrcweir SERVICE( XMLDrawMetaImportOasis );
83*cdf0e10cSrcweir SERVICE( XMLDrawSettingsImportOasis );
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir // draw oasis export
86*cdf0e10cSrcweir SERVICE( XMLDrawExportOasis );
87*cdf0e10cSrcweir SERVICE( XMLDrawStylesExportOasis );
88*cdf0e10cSrcweir SERVICE( XMLDrawContentExportOasis );
89*cdf0e10cSrcweir SERVICE( XMLDrawMetaExportOasis );
90*cdf0e10cSrcweir SERVICE( XMLDrawSettingsExportOasis );
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir // draw OOo import
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir // draw OOo export
95*cdf0e10cSrcweir SERVICE( XMLDrawExportOOO );
96*cdf0e10cSrcweir SERVICE( XMLDrawStylesExportOOO );
97*cdf0e10cSrcweir SERVICE( XMLDrawContentExportOOO );
98*cdf0e10cSrcweir SERVICE( XMLDrawMetaExportOOO );
99*cdf0e10cSrcweir SERVICE( XMLDrawSettingsExportOOO );
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir // impress animation import
102*cdf0e10cSrcweir SERVICE( AnimationsImport );
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir // drawing layer export
105*cdf0e10cSrcweir SERVICE( XMLDrawingLayerExport );
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir // impress xml clipboard export
108*cdf0e10cSrcweir SERVICE( XMLImpressClipboardExport );
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir // chart oasis import
111*cdf0e10cSrcweir SERVICE( SchXMLImport );
112*cdf0e10cSrcweir SERVICE( SchXMLImport_Meta );
113*cdf0e10cSrcweir SERVICE( SchXMLImport_Styles );
114*cdf0e10cSrcweir SERVICE( SchXMLImport_Content );
115*cdf0e10cSrcweir 
116*cdf0e10cSrcweir // chart oasis export
117*cdf0e10cSrcweir SERVICE( SchXMLExport_Oasis );
118*cdf0e10cSrcweir SERVICE( SchXMLExport_Oasis_Meta );
119*cdf0e10cSrcweir SERVICE( SchXMLExport_Oasis_Styles );
120*cdf0e10cSrcweir SERVICE( SchXMLExport_Oasis_Content );
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir // chart OOo import
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir // chart OOo export
125*cdf0e10cSrcweir SERVICE( SchXMLExport );
126*cdf0e10cSrcweir SERVICE( SchXMLExport_Styles );
127*cdf0e10cSrcweir SERVICE( SchXMLExport_Content );
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir // version list import/export
130*cdf0e10cSrcweir SERVICE( XMLVersionListPersistence );
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir // meta export
133*cdf0e10cSrcweir SERVICE( XMLMetaExportComponent );
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir // meta import
136*cdf0e10cSrcweir SERVICE( XMLMetaImportComponent );
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir // meta export OOo
139*cdf0e10cSrcweir SERVICE( XMLMetaExportOOO );
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir // writer autotext event export
142*cdf0e10cSrcweir SERVICE( XMLAutoTextEventExport );
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir // writer autotext event import
145*cdf0e10cSrcweir SERVICE( XMLAutoTextEventImport );
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir // writer autotext event export OOo
148*cdf0e10cSrcweir SERVICE( XMLAutoTextEventExportOOO );
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir // writer autotext event import OOo
151*cdf0e10cSrcweir SERVICE( XMLAutoTextEventImportOOO );
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir // Oasis2OOo transformer
154*cdf0e10cSrcweir SERVICE( Oasis2OOoTransformer );
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir // OOo2Oasis transformer
157*cdf0e10cSrcweir SERVICE( OOo2OasisTransformer );
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir //
160*cdf0e10cSrcweir #ifdef __cplusplus
161*cdf0e10cSrcweir extern "C"
162*cdf0e10cSrcweir {
163*cdf0e10cSrcweir #endif
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir XMLOFF_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
166*cdf0e10cSrcweir {
167*cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
168*cdf0e10cSrcweir }
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir #define SINGLEFACTORY(classname)\
171*cdf0e10cSrcweir 		if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
172*cdf0e10cSrcweir 		{\
173*cdf0e10cSrcweir 			xFactory = ::cppu::createSingleFactory( xMSF,\
174*cdf0e10cSrcweir 				classname##_getImplementationName(),\
175*cdf0e10cSrcweir 				classname##_createInstance,\
176*cdf0e10cSrcweir 				classname##_getSupportedServiceNames() );\
177*cdf0e10cSrcweir 		}
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir XMLOFF_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
180*cdf0e10cSrcweir {
181*cdf0e10cSrcweir 	void * pRet = 0;
182*cdf0e10cSrcweir 	if( pServiceManager )
183*cdf0e10cSrcweir 	{
184*cdf0e10cSrcweir 		uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 		uno::Reference< lang::XSingleServiceFactory > xFactory;
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 		const sal_Int32 nImplNameLen = strlen( pImplName );
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 		// impress oasis import
191*cdf0e10cSrcweir 		SINGLEFACTORY( XMLImpressImportOasis )
192*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressStylesImportOasis )
193*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressContentImportOasis )
194*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressMetaImportOasis )
195*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressSettingsImportOasis )
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir 		// impress oasis export
198*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressExportOasis )
199*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressStylesExportOasis )
200*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressContentExportOasis )
201*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressMetaExportOasis )
202*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressSettingsExportOasis )
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir 		else SINGLEFACTORY( AnimationsImport )
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 		// impress OOo export
207*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressExportOOO )
208*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressStylesExportOOO )
209*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressContentExportOOO )
210*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressMetaExportOOO )
211*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressSettingsExportOOO )
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 		// draw oasis import
214*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawImportOasis )
215*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawStylesImportOasis )
216*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawContentImportOasis )
217*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawMetaImportOasis )
218*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawSettingsImportOasis )
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 		// draw oasis export
221*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawExportOasis )
222*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawStylesExportOasis )
223*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawContentExportOasis )
224*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawMetaExportOasis )
225*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawSettingsExportOasis )
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 		// draw OOo export
228*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawExportOOO )
229*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawStylesExportOOO )
230*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawContentExportOOO )
231*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawMetaExportOOO )
232*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawSettingsExportOOO )
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 		// drawing layer export
235*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLDrawingLayerExport )
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 		// impress xml clipboard export
238*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLImpressClipboardExport )
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 		// chart oasis import
241*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLImport )
242*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLImport_Meta )
243*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLImport_Styles )
244*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLImport_Content )
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 		// chart oasis export
247*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLExport_Oasis )
248*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLExport_Oasis_Meta )
249*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLExport_Oasis_Styles )
250*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLExport_Oasis_Content )
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 		// chart OOo export
253*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLExport )
254*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLExport_Styles )
255*cdf0e10cSrcweir 		else SINGLEFACTORY( SchXMLExport_Content )
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 		// meta import/export
258*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLMetaExportComponent )
259*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLMetaImportComponent )
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir         else SINGLEFACTORY( XMLVersionListPersistence )
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir 		// meta import/export OOo
264*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLMetaExportOOO )
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 		// auto text import/export
267*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLAutoTextEventExport )
268*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLAutoTextEventImport )
269*cdf0e10cSrcweir 		else SINGLEFACTORY( XMLAutoTextEventExportOOO )
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 		if( xFactory.is())
272*cdf0e10cSrcweir 		{
273*cdf0e10cSrcweir 			xFactory->acquire();
274*cdf0e10cSrcweir 			pRet = xFactory.get();
275*cdf0e10cSrcweir 		}
276*cdf0e10cSrcweir 	}
277*cdf0e10cSrcweir 	return pRet;
278*cdf0e10cSrcweir }
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir #ifdef __cplusplus
281*cdf0e10cSrcweir }
282*cdf0e10cSrcweir #endif
283*cdf0e10cSrcweir 
284