xref: /aoo4110/main/filter/source/placeware/uno.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 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_filter.hxx"
26 
27 #include <stdio.h>
28 
29 #include <osl/mutex.hxx>
30 #include <osl/thread.h>
31 #include <cppuhelper/factory.hxx>
32 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
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 namespace pwp {
41 extern OUString PlaceWareExportFilter_getImplementationName() throw ( RuntimeException );
42 extern sal_Bool SAL_CALL PlaceWareExportFilter_supportsService( const OUString& ServiceName ) throw ( RuntimeException );
43 extern Sequence< OUString > SAL_CALL PlaceWareExportFilter_getSupportedServiceNames()  throw ( RuntimeException );
44 extern Reference< XInterface > SAL_CALL PlaceWareExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception );
45 }
46 
47 using namespace ::pwp;
48 
49 extern "C"
50 {
51 //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)52 void SAL_CALL component_getImplementationEnvironment(
53 	const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
54 {
55 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
56 }
57 //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)58 void * SAL_CALL component_getFactory(
59 	const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
60 {
61 	void * pRet = 0;
62 
63     OUString implName = OUString::createFromAscii( pImplName );
64 	if ( pServiceManager && implName.equals(PlaceWareExportFilter_getImplementationName()) )
65 	{
66 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
67 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
68 			OUString::createFromAscii( pImplName ),
69 			PlaceWareExportFilter_createInstance, PlaceWareExportFilter_getSupportedServiceNames() ) );
70 
71 		if (xFactory.is())
72 		{
73 			xFactory->acquire();
74 			pRet = xFactory.get();
75 		}
76 	}
77 
78 	return pRet;
79 }
80 }
81