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