From 3f65724ec5fc92d5a0078a99932358ef7091435c Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 13 Sep 2021 11:29:37 +0300 Subject: Use implementing XUnoTunnel part 4 - Change implementations of getSomething to use getSomethingImpl Or where that's impossible, use getSomething_cast to unify this and reduce number of places where we reinterpret_cast. All static methods getting tunnel ids were renamed to getUnoTunnelId, to comply with the convention used in . TODO (in separate commits): - Revise uses of getSomething to use getFromUnoTunnel Change-Id: Ifde9e214b52e5df678de71fcc32d2199c82e85cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122100 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- starmath/source/mathml/export.cxx | 5 ++--- starmath/source/mathml/import.cxx | 6 ++---- starmath/source/mathml/mathmlexport.cxx | 6 ++---- starmath/source/mathml/mathmlimport.cxx | 6 ++---- starmath/source/unomodel.cxx | 8 ++------ 5 files changed, 10 insertions(+), 21 deletions(-) (limited to 'starmath') diff --git a/starmath/source/mathml/export.cxx b/starmath/source/mathml/export.cxx index a1e768bd71bd..3ddc86bbc943 100644 --- a/starmath/source/mathml/export.cxx +++ b/starmath/source/mathml/export.cxx @@ -446,9 +446,8 @@ SmMLExportWrapper::WriteThroughComponentMS(const Reference& xCompone sal_Int64 SAL_CALL SmMLExport::getSomething(const uno::Sequence& rId) { - if (comphelper::isUnoTunnelId(rId)) - return reinterpret_cast(this); - return SvXMLExport::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf{}); } const uno::Sequence& SmMLExport::getUnoTunnelId() noexcept diff --git a/starmath/source/mathml/import.cxx b/starmath/source/mathml/import.cxx index b03f9cefbbdd..1da11b86fc76 100644 --- a/starmath/source/mathml/import.cxx +++ b/starmath/source/mathml/import.cxx @@ -1213,10 +1213,8 @@ const uno::Sequence& SmMLImport::getUnoTunnelId() noexcept sal_Int64 SAL_CALL SmMLImport::getSomething(const uno::Sequence& rId) { - if (comphelper::isUnoTunnelId(rId)) - return sal::static_int_cast(reinterpret_cast(this)); - - return SvXMLImport::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf{}); } SvXMLImportContext* diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index 7e35757536b6..dedd6532f8a5 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -324,10 +324,8 @@ SmXMLExport::SmXMLExport(const css::uno::Reference& sal_Int64 SAL_CALL SmXMLExport::getSomething(const uno::Sequence& rId) { - if (comphelper::isUnoTunnelId(rId)) - return sal::static_int_cast(reinterpret_cast(this)); - - return SvXMLExport::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf{}); } const uno::Sequence& SmXMLExport::getUnoTunnelId() noexcept diff --git a/starmath/source/mathml/mathmlimport.cxx b/starmath/source/mathml/mathmlimport.cxx index db5426cd927b..e2db20a6d376 100644 --- a/starmath/source/mathml/mathmlimport.cxx +++ b/starmath/source/mathml/mathmlimport.cxx @@ -438,10 +438,8 @@ Math_XMLOasisSettingsImporter_get_implementation(uno::XComponentContext* pCtx, sal_Int64 SAL_CALL SmXMLImport::getSomething(const uno::Sequence& rId) { - if (comphelper::isUnoTunnelId(rId)) - return sal::static_int_cast(reinterpret_cast(this)); - - return SvXMLImport::getSomething(rId); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf{}); } void SmXMLImport::endDocument() diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index c9f27f4dd082..8dd538c3a326 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -363,12 +363,8 @@ const uno::Sequence< sal_Int8 > & SmModel::getUnoTunnelId() sal_Int64 SAL_CALL SmModel::getSomething( const uno::Sequence< sal_Int8 >& rId ) { - if( comphelper::isUnoTunnelId(rId) ) - { - return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this)); - } - - return SfxBaseModel::getSomething( rId ); + return comphelper::getSomethingImpl(rId, this, + comphelper::FallbackToGetSomethingOf{}); } static sal_Int16 lcl_AnyToINT16(const uno::Any& rAny) -- cgit