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 #if defined(_MSC_VER) && (_MSC_VER > 1310) 28 #pragma warning(disable : 4917 4555) 29 #endif 30 31 #ifdef __MINGW32__ 32 #define INITGUID 33 #endif 34 #include "servprov.hxx" 35 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 36 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 37 #include <com/sun/star/registry/XRegistryKey.hpp> 38 #include <com/sun/star/registry/InvalidRegistryException.hpp> 39 #include <rtl/ustring.h> 40 #include <cppuhelper/factory.hxx> 41 42 43 using namespace ::com::sun::star; 44 45 46 uno::Reference<uno::XInterface> SAL_CALL EmbedServer_createInstance( 47 const uno::Reference<lang::XMultiServiceFactory> & xSMgr) 48 throw (uno::Exception) 49 { 50 uno::Reference<uno::XInterface > xService = *new EmbedServer_Impl( xSMgr ); 51 return xService; 52 } 53 54 ::rtl::OUString SAL_CALL EmbedServer_getImplementationName() throw() 55 { 56 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.EmbedServer") ); 57 58 } 59 60 uno::Sequence< ::rtl::OUString > SAL_CALL EmbedServer_getSupportedServiceNames() throw() 61 { 62 uno::Sequence< ::rtl::OUString > aServiceNames( 1 ); 63 aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.OleEmbeddedServerRegistration" ) ); 64 return aServiceNames; 65 } 66 67 extern "C" { 68 69 void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) 70 { 71 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 72 } 73 74 void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) 75 { 76 void * pRet = 0; 77 78 ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) ); 79 uno::Reference< lang::XSingleServiceFactory > xFactory; 80 81 if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) ) 82 { 83 xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>(pServiceManager), 84 EmbedServer_getImplementationName(), 85 EmbedServer_createInstance, 86 EmbedServer_getSupportedServiceNames() ); 87 } 88 89 if (xFactory.is()) 90 { 91 xFactory->acquire(); 92 pRet = xFactory.get(); 93 } 94 95 return pRet; 96 } 97 98 } // extern "C" 99 100 // Fix strange warnings about some 101 // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. 102 // warning C4505: 'xxx' : unreferenced local function has been removed 103 #if defined(_MSC_VER) 104 #pragma warning(disable: 4505) 105 #endif 106