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: svguno.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"
35 #include <osl/mutex.hxx>
36 #include <osl/thread.h>
37 #include <cppuhelper/factory.hxx>
38 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
40 #include <svgfilter.hxx>
42 using ::rtl::OUString
;
43 using namespace ::cppu
;
44 using namespace ::com::sun::star::uno
;
45 using namespace ::com::sun::star::lang
;
46 using namespace ::com::sun::star::registry
;
50 //==================================================================================================
51 SAL_DLLPUBLIC_EXPORT
void SAL_CALL
component_getImplementationEnvironment(
52 const sal_Char
** ppEnvTypeName
, uno_Environment
** /* ppEnv */ )
54 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
56 //==================================================================================================
57 SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL
component_writeInfo(
58 void * /* pServiceManager */, void * pRegistryKey
)
64 Reference
< XRegistryKey
> xNewKey(
65 reinterpret_cast< XRegistryKey
* >( pRegistryKey
)->createKey( SVGFilter_getImplementationName() ) );
66 xNewKey
= xNewKey
->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
68 const Sequence
< OUString
> & rSNL
= SVGFilter_getSupportedServiceNames();
69 const OUString
* pArray
= rSNL
.getConstArray();
70 for ( sal_Int32 nPos
= rSNL
.getLength(); nPos
--; )
71 xNewKey
->createKey( pArray
[nPos
] );
75 catch (InvalidRegistryException
&)
77 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
82 //==================================================================================================
83 SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
component_getFactory(
84 const sal_Char
* pImplName
, void * pServiceManager
, void * /* pRegistryKey */ )
88 OUString implName
= OUString::createFromAscii( pImplName
);
89 if ( pServiceManager
&& implName
.equals(SVGFilter_getImplementationName()) )
91 Reference
< XSingleServiceFactory
> xFactory( createSingleFactory(
92 reinterpret_cast< XMultiServiceFactory
* >( pServiceManager
),
93 OUString::createFromAscii( pImplName
),
94 SVGFilter_createInstance
, SVGFilter_getSupportedServiceNames() ) );
99 pRet
= xFactory
.get();