exports.cxx (cdf0e10c) | exports.cxx (cb2654af) |
---|---|
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 * --- 11 unchanged lines hidden (view full) --- 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 | 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 * --- 11 unchanged lines hidden (view full) --- 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 29#include <stdio.h> 30 31#include <osl/mutex.hxx> 32#include <osl/thread.h> | |
33#include <cppuhelper/factory.hxx> | 28#include <cppuhelper/factory.hxx> |
34#include <rtl/ustring.hxx> 35#include <rtl/ustrbuf.hxx> 36#include <sal/types.h> 37#include <com/sun/star/lang/XSingleServiceFactory.hpp> | |
38 39#include "MyProtocolHandler.h" 40#include "MyListener.h" 41 42namespace css = ::com::sun::star; 43 | 29 30#include "MyProtocolHandler.h" 31#include "MyListener.h" 32 33namespace css = ::com::sun::star; 34 |
44// static void writeInfo(const css::uno::Reference< css::registry::XRegistryKey >& xRegistryKey , 45// const char* pImplementationName, 46// const char* pServiceName ) 47// { 48// ::rtl::OUStringBuffer sKey(256); 49// sKey.append (::rtl::OUString::createFromAscii(pImplementationName)); 50// sKey.appendAscii("/UNO/SERVICES/"); 51// sKey.append (::rtl::OUString::createFromAscii(pServiceName)); | 35#if 0 36static void writeInfo(const css::uno::Reference< css::registry::XRegistryKey >& xRegistryKey , 37 const char* pImplementationName, 38 const char* pServiceName ) 39{ 40 ::rtl::OUStringBuffer sKey(256); 41 sKey.append (::rtl::OUString::createFromAscii(pImplementationName)); 42 sKey.appendAscii("/UNO/SERVICES/"); 43 sKey.append (::rtl::OUString::createFromAscii(pServiceName)); |
52 | 44 |
53// xRegistryKey->createKey(sKey.makeStringAndClear()); 54// } | 45 xRegistryKey->createKey(sKey.makeStringAndClear()); 46} 47#endif |
55 56extern "C" 57{ 58//================================================================================================== 59SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvTypeName, 60 uno_Environment** ppEnv ) 61{ 62 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 63} 64 | 48 49extern "C" 50{ 51//================================================================================================== 52SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char** ppEnvTypeName, 53 uno_Environment** ppEnv ) 54{ 55 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 56} 57 |
65// This method not longer necessary since OOo 3.4 where the component registration was 66// was changed to passive component registration. For more details see 67// http://wiki.services.openoffice.org/wiki/Passive_Component_Registration | 58#if 0 59/** 60 * This method not longer necessary since OOo 3.4 where the component registration was 61 * was changed to passive component registration. For more details see 62 * http://wiki.services.openoffice.org/wiki/Passive_Component_Registration 63 */ |
68//================================================================================================== | 64//================================================================================================== |
69// SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, 70// void* pRegistryKey ) 71// { 72// if (!pRegistryKey) 73// return sal_False; | 65SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(void* pServiceManager, 66 void* pRegistryKey ) 67{ 68 if (!pRegistryKey) 69 return sal_False; |
74 | 70 |
75// try 76// { 77// css::uno::Reference< css::registry::XRegistryKey > xKey(reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey), css::uno::UNO_QUERY); | 71 try 72 { 73 css::uno::Reference< css::registry::XRegistryKey > xKey(reinterpret_cast< css::registry::XRegistryKey* >(pRegistryKey), css::uno::UNO_QUERY); |
78 | 74 |
79// writeInfo( xKey, MYLISTENER_IMPLEMENTATIONNAME , MYLISTENER_SERVICENAME ); 80// writeInfo( xKey, MYPROTOCOLHANDLER_IMPLEMENTATIONNAME, MYPROTOCOLHANDLER_SERVICENAME ); | 75 writeInfo( xKey, MYLISTENER_IMPLEMENTATIONNAME , MYLISTENER_SERVICENAME ); 76 writeInfo( xKey, MYPROTOCOLHANDLER_IMPLEMENTATIONNAME, MYPROTOCOLHANDLER_SERVICENAME ); |
81 | 77 |
82// return sal_True; 83// } 84// catch(const css::registry::InvalidRegistryException&) 85// { OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); } | 78 return sal_True; 79 } 80 catch(const css::registry::InvalidRegistryException&) 81 { OSL_ENSURE( sal_False, "### InvalidRegistryException!" ); } |
86 | 82 |
87// return sal_False; 88// } | 83 return sal_False; 84} 85#endif |
89 90//================================================================================================== 91SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName , 92 void* pServiceManager, 93 void* pRegistryKey ) 94{ 95 if ( !pServiceManager || !pImplName ) 96 return 0; 97 98 css::uno::Reference< css::lang::XSingleServiceFactory > xFactory ; 99 css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR (reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager), css::uno::UNO_QUERY); 100 ::rtl::OUString sImplName = ::rtl::OUString::createFromAscii(pImplName); 101 | 86 87//================================================================================================== 88SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(const sal_Char* pImplName , 89 void* pServiceManager, 90 void* pRegistryKey ) 91{ 92 if ( !pServiceManager || !pImplName ) 93 return 0; 94 95 css::uno::Reference< css::lang::XSingleServiceFactory > xFactory ; 96 css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR (reinterpret_cast< css::lang::XMultiServiceFactory* >(pServiceManager), css::uno::UNO_QUERY); 97 ::rtl::OUString sImplName = ::rtl::OUString::createFromAscii(pImplName); 98 |
102 if (sImplName.equalsAscii(MYLISTENER_IMPLEMENTATIONNAME)) | 99 if (sImplName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MYLISTENER_IMPLEMENTATIONNAME ) ) ) |
103 { 104 css::uno::Sequence< ::rtl::OUString > lNames(1); | 100 { 101 css::uno::Sequence< ::rtl::OUString > lNames(1); |
105 lNames[0] = ::rtl::OUString::createFromAscii(MYLISTENER_IMPLEMENTATIONNAME); | 102 lNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MYLISTENER_IMPLEMENTATIONNAME ) ); |
106 xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyListener::st_createInstance, lNames); 107 } 108 else | 103 xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyListener::st_createInstance, lNames); 104 } 105 else |
109 if (sImplName.equalsAscii(MYPROTOCOLHANDLER_IMPLEMENTATIONNAME)) | 106 if (sImplName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( MYPROTOCOLHANDLER_IMPLEMENTATIONNAME ) ) ) |
110 { 111 css::uno::Sequence< ::rtl::OUString > lNames(1); | 107 { 108 css::uno::Sequence< ::rtl::OUString > lNames(1); |
112 lNames[0] = ::rtl::OUString::createFromAscii(MYPROTOCOLHANDLER_SERVICENAME); | 109 lNames[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( MYPROTOCOLHANDLER_SERVICENAME ) ); |
113 xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyProtocolHandler_createInstance, lNames); 114 } 115 116 if (!xFactory.is()) 117 return 0; 118 119 xFactory->acquire(); 120 return xFactory.get(); 121} 122 123} // extern C | 110 xFactory = ::cppu::createSingleFactory(xSMGR, sImplName, MyProtocolHandler_createInstance, lNames); 111 } 112 113 if (!xFactory.is()) 114 return 0; 115 116 xFactory->acquire(); 117 return xFactory.get(); 118} 119 120} // extern C |