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