1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #if defined(_MSC_VER) && (_MSC_VER > 1310) 24 #pragma warning(disable : 4917 4555) 25 #endif 26 27 #ifdef __MINGW32__ 28 #define INITGUID 29 #endif 30 #include "servprov.hxx" 31 #include <com/sun/star/lang/XSingleServiceFactory.hpp> 32 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 33 #include <com/sun/star/registry/XRegistryKey.hpp> 34 #include <com/sun/star/registry/InvalidRegistryException.hpp> 35 #include <rtl/ustring.h> 36 #include <cppuhelper/factory.hxx> 37 38 39 using namespace ::com::sun::star; 40 41 42 uno::Reference<uno::XInterface> SAL_CALL EmbedServer_createInstance( 43 const uno::Reference<lang::XMultiServiceFactory> & xSMgr) 44 { 45 uno::Reference<uno::XInterface > xService = *new EmbedServer_Impl( xSMgr ); 46 return xService; 47 } 48 49 ::rtl::OUString SAL_CALL EmbedServer_getImplementationName() throw() 50 { 51 return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.ole.EmbedServer") ); 52 53 } 54 55 uno::Sequence< ::rtl::OUString > SAL_CALL EmbedServer_getSupportedServiceNames() throw() 56 { 57 uno::Sequence< ::rtl::OUString > aServiceNames( 1 ); 58 aServiceNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.OleEmbeddedServerRegistration" ) ); 59 return aServiceNames; 60 } 61 62 extern "C" { 63 64 void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) 65 { 66 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 67 } 68 69 void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) 70 { 71 void * pRet = 0; 72 73 ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) ); 74 uno::Reference< lang::XSingleServiceFactory > xFactory; 75 76 if(pServiceManager && aImplName.equals( EmbedServer_getImplementationName() ) ) 77 { 78 xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>(pServiceManager), 79 EmbedServer_getImplementationName(), 80 EmbedServer_createInstance, 81 EmbedServer_getSupportedServiceNames() ); 82 } 83 84 if (xFactory.is()) 85 { 86 xFactory->acquire(); 87 pRet = xFactory.get(); 88 } 89 90 return pRet; 91 } 92 93 } // extern "C" 94 95 // Fix strange warnings about some 96 // ATL::CAxHostWindow::QueryInterface|AddRef|Releae functions. 97 // warning C4505: 'xxx' : unreferenced local function has been removed 98 #if defined(_MSC_VER) 99 #pragma warning(disable: 4505) 100 #endif 101