1*5900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*5900e8ecSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*5900e8ecSAndrew Rist * or more contributor license agreements. See the NOTICE file
5*5900e8ecSAndrew Rist * distributed with this work for additional information
6*5900e8ecSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*5900e8ecSAndrew Rist * to you under the Apache License, Version 2.0 (the
8*5900e8ecSAndrew Rist * "License"); you may not use this file except in compliance
9*5900e8ecSAndrew Rist * with the License. You may obtain a copy of the License at
10*5900e8ecSAndrew Rist *
11*5900e8ecSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*5900e8ecSAndrew Rist *
13*5900e8ecSAndrew Rist * Unless required by applicable law or agreed to in writing,
14*5900e8ecSAndrew Rist * software distributed under the License is distributed on an
15*5900e8ecSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5900e8ecSAndrew Rist * KIND, either express or implied. See the License for the
17*5900e8ecSAndrew Rist * specific language governing permissions and limitations
18*5900e8ecSAndrew Rist * under the License.
19*5900e8ecSAndrew Rist *
20*5900e8ecSAndrew Rist *************************************************************/
21*5900e8ecSAndrew Rist
22*5900e8ecSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir #include "sal/types.h"
27cdf0e10cSrcweir #include "rtl/ustring.hxx"
28cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
29cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
30cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
31cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
33cdf0e10cSrcweir #include <osl/diagnose.h>
34cdf0e10cSrcweir #include <uno/mapping.hxx>
35cdf0e10cSrcweir #include "provider.hxx"
36cdf0e10cSrcweir #include "renderer.hxx"
37cdf0e10cSrcweir #include "unowizard.hxx"
38cdf0e10cSrcweir
39cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
40cdf0e10cSrcweir #include "comphelper/servicedecl.hxx"
41cdf0e10cSrcweir
42cdf0e10cSrcweir #include "cppuhelper/implementationentry.hxx"
43cdf0e10cSrcweir
44cdf0e10cSrcweir using namespace ::com::sun::star::uno;
45cdf0e10cSrcweir using namespace ::com::sun::star::registry;
46cdf0e10cSrcweir using namespace ::com::sun::star::lang;
47cdf0e10cSrcweir using namespace unographic;
48cdf0e10cSrcweir
49cdf0e10cSrcweir using rtl::OUString;
50cdf0e10cSrcweir
51cdf0e10cSrcweir namespace sdecl = comphelper::service_decl;
52cdf0e10cSrcweir
53cdf0e10cSrcweir namespace unographic {
54cdf0e10cSrcweir extern sdecl::ServiceDecl const serviceDecl;
55cdf0e10cSrcweir }
56cdf0e10cSrcweir
57cdf0e10cSrcweir // -------------------------------------------------------------------------------------
58cdf0e10cSrcweir
59cdf0e10cSrcweir // for CreateInstance functions implemented elsewhere
60cdf0e10cSrcweir #define DECLARE_CREATEINSTANCE( ImplName ) \
61cdf0e10cSrcweir Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& );
62cdf0e10cSrcweir
63cdf0e10cSrcweir // for CreateInstance functions implemented elsewhere, while the function is within a namespace
64cdf0e10cSrcweir #define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \
65cdf0e10cSrcweir namespace nmspe { \
66cdf0e10cSrcweir Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \
67cdf0e10cSrcweir }
68cdf0e10cSrcweir
69cdf0e10cSrcweir namespace
70cdf0e10cSrcweir {
71cdf0e10cSrcweir static struct ::cppu::ImplementationEntry s_aServiceEntries[] =
72cdf0e10cSrcweir {
73cdf0e10cSrcweir {
74cdf0e10cSrcweir ::svt::uno::Wizard::Create,
75cdf0e10cSrcweir ::svt::uno::Wizard::getImplementationName_static,
76cdf0e10cSrcweir ::svt::uno::Wizard::getSupportedServiceNames_static,
77cdf0e10cSrcweir ::cppu::createSingleComponentFactory, NULL, 0
78cdf0e10cSrcweir },
79cdf0e10cSrcweir { 0, 0, 0, 0, 0, 0 }
80cdf0e10cSrcweir };
81cdf0e10cSrcweir }
82cdf0e10cSrcweir
83cdf0e10cSrcweir // -------------------------------------------------------------------------------------
84cdf0e10cSrcweir
DECLARE_CREATEINSTANCE_NAMESPACE(svt,OAddressBookSourceDialogUno)85cdf0e10cSrcweir DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno )
86cdf0e10cSrcweir DECLARE_CREATEINSTANCE( SvFilterOptionsDialog )
87cdf0e10cSrcweir DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicProvider )
88cdf0e10cSrcweir DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL )
89cdf0e10cSrcweir
90cdf0e10cSrcweir // -------------------------------------------------------------------------------------
91cdf0e10cSrcweir extern "C"
92cdf0e10cSrcweir {
93cdf0e10cSrcweir
94cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment (
95cdf0e10cSrcweir const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */)
96cdf0e10cSrcweir {
97cdf0e10cSrcweir *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
98cdf0e10cSrcweir }
99cdf0e10cSrcweir
100cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory (
101cdf0e10cSrcweir const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey)
102cdf0e10cSrcweir {
103cdf0e10cSrcweir void * pResult = 0;
104cdf0e10cSrcweir if ( _pServiceManager )
105cdf0e10cSrcweir {
106cdf0e10cSrcweir Reference< XSingleServiceFactory > xFactory;
107cdf0e10cSrcweir if (rtl_str_compare (
108cdf0e10cSrcweir pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir Sequence< OUString > aServiceNames(1);
111cdf0e10cSrcweir aServiceNames.getArray()[0] =
112cdf0e10cSrcweir OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" );
113cdf0e10cSrcweir
114cdf0e10cSrcweir xFactory = ::cppu::createSingleFactory (
115cdf0e10cSrcweir reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ),
116cdf0e10cSrcweir OUString::createFromAscii( pImplementationName ),
117cdf0e10cSrcweir svt::OAddressBookSourceDialogUno_CreateInstance,
118cdf0e10cSrcweir aServiceNames);
119cdf0e10cSrcweir }
120cdf0e10cSrcweir else if (rtl_str_compare (
121cdf0e10cSrcweir pImplementationName, "com.sun.star.svtools.SvFilterOptionsDialog") == 0)
122cdf0e10cSrcweir {
123cdf0e10cSrcweir Sequence< OUString > aServiceNames(1);
124cdf0e10cSrcweir aServiceNames.getArray()[0] =
125cdf0e10cSrcweir OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" );
126cdf0e10cSrcweir
127cdf0e10cSrcweir xFactory = ::cppu::createSingleFactory (
128cdf0e10cSrcweir reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ),
129cdf0e10cSrcweir OUString::createFromAscii( pImplementationName ),
130cdf0e10cSrcweir SvFilterOptionsDialog_CreateInstance,
131cdf0e10cSrcweir aServiceNames);
132cdf0e10cSrcweir }
133cdf0e10cSrcweir else if( 0 == GraphicProvider::getImplementationName_Static().compareToAscii( pImplementationName ) )
134cdf0e10cSrcweir {
135cdf0e10cSrcweir xFactory = ::cppu::createOneInstanceFactory(
136cdf0e10cSrcweir reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),
137cdf0e10cSrcweir GraphicProvider::getImplementationName_Static(),
138cdf0e10cSrcweir GraphicProvider_CreateInstance,
139cdf0e10cSrcweir GraphicProvider::getSupportedServiceNames_Static() );
140cdf0e10cSrcweir }
141cdf0e10cSrcweir else if( 0 == GraphicRendererVCL::getImplementationName_Static().compareToAscii( pImplementationName ) )
142cdf0e10cSrcweir {
143cdf0e10cSrcweir xFactory = ::cppu::createOneInstanceFactory(
144cdf0e10cSrcweir reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),
145cdf0e10cSrcweir GraphicRendererVCL::getImplementationName_Static(),
146cdf0e10cSrcweir GraphicRendererVCL_CreateInstance,
147cdf0e10cSrcweir GraphicRendererVCL::getSupportedServiceNames_Static() );
148cdf0e10cSrcweir }
149cdf0e10cSrcweir else
150cdf0e10cSrcweir {
151cdf0e10cSrcweir pResult = component_getFactoryHelper( pImplementationName, reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl );
152cdf0e10cSrcweir if ( !pResult )
153cdf0e10cSrcweir pResult = ::cppu::component_getFactoryHelper( pImplementationName, _pServiceManager, pRegistryKey, s_aServiceEntries );
154cdf0e10cSrcweir }
155cdf0e10cSrcweir
156cdf0e10cSrcweir if ( xFactory.is() )
157cdf0e10cSrcweir {
158cdf0e10cSrcweir xFactory->acquire();
159cdf0e10cSrcweir pResult = xFactory.get();
160cdf0e10cSrcweir }
161cdf0e10cSrcweir }
162cdf0e10cSrcweir return pResult;
163cdf0e10cSrcweir }
164cdf0e10cSrcweir
165cdf0e10cSrcweir } // "C"
166cdf0e10cSrcweir
167