diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-12 01:35:07 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-09-12 10:43:46 +0200 |
commit | 004dc53f70a3a868815556ae58b044fd0304e1c8 (patch) | |
tree | 5c541b1d506626f6986e4825f02db69f107ed23d /forms | |
parent | 6e4d8f3af4eb43bab419cae1062998f044b3f4c9 (diff) |
Simplify ORichTextModel's XUnoTunnel implementation
Change-Id: I0d0e724c4da705f0f56dec41448a8312c4ffd37d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121975
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/richtext/richtextmodel.cxx | 10 | ||||
-rw-r--r-- | forms/source/richtext/richtextmodel.hxx | 3 |
2 files changed, 5 insertions, 8 deletions
diff --git a/forms/source/richtext/richtextmodel.cxx b/forms/source/richtext/richtextmodel.cxx index cd2ce3463e18..4c5f0c6af706 100644 --- a/forms/source/richtext/richtextmodel.cxx +++ b/forms/source/richtext/richtextmodel.cxx @@ -31,6 +31,7 @@ #include <cppuhelper/typeprovider.hxx> #include <comphelper/guarding.hxx> +#include <comphelper/servicehelper.hxx> #include <svl/itempool.hxx> #include <toolkit/awt/vclxdevice.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -512,7 +513,7 @@ namespace frm { try { - pEngine = reinterpret_cast< RichTextEngine* >( xTunnel->getSomething( getEditEngineTunnelId() ) ); + pEngine = reinterpret_cast<RichTextEngine*>(xTunnel->getSomething(getUnoTunnelId())); } catch( const Exception& ) { @@ -523,7 +524,7 @@ namespace frm } - Sequence< sal_Int8 > ORichTextModel::getEditEngineTunnelId() + Sequence<sal_Int8> ORichTextModel::getUnoTunnelId() { static cppu::OImplementationId aId; return aId.getImplementationId(); @@ -547,10 +548,7 @@ namespace frm sal_Int64 SAL_CALL ORichTextModel::getSomething( const Sequence< sal_Int8 >& _rId ) { - Sequence< sal_Int8 > aEditEngineAccessId( getEditEngineTunnelId() ); - if ( ( _rId.getLength() == aEditEngineAccessId.getLength() ) - && ( 0 == memcmp( aEditEngineAccessId.getConstArray(), _rId.getConstArray(), _rId.getLength() ) ) - ) + if (isUnoTunnelId<ORichTextModel>(_rId)) return reinterpret_cast< sal_Int64 >( m_pEngine.get() ); Reference< XUnoTunnel > xAggTunnel; diff --git a/forms/source/richtext/richtextmodel.hxx b/forms/source/richtext/richtextmodel.hxx index e9e42810a46b..c4f73a1a37c6 100644 --- a/forms/source/richtext/richtextmodel.hxx +++ b/forms/source/richtext/richtextmodel.hxx @@ -119,6 +119,7 @@ namespace frm // XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& aIdentifier ) override; + static css::uno::Sequence<sal_Int8> getUnoTunnelId(); // XModifyBroadcaster virtual void SAL_CALL addModifyListener( const css::uno::Reference< css::util::XModifyListener >& aListener ) override; @@ -166,8 +167,6 @@ namespace frm DECL_LINK( OnEngineContentModified, LinkParamNone*, void ); - static css::uno::Sequence< sal_Int8 > getEditEngineTunnelId(); - private: ORichTextModel( const ORichTextModel& ) = delete; ORichTextModel& operator=( const ORichTextModel& ) = delete; |