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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_dtrans.hxx"
26
27
28 #include <cppuhelper/factory.hxx>
29 #include <clipboardmanager.hxx>
30 #include <generic_clipboard.hxx>
31
32 using namespace com::sun::star::lang;
33 using namespace com::sun::star::registry;
34 using namespace com::sun::star::uno;
35 using namespace cppu;
36 using namespace rtl;
37
38 extern "C"
39 {
40
41 //==================================================================================================
42
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)43 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,
44 uno_Environment ** /*ppEnv*/ )
45 {
46 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
47 }
48
49 //==================================================================================================
50
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)51 SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
52 const sal_Char * pImplName,
53 void * pServiceManager,
54 void * /*pRegistryKey*/
55 )
56 {
57 void * pRet = 0;
58
59 if (pServiceManager)
60 {
61 Reference< XSingleServiceFactory > xFactory;
62
63 if (rtl_str_compare( pImplName, CLIPBOARDMANAGER_IMPLEMENTATION_NAME ) == 0)
64 {
65 xFactory = createOneInstanceFactory(
66 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
67 OUString::createFromAscii( pImplName ),
68 ClipboardManager_createInstance,
69 ClipboardManager_getSupportedServiceNames() );
70 }
71 else if (rtl_str_compare( pImplName, GENERIC_CLIPBOARD_IMPLEMENTATION_NAME ) == 0)
72 {
73 xFactory = createSingleFactory(
74 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
75 OUString::createFromAscii( pImplName ),
76 GenericClipboard_createInstance,
77 GenericClipboard_getSupportedServiceNames() );
78 }
79
80 if (xFactory.is())
81 {
82 xFactory->acquire();
83 pRet = xFactory.get();
84 }
85 }
86
87 return pRet;
88 }
89
90 }
91