merge the formfield patch from ooo-build
[ooovba.git] / lotuswordpro / source / filter / genericfilter.cxx
blob96d5c7373ae796c2696517a6f5171675de5aecd6
1 #include <stdio.h>
3 #include <osl/mutex.hxx>
4 #include <osl/thread.h>
5 #include <cppuhelper/factory.hxx>
7 #ifndef _COM_SUN_STAR_LANG_XSINGLESERVICEFACTORY_HPP_
8 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
9 #endif
11 #include "LotusWordProImportFilter.hxx"
13 using namespace ::rtl;
14 using namespace ::cppu;
15 using namespace ::com::sun::star::uno;
16 using namespace ::com::sun::star::lang;
17 using namespace ::com::sun::star::registry;
19 extern "C"
21 //==================================================================================================
22 void SAL_CALL component_getImplementationEnvironment(
23 const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
25 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
27 //==================================================================================================
28 sal_Bool SAL_CALL component_writeInfo(
29 void * pServiceManager, void * pRegistryKey )
31 if (pRegistryKey)
33 try
35 sal_Int32 nPos = 0;
36 Reference< XRegistryKey > xNewKey(
37 reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( LotusWordProImportFilter_getImplementationName() ) );
38 xNewKey = xNewKey->createKey( OUString::createFromAscii( "/UNO/SERVICES" ) );
40 const Sequence< OUString > & rSNL = LotusWordProImportFilter_getSupportedServiceNames();
41 const OUString * pArray = rSNL.getConstArray();
42 for ( nPos = rSNL.getLength(); nPos--; )
43 xNewKey->createKey( pArray[nPos] );
45 return sal_True;
47 catch (InvalidRegistryException &)
49 OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
52 return sal_False;
54 //==================================================================================================
55 void * SAL_CALL component_getFactory(
56 const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey )
58 void * pRet = 0;
60 OUString implName = OUString::createFromAscii( pImplName );
61 if ( pServiceManager && implName.equals(LotusWordProImportFilter_getImplementationName()) )
63 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
64 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
65 OUString::createFromAscii( pImplName ),
66 LotusWordProImportFilter_createInstance, LotusWordProImportFilter_getSupportedServiceNames() ) );
68 if (xFactory.is())
70 xFactory->acquire();
71 pRet = xFactory.get();
75 return pRet;