diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-12-18 11:13:37 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-12-18 11:13:58 +0100 |
commit | 71f33636dae11f3a53740ce73437255ad53641ed (patch) | |
tree | eee4f443318fa21beb5e2bf1f1c83e9447437c51 /sax | |
parent | DocxAttributeOutput::OutputFlyFrame_Impl: enable DML export by default (diff) | |
download | core-71f33636dae11f3a53740ce73437255ad53641ed.tar.gz core-71f33636dae11f3a53740ce73437255ad53641ed.zip |
Change from ServiceManager- to ComponentContext-based implementations
Change-Id: Iba701c520ad27925bb5e67697e22132b53160ab2
Diffstat (limited to 'sax')
-rw-r--r-- | sax/source/expatwrap/sax_expat.cxx | 32 | ||||
-rw-r--r-- | sax/source/expatwrap/saxwriter.cxx | 31 | ||||
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 35 |
3 files changed, 51 insertions, 47 deletions
diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 83dff1afe9f5..4f00ad9f378e 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -129,7 +129,11 @@ OUString XmlChar2OUString( const XML_Char *p ) class SaxExpatParser_Impl; -static Sequence< OUString > SaxExpatParser_getSupportedServiceNames(void) +OUString SaxExpatParser_getImplementationName() { + return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat"); +} + +Sequence< OUString > SaxExpatParser_getSupportedServiceNames(void) { Sequence<OUString> seq(1); seq[0] = OUString("com.sun.star.xml.sax.Parser"); @@ -594,7 +598,7 @@ void SaxExpatParser::setLocale( const Locale & locale ) throw (RuntimeException) // XServiceInfo OUString SaxExpatParser::getImplementationName() throw () { - return OUString("com.sun.star.comp.extensions.xml.sax.ParserExpat"); + return SaxExpatParser_getImplementationName(); } // XServiceInfo @@ -1019,27 +1023,25 @@ void SaxExpatParser_Impl::callbackEndCDATA( void *pvThis ) CALL_ELEMENT_HANDLER_AND_CARE_FOR_EXCEPTIONS(pImpl,rExtendedDocumentHandler->endCDATA() ); } -} // namespace - -static Reference< XInterface > SaxExpatParser_CreateInstance( - SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & ) - throw(Exception) +Reference< XInterface > SAL_CALL SaxExpatParser_CreateInstance( + SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & ) + SAL_THROW((css::uno::Exception)) { SaxExpatParser *p = new SaxExpatParser; return Reference< XInterface > ( (OWeakObject * ) p ); } +} // namespace + extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_comp_extensions_xml_sax_ParserExpat_component_getFactory( - const char * , void *pServiceManager, void * ) + const char *, void *, void * ) { - Reference< XSingleServiceFactory > xFactory; - Reference< XMultiServiceFactory > xSMgr = - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ); - xFactory = createSingleFactory( xSMgr, - "com.sun.star.comp.extensions.xml.sax.ParserExpat", - SaxExpatParser_CreateInstance, - SaxExpatParser_getSupportedServiceNames() ); + Reference<css::lang::XSingleComponentFactory> xFactory( + cppu::createSingleComponentFactory( + &SaxExpatParser_CreateInstance, + SaxExpatParser_getImplementationName(), + SaxExpatParser_getSupportedServiceNames())); xFactory->acquire(); return xFactory.get(); } diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index a6b9a31d0a4e..b17f3787ac10 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -867,7 +867,11 @@ static inline sal_Int32 getFirstLineBreak( const OUString & str ) throw () return -1; } -static Sequence< OUString > SAXWriter_getSupportedServiceNames(void) throw () +OUString SAXWriter_getImplementationName() { + return OUString("com.sun.star.extensions.xml.sax.Writer"); +} + +Sequence< OUString > SAXWriter_getSupportedServiceNames(void) throw () { Sequence<OUString> seq(1); seq.getArray()[0] = OUString("com.sun.star.xml.sax.Writer"); @@ -994,7 +998,7 @@ static inline sal_Bool isFirstCharWhitespace( const sal_Unicode *p ) throw() // XServiceInfo OUString SAXWriter::getImplementationName() throw() { - return OUString("com.sun.star.extensions.xml.sax.Writer"); + return SAXWriter_getImplementationName(); } // XServiceInfo @@ -1372,27 +1376,24 @@ void SAXWriter::unknown(const OUString& sString) throw (SAXException, RuntimeExc } } -} // namespace - -static Reference < XInterface > SAXWriter_CreateInstance( - SAL_UNUSED_PARAMETER const Reference < XMultiServiceFactory > & ) - throw (Exception) +Reference < XInterface > SAL_CALL SAXWriter_CreateInstance( + SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & ) + SAL_THROW((css::uno::Exception)) { SAXWriter *p = new SAXWriter; return Reference< XInterface > ( (static_cast< OWeakObject * >(p)) ); } +} // namespace + extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_extensions_xml_sax_Writer_component_getFactory( - const char * , void *pServiceManager, void * ) + const char *, void *, void * ) { - Reference< XSingleServiceFactory > xFactory; - Reference< XMultiServiceFactory > xSMgr = - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ); - xFactory = createSingleFactory( xSMgr, - "com.sun.star.extensions.xml.sax.Writer", - SAXWriter_CreateInstance, - SAXWriter_getSupportedServiceNames() ); + Reference<css::lang::XSingleComponentFactory > xFactory( + cppu::createSingleComponentFactory( + &SAXWriter_CreateInstance, SAXWriter_getImplementationName(), + SAXWriter_getSupportedServiceNames())); xFactory->acquire(); return xFactory.get(); } diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 5dd5c6455498..8d17b650cf0d 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -55,16 +55,19 @@ using namespace ::com::sun::star::io; using namespace com::sun::star; using namespace sax_fastparser; -static uno::Sequence<OUString> FastSaxParser_getSupportedServiceNames() - throw (uno::RuntimeException) +namespace { + +OUString FastSaxParser_getImplementationName() { + return OUString("com.sun.star.comp.extensions.xml.sax.FastParser"); +} + +uno::Sequence<OUString> FastSaxParser_getSupportedServiceNames() { Sequence<OUString> seq(1); seq.getArray()[0] = OUString("com.sun.star.xml.sax.FastParser"); return seq; } -namespace { - struct Event; class FastLocatorImpl; struct NamespaceDefine; @@ -1401,7 +1404,7 @@ void FastSaxParser::setLocale( const lang::Locale& rLocale ) OUString FastSaxParser::getImplementationName() throw (uno::RuntimeException) { - return OUString("com.sun.star.comp.extensions.xml.sax.FastParser"); + return FastSaxParser_getImplementationName(); } sal_Bool FastSaxParser::supportsService( const OUString& ServiceName ) @@ -1423,9 +1426,9 @@ bool FastSaxParser::hasNamespaceURL( const OUString& rPrefix ) const } // namespace sax_fastparser -static Reference< XInterface > FastSaxParser_CreateInstance( - SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & ) - throw(Exception) +static Reference< XInterface > SAL_CALL FastSaxParser_CreateInstance( + SAL_UNUSED_PARAMETER const Reference<css::uno::XComponentContext> & ) + SAL_THROW((css::uno::Exception)) { FastSaxParser *p = new FastSaxParser; return Reference< XInterface > ( (OWeakObject * ) p ); @@ -1433,15 +1436,13 @@ static Reference< XInterface > FastSaxParser_CreateInstance( extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL com_sun_star_comp_extensions_xml_sax_FastParser_component_getFactory( - const char * , void *pServiceManager, void * ) -{ - Reference< XSingleServiceFactory > xFactory; - Reference< XMultiServiceFactory > xSMgr = - reinterpret_cast< XMultiServiceFactory * >( pServiceManager ); - xFactory = createSingleFactory( xSMgr, - "com.sun.star.comp.extensions.xml.sax.FastParser", - FastSaxParser_CreateInstance, - FastSaxParser_getSupportedServiceNames() ); + const char *, void *, void * ) +{ + Reference<css::lang::XSingleComponentFactory> xFactory( + cppu::createSingleComponentFactory( + &FastSaxParser_CreateInstance, + FastSaxParser_getImplementationName(), + FastSaxParser_getSupportedServiceNames())); xFactory->acquire(); return xFactory.get(); } |