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_extensions.hxx"
26 
27 #include "xmxcom.hxx"
28 #include "xmxtrct.hxx"
29 #include <osl/diagnose.h>
30 #include <cppuhelper/factory.hxx>
31 #include <uno/mapping.hxx>
32 
33 // -------------------
34 // - factory methods -
35 // -------------------
36 
REF(NMSP_UNO::XInterface)37 static REF( NMSP_UNO::XInterface ) SAL_CALL create_XMLExtractor( const REF( NMSP_LANG::XMultiServiceFactory )& rxFact )
38 {
39 	return REF( NMSP_UNO::XInterface )( *new XMLExtractor( rxFact ) );
40 }
41 
42 extern "C"
43 {
44 //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)45 void SAL_CALL component_getImplementationEnvironment(
46 	const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
47 {
48 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
49 }
50 //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)51 void * SAL_CALL component_getFactory(
52 	const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
53 {
54 	void * pRet = 0;
55 
56 	if (rtl_str_compare( pImplName, "com.sun.star.comp.io.XMLExtractor" ) == 0)
57 	{
58 		NMSP_RTL::OUString aServiceName( B2UCONST( "com.sum.star.io.XMLExtractor" ) );
59 
60 		REF( NMSP_LANG::XSingleServiceFactory ) xFactory( NMSP_CPPU::createSingleFactory(
61 			reinterpret_cast< NMSP_LANG::XMultiServiceFactory * >( pServiceManager ),
62 			NMSP_RTL::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.io.XMLExtractor") ),
63 			create_XMLExtractor,
64 			SEQ( NMSP_RTL::OUString )( &aServiceName, 1 ) ) );
65 
66 		if (xFactory.is())
67 		{
68 			xFactory->acquire();
69 			pRet = xFactory.get();
70 		}
71 	}
72 
73 	return pRet;
74 }
75 }
76