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