summaryrefslogtreecommitdiff
path: root/editeng
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 /editeng
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 'editeng')
-rw-r--r--editeng/source/uno/unofield.cxx6
-rw-r--r--editeng/source/uno/unotext.cxx20
2 files changed, 5 insertions, 21 deletions
diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx
index efe9165ea647..0e1dab6db253 100644
--- a/editeng/source/uno/unofield.cxx
+++ b/editeng/source/uno/unofield.cxx
@@ -237,11 +237,7 @@ const css::uno::Sequence< sal_Int8 > & SvxUnoTextField::getUnoTunnelId() noexcep
sal_Int64 SAL_CALL SvxUnoTextField::getSomething( const css::uno::Sequence< sal_Int8 >& rId )
{
- if( comphelper::isUnoTunnelId<SvxUnoTextField>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
- }
- return 0;
+ return comphelper::getSomethingImpl(rId, this);
}
SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) noexcept
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 7696a5dbd648..3ad90c4709c3 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -2141,14 +2141,8 @@ const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() noexcept
sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId )
{
- if( comphelper::isUnoTunnelId<SvxUnoTextBase>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
- }
- else
- {
- return SvxUnoTextRangeBase::getSomething( rId );
- }
+ return comphelper::getSomethingImpl(
+ rId, this, comphelper::FallbackToGetSomethingOf<SvxUnoTextRangeBase>{});
}
SvxUnoText::SvxUnoText( const SvxItemPropertySet* _pSet ) noexcept
@@ -2215,14 +2209,8 @@ const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() noexcept
sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId )
{
- if( comphelper::isUnoTunnelId<SvxUnoText>(rId) )
- {
- return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
- }
- else
- {
- return SvxUnoTextBase::getSomething( rId );
- }
+ return comphelper::getSomethingImpl(rId, this,
+ comphelper::FallbackToGetSomethingOf<SvxUnoTextBase>{});
}