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: fdcomp.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_filter.hxx"
38 #include <osl/mutex.hxx>
40 #include <osl/thread.h>
42 #include <cppuhelper/factory.hxx>
46 #ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
48 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
54 #include "filterdetect.hxx"
58 using namespace ::rtl
;
60 using namespace ::cppu
;
62 using namespace ::com::sun::star::uno
;
64 using namespace ::com::sun::star::lang
;
66 using namespace ::com::sun::star::registry
;
74 //==================================================================================================
76 void SAL_CALL
component_getImplementationEnvironment(
78 const sal_Char
** ppEnvTypeName
, uno_Environment
** /* ppEnv */ )
82 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
86 //==================================================================================================
88 sal_Bool SAL_CALL
component_writeInfo(
90 void * /* pServiceManager */, void * pRegistryKey
)
102 Reference
< XRegistryKey
> xNewKey(
104 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( FilterDetect_getImplementationName() ) );
106 xNewKey
= xNewKey
->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
110 const Sequence
< OUString
> & rSNL
= FilterDetect_getSupportedServiceNames();
112 const OUString
* pArray
= rSNL
.getConstArray();
114 for ( sal_Int32 nPos
= rSNL
.getLength(); nPos
--; )
116 xNewKey
->createKey( pArray
[nPos
] );
124 catch (InvalidRegistryException
&)
128 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
138 //==================================================================================================
140 void * SAL_CALL
component_getFactory(
142 const sal_Char
* pImplName
, void * pServiceManager
, void * /* pRegistryKey */ )
150 OUString implName
= OUString::createFromAscii( pImplName
);
152 if ( pServiceManager
&& implName
.equals(FilterDetect_getImplementationName()) )
156 Reference
< XSingleServiceFactory
> xFactory( createSingleFactory(
158 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
160 OUString::createFromAscii( pImplName
),
162 FilterDetect_createInstance
, FilterDetect_getSupportedServiceNames() ) );
172 pRet
= xFactory
.get();