extensions/source/propctrlr/eformshelper.cxx         |    3 ++-
 extensions/source/propctrlr/propeventtranslation.cxx |   13 +++++++++++++
 extensions/source/propctrlr/propeventtranslation.hxx |    6 +++++-
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 1a7ad0c10d286ce9ae2700ceb2fd50eed1fb43a4
Author:     Stephan Bergmann <[email protected]>
AuthorDate: Wed Dec 21 15:44:35 2022 +0100
Commit:     Stephan Bergmann <[email protected]>
CommitDate: Thu Dec 22 06:56:41 2022 +0000

    loplugin:unocast (pcr::PropertyEventTranslation)
    
    (See the upcoming commit introducing that loplugin:unocast on why such
    dynamic_casts from UNO types are dangerous.)
    
    Change-Id: I0800465df08a8caa4d48e205f181d3eb35611dc8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144695
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <[email protected]>

diff --git a/extensions/source/propctrlr/eformshelper.cxx 
b/extensions/source/propctrlr/eformshelper.cxx
index 40aceed5dfe7..c53b8eacc909 100644
--- a/extensions/source/propctrlr/eformshelper.cxx
+++ b/extensions/source/propctrlr/eformshelper.cxx
@@ -32,6 +32,7 @@
 #include <com/sun/star/xsd/DataTypeClass.hpp>
 #include <com/sun/star/form/binding/XListEntrySink.hpp>
 #include <comphelper/diagnose_ex.hxx>
+#include <comphelper/servicehelper.hxx>
 
 #include <algorithm>
 #include <o3tl/functional.hxx>
@@ -243,7 +244,7 @@ namespace pcr
             ::comphelper::OInterfaceIteratorHelper3 
aListenerIterator(m_aPropertyListeners);
             while ( aListenerIterator.hasMoreElements() )
             {
-                PropertyEventTranslation* pTranslator = dynamic_cast< 
PropertyEventTranslation* >( aListenerIterator.next().get() );
+                PropertyEventTranslation* pTranslator = 
comphelper::getFromUnoTunnel< PropertyEventTranslation >( 
aListenerIterator.next() );
                 OSL_ENSURE( pTranslator, 
"EFormsHelper::impl_toggleBindingPropertyListening_throw: invalid listener 
element in my container!" );
                 if ( !pTranslator )
                     continue;
diff --git a/extensions/source/propctrlr/propeventtranslation.cxx 
b/extensions/source/propctrlr/propeventtranslation.cxx
index 736c1e06fca2..ce8e794f2211 100644
--- a/extensions/source/propctrlr/propeventtranslation.cxx
+++ b/extensions/source/propctrlr/propeventtranslation.cxx
@@ -20,6 +20,7 @@
 #include "propeventtranslation.hxx"
 
 #include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/servicehelper.hxx>
 
 
 namespace pcr
@@ -48,6 +49,18 @@ namespace pcr
     }
 
 
+    sal_Int64 PropertyEventTranslation::getSomething(
+        css::uno::Sequence<sal_Int8> const & aIdentifier)
+    {
+        return comphelper::getSomethingImpl(aIdentifier, this);
+    }
+
+    css::uno::Sequence<sal_Int8> const & 
PropertyEventTranslation::getUnoTunnelId() {
+        static comphelper::UnoIdInit const id;
+        return id.getSeq();
+    }
+
+
     void SAL_CALL PropertyEventTranslation::propertyChange( const 
PropertyChangeEvent& evt )
     {
         if ( !m_xDelegator.is() )
diff --git a/extensions/source/propctrlr/propeventtranslation.hxx 
b/extensions/source/propctrlr/propeventtranslation.hxx
index 43155b8c67f9..92e143dfbbc2 100644
--- a/extensions/source/propctrlr/propeventtranslation.hxx
+++ b/extensions/source/propctrlr/propeventtranslation.hxx
@@ -20,6 +20,7 @@
 #pragma once
 
 #include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <cppuhelper/implbase.hxx>
 
 
@@ -29,7 +30,7 @@ namespace pcr
 
     //= PropertyEventTranslation
 
-    typedef ::cppu::WeakImplHelper <   css::beans::XPropertyChangeListener
+    typedef ::cppu::WeakImplHelper <   css::beans::XPropertyChangeListener, 
css::lang::XUnoTunnel
                                     >   PropertyEventTranslation_Base;
 
     class PropertyEventTranslation : public PropertyEventTranslation_Base
@@ -52,6 +53,9 @@ namespace pcr
         const css::uno::Reference< css::beans::XPropertyChangeListener >&
             getDelegator() const { return m_xDelegator; }
 
+        sal_Int64 SAL_CALL getSomething(css::uno::Sequence<sal_Int8> const & 
aIdentifier) override;
+        static css::uno::Sequence<sal_Int8> const & getUnoTunnelId();
+
     protected:
         // XPropertyChangeListener
         virtual void SAL_CALL propertyChange( const 
css::beans::PropertyChangeEvent& evt ) override;

Reply via email to