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 #include <com/sun/star/registry/XRegistryKey.hpp> 29 #include <cppu/macros.hxx> 30 #include <cppuhelper/factory.hxx> 31 #include <rtl/ustring.hxx> 32 #include <sal/types.h> 33 #include <uno/environment.h> 34 35 #include "interactionhandler.hxx" 36 #include "requeststringresolver.hxx" 37 #include "passwordcontainer.hxx" 38 39 using namespace rtl; 40 using namespace com::sun::star::uno; 41 using namespace com::sun::star::lang; 42 using namespace com::sun::star::registry; 43 44 //============================================================================ 45 // 46 // component_getImplementationEnvironment 47 // 48 //============================================================================ 49 50 extern "C" void SAL_CALL 51 component_getImplementationEnvironment(sal_Char const ** pEnvTypeName, 52 uno_Environment **) 53 { 54 *pEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 55 } 56 57 //============================================================================ 58 // 59 // component_getFactory 60 // 61 //============================================================================ 62 63 extern "C" void * SAL_CALL component_getFactory(sal_Char const * pImplName, 64 void * pServiceManager, 65 void *) 66 { 67 if (!pImplName) 68 return 0; 69 70 void * pRet = 0; 71 72 Reference< XMultiServiceFactory > xSMgr( 73 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) ); 74 Reference< XSingleServiceFactory > xFactory; 75 76 ////////////////////////////////////////////////////////////////////// 77 // UUI Interaction Handler. 78 ////////////////////////////////////////////////////////////////////// 79 80 if ( rtl_str_compare(pImplName, 81 UUIInteractionHandler::m_aImplementationName) 82 == 0) 83 { 84 xFactory = 85 cppu::createSingleFactory( 86 static_cast< XMultiServiceFactory * >(pServiceManager), 87 OUString::createFromAscii( 88 UUIInteractionHandler::m_aImplementationName), 89 &UUIInteractionHandler::createInstance, 90 UUIInteractionHandler::getSupportedServiceNames_static()); 91 } 92 93 ////////////////////////////////////////////////////////////////////// 94 // UUI Interaction Request String Resolver. 95 ////////////////////////////////////////////////////////////////////// 96 97 else if ( rtl_str_compare(pImplName, 98 UUIInteractionRequestStringResolver::m_aImplementationName) 99 == 0) 100 { 101 xFactory = 102 cppu::createSingleFactory( 103 static_cast< XMultiServiceFactory * >(pServiceManager), 104 OUString::createFromAscii( 105 UUIInteractionRequestStringResolver::m_aImplementationName), 106 &UUIInteractionRequestStringResolver::createInstance, 107 UUIInteractionRequestStringResolver::getSupportedServiceNames_static()); 108 } 109 110 ////////////////////////////////////////////////////////////////////// 111 // UUI Password Container Interaction Handler. 112 ////////////////////////////////////////////////////////////////////// 113 114 else if ( uui::PasswordContainerInteractionHandler::getImplementationName_Static(). 115 compareToAscii( pImplName ) == 0 ) 116 { 117 xFactory = 118 uui::PasswordContainerInteractionHandler::createServiceFactory( xSMgr ); 119 } 120 121 ////////////////////////////////////////////////////////////////////// 122 123 if ( xFactory.is() ) 124 { 125 xFactory->acquire(); 126 pRet = xFactory.get(); 127 } 128 129 return pRet; 130 } 131