1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_filter.hxx"
26 
27 #include "filtertracer.hxx"
28 
29 #include <cppuhelper/factory.hxx>
30 #include <uno/mapping.hxx>
31 
32 // -------------------
33 // - factory methods -
34 // -------------------
35 
REF(NMSP_UNO::XInterface)36 static REF( NMSP_UNO::XInterface ) SAL_CALL create_FilterTracer( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
37 {
38 	return REF( NMSP_UNO::XInterface )( *new FilterTracer( rxFact ) );
39 }
40 
41 // ------------------------------------------
42 // - component_getImplementationEnvironment -
43 // ------------------------------------------
44 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)45 extern "C" void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
46 {
47 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
48 }
49 
50 // ------------------------
51 // - component_getFactory -
52 // ------------------------
53 
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)54 extern "C" void* SAL_CALL component_getFactory( const sal_Char* pImplName, void* pServiceManager, void* /* pRegistryKey */ )
55 {
56 	REF( NMSP_LANG::XSingleServiceFactory ) xFactory;
57 	void*									pRet = 0;
58 
59 	if( rtl_str_compare( pImplName, "com.sun.star.util.FilterTracer" ) == 0 )
60 	{
61 		const rtl::OUString aServiceName( B2UCONST( "com.sun.star.util.FilterTracer" ) );
62 
63 		xFactory = REF( NMSP_LANG::XSingleServiceFactory )( cppu::createSingleFactory(
64 			reinterpret_cast< NMSP_LANG::XMultiServiceFactory* >( pServiceManager ),
65 				B2UCONST( "com.sun.star.util.FilterTracer" ),
66 						create_FilterTracer, SEQ( rtl::OUString )( &aServiceName, 1 ) ) );
67 	}
68 	if( xFactory.is() )
69 	{
70 		xFactory->acquire();
71 		pRet = xFactory.get();
72 	}
73 
74 	return pRet;
75 }
76