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 .
21 #include <com/sun/star/registry/XRegistryKey.hpp>
22 #include <cppuhelper/factory.hxx>
23 #include <osl/diagnose.h>
25 #include <XMLFilterRegistration.hxx>
27 using namespace ::com::sun::star
;
29 #define ENUMERATE_SERVICE( classname ) \
30 { classname##_getImplementationName, classname##_getSupportedServiceNames, classname##_createInstance }
34 typedef OUString (SAL_CALL
* GetImplementationName
)();
35 typedef uno::Sequence
< OUString
> (SAL_CALL
* GetSupportedServiceNames
)();
36 typedef uno::Reference
< ::uno::XInterface
> (SAL_CALL
* CreateInstance
)(
37 const uno::Reference
< lang::XMultiServiceFactory
>& );
39 struct ServiceDescriptor
41 GetImplementationName getImplementationName
;
42 GetSupportedServiceNames getSupportedServiceNames
;
43 CreateInstance createInstance
;
46 static const ServiceDescriptor
* getServiceDescriptors()
48 static const ServiceDescriptor aDescriptors
[] =
50 ENUMERATE_SERVICE( OOo2OasisTransformer
),
51 ENUMERATE_SERVICE( Oasis2OOoTransformer
),
53 ENUMERATE_SERVICE( XMLAutoTextEventImportOOO
),
54 ENUMERATE_SERVICE( XMLMetaImportOOO
),
55 ENUMERATE_SERVICE( XMLMathSettingsImportOOO
),
56 ENUMERATE_SERVICE( XMLMathMetaImportOOO
),
57 ENUMERATE_SERVICE( XMLCalcSettingsImportOOO
),
58 ENUMERATE_SERVICE( XMLCalcMetaImportOOO
),
59 ENUMERATE_SERVICE( XMLCalcContentImportOOO
),
60 ENUMERATE_SERVICE( XMLCalcStylesImportOOO
),
61 ENUMERATE_SERVICE( XMLCalcImportOOO
),
62 ENUMERATE_SERVICE( XMLWriterSettingsImportOOO
),
63 ENUMERATE_SERVICE( XMLWriterMetaImportOOO
),
64 ENUMERATE_SERVICE( XMLWriterContentImportOOO
),
65 ENUMERATE_SERVICE( XMLWriterStylesImportOOO
),
66 ENUMERATE_SERVICE( XMLWriterImportOOO
),
67 ENUMERATE_SERVICE( XMLChartContentImportOOO
),
68 ENUMERATE_SERVICE( XMLChartStylesImportOOO
),
69 ENUMERATE_SERVICE( XMLChartImportOOO
),
70 ENUMERATE_SERVICE( XMLDrawSettingsImportOOO
),
71 ENUMERATE_SERVICE( XMLDrawMetaImportOOO
),
72 ENUMERATE_SERVICE( XMLDrawContentImportOOO
),
73 ENUMERATE_SERVICE( XMLDrawStylesImportOOO
),
74 ENUMERATE_SERVICE( XMLDrawImportOOO
),
75 ENUMERATE_SERVICE( XMLImpressSettingsImportOOO
),
76 ENUMERATE_SERVICE( XMLImpressMetaImportOOO
),
77 ENUMERATE_SERVICE( XMLImpressContentImportOOO
),
78 ENUMERATE_SERVICE( XMLImpressStylesImportOOO
),
79 ENUMERATE_SERVICE( XMLImpressImportOOO
),
91 SAL_DLLPUBLIC_EXPORT
void* SAL_CALL
xof_component_getFactory( const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
98 uno::Reference
< lang::XMultiServiceFactory
> xMSF( static_cast< lang::XMultiServiceFactory
* >( pServiceManager
) );
100 const sal_Int32 nImplNameLen
= strlen( pImplName
);
102 const ServiceDescriptor
* pDescriptor
= getServiceDescriptors();
103 while ( pDescriptor
->getImplementationName
)
105 if ( pDescriptor
->getImplementationName().equalsAsciiL( pImplName
, nImplNameLen
) )
107 uno::Reference
< lang::XSingleServiceFactory
> xFactory
=
108 ::cppu::createSingleFactory( xMSF
,
109 pDescriptor
->getImplementationName(),
110 pDescriptor
->createInstance
,
111 pDescriptor
->getSupportedServiceNames()
117 pRet
= xFactory
.get();
125 catch( uno::Exception
& )
127 OSL_FAIL( "xof::xof_component_getFactory: Exception!" );
138 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */