xref: /trunk/main/filter/source/flash/swfuno.cxx (revision 9e0fc027)
1*9e0fc027SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9e0fc027SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9e0fc027SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9e0fc027SAndrew Rist  * distributed with this work for additional information
6*9e0fc027SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9e0fc027SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9e0fc027SAndrew Rist  * "License"); you may not use this file except in compliance
9*9e0fc027SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9e0fc027SAndrew Rist  *
11*9e0fc027SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9e0fc027SAndrew Rist  *
13*9e0fc027SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9e0fc027SAndrew Rist  * software distributed under the License is distributed on an
15*9e0fc027SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9e0fc027SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9e0fc027SAndrew Rist  * specific language governing permissions and limitations
18*9e0fc027SAndrew Rist  * under the License.
19*9e0fc027SAndrew Rist  *
20*9e0fc027SAndrew Rist  *************************************************************/
21*9e0fc027SAndrew Rist 
22*9e0fc027SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_filter.hxx"
26cdf0e10cSrcweir #include <stdio.h>
27cdf0e10cSrcweir 
28cdf0e10cSrcweir #include <osl/mutex.hxx>
29cdf0e10cSrcweir #include <osl/thread.h>
30cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
31cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir using namespace ::rtl;
34cdf0e10cSrcweir using namespace ::cppu;
35cdf0e10cSrcweir using namespace ::com::sun::star::uno;
36cdf0e10cSrcweir using namespace ::com::sun::star::lang;
37cdf0e10cSrcweir using namespace ::com::sun::star::registry;
38cdf0e10cSrcweir 
39cdf0e10cSrcweir namespace swf {
40cdf0e10cSrcweir extern OUString FlashExportFilter_getImplementationName() throw ( RuntimeException );
41cdf0e10cSrcweir extern sal_Bool SAL_CALL FlashExportFilter_supportsService( const OUString& ServiceName ) throw ( RuntimeException );
42cdf0e10cSrcweir extern Sequence< OUString > SAL_CALL FlashExportFilter_getSupportedServiceNames()  throw ( RuntimeException );
43cdf0e10cSrcweir extern Reference< XInterface > SAL_CALL FlashExportFilter_createInstance( const Reference< XMultiServiceFactory > & rSMgr) throw ( Exception );
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir extern rtl::OUString SWFDialog_getImplementationName () throw (com::sun::star::uno::RuntimeException);
47cdf0e10cSrcweir extern com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SWFDialog_getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException);
48cdf0e10cSrcweir 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 );
49cdf0e10cSrcweir 
50cdf0e10cSrcweir using namespace ::swf;
51cdf0e10cSrcweir 
52cdf0e10cSrcweir extern "C"
53cdf0e10cSrcweir {
54cdf0e10cSrcweir //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)55cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
56cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** /* ppEnv */ )
57cdf0e10cSrcweir {
58cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
59cdf0e10cSrcweir }
60cdf0e10cSrcweir 
61cdf0e10cSrcweir //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)62cdf0e10cSrcweir SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
63cdf0e10cSrcweir 	const sal_Char * pImplName, void * pServiceManager, void * /* pRegistryKey */ )
64cdf0e10cSrcweir {
65cdf0e10cSrcweir 	void * pRet = 0;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir 	if( pServiceManager )
68cdf0e10cSrcweir 	{
69cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory;
70cdf0e10cSrcweir 
71cdf0e10cSrcweir 		OUString implName = OUString::createFromAscii( pImplName );
72cdf0e10cSrcweir 		if ( implName.equals(FlashExportFilter_getImplementationName()) )
73cdf0e10cSrcweir 		{
74cdf0e10cSrcweir 			xFactory = createSingleFactory(
75cdf0e10cSrcweir 				reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
76cdf0e10cSrcweir 				OUString::createFromAscii( pImplName ),
77cdf0e10cSrcweir 				FlashExportFilter_createInstance, FlashExportFilter_getSupportedServiceNames() );
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 		}
80cdf0e10cSrcweir 		else if ( implName.equals(SWFDialog_getImplementationName()) )
81cdf0e10cSrcweir 		{
82cdf0e10cSrcweir 			xFactory = createSingleFactory(
83cdf0e10cSrcweir 				reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
84cdf0e10cSrcweir 				OUString::createFromAscii( pImplName ),
85cdf0e10cSrcweir 				SWFDialog_createInstance, SWFDialog_getSupportedServiceNames() );
86cdf0e10cSrcweir 		}
87cdf0e10cSrcweir 
88cdf0e10cSrcweir 		if (xFactory.is())
89cdf0e10cSrcweir 		{
90cdf0e10cSrcweir 			xFactory->acquire();
91cdf0e10cSrcweir 			pRet = xFactory.get();
92cdf0e10cSrcweir 		}
93cdf0e10cSrcweir 	}
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	return pRet;
96cdf0e10cSrcweir }
97cdf0e10cSrcweir }
98