1 #include <cppuhelper/factory.hxx>
2 #include <cppuhelper/weak.hxx>
3 #include <cppuhelper/implbase2.hxx>
5 #include "../tools/fastserializer.hxx"
6 #include "fastparser.hxx"
8 using namespace sax_fastparser
;
9 using namespace ::cppu
;
10 using namespace ::com::sun::star::uno
;
11 using namespace ::com::sun::star::registry
;
12 using ::rtl::OUString
;
13 using namespace ::com::sun::star::lang
;
15 namespace sax_fastparser
18 //--------------------------------------
19 // the extern interface
20 //---------------------------------------
21 Reference
< XInterface
> SAL_CALL
FastSaxParser_CreateInstance( const Reference
< XMultiServiceFactory
> & ) throw(Exception
)
23 FastSaxParser
*p
= new FastSaxParser
;
24 return Reference
< XInterface
> ( (OWeakObject
* ) p
);
27 Reference
< XInterface
> SAL_CALL
FastSaxSerializer_CreateInstance( const Reference
< XMultiServiceFactory
> & ) throw(Exception
)
29 FastSaxSerializer
*p
= new FastSaxSerializer
;
30 return Reference
< XInterface
> ( (OWeakObject
* ) p
);
37 void SAL_CALL
component_getImplementationEnvironment(
38 const sal_Char
** ppEnvTypeName
, uno_Environment
** /*ppEnv*/ )
40 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
44 sal_Bool SAL_CALL
component_writeInfo(
45 void * /*pServiceManager*/, void * pRegistryKey
)
51 Reference
< XRegistryKey
> xKey( reinterpret_cast< XRegistryKey
* >( pRegistryKey
) );
53 Reference
< XRegistryKey
> xNewKey( xKey
->createKey(
54 OUString::createFromAscii( "/" PARSER_IMPLEMENTATION_NAME
"/UNO/SERVICES" ) ) );
55 xNewKey
->createKey( OUString::createFromAscii( PARSER_SERVICE_NAME
) );
57 Reference
< XRegistryKey
> xNewKey1( xKey
->createKey(
58 OUString::createFromAscii( "/" SERIALIZER_IMPLEMENTATION_NAME
"/UNO/SERVICES" ) ) );
59 xNewKey1
->createKey( OUString::createFromAscii( SERIALIZER_SERVICE_NAME
) );
63 catch (InvalidRegistryException
&)
65 OSL_ENSURE( sal_False
, "### InvalidRegistryException!" );
71 void * SAL_CALL
component_getFactory( const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
77 Reference
< XSingleServiceFactory
> xRet
;
78 Reference
< XMultiServiceFactory
> xSMgr( reinterpret_cast< XMultiServiceFactory
* > ( pServiceManager
) );
80 OUString
aImplementationName( OUString::createFromAscii( pImplName
) );
82 if (aImplementationName
== OUString( RTL_CONSTASCII_USTRINGPARAM( PARSER_IMPLEMENTATION_NAME
) ) )
84 xRet
= createSingleFactory( xSMgr
, aImplementationName
,
85 FastSaxParser_CreateInstance
,
86 FastSaxParser::getSupportedServiceNames_Static() );
88 else if (aImplementationName
== OUString( RTL_CONSTASCII_USTRINGPARAM( SERIALIZER_IMPLEMENTATION_NAME
) ) )
90 xRet
= createSingleFactory( xSMgr
, aImplementationName
,
91 FastSaxSerializer_CreateInstance
,
92 FastSaxSerializer::getSupportedServiceNames_Static() );