summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-12-21 15:44:35 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-12-22 06:56:41 +0000
commit1a7ad0c10d286ce9ae2700ceb2fd50eed1fb43a4 (patch)
treed864c1387abd5e828744e1ec2fa6d7828a16731a
parent17a8cb1573c5b75e5b7a6c480e09c681edcc26c0 (diff)
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 <sbergman@redhat.com>
-rw-r--r--extensions/source/propctrlr/eformshelper.cxx3
-rw-r--r--extensions/source/propctrlr/propeventtranslation.cxx13
-rw-r--r--extensions/source/propctrlr/propeventtranslation.hxx6
3 files changed, 20 insertions, 2 deletions
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;