Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <cppuhelper/factory.hxx>
31 : : #include <rtl/instance.hxx>
32 : :
33 : : #include "typedetection.hxx"
34 : : #include "filterfactory.hxx"
35 : : #include "contenthandlerfactory.hxx"
36 : : #include "frameloaderfactory.hxx"
37 : : #include "configflush.hxx"
38 : :
39 : :
40 : : namespace filter{
41 : : namespace config{
42 : :
43 : :
44 : : extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL
45 : 512 : filterconfig1_component_getFactory( const sal_Char* pImplementationName,
46 : : void* pServiceManager,
47 : : void* /* pRegistryKey */ )
48 : : {
49 [ + - ][ - + ]: 512 : if ((!pImplementationName) || (!pServiceManager ))
50 : 0 : return NULL;
51 : :
52 : : com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
53 [ + - ]: 512 : xSMGR = reinterpret_cast< com::sun::star::lang::XMultiServiceFactory* >(pServiceManager);
54 : 512 : com::sun::star::uno::Reference< com::sun::star::lang::XSingleServiceFactory > xFactory;
55 : 512 : rtl::OUString sImplName = rtl::OUString::createFromAscii(pImplementationName);
56 : :
57 [ + + ][ + - ]: 512 : if (TypeDetection::impl_getImplementationName() == sImplName)
58 : : xFactory = cppu::createSingleFactory( xSMGR,
59 : : TypeDetection::impl_getImplementationName(),
60 : : TypeDetection::impl_createInstance,
61 [ + - ][ + - ]: 127 : TypeDetection::impl_getSupportedServiceNames() );
[ + - ][ + - ]
[ + - ]
62 : :
63 [ + - ][ + + ]: 512 : if (FilterFactory::impl_getImplementationName() == sImplName)
64 : : xFactory = cppu::createSingleFactory( xSMGR,
65 : : FilterFactory::impl_getImplementationName(),
66 : : FilterFactory::impl_createInstance,
67 [ + - ][ + - ]: 127 : FilterFactory::impl_getSupportedServiceNames() );
[ + - ][ + - ]
[ + - ]
68 : :
69 [ + - ][ + + ]: 512 : if (ContentHandlerFactory::impl_getImplementationName() == sImplName)
70 : : xFactory = cppu::createSingleFactory( xSMGR,
71 : : ContentHandlerFactory::impl_getImplementationName(),
72 : : ContentHandlerFactory::impl_createInstance,
73 [ + - ][ + - ]: 18 : ContentHandlerFactory::impl_getSupportedServiceNames() );
[ + - ][ + - ]
[ + - ]
74 : :
75 [ + - ][ + + ]: 512 : if (FrameLoaderFactory::impl_getImplementationName() == sImplName)
76 : : xFactory = cppu::createSingleFactory( xSMGR,
77 : : FrameLoaderFactory::impl_getImplementationName(),
78 : : FrameLoaderFactory::impl_createInstance,
79 [ + - ][ + - ]: 113 : FrameLoaderFactory::impl_getSupportedServiceNames() );
[ + - ][ + - ]
[ + - ]
80 : :
81 [ + - ][ + + ]: 512 : if (ConfigFlush::impl_getImplementationName() == sImplName)
82 : : xFactory = cppu::createOneInstanceFactory( xSMGR,
83 : : ConfigFlush::impl_getImplementationName(),
84 : : ConfigFlush::impl_createInstance,
85 [ + - ][ + - ]: 127 : ConfigFlush::impl_getSupportedServiceNames() );
[ + - ][ + - ]
[ + - ]
86 : :
87 : : /* And if one of these checks was successful => xFactory was set! */
88 [ + - ]: 512 : if (xFactory.is())
89 : : {
90 [ + - ]: 512 : xFactory->acquire();
91 [ + - ]: 512 : return xFactory.get();
92 : : }
93 : :
94 : 512 : return NULL;
95 : : }
96 : :
97 : : } // namespace config
98 : : } // namespace filter
99 : :
100 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|