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 <xmloff/xmlreg.hxx>
32 :
33 : #include <facreg.hxx>
34 :
35 : using namespace com::sun::star;
36 :
37 : #ifdef __cplusplus
38 : extern "C"
39 : {
40 : #endif
41 :
42 : #define SINGLEFACTORY(classname)\
43 : if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\
44 : {\
45 : xFactory = ::cppu::createSingleFactory( xMSF,\
46 : classname##_getImplementationName(),\
47 : classname##_createInstance,\
48 : classname##_getSupportedServiceNames() );\
49 : }
50 :
51 111 : XMLOFF_DLLPUBLIC void * SAL_CALL xo_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
52 : {
53 111 : void * pRet = 0;
54 111 : if( pServiceManager )
55 : {
56 111 : uno::Reference< lang::XMultiServiceFactory > xMSF( static_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
57 :
58 222 : uno::Reference< lang::XSingleServiceFactory > xFactory;
59 :
60 111 : const sal_Int32 nImplNameLen = strlen( pImplName );
61 :
62 : // impress oasis import
63 111 : SINGLEFACTORY( XMLImpressImportOasis )
64 110 : else SINGLEFACTORY( XMLImpressStylesImportOasis )
65 101 : else SINGLEFACTORY( XMLImpressContentImportOasis )
66 92 : else SINGLEFACTORY( XMLImpressMetaImportOasis )
67 83 : else SINGLEFACTORY( XMLImpressSettingsImportOasis )
68 :
69 : // impress oasis export
70 75 : else SINGLEFACTORY( XMLImpressExportOasis )
71 75 : else SINGLEFACTORY( XMLImpressStylesExportOasis )
72 73 : else SINGLEFACTORY( XMLImpressContentExportOasis )
73 71 : else SINGLEFACTORY( XMLImpressMetaExportOasis )
74 70 : else SINGLEFACTORY( XMLImpressSettingsExportOasis )
75 :
76 68 : else SINGLEFACTORY( AnimationsImport )
77 :
78 : // impress OOo export
79 65 : else SINGLEFACTORY( XMLImpressExportOOO )
80 65 : else SINGLEFACTORY( XMLImpressStylesExportOOO )
81 65 : else SINGLEFACTORY( XMLImpressContentExportOOO )
82 65 : else SINGLEFACTORY( XMLImpressMetaExportOOO )
83 64 : else SINGLEFACTORY( XMLImpressSettingsExportOOO )
84 :
85 : // draw oasis import
86 64 : else SINGLEFACTORY( XMLDrawImportOasis )
87 60 : else SINGLEFACTORY( XMLDrawStylesImportOasis )
88 60 : else SINGLEFACTORY( XMLDrawContentImportOasis )
89 60 : else SINGLEFACTORY( XMLDrawMetaImportOasis )
90 60 : else SINGLEFACTORY( XMLDrawSettingsImportOasis )
91 :
92 : // draw oasis export
93 60 : else SINGLEFACTORY( XMLDrawExportOasis )
94 60 : else SINGLEFACTORY( XMLDrawStylesExportOasis )
95 58 : else SINGLEFACTORY( XMLDrawContentExportOasis )
96 56 : else SINGLEFACTORY( XMLDrawMetaExportOasis )
97 55 : else SINGLEFACTORY( XMLDrawSettingsExportOasis )
98 :
99 : // draw OOo export
100 53 : else SINGLEFACTORY( XMLDrawExportOOO )
101 52 : else SINGLEFACTORY( XMLDrawStylesExportOOO )
102 52 : else SINGLEFACTORY( XMLDrawContentExportOOO )
103 51 : else SINGLEFACTORY( XMLDrawMetaExportOOO )
104 50 : else SINGLEFACTORY( XMLDrawSettingsExportOOO )
105 :
106 : // drawing layer export
107 50 : else SINGLEFACTORY( XMLDrawingLayerExport )
108 :
109 : // impress xml clipboard export
110 50 : else SINGLEFACTORY( XMLImpressClipboardExport )
111 :
112 : // chart oasis import
113 50 : else SINGLEFACTORY( SchXMLImport )
114 49 : else SINGLEFACTORY( SchXMLImport_Meta )
115 42 : else SINGLEFACTORY( SchXMLImport_Styles )
116 34 : else SINGLEFACTORY( SchXMLImport_Content )
117 :
118 : // chart oasis export
119 26 : else SINGLEFACTORY( SchXMLExport_Oasis )
120 26 : else SINGLEFACTORY( SchXMLExport_Oasis_Meta )
121 18 : else SINGLEFACTORY( SchXMLExport_Oasis_Styles )
122 10 : else SINGLEFACTORY( SchXMLExport_Oasis_Content )
123 :
124 : // chart OOo export
125 2 : else SINGLEFACTORY( SchXMLExport )
126 2 : else SINGLEFACTORY( SchXMLExport_Styles )
127 2 : else SINGLEFACTORY( SchXMLExport_Content )
128 :
129 : // meta import/export
130 2 : else SINGLEFACTORY( XMLMetaExportComponent )
131 1 : else SINGLEFACTORY( XMLMetaImportComponent )
132 :
133 : // meta import/export OOo
134 0 : else SINGLEFACTORY( XMLMetaExportOOO )
135 :
136 : // auto text import/export
137 0 : else SINGLEFACTORY( XMLAutoTextEventExport )
138 0 : else SINGLEFACTORY( XMLAutoTextEventImport )
139 0 : else SINGLEFACTORY( XMLAutoTextEventExportOOO )
140 :
141 111 : if( xFactory.is())
142 : {
143 111 : xFactory->acquire();
144 111 : pRet = xFactory.get();
145 111 : }
146 : }
147 111 : return pRet;
148 : }
149 :
150 : #ifdef __cplusplus
151 : }
152 : #endif
153 :
154 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|