1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <com/sun/star/registry/XRegistryKey.hpp>
23 #include <cppuhelper/factory.hxx>
25 using namespace ::com::sun::star
;
27 #define DECLARE_SERVICE( classname ) \
28 extern OUString SAL_CALL classname##_getImplementationName() throw(); \
29 extern uno::Sequence< OUString > SAL_CALL classname##_getSupportedServiceNames() throw(); \
30 extern uno::Reference< uno::XInterface > SAL_CALL classname##_createInstance( \
31 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception );
33 #define ENUMERATE_SERVICE( classname ) \
34 { classname##_getImplementationName, classname##_getSupportedServiceNames, classname##_createInstance }
36 // ============================================================================
37 DECLARE_SERVICE( OOo2OasisTransformer
)
38 DECLARE_SERVICE( Oasis2OOoTransformer
)
40 DECLARE_SERVICE( XMLAutoTextEventImportOOO
)
41 DECLARE_SERVICE( XMLMetaImportOOO
)
42 DECLARE_SERVICE( XMLMathSettingsImportOOO
)
43 DECLARE_SERVICE( XMLMathMetaImportOOO
)
44 DECLARE_SERVICE( XMLCalcSettingsImportOOO
)
45 DECLARE_SERVICE( XMLCalcMetaImportOOO
)
46 DECLARE_SERVICE( XMLCalcContentImportOOO
)
47 DECLARE_SERVICE( XMLCalcStylesImportOOO
)
48 DECLARE_SERVICE( XMLCalcImportOOO
)
49 DECLARE_SERVICE( XMLWriterSettingsImportOOO
)
50 DECLARE_SERVICE( XMLWriterMetaImportOOO
)
51 DECLARE_SERVICE( XMLWriterContentImportOOO
)
52 DECLARE_SERVICE( XMLWriterStylesImportOOO
)
53 DECLARE_SERVICE( XMLWriterImportOOO
)
54 DECLARE_SERVICE( XMLChartContentImportOOO
)
55 DECLARE_SERVICE( XMLChartStylesImportOOO
)
56 DECLARE_SERVICE( XMLChartImportOOO
)
57 DECLARE_SERVICE( XMLDrawSettingsImportOOO
)
58 DECLARE_SERVICE( XMLDrawMetaImportOOO
)
59 DECLARE_SERVICE( XMLDrawContentImportOOO
)
60 DECLARE_SERVICE( XMLDrawStylesImportOOO
)
61 DECLARE_SERVICE( XMLDrawImportOOO
)
62 DECLARE_SERVICE( XMLImpressSettingsImportOOO
)
63 DECLARE_SERVICE( XMLImpressMetaImportOOO
)
64 DECLARE_SERVICE( XMLImpressContentImportOOO
)
65 DECLARE_SERVICE( XMLImpressStylesImportOOO
)
66 DECLARE_SERVICE( XMLImpressImportOOO
)
68 // ============================================================================
70 // ----------------------------------------------------------------------------
73 typedef OUString (SAL_CALL
* GetImplementationName
)();
74 typedef uno::Sequence
< OUString
> (SAL_CALL
* GetSupportedServiceNames
)();
75 typedef uno::Reference
< ::uno::XInterface
> (SAL_CALL
* CreateInstance
)(
76 const uno::Reference
< lang::XMultiServiceFactory
>& );
78 struct ServiceDescriptor
80 GetImplementationName getImplementationName
;
81 GetSupportedServiceNames getSupportedServiceNames
;
82 CreateInstance createInstance
;
85 // ------------------------------------------------------------------------
86 static const ServiceDescriptor
* getServiceDescriptors()
88 static const ServiceDescriptor aDescriptors
[] =
90 // ================================================================
91 ENUMERATE_SERVICE( OOo2OasisTransformer
),
92 ENUMERATE_SERVICE( Oasis2OOoTransformer
),
94 ENUMERATE_SERVICE( XMLAutoTextEventImportOOO
),
95 ENUMERATE_SERVICE( XMLMetaImportOOO
),
96 ENUMERATE_SERVICE( XMLMathSettingsImportOOO
),
97 ENUMERATE_SERVICE( XMLMathMetaImportOOO
),
98 ENUMERATE_SERVICE( XMLCalcSettingsImportOOO
),
99 ENUMERATE_SERVICE( XMLCalcMetaImportOOO
),
100 ENUMERATE_SERVICE( XMLCalcContentImportOOO
),
101 ENUMERATE_SERVICE( XMLCalcStylesImportOOO
),
102 ENUMERATE_SERVICE( XMLCalcImportOOO
),
103 ENUMERATE_SERVICE( XMLWriterSettingsImportOOO
),
104 ENUMERATE_SERVICE( XMLWriterMetaImportOOO
),
105 ENUMERATE_SERVICE( XMLWriterContentImportOOO
),
106 ENUMERATE_SERVICE( XMLWriterStylesImportOOO
),
107 ENUMERATE_SERVICE( XMLWriterImportOOO
),
108 ENUMERATE_SERVICE( XMLChartContentImportOOO
),
109 ENUMERATE_SERVICE( XMLChartStylesImportOOO
),
110 ENUMERATE_SERVICE( XMLChartImportOOO
),
111 ENUMERATE_SERVICE( XMLDrawSettingsImportOOO
),
112 ENUMERATE_SERVICE( XMLDrawMetaImportOOO
),
113 ENUMERATE_SERVICE( XMLDrawContentImportOOO
),
114 ENUMERATE_SERVICE( XMLDrawStylesImportOOO
),
115 ENUMERATE_SERVICE( XMLDrawImportOOO
),
116 ENUMERATE_SERVICE( XMLImpressSettingsImportOOO
),
117 ENUMERATE_SERVICE( XMLImpressMetaImportOOO
),
118 ENUMERATE_SERVICE( XMLImpressContentImportOOO
),
119 ENUMERATE_SERVICE( XMLImpressStylesImportOOO
),
120 ENUMERATE_SERVICE( XMLImpressImportOOO
),
121 // ================================================================
127 // ----------------------------------------------------------------------------
134 SAL_DLLPUBLIC_EXPORT
void* SAL_CALL
xof_component_getFactory( const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
137 if( pServiceManager
)
141 uno::Reference
< lang::XMultiServiceFactory
> xMSF( reinterpret_cast< lang::XMultiServiceFactory
* >( pServiceManager
) );
143 const sal_Int32 nImplNameLen
= strlen( pImplName
);
145 const ServiceDescriptor
* pDescriptor
= getServiceDescriptors();
146 while ( pDescriptor
->getImplementationName
)
148 if ( pDescriptor
->getImplementationName().equalsAsciiL( pImplName
, nImplNameLen
) )
150 uno::Reference
< lang::XSingleServiceFactory
> xFactory
=
151 ::cppu::createSingleFactory( xMSF
,
152 pDescriptor
->getImplementationName(),
153 pDescriptor
->createInstance
,
154 pDescriptor
->getSupportedServiceNames()
160 pRet
= xFactory
.get();
168 catch( uno::Exception
& )
170 OSL_FAIL( "xof::xof_component_getFactory: Exception!" );
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */