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: filterenv.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 ************************************************************************/
30 // MARKER(update_precomp.py): autogen include statement, do not remove
31 #include "precompiled_filter.hxx"
33 #include <osl/mutex.hxx>
34 #include <osl/thread.h>
35 #include <cppuhelper/factory.hxx>
37 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
39 #include "t602filter.hxx"
41 using namespace ::rtl
;
42 using namespace ::cppu
;
43 using namespace ::com::sun::star::uno
;
44 using namespace ::com::sun::star::lang
;
45 using namespace ::com::sun::star::registry
;
47 using namespace T602ImportFilter
;
51 //==================================================================================================
52 void SAL_CALL
component_getImplementationEnvironment(
53 const sal_Char
** ppEnvTypeName
, uno_Environment
** /* ppEnv */ )
55 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
57 //==================================================================================================
58 sal_Bool SAL_CALL
component_writeInfo(
59 void * /* pServiceManager */, void * pRegistryKey
)
66 Reference
< XRegistryKey
> xNewKey(
67 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( T602ImportFilter_getImplementationName() ) );
68 xNewKey
= xNewKey
->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
70 const Sequence
< OUString
> & rSNL
= T602ImportFilter_getSupportedServiceNames();
71 const OUString
* pArray
= rSNL
.getConstArray();
72 for ( nPos
= rSNL
.getLength(); nPos
--; )
73 xNewKey
->createKey( pArray
[nPos
] );
75 xNewKey
= reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( T602ImportFilterDialog_getImplementationName() );
76 xNewKey
= xNewKey
->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
78 const Sequence
< OUString
> & rSNL2
= T602ImportFilterDialog_getSupportedServiceNames();
79 pArray
= rSNL2
.getConstArray();
80 for ( nPos
= rSNL2
.getLength(); nPos
--; )
81 xNewKey
->createKey( pArray
[nPos
] );
85 catch (InvalidRegistryException
&)
87 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
92 //==================================================================================================
93 void * SAL_CALL
component_getFactory(
94 const sal_Char
* pImplName
, void * pServiceManager
, void * /* pRegistryKey */ )
98 OUString implName
= OUString::createFromAscii( pImplName
);
99 if ( pServiceManager
&& implName
.equals(T602ImportFilter_getImplementationName()) )
101 Reference
< XSingleServiceFactory
> xFactory( createSingleFactory(
102 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
103 OUString::createFromAscii( pImplName
),
104 T602ImportFilter_createInstance
, T602ImportFilter_getSupportedServiceNames() ) );
109 pRet
= xFactory
.get();
112 else if ( pServiceManager
&& implName
.equals(T602ImportFilterDialog_getImplementationName()) )
114 Reference
< XSingleServiceFactory
> xFactory( createSingleFactory(
115 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
116 OUString::createFromAscii( pImplName
),
117 T602ImportFilterDialog_createInstance
, T602ImportFilterDialog_getSupportedServiceNames() ) );
122 pRet
= xFactory
.get();