Teach symstore more duplicated DLLs
[LibreOffice.git] / xmloff / source / transform / XMLFilterRegistration.cxx
blob447f258a86d8366ada0926b90f4997294493af76
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <string.h>
21 #include <cppuhelper/factory.hxx>
22 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
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 }
32 namespace
34 typedef OUString (* GetImplementationName)();
35 typedef uno::Sequence< OUString > (* GetSupportedServiceNames)();
36 typedef uno::Reference< ::uno::XInterface > (* CreateInstance)(
37 const uno::Reference< lang::XMultiServiceFactory >& );
39 struct ServiceDescriptor
41 GetImplementationName const getImplementationName;
42 GetSupportedServiceNames const getSupportedServiceNames;
43 CreateInstance const createInstance;
46 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 ),
80 { nullptr, nullptr, nullptr }
82 return aDescriptors;
86 extern "C"
89 SAL_DLLPUBLIC_EXPORT void* xof_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
91 void * pRet = nullptr;
92 if( pServiceManager )
94 try
96 uno::Reference< lang::XMultiServiceFactory > xMSF( static_cast< lang::XMultiServiceFactory * >( pServiceManager ) );
98 const sal_Int32 nImplNameLen = strlen( pImplName );
100 const ServiceDescriptor* pDescriptor = getServiceDescriptors();
101 while ( pDescriptor->getImplementationName )
103 if ( pDescriptor->getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )
105 uno::Reference< lang::XSingleServiceFactory > xFactory =
106 ::cppu::createSingleFactory( xMSF,
107 pDescriptor->getImplementationName(),
108 pDescriptor->createInstance,
109 pDescriptor->getSupportedServiceNames()
112 if ( xFactory.is() )
114 xFactory->acquire();
115 pRet = xFactory.get();
116 break;
120 ++pDescriptor;
123 catch( uno::Exception& )
125 OSL_FAIL( "xof::xof_component_getFactory: Exception!" );
129 return pRet;
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */