1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dtrans.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_dtrans.hxx"
35 #include <cppuhelper/factory.hxx>
36 #include <clipboardmanager.hxx>
37 #include <generic_clipboard.hxx>
39 using namespace com::sun::star::lang
;
40 using namespace com::sun::star::registry
;
41 using namespace com::sun::star::uno
;
48 //==================================================================================================
50 void SAL_CALL
component_getImplementationEnvironment(const sal_Char
** ppEnvTypeName
,
51 uno_Environment
** /*ppEnv*/ )
53 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
56 //==================================================================================================
58 sal_Bool SAL_CALL
component_writeInfo(void * /*pServiceManager*/, void * pRegistryKey
)
64 Reference
< XRegistryKey
> xNewKey(
65 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey(
66 OUString::createFromAscii("/" CLIPBOARDMANAGER_IMPLEMENTATION_NAME
"/UNO/SERVICES" ) ) );
68 const Sequence
< OUString
> & rSNL
= ClipboardManager_getSupportedServiceNames();
69 const OUString
* pArray
= rSNL
.getConstArray();
71 for ( nPos
= rSNL
.getLength(); nPos
--; )
72 xNewKey
->createKey( pArray
[nPos
] );
74 xNewKey
= reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey(
75 OUString::createFromAscii("/" GENERIC_CLIPBOARD_IMPLEMENTATION_NAME
"/UNO/SERVICES" ) );
77 const Sequence
< OUString
> & rSNL2
= GenericClipboard_getSupportedServiceNames();
78 pArray
= rSNL2
.getConstArray();
79 for ( nPos
= rSNL2
.getLength(); nPos
--; )
80 xNewKey
->createKey( pArray
[nPos
] );
84 catch (InvalidRegistryException
&)
86 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
93 //==================================================================================================
95 void * SAL_CALL
component_getFactory(
96 const sal_Char
* pImplName
,
97 void * pServiceManager
,
98 void * /*pRegistryKey*/
105 Reference
< XSingleServiceFactory
> xFactory
;
107 if (rtl_str_compare( pImplName
, CLIPBOARDMANAGER_IMPLEMENTATION_NAME
) == 0)
109 xFactory
= createOneInstanceFactory(
110 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
111 OUString::createFromAscii( pImplName
),
112 ClipboardManager_createInstance
,
113 ClipboardManager_getSupportedServiceNames() );
115 else if (rtl_str_compare( pImplName
, GENERIC_CLIPBOARD_IMPLEMENTATION_NAME
) == 0)
117 xFactory
= createSingleFactory(
118 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
119 OUString::createFromAscii( pImplName
),
120 GenericClipboard_createInstance
,
121 GenericClipboard_getSupportedServiceNames() );
127 pRet
= xFactory
.get();