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: filtertraceruno.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"
34 #include "filtertracer.hxx"
36 #include <cppuhelper/factory.hxx>
37 #include <uno/mapping.hxx>
39 // -------------------
40 // - factory methods -
41 // -------------------
43 static REF( NMSP_UNO::XInterface
) SAL_CALL
create_FilterTracer( const REF( NMSP_LANG::XMultiServiceFactory
)& rxFact
)
45 return REF( NMSP_UNO::XInterface
)( *new FilterTracer( rxFact
) );
48 // ------------------------------------------
49 // - component_getImplementationEnvironment -
50 // ------------------------------------------
52 extern "C" void SAL_CALL
component_getImplementationEnvironment( const sal_Char
** ppEnvTypeName
, uno_Environment
** /* ppEnv */ )
54 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
57 // -----------------------
58 // - component_writeInfo -
59 // -----------------------
61 extern "C" sal_Bool SAL_CALL
component_writeInfo( void* /* pServiceManager */, void* pRegistryKey
)
63 sal_Bool bRet
= sal_False
;
69 NMSP_UNO::Reference
< com::sun::star::registry::XRegistryKey
> xNewKey(
70 reinterpret_cast< com::sun::star::registry::XRegistryKey
* >( pRegistryKey
)->createKey(
71 FilterTracer_getImplementationName() ) );
72 xNewKey
= xNewKey
->createKey( B2UCONST( "/UNO/SERVICES" ) );
73 const SEQ( rtl::OUString
)& rSNL
= FilterTracer_getSupportedServiceNames();
74 const rtl::OUString
* pArray
= rSNL
.getConstArray();
75 for ( sal_Int32 nPos
= rSNL
.getLength(); nPos
--; )
76 xNewKey
->createKey( pArray
[nPos
] );
79 catch( com::sun::star::registry::InvalidRegistryException
& )
81 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
88 // ------------------------
89 // - component_getFactory -
90 // ------------------------
92 extern "C" void* SAL_CALL
component_getFactory( const sal_Char
* pImplName
, void* pServiceManager
, void* /* pRegistryKey */ )
94 REF( NMSP_LANG::XSingleServiceFactory
) xFactory
;
97 if( rtl_str_compare( pImplName
, "com.sun.star.util.FilterTracer" ) == 0 )
99 const rtl::OUString
aServiceName( B2UCONST( "com.sun.star.util.FilterTracer" ) );
101 xFactory
= REF( NMSP_LANG::XSingleServiceFactory
)( cppu::createSingleFactory(
102 reinterpret_cast< NMSP_LANG::XMultiServiceFactory
* >( pServiceManager
),
103 B2UCONST( "com.sun.star.util.FilterTracer" ),
104 create_FilterTracer
, SEQ( rtl::OUString
)( &aServiceName
, 1 ) ) );
109 pRet
= xFactory
.get();