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 : : #include "sal/types.h"
30 : : #include "rtl/ustring.hxx"
31 : : #include <cppuhelper/factory.hxx>
32 : : #include <cppuhelper/weak.hxx>
33 : : #include <com/sun/star/lang/XSingleServiceFactory.hpp>
34 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
35 : : #include <com/sun/star/registry/XRegistryKey.hpp>
36 : : #include <osl/diagnose.h>
37 : : #include <uno/mapping.hxx>
38 : : #include "provider.hxx"
39 : : #include "renderer.hxx"
40 : : #include "unowizard.hxx"
41 : :
42 : : #include "comphelper/servicedecl.hxx"
43 : :
44 : : #include "cppuhelper/implementationentry.hxx"
45 : :
46 : : using namespace ::com::sun::star::uno;
47 : : using namespace ::com::sun::star::registry;
48 : : using namespace ::com::sun::star::lang;
49 : : using namespace unographic;
50 : :
51 : : using rtl::OUString;
52 : :
53 : : namespace sdecl = comphelper::service_decl;
54 : :
55 : : namespace unographic {
56 : : extern sdecl::ServiceDecl const serviceDecl;
57 : : }
58 : :
59 : : // -------------------------------------------------------------------------------------
60 : :
61 : : // for CreateInstance functions implemented elsewhere
62 : : #define DECLARE_CREATEINSTANCE( ImplName ) \
63 : : Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& );
64 : :
65 : : // for CreateInstance functions implemented elsewhere, while the function is within a namespace
66 : : #define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \
67 : : namespace nmspe { \
68 : : Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \
69 : : }
70 : :
71 : : namespace
72 : : {
73 : : static struct ::cppu::ImplementationEntry s_aServiceEntries[] =
74 : : {
75 : : {
76 : : ::svt::uno::Wizard::Create,
77 : : ::svt::uno::Wizard::getImplementationName_static,
78 : : ::svt::uno::Wizard::getSupportedServiceNames_static,
79 : : ::cppu::createSingleComponentFactory, NULL, 0
80 : : },
81 : : { 0, 0, 0, 0, 0, 0 }
82 : : };
83 : : }
84 : :
85 : : // -------------------------------------------------------------------------------------
86 : :
87 : : DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno )
88 : : DECLARE_CREATEINSTANCE( SvFilterOptionsDialog )
89 : : DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicProvider )
90 : : DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL )
91 : :
92 : : // -------------------------------------------------------------------------------------
93 : : extern "C"
94 : : {
95 : :
96 : 109 : SAL_DLLPUBLIC_EXPORT void * SAL_CALL svt_component_getFactory (
97 : : const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey)
98 : : {
99 : 109 : void * pResult = 0;
100 [ + - ]: 109 : if ( _pServiceManager )
101 : : {
102 : 109 : Reference< XSingleServiceFactory > xFactory;
103 [ - + ]: 109 : if (rtl_str_compare (
104 : 109 : pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0)
105 : : {
106 [ # # ]: 0 : Sequence< OUString > aServiceNames(1);
107 : : aServiceNames.getArray()[0] =
108 [ # # ][ # # ]: 0 : OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.AddressBookSourceDialog" ));
109 : :
110 : : xFactory = ::cppu::createSingleFactory (
111 : : reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ),
112 : : OUString::createFromAscii( pImplementationName ),
113 : : svt::OAddressBookSourceDialogUno_CreateInstance,
114 [ # # ][ # # ]: 0 : aServiceNames);
[ # # ][ # # ]
115 : : }
116 [ - + ]: 109 : else if (rtl_str_compare (
117 : 109 : pImplementationName, "com.sun.star.svtools.SvFilterOptionsDialog") == 0)
118 : : {
119 [ # # ]: 0 : Sequence< OUString > aServiceNames(1);
120 : : aServiceNames.getArray()[0] =
121 [ # # ][ # # ]: 0 : OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilterOptionsDialog" ));
122 : :
123 : : xFactory = ::cppu::createSingleFactory (
124 : : reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ),
125 : : OUString::createFromAscii( pImplementationName ),
126 : : SvFilterOptionsDialog_CreateInstance,
127 [ # # ][ # # ]: 0 : aServiceNames);
[ # # ][ # # ]
128 : : }
129 [ + + ]: 109 : else if( 0 == GraphicProvider::getImplementationName_Static().compareToAscii( pImplementationName ) )
130 : : {
131 : : xFactory = ::cppu::createOneInstanceFactory(
132 : : reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),
133 : : GraphicProvider::getImplementationName_Static(),
134 : : GraphicProvider_CreateInstance,
135 [ + - ][ + - ]: 98 : GraphicProvider::getSupportedServiceNames_Static() );
[ + - ][ + - ]
136 : : }
137 [ - + ]: 11 : else if( 0 == GraphicRendererVCL::getImplementationName_Static().compareToAscii( pImplementationName ) )
138 : : {
139 : : xFactory = ::cppu::createOneInstanceFactory(
140 : : reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),
141 : : GraphicRendererVCL::getImplementationName_Static(),
142 : : GraphicRendererVCL_CreateInstance,
143 [ # # ][ # # ]: 0 : GraphicRendererVCL::getSupportedServiceNames_Static() );
[ # # ][ # # ]
144 : : }
145 : : else
146 : : {
147 [ + - ]: 11 : pResult = component_getFactoryHelper( pImplementationName, reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl );
148 [ - + ]: 11 : if ( !pResult )
149 [ # # ]: 0 : pResult = ::cppu::component_getFactoryHelper( pImplementationName, _pServiceManager, pRegistryKey, s_aServiceEntries );
150 : : }
151 : :
152 [ + + ]: 109 : if ( xFactory.is() )
153 : : {
154 [ + - ]: 98 : xFactory->acquire();
155 [ + - ]: 98 : pResult = xFactory.get();
156 : 109 : }
157 : : }
158 : 109 : return pResult;
159 : : }
160 : :
161 : : } // "C"
162 : :
163 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|