1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_svtools.hxx" 30*cdf0e10cSrcweir #include "sal/types.h" 31*cdf0e10cSrcweir #include "rtl/ustring.hxx" 32*cdf0e10cSrcweir #include <cppuhelper/factory.hxx> 33*cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 34*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 36*cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp> 37*cdf0e10cSrcweir #include <osl/diagnose.h> 38*cdf0e10cSrcweir #include <uno/mapping.hxx> 39*cdf0e10cSrcweir #include "provider.hxx" 40*cdf0e10cSrcweir #include "renderer.hxx" 41*cdf0e10cSrcweir #include "unowizard.hxx" 42*cdf0e10cSrcweir 43*cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp> 44*cdf0e10cSrcweir #include "comphelper/servicedecl.hxx" 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir #include "cppuhelper/implementationentry.hxx" 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir using namespace ::com::sun::star::uno; 49*cdf0e10cSrcweir using namespace ::com::sun::star::registry; 50*cdf0e10cSrcweir using namespace ::com::sun::star::lang; 51*cdf0e10cSrcweir using namespace unographic; 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir using rtl::OUString; 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir namespace sdecl = comphelper::service_decl; 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir namespace unographic { 58*cdf0e10cSrcweir extern sdecl::ServiceDecl const serviceDecl; 59*cdf0e10cSrcweir } 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir // ------------------------------------------------------------------------------------- 62*cdf0e10cSrcweir 63*cdf0e10cSrcweir // for CreateInstance functions implemented elsewhere 64*cdf0e10cSrcweir #define DECLARE_CREATEINSTANCE( ImplName ) \ 65*cdf0e10cSrcweir Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir // for CreateInstance functions implemented elsewhere, while the function is within a namespace 68*cdf0e10cSrcweir #define DECLARE_CREATEINSTANCE_NAMESPACE( nmspe, ImplName ) \ 69*cdf0e10cSrcweir namespace nmspe { \ 70*cdf0e10cSrcweir Reference< XInterface > SAL_CALL ImplName##_CreateInstance( const Reference< XMultiServiceFactory >& ); \ 71*cdf0e10cSrcweir } 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir namespace 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir static struct ::cppu::ImplementationEntry s_aServiceEntries[] = 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir { 78*cdf0e10cSrcweir ::svt::uno::Wizard::Create, 79*cdf0e10cSrcweir ::svt::uno::Wizard::getImplementationName_static, 80*cdf0e10cSrcweir ::svt::uno::Wizard::getSupportedServiceNames_static, 81*cdf0e10cSrcweir ::cppu::createSingleComponentFactory, NULL, 0 82*cdf0e10cSrcweir }, 83*cdf0e10cSrcweir { 0, 0, 0, 0, 0, 0 } 84*cdf0e10cSrcweir }; 85*cdf0e10cSrcweir } 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir // ------------------------------------------------------------------------------------- 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir DECLARE_CREATEINSTANCE_NAMESPACE( svt, OAddressBookSourceDialogUno ) 90*cdf0e10cSrcweir DECLARE_CREATEINSTANCE( SvFilterOptionsDialog ) 91*cdf0e10cSrcweir DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicProvider ) 92*cdf0e10cSrcweir DECLARE_CREATEINSTANCE_NAMESPACE( unographic, GraphicRendererVCL ) 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir // ------------------------------------------------------------------------------------- 95*cdf0e10cSrcweir extern "C" 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment ( 99*cdf0e10cSrcweir const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */) 100*cdf0e10cSrcweir { 101*cdf0e10cSrcweir *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir 104*cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory ( 105*cdf0e10cSrcweir const sal_Char * pImplementationName, void * _pServiceManager, void * pRegistryKey) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir void * pResult = 0; 108*cdf0e10cSrcweir if ( _pServiceManager ) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir Reference< XSingleServiceFactory > xFactory; 111*cdf0e10cSrcweir if (rtl_str_compare ( 112*cdf0e10cSrcweir pImplementationName, "com.sun.star.comp.svtools.OAddressBookSourceDialogUno") == 0) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir Sequence< OUString > aServiceNames(1); 115*cdf0e10cSrcweir aServiceNames.getArray()[0] = 116*cdf0e10cSrcweir OUString::createFromAscii( "com.sun.star.ui.AddressBookSourceDialog" ); 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir xFactory = ::cppu::createSingleFactory ( 119*cdf0e10cSrcweir reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), 120*cdf0e10cSrcweir OUString::createFromAscii( pImplementationName ), 121*cdf0e10cSrcweir svt::OAddressBookSourceDialogUno_CreateInstance, 122*cdf0e10cSrcweir aServiceNames); 123*cdf0e10cSrcweir } 124*cdf0e10cSrcweir else if (rtl_str_compare ( 125*cdf0e10cSrcweir pImplementationName, "com.sun.star.svtools.SvFilterOptionsDialog") == 0) 126*cdf0e10cSrcweir { 127*cdf0e10cSrcweir Sequence< OUString > aServiceNames(1); 128*cdf0e10cSrcweir aServiceNames.getArray()[0] = 129*cdf0e10cSrcweir OUString::createFromAscii( "com.sun.star.ui.dialogs.FilterOptionsDialog" ); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir xFactory = ::cppu::createSingleFactory ( 132*cdf0e10cSrcweir reinterpret_cast< XMultiServiceFactory* >( _pServiceManager ), 133*cdf0e10cSrcweir OUString::createFromAscii( pImplementationName ), 134*cdf0e10cSrcweir SvFilterOptionsDialog_CreateInstance, 135*cdf0e10cSrcweir aServiceNames); 136*cdf0e10cSrcweir } 137*cdf0e10cSrcweir else if( 0 == GraphicProvider::getImplementationName_Static().compareToAscii( pImplementationName ) ) 138*cdf0e10cSrcweir { 139*cdf0e10cSrcweir xFactory = ::cppu::createOneInstanceFactory( 140*cdf0e10cSrcweir reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ), 141*cdf0e10cSrcweir GraphicProvider::getImplementationName_Static(), 142*cdf0e10cSrcweir GraphicProvider_CreateInstance, 143*cdf0e10cSrcweir GraphicProvider::getSupportedServiceNames_Static() ); 144*cdf0e10cSrcweir } 145*cdf0e10cSrcweir else if( 0 == GraphicRendererVCL::getImplementationName_Static().compareToAscii( pImplementationName ) ) 146*cdf0e10cSrcweir { 147*cdf0e10cSrcweir xFactory = ::cppu::createOneInstanceFactory( 148*cdf0e10cSrcweir reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ), 149*cdf0e10cSrcweir GraphicRendererVCL::getImplementationName_Static(), 150*cdf0e10cSrcweir GraphicRendererVCL_CreateInstance, 151*cdf0e10cSrcweir GraphicRendererVCL::getSupportedServiceNames_Static() ); 152*cdf0e10cSrcweir } 153*cdf0e10cSrcweir else 154*cdf0e10cSrcweir { 155*cdf0e10cSrcweir pResult = component_getFactoryHelper( pImplementationName, reinterpret_cast< lang::XMultiServiceFactory * >( _pServiceManager ),reinterpret_cast< registry::XRegistryKey* >( pRegistryKey ), serviceDecl ); 156*cdf0e10cSrcweir if ( !pResult ) 157*cdf0e10cSrcweir pResult = ::cppu::component_getFactoryHelper( pImplementationName, _pServiceManager, pRegistryKey, s_aServiceEntries ); 158*cdf0e10cSrcweir } 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir if ( xFactory.is() ) 161*cdf0e10cSrcweir { 162*cdf0e10cSrcweir xFactory->acquire(); 163*cdf0e10cSrcweir pResult = xFactory.get(); 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir } 166*cdf0e10cSrcweir return pResult; 167*cdf0e10cSrcweir } 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir } // "C" 170*cdf0e10cSrcweir 171