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 <cppuhelper/factory.hxx>
22 : #include <rtl/instance.hxx>
23 :
24 : #include "typedetection.hxx"
25 : #include "filterfactory.hxx"
26 : #include "contenthandlerfactory.hxx"
27 : #include "frameloaderfactory.hxx"
28 : #include "configflush.hxx"
29 :
30 :
31 : namespace filter{
32 : namespace config{
33 :
34 :
35 : extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL
36 55 : filterconfig1_component_getFactory( const sal_Char* pImplementationName,
37 : void* pServiceManager,
38 : void* /* pRegistryKey */ )
39 : {
40 55 : if ((!pImplementationName) || (!pServiceManager ))
41 0 : return NULL;
42 :
43 : com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
44 55 : xSMGR = reinterpret_cast< com::sun::star::lang::XMultiServiceFactory* >(pServiceManager);
45 55 : com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xFactory;
46 55 : rtl::OUString sImplName = rtl::OUString::createFromAscii(pImplementationName);
47 :
48 55 : if (TypeDetection::impl_getImplementationName() == sImplName)
49 : xFactory = cppu::createSingleFactory( xSMGR,
50 : TypeDetection::impl_getImplementationName(),
51 : TypeDetection::impl_createInstance,
52 13 : TypeDetection::impl_getSupportedServiceNames() );
53 :
54 55 : if (FilterFactory::impl_getImplementationName() == sImplName)
55 : xFactory = cppu::createSingleFactory( xSMGR,
56 : FilterFactory::impl_getImplementationName(),
57 : FilterFactory::impl_createInstance,
58 13 : FilterFactory::impl_getSupportedServiceNames() );
59 :
60 55 : if (ContentHandlerFactory::impl_getImplementationName() == sImplName)
61 : xFactory = cppu::createSingleFactory( xSMGR,
62 : ContentHandlerFactory::impl_getImplementationName(),
63 : ContentHandlerFactory::impl_createInstance,
64 8 : ContentHandlerFactory::impl_getSupportedServiceNames() );
65 :
66 55 : if (FrameLoaderFactory::impl_getImplementationName() == sImplName)
67 : xFactory = cppu::createSingleFactory( xSMGR,
68 : FrameLoaderFactory::impl_getImplementationName(),
69 : FrameLoaderFactory::impl_createInstance,
70 8 : FrameLoaderFactory::impl_getSupportedServiceNames() );
71 :
72 55 : if (ConfigFlush::impl_getImplementationName() == sImplName)
73 : xFactory = cppu::createOneInstanceFactory( xSMGR,
74 : ConfigFlush::impl_getImplementationName(),
75 : ConfigFlush::impl_createInstance,
76 13 : ConfigFlush::impl_getSupportedServiceNames() );
77 :
78 : /* And if one of these checks was successful => xFactory was set! */
79 55 : if (xFactory.is())
80 : {
81 55 : xFactory->acquire();
82 55 : return xFactory.get();
83 : }
84 :
85 0 : return NULL;
86 : }
87 :
88 : } // namespace config
89 : } // namespace filter
90 :
91 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|