1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_desktop.hxx" 30 #include <com/sun/star/beans/NamedValue.hpp> 31 #include <com/sun/star/registry/XRegistryKey.hpp> 32 #include <com/sun/star/util/Date.hpp> 33 #include <uno/environment.h> 34 #include <cppuhelper/factory.hxx> 35 #include <unotools/configmgr.hxx> 36 37 #include "splash.hxx" 38 #include "firststart.hxx" 39 40 41 using namespace rtl; 42 using namespace ::com::sun::star::uno; 43 using namespace ::com::sun::star::lang; 44 using namespace ::com::sun::star::beans; 45 using namespace ::com::sun::star::registry; 46 using namespace ::desktop; 47 48 static const char* pServices[] = 49 { 50 SplashScreen::serviceName, 51 FirstStart::serviceName, 52 NULL 53 }; 54 55 static const char* pImplementations[] = 56 { 57 SplashScreen::implementationName, 58 FirstStart::implementationName, 59 NULL 60 }; 61 62 typedef Reference<XInterface>(* fProvider)(const Reference<XMultiServiceFactory>&); 63 64 static const fProvider pInstanceProviders[] = 65 { 66 SplashScreen::getInstance, 67 FirstStart::CreateInstance, 68 NULL 69 }; 70 71 72 static const char** pSupportedServices[] = 73 { 74 SplashScreen::interfaces, 75 FirstStart::interfaces, 76 NULL 77 }; 78 79 static Sequence<OUString> 80 getSupportedServiceNames(int p) { 81 const char **names = pSupportedServices[p]; 82 Sequence<OUString> aSeq; 83 for(int i = 0; names[i] != NULL; i++) { 84 aSeq.realloc(i+1); 85 aSeq[i] = OUString::createFromAscii(names[i]); 86 } 87 return aSeq; 88 } 89 90 extern "C" 91 { 92 void SAL_CALL 93 component_getImplementationEnvironment( 94 const sal_Char** ppEnvironmentTypeName, 95 uno_Environment**) 96 { 97 *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; 98 } 99 100 void* SAL_CALL 101 component_getFactory( 102 const sal_Char* pImplementationName, 103 void* pServiceManager, 104 void*) 105 { 106 // Set default return value for this operation - if it failed. 107 if ( pImplementationName && pServiceManager ) 108 { 109 Reference< XSingleServiceFactory > xFactory; 110 Reference< XMultiServiceFactory > xServiceManager( 111 reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ; 112 113 // search implementation 114 for (int i = 0; (pImplementations[i]!=NULL); i++) { 115 if ( strcmp(pImplementations[i], pImplementationName ) == 0 ) { 116 // found implementation 117 xFactory = Reference<XSingleServiceFactory>(cppu::createSingleFactory( 118 xServiceManager, OUString::createFromAscii(pImplementationName), 119 pInstanceProviders[i], getSupportedServiceNames(i))); 120 if ( xFactory.is() ) { 121 // Factory is valid - service was found. 122 xFactory->acquire(); 123 return xFactory.get(); 124 } 125 } 126 } // for() 127 } 128 // Return with result of this operation. 129 return NULL; 130 } 131 } // extern "C" 132