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