From 84a0496de8300e4e7febb0f30862d8c5f9a1472e Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Thu, 15 Nov 2018 22:49:07 +0100 Subject: starmath: create XMLOasisMetaImporter instances with an uno constructor Change-Id: Ie48a779958a393b68dea613c3bcc17113165f065 Reviewed-on: https://gerrit.libreoffice.org/63443 Tested-by: Jenkins Reviewed-by: Miklos Vajna --- solenv/bin/native-code.py | 1 + starmath/source/mathmlimport.cxx | 20 +++++--------------- starmath/source/register.cxx | 9 +-------- starmath/source/register.hxx | 7 ------- starmath/util/sm.component | 3 ++- 5 files changed, 9 insertions(+), 31 deletions(-) diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 7b07c6597139..b0e0ab1c5822 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -279,6 +279,7 @@ edit_constructor_list = [ "Math_XMLOasisMetaExporter_get_implementation", "Math_XMLOasisSettingsExporter_get_implementation", "Math_XMLImporter_get_implementation", + "Math_XMLOasisMetaImporter_get_implementation", # sw/util/sw.component "com_sun_star_comp_Writer_XMLOasisContentExporter_get_implementation", "com_sun_star_comp_Writer_XMLOasisMetaExporter_get_implementation", diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index d9f764344dc1..fcf3ebb21b48 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -442,24 +442,14 @@ Math_XMLImporter_get_implementation(uno::XComponentContext* pCtx, new SmXMLImport(pCtx, "com.sun.star.comp.Math.XMLImporter", SvXMLImportFlags::ALL)); } -OUString SmXMLImportMeta_getImplementationName() throw() -{ - return OUString( "com.sun.star.comp.Math.XMLOasisMetaImporter" ); -} - -uno::Sequence< OUString > SmXMLImportMeta_getSupportedServiceNames() -throw() -{ - return uno::Sequence{ IMPORT_SVC_NAME }; -} - -uno::Reference< uno::XInterface > SmXMLImportMeta_createInstance( - const uno::Reference< lang::XMultiServiceFactory > & rSMgr) +extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* +Math_XMLOasisMetaImporter_get_implementation(uno::XComponentContext* pCtx, + uno::Sequence const& /*rSeq*/) { - return static_cast(new SmXMLImport( comphelper::getComponentContext(rSMgr), SmXMLImportMeta_getImplementationName(), SvXMLImportFlags::META )); + return cppu::acquire(new SmXMLImport(pCtx, "com.sun.star.comp.Math.XMLOasisMetaImporter", + SvXMLImportFlags::META)); } - OUString SmXMLImportSettings_getImplementationName() throw() { return OUString( "com.sun.star.comp.Math.XMLOasisSettingsImporter" ); diff --git a/starmath/source/register.cxx b/starmath/source/register.cxx index 683f5c589fa8..e3bfe9f79e5b 100644 --- a/starmath/source/register.cxx +++ b/starmath/source/register.cxx @@ -46,14 +46,7 @@ SAL_DLLPUBLIC_EXPORT void* sm_component_getFactory( const sal_Char* pImplementat Reference< XSingleServiceFactory > xFactory ; Reference< XMultiServiceFactory > xServiceManager( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; - if( SmXMLImportMeta_getImplementationName().equalsAscii( pImplementationName )) - { - xFactory = ::cppu::createSingleFactory( xServiceManager, - SmXMLImportMeta_getImplementationName(), - SmXMLImportMeta_createInstance, - SmXMLImportMeta_getSupportedServiceNames() ); - } - else if( SmXMLImportSettings_getImplementationName().equalsAscii( pImplementationName )) + if (SmXMLImportSettings_getImplementationName().equalsAscii(pImplementationName)) { xFactory = ::cppu::createSingleFactory( xServiceManager, SmXMLImportSettings_getImplementationName(), diff --git a/starmath/source/register.hxx b/starmath/source/register.hxx index 04dea0bd0da0..cad881135d63 100644 --- a/starmath/source/register.hxx +++ b/starmath/source/register.hxx @@ -32,13 +32,6 @@ OUString css::uno::Reference< css::uno::XInterface > SmDocument_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr, SfxModelFlags _nCreationFlags); -css::uno::Sequence< OUString > - SmXMLImportMeta_getSupportedServiceNames() throw(); -OUString - SmXMLImportMeta_getImplementationName() throw(); -/// @throws css::uno::Exception -css::uno::Reference< css::uno::XInterface > - SmXMLImportMeta_createInstance(const css::uno::Reference< css::lang::XMultiServiceFactory > & rSMgr); css::uno::Sequence< OUString > SmXMLImportSettings_getSupportedServiceNames() throw(); OUString SmXMLImportSettings_getImplementationName() throw(); diff --git a/starmath/util/sm.component b/starmath/util/sm.component index 9215aebaef3b..91b7f1994d30 100644 --- a/starmath/util/sm.component +++ b/starmath/util/sm.component @@ -42,7 +42,8 @@ constructor="Math_XMLOasisMetaExporter_get_implementation"> - +