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