xref: /aoo41x/main/filter/source/flash/swfuno.cxx (revision 9e0fc027)
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 #include <stdio.h>
27 
28 #include <osl/mutex.hxx>
29 #include <osl/thread.h>
30 #include <cppuhelper/factory.hxx>
31 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32 
33 using namespace ::rtl;
34 using namespace ::cppu;
35 using namespace ::com::sun::star::uno;
36 using namespace ::com::sun::star::lang;
37 using namespace ::com::sun::star::registry;
38 
39 namespace swf {
40 extern OUString FlashExportFilter_getImplementationName() throw ( RuntimeException );
41 extern sal_Bool SAL_CALL FlashExportFilter_supportsService( const OUString& ServiceName ) throw ( RuntimeException );
42 extern Sequence< OUString > SAL_CALL FlashExportFilter_getSupportedServiceNames()  throw ( RuntimeException );
43 extern Reference< XInterface > SAL_CALL FlashExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception );
44 }
45 
46 extern rtl::OUString SWFDialog_getImplementationName () throw (com::sun::star::uno::RuntimeException);
47 extern com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SWFDialog_getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
48 extern com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SWFDialog_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr) throw( com::sun::star::uno::Exception );
49 
50 using namespace ::swf;
51 
52 extern "C"
53 {
54 //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)55 SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
56 	const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
57 {
58 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
59 }
60 
61 //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)62 SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
63 	const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
64 {
65 	void * pRet = 0;
66 
67 	if( pServiceManager )
68 	{
69 		Reference< XSingleServiceFactory > xFactory;
70 
71 		OUString implName = OUString::createFromAscii( pImplName );
72 		if ( implName.equals(FlashExportFilter_getImplementationName()) )
73 		{
74 			xFactory = createSingleFactory(
75 				reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
76 				OUString::createFromAscii( pImplName ),
77 				FlashExportFilter_createInstance, FlashExportFilter_getSupportedServiceNames() );
78 
79 		}
80 		else if ( implName.equals(SWFDialog_getImplementationName()) )
81 		{
82 			xFactory = createSingleFactory(
83 				reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
84 				OUString::createFromAscii( pImplName ),
85 				SWFDialog_createInstance, SWFDialog_getSupportedServiceNames() );
86 		}
87 
88 		if (xFactory.is())
89 		{
90 			xFactory->acquire();
91 			pRet = xFactory.get();
92 		}
93 	}
94 
95 	return pRet;
96 }
97 }
98