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: Os2Service.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 #include "Os2Clipboard.hxx"
32 #include <cppuhelper/factory.hxx>
33 #include <com/sun/star/container/XSet.hpp>
34 #include <osl/diagnose.h>
37 using namespace com::sun::star::uno
;
38 using namespace com::sun::star::registry
;
40 using namespace com::sun::star::lang
;
41 using namespace com::sun::star::datatransfer::clipboard
;
46 Reference
< XInterface
> SAL_CALL
createInstance( const Reference
< XMultiServiceFactory
>& rServiceManager
)
48 return Reference
< XInterface
>( static_cast< XClipboard
* >( new Os2Clipboard() ) );
56 void SAL_CALL
component_getImplementationEnvironment(
57 const sal_Char
** ppEnvTypeName
, uno_Environment
** ppEnv
)
59 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
62 sal_Bool SAL_CALL
component_writeInfo( void* pServiceManager
, void* pRegistryKey
)
64 sal_Bool bRetVal
= sal_False
;
70 Reference
< XRegistryKey
> pXNewKey( static_cast< XRegistryKey
* >( pRegistryKey
) );
71 pXNewKey
->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( OS2_CLIPBOARD_REGKEY_NAME
) ) );
74 catch( InvalidRegistryException
& )
76 OSL_ENSURE(sal_False
, "InvalidRegistryException caught");
84 void* SAL_CALL
component_getFactory( const sal_Char
* pImplName
, uno_Interface
* pSrvManager
, uno_Interface
* pRegistryKey
)
88 if ( pSrvManager
&& ( 0 == rtl_str_compare( pImplName
, OS2_CLIPBOARD_IMPL_NAME
) ) )
90 Sequence
< OUString
> aSNS( 1 );
91 aSNS
.getArray()[0] = OUString( RTL_CONSTASCII_USTRINGPARAM( OS2_CLIPBOARD_SERVICE_NAME
) );
93 //OUString( RTL_CONSTASCII_USTRINGPARAM( FPS_IMPL_NAME ) )
94 Reference
< XSingleServiceFactory
> xFactory ( createOneInstanceFactory(
95 reinterpret_cast< XMultiServiceFactory
* > ( pSrvManager
),
96 OUString::createFromAscii( pImplName
),
102 pRet
= xFactory
.get();