xref: /aoo42x/main/sax/source/fastparser/facreg.cxx (revision cdf0e10c)
1*cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
2*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
3*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
4*cdf0e10cSrcweir 
5*cdf0e10cSrcweir #include "../tools/fastserializer.hxx"
6*cdf0e10cSrcweir #include "fastparser.hxx"
7*cdf0e10cSrcweir 
8*cdf0e10cSrcweir using namespace sax_fastparser;
9*cdf0e10cSrcweir using namespace ::cppu;
10*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
11*cdf0e10cSrcweir using namespace ::com::sun::star::registry;
12*cdf0e10cSrcweir using ::rtl::OUString;
13*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
14*cdf0e10cSrcweir 
15*cdf0e10cSrcweir namespace sax_fastparser
16*cdf0e10cSrcweir {
17*cdf0e10cSrcweir 
18*cdf0e10cSrcweir //--------------------------------------
19*cdf0e10cSrcweir // the extern interface
20*cdf0e10cSrcweir //---------------------------------------
21*cdf0e10cSrcweir Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance( const Reference< XMultiServiceFactory  >  & ) throw(Exception)
22*cdf0e10cSrcweir {
23*cdf0e10cSrcweir 	FastSaxParser *p = new FastSaxParser;
24*cdf0e10cSrcweir 	return Reference< XInterface > ( (OWeakObject * ) p );
25*cdf0e10cSrcweir }
26*cdf0e10cSrcweir 
27*cdf0e10cSrcweir Reference< XInterface > SAL_CALL FastSaxSerializer_CreateInstance( const Reference< XMultiServiceFactory  >  & ) throw(Exception)
28*cdf0e10cSrcweir {
29*cdf0e10cSrcweir 	FastSaxSerializer *p = new FastSaxSerializer;
30*cdf0e10cSrcweir 	return Reference< XInterface > ( (OWeakObject * ) p );
31*cdf0e10cSrcweir }
32*cdf0e10cSrcweir }
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir extern "C"
35*cdf0e10cSrcweir {
36*cdf0e10cSrcweir 
37*cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
38*cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
39*cdf0e10cSrcweir {
40*cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
41*cdf0e10cSrcweir }
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
44*cdf0e10cSrcweir {
45*cdf0e10cSrcweir 	void * pRet = 0;
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir 	if (pServiceManager )
48*cdf0e10cSrcweir 	{
49*cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xRet;
50*cdf0e10cSrcweir 		Reference< XMultiServiceFactory > xSMgr( reinterpret_cast< XMultiServiceFactory * > ( pServiceManager ) );
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir 		OUString aImplementationName( OUString::createFromAscii( pImplName ) );
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir 		if (aImplementationName == OUString( RTL_CONSTASCII_USTRINGPARAM( PARSER_IMPLEMENTATION_NAME  ) ) )
55*cdf0e10cSrcweir 		{
56*cdf0e10cSrcweir 			xRet = createSingleFactory( xSMgr, aImplementationName,
57*cdf0e10cSrcweir 										FastSaxParser_CreateInstance,
58*cdf0e10cSrcweir 										FastSaxParser::getSupportedServiceNames_Static() );
59*cdf0e10cSrcweir 		}
60*cdf0e10cSrcweir 		else if (aImplementationName == OUString( RTL_CONSTASCII_USTRINGPARAM( SERIALIZER_IMPLEMENTATION_NAME  ) ) )
61*cdf0e10cSrcweir 		{
62*cdf0e10cSrcweir 			xRet = createSingleFactory( xSMgr, aImplementationName,
63*cdf0e10cSrcweir 										FastSaxSerializer_CreateInstance,
64*cdf0e10cSrcweir 										FastSaxSerializer::getSupportedServiceNames_Static() );
65*cdf0e10cSrcweir 		}
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir 		if (xRet.is())
68*cdf0e10cSrcweir 		{
69*cdf0e10cSrcweir 			xRet->acquire();
70*cdf0e10cSrcweir 			pRet = xRet.get();
71*cdf0e10cSrcweir 		}
72*cdf0e10cSrcweir 	}
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir 	return pRet;
75*cdf0e10cSrcweir }
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir }
79