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 24 #include "Os2Clipboard.hxx" 25 #include <cppuhelper/factory.hxx> 26 #include <com/sun/star/container/XSet.hpp> 27 #include <osl/diagnose.h> 28 29 using namespace rtl; 30 using namespace com::sun::star::uno; 31 using namespace com::sun::star::registry; 32 using namespace cppu; 33 using namespace com::sun::star::lang; 34 using namespace com::sun::star::datatransfer::clipboard; 35 using namespace os2; 36 37 namespace os2 { 38 39 Reference< XInterface > SAL_CALL createInstance( const Reference< XMultiServiceFactory >& rServiceManager ) 40 { 41 return Reference< XInterface >( static_cast< XClipboard* >( new Os2Clipboard() ) ); 42 } 43 44 } // namespace os2 45 46 extern "C" 47 { 48 49 void SAL_CALL component_getImplementationEnvironment( 50 const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv ) 51 { 52 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 53 } 54 55 void* SAL_CALL component_getFactory( const sal_Char* pImplName, uno_Interface* pSrvManager, uno_Interface* pRegistryKey ) 56 { 57 void* pRet = 0; 58 59 if ( pSrvManager && ( 0 == rtl_str_compare( pImplName, OS2_CLIPBOARD_IMPL_NAME ) ) ) 60 { 61 Sequence< OUString > aSNS( 1 ); 62 aSNS.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( OS2_CLIPBOARD_SERVICE_NAME ) ); 63 64 //OUString( RTL_CONSTASCII_USTRINGPARAM( FPS_IMPL_NAME ) ) 65 Reference< XSingleServiceFactory > xFactory ( createOneInstanceFactory( 66 reinterpret_cast< XMultiServiceFactory* > ( pSrvManager ), 67 OUString::createFromAscii( pImplName ), 68 createInstance, 69 aSNS ) ); 70 if ( xFactory.is() ) 71 { 72 xFactory->acquire(); 73 pRet = xFactory.get(); 74 } 75 } 76 77 return pRet; 78 } 79 80 } // extern "C" 81