[Libreoffice-commits] core.git: 2 commits - comphelper/source forms/source include/comphelper

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sun Sep 12 08:44:09 UTC 2021


 comphelper/source/misc/accimplaccess.cxx |   13 +++++--------
 forms/source/richtext/richtextmodel.cxx  |   10 ++++------
 forms/source/richtext/richtextmodel.hxx  |    3 +--
 include/comphelper/accimplaccess.hxx     |    4 +---
 4 files changed, 11 insertions(+), 19 deletions(-)

New commits:
commit 004dc53f70a3a868815556ae58b044fd0304e1c8
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Sep 12 01:35:07 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Sep 12 10:43:46 2021 +0200

    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 at collabora.com>

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;
commit 6e4d8f3af4eb43bab419cae1062998f044b3f4c9
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Sep 12 02:00:41 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Sep 12 10:43:36 2021 +0200

    Simplify OAccessibleImplementationAccess' XUnoTunnel implementation
    
    Change-Id: Iad82fe1e0e524d2c33ab2165bd08353c4967c57f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121976
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/comphelper/source/misc/accimplaccess.cxx b/comphelper/source/misc/accimplaccess.cxx
index 71a12c8a7e98..49304aad3270 100644
--- a/comphelper/source/misc/accimplaccess.cxx
+++ b/comphelper/source/misc/accimplaccess.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <comphelper/accimplaccess.hxx>
+#include <comphelper/servicehelper.hxx>
 #include <cppuhelper/typeprovider.hxx>
 
 #include <string.h>
@@ -38,7 +39,7 @@ namespace comphelper
     {
     }
 
-    Sequence< sal_Int8 > OAccessibleImplementationAccess::getUnoTunnelImplementationId()
+    Sequence<sal_Int8> OAccessibleImplementationAccess::getUnoTunnelId()
     {
         static cppu::OImplementationId implID;
 
@@ -48,14 +49,10 @@ namespace comphelper
 
     sal_Int64 SAL_CALL OAccessibleImplementationAccess::getSomething( const Sequence< sal_Int8 >& _rIdentifier )
     {
-        sal_Int64 nReturn( 0 );
+        if (isUnoTunnelId<OAccessibleImplementationAccess>(_rIdentifier))
+            return reinterpret_cast<sal_Int64>(this);
 
-        if  (   ( _rIdentifier.getLength() == 16 )
-            &&  ( 0 == memcmp( getUnoTunnelImplementationId().getConstArray(), _rIdentifier.getConstArray(), 16 ) )
-            )
-            nReturn = reinterpret_cast< sal_Int64 >( this );
-
-        return nReturn;
+        return 0;
     }
 
 }   // namespace comphelper
diff --git a/include/comphelper/accimplaccess.hxx b/include/comphelper/accimplaccess.hxx
index 46cce628be12..4aec719eac8b 100644
--- a/include/comphelper/accimplaccess.hxx
+++ b/include/comphelper/accimplaccess.hxx
@@ -63,9 +63,7 @@ namespace comphelper
         virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence< sal_Int8 >& _rIdentifier ) override;
 
     public:
-
-    private:
-        COMPHELPER_DLLPRIVATE static css::uno::Sequence< sal_Int8 > getUnoTunnelImplementationId();
+        COMPHELPER_DLLPRIVATE static css::uno::Sequence<sal_Int8> getUnoTunnelId();
     };
 
 } // namespace comphelper


More information about the Libreoffice-commits mailing list