summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-12-03 09:38:14 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-03 20:42:00 +0100
commitf9f5c9f0d6af2cb2f39d5bc1513216b8d892977c (patch)
tree38a38137eb99b1177e5dd85d0e948388307e850d /extensions
parentff2068892d88091b26f3a3c034bcca49727d5840 (diff)
replace comphelper::OListenerContainer with OInterfaceContainerHelper3
OInterfaceContainerHelper3 is in wide use and can do the same thing with less ceremony Change-Id: I5252738d6b7bda6245c66da46352944ead79bd52 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126271 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/propctrlr/eformshelper.cxx21
-rw-r--r--extensions/source/propctrlr/eventhandler.cxx6
-rw-r--r--extensions/source/propctrlr/formgeometryhandler.cxx1
-rw-r--r--extensions/source/propctrlr/genericpropertyhandler.hxx1
-rw-r--r--extensions/source/propctrlr/pcrcommon.hxx7
-rw-r--r--extensions/source/propctrlr/propertycomposer.cxx8
-rw-r--r--extensions/source/propctrlr/propertyhandler.cxx16
7 files changed, 28 insertions, 32 deletions
diff --git a/extensions/source/propctrlr/eformshelper.cxx b/extensions/source/propctrlr/eformshelper.cxx
index ff0a91e0e518..c880f096b4b2 100644
--- a/extensions/source/propctrlr/eformshelper.cxx
+++ b/extensions/source/propctrlr/eformshelper.cxx
@@ -241,10 +241,10 @@ namespace pcr
{
if ( !_bDoListen )
{
- ::comphelper::OInterfaceIteratorHelper2 aListenerIterator = m_aPropertyListeners.createIterator();
+ ::comphelper::OInterfaceIteratorHelper3 aListenerIterator(m_aPropertyListeners);
while ( aListenerIterator.hasMoreElements() )
{
- PropertyEventTranslation* pTranslator = dynamic_cast< PropertyEventTranslation* >( aListenerIterator.next() );
+ PropertyEventTranslation* pTranslator = dynamic_cast< PropertyEventTranslation* >( aListenerIterator.next().get() );
OSL_ENSURE( pTranslator, "EFormsHelper::impl_toggleBindingPropertyListening_throw: invalid listener element in my container!" );
if ( !pTranslator )
continue;
@@ -255,7 +255,7 @@ namespace pcr
if ( pTranslator->getDelegator() == _rxConcreteListenerOrNull )
{
impl_switchBindingListening_throw( false, xEventSourceTranslator );
- m_aPropertyListeners.removeListener( xEventSourceTranslator );
+ m_aPropertyListeners.removeInterface( xEventSourceTranslator );
break;
}
}
@@ -270,17 +270,14 @@ namespace pcr
if ( _rxConcreteListenerOrNull.is() )
{
Reference< XPropertyChangeListener > xEventSourceTranslator( new PropertyEventTranslation( _rxConcreteListenerOrNull, m_xBindableControl ) );
- m_aPropertyListeners.addListener( xEventSourceTranslator );
+ m_aPropertyListeners.addInterface( xEventSourceTranslator );
impl_switchBindingListening_throw( true, xEventSourceTranslator );
}
else
{
- ::comphelper::OInterfaceIteratorHelper2 aListenerIterator = m_aPropertyListeners.createIterator();
+ ::comphelper::OInterfaceIteratorHelper3 aListenerIterator(m_aPropertyListeners);
while ( aListenerIterator.hasMoreElements() )
- {
- Reference< XPropertyChangeListener > xListener( aListenerIterator.next(), UNO_QUERY );
- impl_switchBindingListening_throw( true, xListener );
- }
+ impl_switchBindingListening_throw( true, aListenerIterator.next() );
}
}
}
@@ -702,7 +699,7 @@ namespace pcr
void EFormsHelper::firePropertyChange( const OUString& _rName, const Any& _rOldValue, const Any& _rNewValue ) const
{
- if ( m_aPropertyListeners.empty() )
+ if ( m_aPropertyListeners.getLength() == 0 )
return;
if ( _rOldValue == _rNewValue )
@@ -717,7 +714,7 @@ namespace pcr
aEvent.OldValue = _rOldValue;
aEvent.NewValue = _rNewValue;
- const_cast< EFormsHelper* >( this )->m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange );
+ const_cast< EFormsHelper* >( this )->m_aPropertyListeners.notifyEach( &XPropertyChangeListener::propertyChange, aEvent );
}
catch( const Exception& )
{
@@ -728,7 +725,7 @@ namespace pcr
void EFormsHelper::firePropertyChanges( const Reference< XPropertySet >& _rxOldProps, const Reference< XPropertySet >& _rxNewProps, std::set< OUString >& _rFilter ) const
{
- if ( m_aPropertyListeners.empty() )
+ if ( m_aPropertyListeners.getLength() == 0 )
return;
try
diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx
index 34b07b5888ac..5939110d0ede 100644
--- a/extensions/source/propctrlr/eventhandler.cxx
+++ b/extensions/source/propctrlr/eventhandler.cxx
@@ -541,7 +541,7 @@ namespace pcr
aEvent.PropertyName = _rPropertyName;
aEvent.OldValue <<= aOldScriptEvent;
aEvent.NewValue <<= aNewScriptEvent;
- m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &XPropertyChangeListener::propertyChange, aEvent );
}
Any SAL_CALL EventHandler::convertToPropertyValue( const OUString& _rPropertyName, const Any& _rControlValue )
@@ -642,13 +642,13 @@ namespace pcr
::osl::MutexGuard aGuard( m_aMutex );
if ( !_rxListener.is() )
throw NullPointerException();
- m_aPropertyListeners.addListener( _rxListener );
+ m_aPropertyListeners.addInterface( _rxListener );
}
void SAL_CALL EventHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener )
{
::osl::MutexGuard aGuard( m_aMutex );
- m_aPropertyListeners.removeListener( _rxListener );
+ m_aPropertyListeners.removeInterface( _rxListener );
}
Sequence< Property > SAL_CALL EventHandler::getSupportedProperties()
diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx
index f33ee1a6df78..356a694dc513 100644
--- a/extensions/source/propctrlr/formgeometryhandler.cxx
+++ b/extensions/source/propctrlr/formgeometryhandler.cxx
@@ -41,6 +41,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/interfacecontainer.hxx>
+#include <comphelper/interfacecontainer2.hxx>
#include <comphelper/componentbase.hxx>
#include <rtl/ref.hxx>
#include <tools/diagnose_ex.h>
diff --git a/extensions/source/propctrlr/genericpropertyhandler.hxx b/extensions/source/propctrlr/genericpropertyhandler.hxx
index 152279347a7a..b2114be3cc5e 100644
--- a/extensions/source/propctrlr/genericpropertyhandler.hxx
+++ b/extensions/source/propctrlr/genericpropertyhandler.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/inspection/XPropertyHandler.hpp>
#include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <comphelper/interfacecontainer2.hxx>
#include <cppuhelper/compbase.hxx>
#include <rtl/ref.hxx>
diff --git a/extensions/source/propctrlr/pcrcommon.hxx b/extensions/source/propctrlr/pcrcommon.hxx
index 74cfe6089baa..2ab06e8668de 100644
--- a/extensions/source/propctrlr/pcrcommon.hxx
+++ b/extensions/source/propctrlr/pcrcommon.hxx
@@ -29,9 +29,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/XPropertyChangeListener.hpp>
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
-
-#include <comphelper/listenernotification.hxx>
-
+#include <comphelper/interfacecontainer3.hxx>
namespace pcr
{
@@ -45,8 +43,7 @@ namespace pcr
//= types
- typedef ::comphelper::OSimpleListenerContainer < css::beans::XPropertyChangeListener
- , css::beans::PropertyChangeEvent
+ typedef ::comphelper::OInterfaceContainerHelper3 < css::beans::XPropertyChangeListener
> PropertyChangeListeners;
diff --git a/extensions/source/propctrlr/propertycomposer.cxx b/extensions/source/propctrlr/propertycomposer.cxx
index b19e32fd9ff1..d77280d9fa18 100644
--- a/extensions/source/propctrlr/propertycomposer.cxx
+++ b/extensions/source/propctrlr/propertycomposer.cxx
@@ -186,14 +186,14 @@ namespace pcr
void SAL_CALL PropertyComposer::addPropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener )
{
MethodGuard aGuard( *this );
- m_aPropertyListeners.addListener( _rxListener );
+ m_aPropertyListeners.addInterface( _rxListener );
}
void SAL_CALL PropertyComposer::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener )
{
MethodGuard aGuard( *this );
- m_aPropertyListeners.removeListener( _rxListener );
+ m_aPropertyListeners.removeInterface( _rxListener );
}
@@ -432,14 +432,14 @@ namespace pcr
{
DBG_UNHANDLED_EXCEPTION("extensions.propctrlr");
}
- m_aPropertyListeners.notify( aTranslatedEvent, &XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &XPropertyChangeListener::propertyChange, aTranslatedEvent );
}
void SAL_CALL PropertyComposer::disposing( const EventObject& Source )
{
MethodGuard aGuard( *this );
- m_aPropertyListeners.disposing( Source );
+ m_aPropertyListeners.disposeAndClear( Source );
}
diff --git a/extensions/source/propctrlr/propertyhandler.cxx b/extensions/source/propctrlr/propertyhandler.cxx
index a1817393324f..6c1215524fd2 100644
--- a/extensions/source/propctrlr/propertyhandler.cxx
+++ b/extensions/source/propctrlr/propertyhandler.cxx
@@ -79,11 +79,11 @@ namespace pcr
return;
// remove all old property change listeners
- ::comphelper::OInterfaceIteratorHelper2 removeListener = m_aPropertyListeners.createIterator();
- ::comphelper::OInterfaceIteratorHelper2 readdListener = m_aPropertyListeners.createIterator(); // will copy the container as needed
+ ::comphelper::OInterfaceIteratorHelper3 removeListener(m_aPropertyListeners);
+ ::comphelper::OInterfaceIteratorHelper3 readdListener(m_aPropertyListeners); // will copy the container as needed
while ( removeListener.hasMoreElements() )
- removePropertyChangeListener( static_cast< XPropertyChangeListener* >( removeListener.next() ) );
- OSL_ENSURE( m_aPropertyListeners.empty(), "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" );
+ removePropertyChangeListener( removeListener.next() );
+ OSL_ENSURE( m_aPropertyListeners.getLength() == 0, "PropertyHandler::inspect: derived classes are expected to forward the removePropertyChangeListener call to their base class (me)!" );
// remember the new component, and give derived classes the chance to react on it
m_xComponent = xNewComponent;
@@ -91,7 +91,7 @@ namespace pcr
// add the listeners, again
while ( readdListener.hasMoreElements() )
- addPropertyChangeListener( static_cast< XPropertyChangeListener* >( readdListener.next() ) );
+ addPropertyChangeListener( readdListener.next() );
}
void PropertyHandler::onNewComponent()
@@ -228,13 +228,13 @@ namespace pcr
::osl::MutexGuard aGuard( m_aMutex );
if ( !_rxListener.is() )
throw NullPointerException();
- m_aPropertyListeners.addListener( _rxListener );
+ m_aPropertyListeners.addInterface( _rxListener );
}
void SAL_CALL PropertyHandler::removePropertyChangeListener( const Reference< XPropertyChangeListener >& _rxListener )
{
::osl::MutexGuard aGuard( m_aMutex );
- m_aPropertyListeners.removeListener( _rxListener );
+ m_aPropertyListeners.removeInterface( _rxListener );
}
sal_Bool SAL_CALL PropertyHandler::suspend( sal_Bool /*_bSuspend*/ )
@@ -260,7 +260,7 @@ namespace pcr
aEvent.PropertyName = _rPropName;
aEvent.OldValue = _rOldValue;
aEvent.NewValue = _rNewValue;
- m_aPropertyListeners.notify( aEvent, &XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &XPropertyChangeListener::propertyChange, aEvent );
}
const Property* PropertyHandler::impl_getPropertyFromId_nothrow( PropertyId _nPropId ) const