1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 // MARKER(update_precomp.py): autogen include statement, do not remove
30 #include "precompiled_filter.hxx"
36 #include <osl/mutex.hxx>
38 #include <osl/thread.h>
40 #include <cppuhelper/factory.hxx>
44 #ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
46 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
52 #include "XmlFilterAdaptor.hxx"
56 using namespace ::rtl
;
58 using namespace ::cppu
;
60 using namespace ::com::sun::star::uno
;
62 using namespace ::com::sun::star::lang
;
64 using namespace ::com::sun::star::registry
;
72 //==================================================================================================
74 void SAL_CALL
component_getImplementationEnvironment(
76 const sal_Char
** ppEnvTypeName
, uno_Environment
** /* ppEnv */ )
80 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
84 //==================================================================================================
86 sal_Bool SAL_CALL
component_writeInfo(
88 void * /* pServiceManager */, void * pRegistryKey
)
100 Reference
< XRegistryKey
> xNewKey(
102 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( XmlFilterAdaptor_getImplementationName() ) );
104 xNewKey
= xNewKey
->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
108 const Sequence
< OUString
> & rSNL
= XmlFilterAdaptor_getSupportedServiceNames();
110 const OUString
* pArray
= rSNL
.getConstArray();
112 for ( sal_Int32 nPos
= rSNL
.getLength(); nPos
--; )
114 xNewKey
->createKey( pArray
[nPos
] );
122 catch (InvalidRegistryException
&)
126 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
136 //==================================================================================================
138 void * SAL_CALL
component_getFactory(
140 const sal_Char
* pImplName
, void * pServiceManager
, void * /* pRegistryKey */ )
148 OUString implName
= OUString::createFromAscii( pImplName
);
150 if ( pServiceManager
&& implName
.equals(XmlFilterAdaptor_getImplementationName()) )
154 Reference
< XSingleServiceFactory
> xFactory( createSingleFactory(
156 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
158 OUString::createFromAscii( pImplName
),
160 XmlFilterAdaptor_createInstance
, XmlFilterAdaptor_getSupportedServiceNames() ) );
170 pRet
= xFactory
.get();
182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */