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 <cppuhelper/factory.hxx>
22 #include <rtl/instance.hxx>
24 #include "typedetection.hxx"
25 #include "filterfactory.hxx"
26 #include "contenthandlerfactory.hxx"
27 #include "frameloaderfactory.hxx"
28 #include "configflush.hxx"
35 extern "C" SAL_DLLPUBLIC_EXPORT
void* SAL_CALL
36 filterconfig1_component_getFactory( const sal_Char
* pImplementationName
,
37 void* pServiceManager
,
38 void* /* pRegistryKey */ )
40 if ((!pImplementationName
) || (!pServiceManager
))
43 com::sun::star::uno::Reference
< com::sun::star::lang::XMultiServiceFactory
>
44 xSMGR
= reinterpret_cast< com::sun::star::lang::XMultiServiceFactory
* >(pServiceManager
);
45 com::sun::star::uno::Reference
< com::sun::star::lang::XSingleServiceFactory
> xFactory
;
46 OUString sImplName
= OUString::createFromAscii(pImplementationName
);
48 if (TypeDetection::impl_getImplementationName() == sImplName
)
49 xFactory
= cppu::createSingleFactory( xSMGR
,
50 TypeDetection::impl_getImplementationName(),
51 TypeDetection::impl_createInstance
,
52 TypeDetection::impl_getSupportedServiceNames() );
54 if (FilterFactory::impl_getImplementationName() == sImplName
)
55 xFactory
= cppu::createSingleFactory( xSMGR
,
56 FilterFactory::impl_getImplementationName(),
57 FilterFactory::impl_createInstance
,
58 FilterFactory::impl_getSupportedServiceNames() );
60 if (ContentHandlerFactory::impl_getImplementationName() == sImplName
)
61 xFactory
= cppu::createSingleFactory( xSMGR
,
62 ContentHandlerFactory::impl_getImplementationName(),
63 ContentHandlerFactory::impl_createInstance
,
64 ContentHandlerFactory::impl_getSupportedServiceNames() );
66 if (FrameLoaderFactory::impl_getImplementationName() == sImplName
)
67 xFactory
= cppu::createSingleFactory( xSMGR
,
68 FrameLoaderFactory::impl_getImplementationName(),
69 FrameLoaderFactory::impl_createInstance
,
70 FrameLoaderFactory::impl_getSupportedServiceNames() );
72 if (ConfigFlush::impl_getImplementationName() == sImplName
)
73 xFactory
= cppu::createOneInstanceFactory( xSMGR
,
74 ConfigFlush::impl_getImplementationName(),
75 ConfigFlush::impl_createInstance
,
76 ConfigFlush::impl_getSupportedServiceNames() );
78 /* And if one of these checks was successful => xFactory was set! */
82 return xFactory
.get();
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */