xref: /aoo4110/main/filter/source/t602/filterenv.cxx (revision b1cdbd2c)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
24 #include "precompiled_filter.hxx"
25 
26 #include <osl/mutex.hxx>
27 #include <osl/thread.h>
28 #include <cppuhelper/factory.hxx>
29 
30 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
31 
32 #include "t602filter.hxx"
33 
34 using namespace ::rtl;
35 using namespace ::cppu;
36 using namespace ::com::sun::star::uno;
37 using namespace ::com::sun::star::lang;
38 using namespace ::com::sun::star::registry;
39 
40 using namespace T602ImportFilter;
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     OUString implName = OUString::createFromAscii( pImplName );
57 	if ( pServiceManager && implName.equals(T602ImportFilter_getImplementationName()) )
58 	{
59 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
60 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
61 			OUString::createFromAscii( pImplName ),
62 			T602ImportFilter_createInstance, T602ImportFilter_getSupportedServiceNames() ) );
63 
64 		if (xFactory.is())
65 		{
66 			xFactory->acquire();
67 			pRet = xFactory.get();
68 		}
69 	}
70 	else if ( pServiceManager && implName.equals(T602ImportFilterDialog_getImplementationName()) )
71 	{
72 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
73 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
74 			OUString::createFromAscii( pImplName ),
75 			T602ImportFilterDialog_createInstance, T602ImportFilterDialog_getSupportedServiceNames() ) );
76 
77 		if (xFactory.is())
78 		{
79 			xFactory->acquire();
80 			pRet = xFactory.get();
81 		}
82 	}
83 
84 
85 	return pRet;
86 }
87 }
88 
89 
90