1*63bba73cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*63bba73cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*63bba73cSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*63bba73cSAndrew Rist * distributed with this work for additional information
6*63bba73cSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*63bba73cSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*63bba73cSAndrew Rist * "License"); you may not use this file except in compliance
9*63bba73cSAndrew Rist * with the License. You may obtain a copy of the License at
10*63bba73cSAndrew Rist *
11*63bba73cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*63bba73cSAndrew Rist *
13*63bba73cSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*63bba73cSAndrew Rist * software distributed under the License is distributed on an
15*63bba73cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*63bba73cSAndrew Rist * KIND, either express or implied. See the License for the
17*63bba73cSAndrew Rist * specific language governing permissions and limitations
18*63bba73cSAndrew Rist * under the License.
19*63bba73cSAndrew Rist *
20*63bba73cSAndrew Rist *************************************************************/
21*63bba73cSAndrew Rist
22*63bba73cSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmloff.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir #include "sal/config.h"
28cdf0e10cSrcweir
29cdf0e10cSrcweir #include "xmloff/dllapi.h"
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <string.h>
32cdf0e10cSrcweir #include <com/sun/star/container/XSet.hpp>
33cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
34cdf0e10cSrcweir #include <osl/diagnose.h>
35cdf0e10cSrcweir #include <tools/debug.hxx>
36cdf0e10cSrcweir
37cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
38cdf0e10cSrcweir #include <uno/lbnames.h>
39cdf0e10cSrcweir #include "xmloff/xmlreg.hxx"
40cdf0e10cSrcweir
41cdf0e10cSrcweir using namespace rtl;
42cdf0e10cSrcweir using namespace com::sun::star;
43cdf0e10cSrcweir
44cdf0e10cSrcweir #define SERVICE( className ) \
45cdf0e10cSrcweir extern OUString SAL_CALL className##_getImplementationName() throw(); \
46cdf0e10cSrcweir extern uno::Sequence< OUString > SAL_CALL className##_getSupportedServiceNames() throw();\
47cdf0e10cSrcweir extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance( \
48cdf0e10cSrcweir const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) \
49cdf0e10cSrcweir throw( uno::Exception )
50cdf0e10cSrcweir
51cdf0e10cSrcweir // impress oasis import
52cdf0e10cSrcweir SERVICE( XMLImpressImportOasis );
53cdf0e10cSrcweir SERVICE( XMLImpressStylesImportOasis );
54cdf0e10cSrcweir SERVICE( XMLImpressContentImportOasis );
55cdf0e10cSrcweir SERVICE( XMLImpressMetaImportOasis );
56cdf0e10cSrcweir SERVICE( XMLImpressSettingsImportOasis );
57cdf0e10cSrcweir
58cdf0e10cSrcweir // impress oasis export
59cdf0e10cSrcweir SERVICE( XMLImpressExportOasis );
60cdf0e10cSrcweir SERVICE( XMLImpressStylesExportOasis );
61cdf0e10cSrcweir SERVICE( XMLImpressContentExportOasis );
62cdf0e10cSrcweir SERVICE( XMLImpressMetaExportOasis );
63cdf0e10cSrcweir SERVICE( XMLImpressSettingsExportOasis );
64cdf0e10cSrcweir
65cdf0e10cSrcweir // impress OOo import
66cdf0e10cSrcweir
67cdf0e10cSrcweir // impress OOo export
68cdf0e10cSrcweir SERVICE( XMLImpressExportOOO );
69cdf0e10cSrcweir SERVICE( XMLImpressStylesExportOOO );
70cdf0e10cSrcweir SERVICE( XMLImpressContentExportOOO );
71cdf0e10cSrcweir SERVICE( XMLImpressMetaExportOOO );
72cdf0e10cSrcweir SERVICE( XMLImpressSettingsExportOOO );
73cdf0e10cSrcweir
74cdf0e10cSrcweir // draw oasis import
75cdf0e10cSrcweir SERVICE( XMLDrawImportOasis );
76cdf0e10cSrcweir SERVICE( XMLDrawStylesImportOasis );
77cdf0e10cSrcweir SERVICE( XMLDrawContentImportOasis );
78cdf0e10cSrcweir SERVICE( XMLDrawMetaImportOasis );
79cdf0e10cSrcweir SERVICE( XMLDrawSettingsImportOasis );
80cdf0e10cSrcweir
81cdf0e10cSrcweir // draw oasis export
82cdf0e10cSrcweir SERVICE( XMLDrawExportOasis );
83cdf0e10cSrcweir SERVICE( XMLDrawStylesExportOasis );
84cdf0e10cSrcweir SERVICE( XMLDrawContentExportOasis );
85cdf0e10cSrcweir SERVICE( XMLDrawMetaExportOasis );
86cdf0e10cSrcweir SERVICE( XMLDrawSettingsExportOasis );
87cdf0e10cSrcweir
88cdf0e10cSrcweir // draw OOo import
89cdf0e10cSrcweir
90cdf0e10cSrcweir // draw OOo export
91cdf0e10cSrcweir SERVICE( XMLDrawExportOOO );
92cdf0e10cSrcweir SERVICE( XMLDrawStylesExportOOO );
93cdf0e10cSrcweir SERVICE( XMLDrawContentExportOOO );
94cdf0e10cSrcweir SERVICE( XMLDrawMetaExportOOO );
95cdf0e10cSrcweir SERVICE( XMLDrawSettingsExportOOO );
96cdf0e10cSrcweir
97cdf0e10cSrcweir // impress animation import
98cdf0e10cSrcweir SERVICE( AnimationsImport );
99cdf0e10cSrcweir
100cdf0e10cSrcweir // drawing layer export
101cdf0e10cSrcweir SERVICE( XMLDrawingLayerExport );
102cdf0e10cSrcweir
103cdf0e10cSrcweir // impress xml clipboard export
104cdf0e10cSrcweir SERVICE( XMLImpressClipboardExport );
105cdf0e10cSrcweir
106cdf0e10cSrcweir // chart oasis import
107cdf0e10cSrcweir SERVICE( SchXMLImport );
108cdf0e10cSrcweir SERVICE( SchXMLImport_Meta );
109cdf0e10cSrcweir SERVICE( SchXMLImport_Styles );
110cdf0e10cSrcweir SERVICE( SchXMLImport_Content );
111cdf0e10cSrcweir
112cdf0e10cSrcweir // chart oasis export
113cdf0e10cSrcweir SERVICE( SchXMLExport_Oasis );
114cdf0e10cSrcweir SERVICE( SchXMLExport_Oasis_Meta );
115cdf0e10cSrcweir SERVICE( SchXMLExport_Oasis_Styles );
116cdf0e10cSrcweir SERVICE( SchXMLExport_Oasis_Content );
117cdf0e10cSrcweir
118cdf0e10cSrcweir // chart OOo import
119cdf0e10cSrcweir
120cdf0e10cSrcweir // chart OOo export
121cdf0e10cSrcweir SERVICE( SchXMLExport );
122cdf0e10cSrcweir SERVICE( SchXMLExport_Styles );
123cdf0e10cSrcweir SERVICE( SchXMLExport_Content );
124cdf0e10cSrcweir
125cdf0e10cSrcweir // version list import/export
126cdf0e10cSrcweir SERVICE( XMLVersionListPersistence );
127cdf0e10cSrcweir
128cdf0e10cSrcweir // meta export
129cdf0e10cSrcweir SERVICE( XMLMetaExportComponent );
130cdf0e10cSrcweir
131cdf0e10cSrcweir // meta import
132cdf0e10cSrcweir SERVICE( XMLMetaImportComponent );
133cdf0e10cSrcweir
134cdf0e10cSrcweir // meta export OOo
135cdf0e10cSrcweir SERVICE( XMLMetaExportOOO );
136cdf0e10cSrcweir
137cdf0e10cSrcweir // writer autotext event export
138cdf0e10cSrcweir SERVICE( XMLAutoTextEventExport );
139cdf0e10cSrcweir
140cdf0e10cSrcweir // writer autotext event import
141cdf0e10cSrcweir SERVICE( XMLAutoTextEventImport );
142cdf0e10cSrcweir
143cdf0e10cSrcweir // writer autotext event export OOo
144cdf0e10cSrcweir SERVICE( XMLAutoTextEventExportOOO );
145cdf0e10cSrcweir
146cdf0e10cSrcweir // writer autotext event import OOo
147cdf0e10cSrcweir SERVICE( XMLAutoTextEventImportOOO );
148cdf0e10cSrcweir
149cdf0e10cSrcweir // Oasis2OOo transformer
150cdf0e10cSrcweir SERVICE( Oasis2OOoTransformer );
151cdf0e10cSrcweir
152cdf0e10cSrcweir // OOo2Oasis transformer
153cdf0e10cSrcweir SERVICE( OOo2OasisTransformer );
154cdf0e10cSrcweir
155cdf0e10cSrcweir //
156cdf0e10cSrcweir #ifdef __cplusplus
157cdf0e10cSrcweir extern "C"
158cdf0e10cSrcweir {
159cdf0e10cSrcweir #endif
160cdf0e10cSrcweir
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)161cdf0e10cSrcweir XMLOFF_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** )
162cdf0e10cSrcweir {
163cdf0e10cSrcweir *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
164cdf0e10cSrcweir }
165cdf0e10cSrcweir
166cdf0e10cSrcweir #define SINGLEFACTORY(classname)\
167cdf0e10cSrcweir if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
168cdf0e10cSrcweir {\
169cdf0e10cSrcweir xFactory = ::cppu::createSingleFactory( xMSF,\
170cdf0e10cSrcweir classname##_getImplementationName(),\
171cdf0e10cSrcweir classname##_createInstance,\
172cdf0e10cSrcweir classname##_getSupportedServiceNames() );\
173cdf0e10cSrcweir }
174cdf0e10cSrcweir
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)175cdf0e10cSrcweir XMLOFF_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
176cdf0e10cSrcweir {
177cdf0e10cSrcweir void * pRet = 0;
178cdf0e10cSrcweir if( pServiceManager )
179cdf0e10cSrcweir {
180cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xMSF( reinterpret_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
181cdf0e10cSrcweir
182cdf0e10cSrcweir uno::Reference< lang::XSingleServiceFactory > xFactory;
183cdf0e10cSrcweir
184cdf0e10cSrcweir const sal_Int32 nImplNameLen = strlen( pImplName );
185cdf0e10cSrcweir
186cdf0e10cSrcweir // impress oasis import
187cdf0e10cSrcweir SINGLEFACTORY( XMLImpressImportOasis )
188cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressStylesImportOasis )
189cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressContentImportOasis )
190cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressMetaImportOasis )
191cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressSettingsImportOasis )
192cdf0e10cSrcweir
193cdf0e10cSrcweir // impress oasis export
194cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressExportOasis )
195cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressStylesExportOasis )
196cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressContentExportOasis )
197cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressMetaExportOasis )
198cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressSettingsExportOasis )
199cdf0e10cSrcweir
200cdf0e10cSrcweir else SINGLEFACTORY( AnimationsImport )
201cdf0e10cSrcweir
202cdf0e10cSrcweir // impress OOo export
203cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressExportOOO )
204cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressStylesExportOOO )
205cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressContentExportOOO )
206cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressMetaExportOOO )
207cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressSettingsExportOOO )
208cdf0e10cSrcweir
209cdf0e10cSrcweir // draw oasis import
210cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawImportOasis )
211cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawStylesImportOasis )
212cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawContentImportOasis )
213cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawMetaImportOasis )
214cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawSettingsImportOasis )
215cdf0e10cSrcweir
216cdf0e10cSrcweir // draw oasis export
217cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawExportOasis )
218cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawStylesExportOasis )
219cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawContentExportOasis )
220cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawMetaExportOasis )
221cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawSettingsExportOasis )
222cdf0e10cSrcweir
223cdf0e10cSrcweir // draw OOo export
224cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawExportOOO )
225cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawStylesExportOOO )
226cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawContentExportOOO )
227cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawMetaExportOOO )
228cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawSettingsExportOOO )
229cdf0e10cSrcweir
230cdf0e10cSrcweir // drawing layer export
231cdf0e10cSrcweir else SINGLEFACTORY( XMLDrawingLayerExport )
232cdf0e10cSrcweir
233cdf0e10cSrcweir // impress xml clipboard export
234cdf0e10cSrcweir else SINGLEFACTORY( XMLImpressClipboardExport )
235cdf0e10cSrcweir
236cdf0e10cSrcweir // chart oasis import
237cdf0e10cSrcweir else SINGLEFACTORY( SchXMLImport )
238cdf0e10cSrcweir else SINGLEFACTORY( SchXMLImport_Meta )
239cdf0e10cSrcweir else SINGLEFACTORY( SchXMLImport_Styles )
240cdf0e10cSrcweir else SINGLEFACTORY( SchXMLImport_Content )
241cdf0e10cSrcweir
242cdf0e10cSrcweir // chart oasis export
243cdf0e10cSrcweir else SINGLEFACTORY( SchXMLExport_Oasis )
244cdf0e10cSrcweir else SINGLEFACTORY( SchXMLExport_Oasis_Meta )
245cdf0e10cSrcweir else SINGLEFACTORY( SchXMLExport_Oasis_Styles )
246cdf0e10cSrcweir else SINGLEFACTORY( SchXMLExport_Oasis_Content )
247cdf0e10cSrcweir
248cdf0e10cSrcweir // chart OOo export
249cdf0e10cSrcweir else SINGLEFACTORY( SchXMLExport )
250cdf0e10cSrcweir else SINGLEFACTORY( SchXMLExport_Styles )
251cdf0e10cSrcweir else SINGLEFACTORY( SchXMLExport_Content )
252cdf0e10cSrcweir
253cdf0e10cSrcweir // meta import/export
254cdf0e10cSrcweir else SINGLEFACTORY( XMLMetaExportComponent )
255cdf0e10cSrcweir else SINGLEFACTORY( XMLMetaImportComponent )
256cdf0e10cSrcweir
257cdf0e10cSrcweir else SINGLEFACTORY( XMLVersionListPersistence )
258cdf0e10cSrcweir
259cdf0e10cSrcweir // meta import/export OOo
260cdf0e10cSrcweir else SINGLEFACTORY( XMLMetaExportOOO )
261cdf0e10cSrcweir
262cdf0e10cSrcweir // auto text import/export
263cdf0e10cSrcweir else SINGLEFACTORY( XMLAutoTextEventExport )
264cdf0e10cSrcweir else SINGLEFACTORY( XMLAutoTextEventImport )
265cdf0e10cSrcweir else SINGLEFACTORY( XMLAutoTextEventExportOOO )
266cdf0e10cSrcweir
267cdf0e10cSrcweir if( xFactory.is())
268cdf0e10cSrcweir {
269cdf0e10cSrcweir xFactory->acquire();
270cdf0e10cSrcweir pRet = xFactory.get();
271cdf0e10cSrcweir }
272cdf0e10cSrcweir }
273cdf0e10cSrcweir return pRet;
274cdf0e10cSrcweir }
275cdf0e10cSrcweir
276cdf0e10cSrcweir #ifdef __cplusplus
277cdf0e10cSrcweir }
278cdf0e10cSrcweir #endif
279cdf0e10cSrcweir
280