summaryrefslogtreecommitdiff
path: root/starmath
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-09-13 11:29:37 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-15 06:08:14 +0200
commit3f65724ec5fc92d5a0078a99932358ef7091435c (patch)
tree94dd9bf1d0ecd42dbf7f94db45bc7e1bf29b83ce /starmath
parent6444b026b4039458d01ada5fee58eae98166585b (diff)
Use <comphelper/servicehelper.hxx> 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 <comphelper/servicehelper.hxx>. 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 <mike.kaganski@collabora.com>
Diffstat (limited to 'starmath')
-rw-r--r--starmath/source/mathml/export.cxx5
-rw-r--r--starmath/source/mathml/import.cxx6
-rw-r--r--starmath/source/mathml/mathmlexport.cxx6
-rw-r--r--starmath/source/mathml/mathmlimport.cxx6
-rw-r--r--starmath/source/unomodel.cxx8
5 files changed, 10 insertions, 21 deletions
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<XComponent>& xCompone
sal_Int64 SAL_CALL SmMLExport::getSomething(const uno::Sequence<sal_Int8>& rId)
{
- if (comphelper::isUnoTunnelId<SmMLExport>(rId))
- return reinterpret_cast<intptr_t>(this);
- return SvXMLExport::getSomething(rId);
+ return comphelper::getSomethingImpl(rId, this,
+ comphelper::FallbackToGetSomethingOf<SvXMLExport>{});
}
const uno::Sequence<sal_Int8>& 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<sal_Int8>& SmMLImport::getUnoTunnelId() noexcept
sal_Int64 SAL_CALL SmMLImport::getSomething(const uno::Sequence<sal_Int8>& rId)
{
- if (comphelper::isUnoTunnelId<SmMLImport>(rId))
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
-
- return SvXMLImport::getSomething(rId);
+ return comphelper::getSomethingImpl(rId, this,
+ comphelper::FallbackToGetSomethingOf<SvXMLImport>{});
}
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<css::uno::XComponentContext>&
sal_Int64 SAL_CALL SmXMLExport::getSomething(const uno::Sequence<sal_Int8>& rId)
{
- if (comphelper::isUnoTunnelId<SmXMLExport>(rId))
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
-
- return SvXMLExport::getSomething(rId);
+ return comphelper::getSomethingImpl(rId, this,
+ comphelper::FallbackToGetSomethingOf<SvXMLExport>{});
}
const uno::Sequence<sal_Int8>& 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<sal_Int8>& rId)
{
- if (comphelper::isUnoTunnelId<SmXMLImport>(rId))
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
-
- return SvXMLImport::getSomething(rId);
+ return comphelper::getSomethingImpl(rId, this,
+ comphelper::FallbackToGetSomethingOf<SvXMLImport>{});
}
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<SmModel>(rId) )
- {
- return sal::static_int_cast< sal_Int64 >(reinterpret_cast< sal_uIntPtr >(this));
- }
-
- return SfxBaseModel::getSomething( rId );
+ return comphelper::getSomethingImpl(rId, this,
+ comphelper::FallbackToGetSomethingOf<SfxBaseModel>{});
}
static sal_Int16 lcl_AnyToINT16(const uno::Any& rAny)