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