summaryrefslogtreecommitdiff
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
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>
-rw-r--r--basic/source/inc/namecont.hxx18
-rw-r--r--basic/source/uno/namecont.cxx19
-rw-r--r--comphelper/Library_comphelper.mk1
-rw-r--r--comphelper/source/misc/listenernotification.cxx114
-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
-rw-r--r--forms/Library_frm.mk1
-rw-r--r--forms/source/component/DatabaseForm.cxx24
-rw-r--r--forms/source/component/DatabaseForm.hxx3
-rw-r--r--forms/source/inc/listenercontainers.hxx110
-rw-r--r--forms/source/misc/listenercontainers.cxx58
-rw-r--r--include/comphelper/listenernotification.hxx266
-rw-r--r--reportdesign/source/ui/inc/GeometryHandler.hxx6
-rw-r--r--reportdesign/source/ui/inspection/GeometryHandler.cxx16
-rw-r--r--sd/source/ui/slideshow/slideshowviewimpl.cxx110
-rw-r--r--sd/source/ui/slideshow/slideshowviewimpl.hxx30
-rw-r--r--solenv/clang-format/excludelist2
22 files changed, 112 insertions, 726 deletions
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 6a3b020d00a4..11c5febe0a04 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -50,7 +50,6 @@
#include <cppuhelper/basemutex.hxx>
#include <rtl/ref.hxx>
#include <comphelper/interfacecontainer3.hxx>
-#include <comphelper/listenernotification.hxx>
#include <xmlscript/xmllib_imexp.hxx>
#include <comphelper/interfacecontainer3.hxx>
@@ -158,21 +157,8 @@ public:
};
-typedef ::comphelper::OListenerContainerBase<
- css::script::vba::XVBAScriptListener,
- css::script::vba::VBAScriptEvent > VBAScriptListenerContainer_BASE;
-
-class VBAScriptListenerContainer final : public VBAScriptListenerContainer_BASE
-{
-public:
- explicit VBAScriptListenerContainer( ::osl::Mutex& rMutex );
-
-private:
- virtual bool implTypedNotify(
- const css::uno::Reference< css::script::vba::XVBAScriptListener >& rxListener,
- const css::script::vba::VBAScriptEvent& rEvent ) override;
-};
-
+typedef ::comphelper::OInterfaceContainerHelper3<
+ css::script::vba::XVBAScriptListener > VBAScriptListenerContainer;
class SfxLibrary;
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index 87b33ea9be66..b92f5a590617 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -338,17 +338,6 @@ void ModifiableHelper::setModified( bool _bModified )
}
-VBAScriptListenerContainer::VBAScriptListenerContainer( ::osl::Mutex& rMutex ) :
- VBAScriptListenerContainer_BASE( rMutex )
-{
-}
-
-bool VBAScriptListenerContainer::implTypedNotify( const Reference< vba::XVBAScriptListener >& rxListener, const vba::VBAScriptEvent& rEvent )
-{
- rxListener->notifyVBAScriptEvent( rEvent );
- return true; // notify all other listeners too
-}
-
// Ctor
SfxLibraryContainer::SfxLibraryContainer()
: SfxLibraryContainer_BASE( m_aMutex )
@@ -2675,7 +2664,7 @@ void SAL_CALL SfxLibraryContainer::disposing()
{
Reference< XModel > xModel = mxOwnerDocument;
EventObject aEvent( xModel );
- maVBAScriptListeners.disposing( aEvent );
+ maVBAScriptListeners.disposeAndClear( aEvent );
stopAllComponentListening();
mxOwnerDocument.clear();
}
@@ -2850,12 +2839,12 @@ sal_Int32 SAL_CALL SfxLibraryContainer::getRunningVBAScripts()
void SAL_CALL SfxLibraryContainer::addVBAScriptListener( const Reference< vba::XVBAScriptListener >& rxListener )
{
- maVBAScriptListeners.addTypedListener( rxListener );
+ maVBAScriptListeners.addInterface( rxListener );
}
void SAL_CALL SfxLibraryContainer::removeVBAScriptListener( const Reference< vba::XVBAScriptListener >& rxListener )
{
- maVBAScriptListeners.removeTypedListener( rxListener );
+ maVBAScriptListeners.removeInterface( rxListener );
}
void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifier, const OUString& rModuleName )
@@ -2875,7 +2864,7 @@ void SAL_CALL SfxLibraryContainer::broadcastVBAScriptEvent( sal_Int32 nIdentifie
Reference< XModel > xModel = mxOwnerDocument; // weak-ref -> ref
vba::VBAScriptEvent aEvent( Reference<XInterface>(xModel, UNO_QUERY), nIdentifier, rModuleName );
- maVBAScriptListeners.notify( aEvent );
+ maVBAScriptListeners.notifyEach( &css::script::vba::XVBAScriptListener::notifyVBAScriptEvent, aEvent );
}
// Methods XServiceInfo
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 1da5e7daa658..c4d9e4587f3c 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -108,7 +108,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/hash \
comphelper/source/misc/instancelocker \
comphelper/source/misc/interaction \
- comphelper/source/misc/listenernotification \
comphelper/source/misc/logging \
comphelper/source/misc/lok \
comphelper/source/misc/mimeconfighelper \
diff --git a/comphelper/source/misc/listenernotification.cxx b/comphelper/source/misc/listenernotification.cxx
deleted file mode 100644
index 4bb4e7f619a0..000000000000
--- a/comphelper/source/misc/listenernotification.cxx
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <comphelper/listenernotification.hxx>
-
-#include <com/sun/star/lang/XEventListener.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <osl/diagnose.h>
-
-
-namespace comphelper
-{
-
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
-
- OListenerContainer::OListenerContainer( ::osl::Mutex& _rMutex )
- :m_aListeners( _rMutex )
- {
- }
-
- OListenerContainer::~OListenerContainer() {}
-
-
- void OListenerContainer::impl_addListener( const Reference< XEventListener >& _rxListener )
- {
- OSL_PRECOND( _rxListener.is(), "OListenerContainer::impl_addListener: a NULL listener?!" );
- if ( _rxListener.is() )
- m_aListeners.addInterface( _rxListener );
- }
-
-
- void OListenerContainer::impl_removeListener( const Reference< XEventListener >& _rxListener )
- {
-#if OSL_DEBUG_LEVEL > 0
- ::comphelper::OInterfaceIteratorHelper2 aIter( m_aListeners );
- bool bFound = false;
- while ( aIter.hasMoreElements() && !bFound )
- {
- bFound = ( Reference< XInterface >( aIter.next() ) == _rxListener );
- }
- OSL_ENSURE( bFound, "OListenerContainer::impl_removeListener: sure your listener handling is correct? The given listener is not registered!" );
-#endif
- m_aListeners.removeInterface( _rxListener );
- }
-
-
- void OListenerContainer::disposing( const EventObject& _rEventSource )
- {
- m_aListeners.disposeAndClear( _rEventSource );
- }
-
-
- void OListenerContainer::clear()
- {
- m_aListeners.clear();
- }
-
-
- bool OListenerContainer::impl_notify( const EventObject& _rEvent )
- {
- ::comphelper::OInterfaceIteratorHelper2 aIter( m_aListeners );
- bool bCancelled = false;
- while ( aIter.hasMoreElements() && !bCancelled )
- {
- Reference< XEventListener > xListener( static_cast< XEventListener* >( aIter.next() ) );
- if ( !xListener.is() )
- continue;
-
- try
- {
- bCancelled = !implNotify( xListener, _rEvent );
- }
- catch( const DisposedException& e )
- {
- // DisposedExceptions from the listener might indicate a
- // broken connection to a different environment.
-
- OSL_ENSURE( e.Context.is(), "OListenerContainer::impl_notify: caught dispose exception with empty Context field" );
-
- // If the exception stems from the listener then remove it
- // from the list of listeners. If the Context field of the
- // exception is empty this is interpreted to indicate the
- // listener as well.
- if ( e.Context == xListener || !e.Context.is() )
- aIter.remove();
- }
- }
-
- return !bCancelled;
- }
-
-
-} // namespace comphelper
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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
diff --git a/forms/Library_frm.mk b/forms/Library_frm.mk
index 834a2a4eb91f..5739c28c0c80 100644
--- a/forms/Library_frm.mk
+++ b/forms/Library_frm.mk
@@ -106,7 +106,6 @@ $(eval $(call gb_Library_add_exception_objects,frm,\
forms/source/misc/componenttools \
forms/source/misc/InterfaceContainer \
forms/source/misc/limitedformats \
- forms/source/misc/listenercontainers \
forms/source/misc/property \
forms/source/resource/frm_resource \
forms/source/richtext/attributedispatcher \
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx
index c9281843326c..3aefbd798ade 100644
--- a/forms/source/component/DatabaseForm.cxx
+++ b/forms/source/component/DatabaseForm.cxx
@@ -229,7 +229,7 @@ ODatabaseForm::ODatabaseForm(const Reference<XComponentContext>& _rxContext)
,m_aRowSetApproveListeners(m_aMutex)
,m_aSubmitListeners(m_aMutex)
,m_aErrorListeners(m_aMutex)
- ,m_aResetListeners( *this, m_aMutex )
+ ,m_aResetListeners(m_aMutex)
,m_aPropertyBagHelper( *this )
,m_aParameterManager( m_aMutex, _rxContext )
,m_aFilterManager()
@@ -263,7 +263,7 @@ ODatabaseForm::ODatabaseForm( const ODatabaseForm& _cloneSource )
,m_aRowSetApproveListeners( m_aMutex )
,m_aSubmitListeners( m_aMutex )
,m_aErrorListeners( m_aMutex )
- ,m_aResetListeners( *this, m_aMutex )
+ ,m_aResetListeners( m_aMutex )
,m_aPropertyBagHelper( *this )
,m_aParameterManager( m_aMutex, _cloneSource.m_xContext )
,m_aFilterManager()
@@ -1220,7 +1220,7 @@ void ODatabaseForm::disposing()
EventObject aEvt(static_cast<XWeak*>(this));
m_aLoadListeners.disposeAndClear(aEvt);
m_aRowSetApproveListeners.disposeAndClear(aEvt);
- m_aResetListeners.disposing();
+ m_aResetListeners.disposeAndClear(aEvt);
m_aSubmitListeners.disposeAndClear(aEvt);
m_aErrorListeners.disposeAndClear(aEvt);
@@ -1893,7 +1893,7 @@ void SAL_CALL ODatabaseForm::reset()
return;
}
- if ( !m_aResetListeners.empty() )
+ if ( m_aResetListeners.getLength() )
{
::osl::MutexGuard aResetGuard(m_aResetSafety);
++m_nResetsPending;
@@ -1921,8 +1921,13 @@ void SAL_CALL ODatabaseForm::reset()
void ODatabaseForm::reset_impl(bool _bApproveByListeners)
{
if ( _bApproveByListeners )
- if ( !m_aResetListeners.approveReset() )
- return;
+ {
+ ::comphelper::OInterfaceIteratorHelper3 aIter(m_aResetListeners);
+ EventObject aEvent(*this);
+ while (aIter.hasMoreElements())
+ if (!aIter.next()->approveReset(aEvent))
+ return;
+ }
::osl::ResettableMutexGuard aResetGuard(m_aResetSafety);
// do we have a database connected form and stay on the insert row
@@ -2026,7 +2031,8 @@ void ODatabaseForm::reset_impl(bool _bApproveByListeners)
aResetGuard.clear();
{
- m_aResetListeners.resetted();
+ css::lang::EventObject aEvent( *this );
+ m_aResetListeners.notifyEach(&css::form::XResetListener::resetted, aEvent);
}
aResetGuard.reset();
@@ -2041,13 +2047,13 @@ void ODatabaseForm::reset_impl(bool _bApproveByListeners)
void SAL_CALL ODatabaseForm::addResetListener(const Reference<XResetListener>& _rListener)
{
- m_aResetListeners.addTypedListener( _rListener );
+ m_aResetListeners.addInterface( _rListener );
}
void SAL_CALL ODatabaseForm::removeResetListener(const Reference<XResetListener>& _rListener)
{
- m_aResetListeners.removeTypedListener( _rListener );
+ m_aResetListeners.removeInterface( _rListener );
}
diff --git a/forms/source/component/DatabaseForm.hxx b/forms/source/component/DatabaseForm.hxx
index a0ad6e3b86ae..7d6b86e03277 100644
--- a/forms/source/component/DatabaseForm.hxx
+++ b/forms/source/component/DatabaseForm.hxx
@@ -62,7 +62,6 @@
#include <connectivity/filtermanager.hxx>
#include <connectivity/warningscontainer.hxx>
-#include <listenercontainers.hxx>
#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/propmultiplex.hxx>
#include <comphelper/uno3.hxx>
@@ -154,7 +153,7 @@ class ODatabaseForm :public OFormComponents
::comphelper::OInterfaceContainerHelper3<css::sdb::XRowSetApproveListener> m_aRowSetApproveListeners;
::comphelper::OInterfaceContainerHelper3<css::form::XSubmitListener> m_aSubmitListeners;
::comphelper::OInterfaceContainerHelper3<css::sdb::XSQLErrorListener> m_aErrorListeners;
- ResetListeners m_aResetListeners;
+ ::comphelper::OInterfaceContainerHelper3<css::form::XResetListener> m_aResetListeners;
::osl::Mutex m_aResetSafety;
css::uno::Any m_aCycle;
css::uno::Any m_aIgnoreResult; // set when we are a subform and our master form positioned on a new row
diff --git a/forms/source/inc/listenercontainers.hxx b/forms/source/inc/listenercontainers.hxx
deleted file mode 100644
index f7b0cbb88579..000000000000
--- a/forms/source/inc/listenercontainers.hxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#pragma once
-
-#include <com/sun/star/form/XResetListener.hpp>
-#include <comphelper/listenernotification.hxx>
-#include <cppuhelper/weak.hxx>
-
-
-namespace frm
-{
-
- template < class LISTENER >
- class EventListeners : public ::comphelper::OListenerContainerBase< LISTENER, css::lang::EventObject >
- {
- public:
- typedef ::comphelper::OListenerContainerBase< LISTENER, css::lang::EventObject >
- EventListeners_Base;
-
- private:
- ::cppu::OWeakObject& m_rInstigator;
-
- protected:
- EventListeners( ::cppu::OWeakObject& _rInstigator, ::osl::Mutex& _rMutex )
- :EventListeners_Base( _rMutex )
- ,m_rInstigator( _rInstigator )
- {
- }
-
- public:
- bool notify()
- {
- css::lang::EventObject aEvent( m_rInstigator );
- return EventListeners_Base::notify( aEvent );
- }
-
- void disposing()
- {
- css::lang::EventObject aEvent( m_rInstigator );
- EventListeners_Base::disposing( aEvent );
- }
- protected:
- using EventListeners_Base::notify;
- using EventListeners_Base::disposing;
- };
-
- typedef EventListeners < css::form::XResetListener
- > ResetListeners_Base;
- class ResetListeners : public ResetListeners_Base
- {
- private:
- enum NotificationType
- {
- eApproval,
- eFinal
- };
- NotificationType m_eCurrentNotificationType;
-
- public:
- ResetListeners( ::cppu::OWeakObject& _rInstigator, ::osl::Mutex& _rMutex )
- :ResetListeners_Base( _rInstigator, _rMutex )
- ,m_eCurrentNotificationType( eApproval )
- {
- }
-
- /** see whether all our listeners approve the reset
- */
- bool approveReset()
- {
- m_eCurrentNotificationType = eApproval;
- return notify();
- }
-
- /** tell all our listeners that the reset happened
- */
- void resetted()
- {
- m_eCurrentNotificationType = eFinal;
- notify();
- }
-
- protected:
- virtual bool implTypedNotify(
- const css::uno::Reference< css::form::XResetListener >& _rxListener,
- const css::lang::EventObject& _rEvent
- ) override;
- };
-
-
-} // namespace frm
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/forms/source/misc/listenercontainers.cxx b/forms/source/misc/listenercontainers.cxx
deleted file mode 100644
index 13adf3e612ad..000000000000
--- a/forms/source/misc/listenercontainers.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <listenercontainers.hxx>
-#include <osl/diagnose.h>
-
-
-namespace frm
-{
-
-
- using namespace ::com::sun::star::uno;
- using namespace ::com::sun::star::lang;
- using namespace ::com::sun::star::form;
-
-
- //= ResetListeners
-
-
- bool ResetListeners::implTypedNotify( const Reference< XResetListener >& _rxListener,
- const EventObject& _rEvent )
- {
- switch ( m_eCurrentNotificationType )
- {
- case eApproval:
- if ( !_rxListener->approveReset( _rEvent ) )
- return false;
- return true;
- case eFinal:
- _rxListener->resetted( _rEvent );
- break;
- default:
- OSL_FAIL( "ResetListeners::implNotify: invalid notification type!" );
- }
- return true;
- }
-
-
-} // namespace frm
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/comphelper/listenernotification.hxx b/include/comphelper/listenernotification.hxx
deleted file mode 100644
index 15f1ca64b980..000000000000
--- a/include/comphelper/listenernotification.hxx
+++ /dev/null
@@ -1,266 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_COMPHELPER_LISTENERNOTIFICATION_HXX
-#define INCLUDED_COMPHELPER_LISTENERNOTIFICATION_HXX
-
-#include <comphelper/interfacecontainer2.hxx>
-
-#include <com/sun/star/lang/EventObject.hpp>
-#include <comphelper/comphelperdllapi.h>
-
-#include <memory>
-
-namespace com::sun::star::lang { class XEventListener; }
-
-namespace comphelper
-{
-
-
- //= OListenerContainer
-
- /** abstract base class which manages a listener container, including
- THB's listener notification pattern which cares for removing listeners
- which throw a DisposedException upon notification
-
- Using this class is pretty easy:
- <ul>
- <li>Derive from it, and overwrite implNotify.</li>
- <li>Use <member>impl_addListener</member> and <member>impl_removeListener</member> in your
- XFoo::addFooListener and XFoo::removeFooListener methods.</li>
- <li>call <member>impl_notify</member> whenever the event you want to notify happened</li>
- <li>call <member>disposing</member> upon the disposal of your broadcaster.</li>
- </ul>
-
- See OListenerContainerBase for an implementation which even saves
- you some more work, by doing the casts for you.
-
- @see http://www.openoffice.org/servlets/ReadMsg?list=interface-announce&msgId=494345
- @see OListenerContainerBase
- */
- class COMPHELPER_DLLPUBLIC OListenerContainer
- {
- private:
- ::comphelper::OInterfaceContainerHelper2 m_aListeners;
-
- public:
- /** sends a XEventObject::disposing notification to all listeners, and clears the
- listener container
-
- You'll usually call this from within your own dispose/disposing method
- */
- void disposing( const css::lang::EventObject& _rEventSource );
-
- /** clears the container without calling <member scope="css::lang">XEventListener::disposing</member>
- at the listeners
- */
- void clear();
-
- /** determines whether the listener container is currently empty
- */
- inline bool
- empty() const;
-
- /** creates an iterator for looping through all registered listeners
- */
- ::comphelper::OInterfaceIteratorHelper2 createIterator()
- {
- return ::comphelper::OInterfaceIteratorHelper2( m_aListeners );
- }
-
- protected:
- OListenerContainer( ::osl::Mutex& _rMutex );
-
- virtual ~OListenerContainer();
-
- void impl_addListener( const css::uno::Reference< css::lang::XEventListener >& _rxListener );
- void impl_removeListener( const css::uno::Reference< css::lang::XEventListener >& _rxListener );
-
- /** notifies all listeners of the given event, using THB's notification pattern
-
- internally, this method will call <member>implNotify</member> for every listener
-
- @return
- <TRUE/> if all listeners have been notified, <FALSE/> else. The latter can happen
- if <member>implNotify</member> cancels the notification loop.
-
- @see implNotify
- */
- bool impl_notify( const css::lang::EventObject& _rEvent );
-
- protected:
- /** call a single listener
-
- @pure
-
- @throws css::uno::Exception
- if the listener throws an exception during notification. Please don't catch
- any listener exceptions in your implementation of this method, simply let them
- pass to the caller.
-
- @param _rxListener
- specifies the listener to call. Is guaranteed to not be <NULL/>
- @param _rEvent
- the event to broadcast. This is the same as passed to <member>notify</member>, so if
- your base class knows the type passed into <member>notify</member>, it can safely assume
- that <arg>_rEvent</arg> is also of this type.
-
- @return
- <TRUE/> if the remaining listeners should be called, <FALSE/> if the notification
- loop should be cancelled
-
- @see notify
- */
- virtual bool implNotify(
- const css::uno::Reference< css::lang::XEventListener >& _rxListener,
- const css::lang::EventObject& _rEvent
- ) = 0;
- };
-
-
- inline bool OListenerContainer::empty() const
- {
- return ( m_aListeners.getLength() == 0 );
- }
-
-
- //= OSimpleListenerContainer
-
- /** helper class for simple notification of the form LISTENER::METHOD( EVENT )
-
- This class is not threadsafe!
-
- @param LISTENER
- the listener class to call, e.g. css::lang::XEventListener
- @param EVENT
- the event type to notify, e.g. css::lang::EventObject
- */
- template< class LISTENER, class EVENT >
- class OSimpleListenerContainer final : protected OListenerContainer
- {
- public:
- typedef LISTENER ListenerClass;
- typedef EVENT EventClass;
- typedef void ( SAL_CALL LISTENER::*NotificationMethod )( const EventClass& );
-
- private:
- NotificationMethod m_pNotificationMethod;
-
- public:
- OSimpleListenerContainer( ::osl::Mutex& _rMutex )
- :OListenerContainer( _rMutex )
- ,m_pNotificationMethod( nullptr )
- {
- }
-
- void addListener( const css::uno::Reference< ListenerClass >& _rxListener )
- {
- OListenerContainer::impl_addListener( _rxListener.get() );
- }
-
- void removeListener( const css::uno::Reference< ListenerClass >& _rxListener )
- {
- OListenerContainer::impl_removeListener( _rxListener.get() );
- }
-
- // publish some otherwise hidden base functionality
- using OListenerContainer::disposing;
- using OListenerContainer::clear;
- using OListenerContainer::empty;
- using OListenerContainer::createIterator;
-
- /// typed notification
- inline void notify( const EventClass& _rEvent, NotificationMethod _pNotify );
-
- private:
- virtual bool implNotify(
- const css::uno::Reference< css::lang::XEventListener >& _rxListener,
- const css::lang::EventObject& _rEvent
- ) override
- {
- const EventClass& rTypedEvent( static_cast< const EventClass& >( _rEvent ) );
- ListenerClass* pTypedListener( static_cast< ListenerClass* >( _rxListener.get() ) );
- (pTypedListener->*m_pNotificationMethod)( rTypedEvent );
- return true;
- }
- };
-
-
- template< class LISTENER, class EVENT >
- inline void OSimpleListenerContainer< LISTENER, EVENT >::notify( const EventClass& _rEvent, NotificationMethod _pNotify )
- {
- m_pNotificationMethod = _pNotify;
- OListenerContainer::impl_notify( _rEvent );
- m_pNotificationMethod = nullptr;
- }
-
- //= OListenerContainerBase
-
- /** is a specialization of OListenerContainer which saves you some additional type casts,
- by making the required listener and event types template arguments.
- */
- template< class ListenerClass, class EventClass >
- class OListenerContainerBase : public OListenerContainer
- {
- public:
- OListenerContainerBase( ::osl::Mutex& _rMutex ) : OListenerContainer( _rMutex )
- {
- }
-
- void addTypedListener( const css::uno::Reference< ListenerClass >& _rxListener )
- {
- OListenerContainer::impl_addListener( _rxListener.get() );
- }
-
- void removeTypedListener( const css::uno::Reference< ListenerClass >& _rxListener )
- {
- OListenerContainer::impl_removeListener( _rxListener.get() );
- }
-
- bool notify( const EventClass& _rEvent )
- {
- return OListenerContainer::impl_notify( _rEvent );
- }
-
- using OListenerContainer::impl_notify;
-
- protected:
- virtual bool implNotify(
- const css::uno::Reference< css::lang::XEventListener >& _rxListener,
- const css::lang::EventObject& _rEvent
- ) override
- {
- return implTypedNotify(
- css::uno::Reference< ListenerClass >( static_cast< ListenerClass* >( _rxListener.get() ) ),
- static_cast< const EventClass& >( _rEvent )
- );
- }
-
- virtual bool implTypedNotify(
- const css::uno::Reference< ListenerClass >& _rxListener,
- const EventClass& _rEvent
- ) = 0;
- };
-
-} // namespace comphelper
-
-
-#endif // INCLUDED_COMPHELPER_LISTENERNOTIFICATION_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/reportdesign/source/ui/inc/GeometryHandler.hxx b/reportdesign/source/ui/inc/GeometryHandler.hxx
index 79fb54433238..13d08414c482 100644
--- a/reportdesign/source/ui/inc/GeometryHandler.hxx
+++ b/reportdesign/source/ui/inc/GeometryHandler.hxx
@@ -38,8 +38,8 @@
#include <memory>
#include <string_view>
+#include <comphelper/interfacecontainer3.hxx>
#include <comphelper/stl_types.hxx>
-#include <comphelper/listenernotification.hxx>
namespace rptui
@@ -60,9 +60,7 @@ namespace rptui
class OPropertyInfoService;
typedef ::std::pair< css::uno::Reference< css::report::XFunction>, css::uno::Reference< css::report::XFunctionsSupplier> > TFunctionPair;
typedef ::std::multimap< OUString,TFunctionPair, ::comphelper::UStringMixLess > TFunctions;
- typedef ::comphelper::OSimpleListenerContainer < css::beans::XPropertyChangeListener
- , css::beans::PropertyChangeEvent
- > PropertyChangeListeners;
+ typedef ::comphelper::OInterfaceContainerHelper3< css::beans::XPropertyChangeListener > PropertyChangeListeners;
typedef ::cppu::WeakComponentImplHelper< css::inspection::XPropertyHandler
, css::beans::XPropertyChangeListener
, css::lang::XServiceInfo> GeometryHandler_Base;
diff --git a/reportdesign/source/ui/inspection/GeometryHandler.cxx b/reportdesign/source/ui/inspection/GeometryHandler.cxx
index 26a7878cc0ab..4dd7ac4df9c7 100644
--- a/reportdesign/source/ui/inspection/GeometryHandler.cxx
+++ b/reportdesign/source/ui/inspection/GeometryHandler.cxx
@@ -488,7 +488,7 @@ void SAL_CALL GeometryHandler::setPropertyValue(const OUString & PropertyName, c
m_sScope.clear();
aEvent.NewValue <<= m_sScope;
aGuard.clear();
- m_aPropertyListeners.notify( aEvent, &beans::XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &beans::XPropertyChangeListener::propertyChange, aEvent );
}
else if ( m_nDataFieldType == USER_DEF_FUNCTION )
{
@@ -1242,14 +1242,14 @@ uno::Any SAL_CALL GeometryHandler::convertToControlValue(const OUString & Proper
void SAL_CALL GeometryHandler::addPropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener)
{
::osl::MutexGuard aGuard( m_aMutex );
- m_aPropertyListeners.addListener( _rxListener );
+ m_aPropertyListeners.addInterface( _rxListener );
m_xFormComponentHandler->addPropertyChangeListener(_rxListener);
}
void SAL_CALL GeometryHandler::removePropertyChangeListener(const uno::Reference< beans::XPropertyChangeListener > & _rxListener)
{
::osl::MutexGuard aGuard( m_aMutex );
- m_aPropertyListeners.removeListener( _rxListener );
+ m_aPropertyListeners.removeInterface( _rxListener );
m_xFormComponentHandler->removePropertyChangeListener(_rxListener);
}
@@ -1444,7 +1444,7 @@ inspection::InteractiveSelectionResult SAL_CALL GeometryHandler::onInteractivePr
beans::PropertyChangeEvent aScopeEvent;
aScopeEvent.PropertyName = PROPERTY_FILLCOLOR;
aScopeEvent.NewValue = xShape->getPropertyValue(PROPERTY_FILLCOLOR);
- m_aPropertyListeners.notify( aScopeEvent, &beans::XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &beans::XPropertyChangeListener::propertyChange, aScopeEvent );
}
return eResult;
}
@@ -1954,7 +1954,7 @@ void GeometryHandler::createDefaultFunction(::osl::ResettableMutexGuard& _aGuard
m_xReportComponent->setPropertyValue(PROPERTY_DATAFIELD,uno::makeAny( impl_convertToFormula( uno::makeAny(sQuotedFunctionName) )));
aEvent.NewValue <<= m_sScope;
_aGuard.clear();
- m_aPropertyListeners.notify( aEvent, &beans::XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &beans::XPropertyChangeListener::propertyChange, aEvent );
}
}
catch(uno::Exception&)
@@ -1996,7 +1996,7 @@ void GeometryHandler::resetOwnProperties(::osl::ResettableMutexGuard& _aGuard,co
aScopeEvent.PropertyName = PROPERTY_TYPE;
aScopeEvent.OldValue <<= _nOldDataFieldType;
aScopeEvent.NewValue <<= nNewDataFieldType;
- m_aPropertyListeners.notify( aScopeEvent, &beans::XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &beans::XPropertyChangeListener::propertyChange, aScopeEvent );
}
if ( _sOldFunctionName != sNewFunction )
{
@@ -2005,7 +2005,7 @@ void GeometryHandler::resetOwnProperties(::osl::ResettableMutexGuard& _aGuard,co
aFormulaEvent.OldValue <<= _sOldFunctionName;
aFormulaEvent.NewValue <<= sNewFunction;
- m_aPropertyListeners.notify( aFormulaEvent, &beans::XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &beans::XPropertyChangeListener::propertyChange, aFormulaEvent );
}
if ( _sOldScope != sNewScope )
{
@@ -2013,7 +2013,7 @@ void GeometryHandler::resetOwnProperties(::osl::ResettableMutexGuard& _aGuard,co
aScopeEvent.PropertyName = PROPERTY_SCOPE;
aScopeEvent.OldValue <<= _sOldScope;
aScopeEvent.NewValue <<= sNewScope;
- m_aPropertyListeners.notify( aScopeEvent, &beans::XPropertyChangeListener::propertyChange );
+ m_aPropertyListeners.notifyEach( &beans::XPropertyChangeListener::propertyChange, aScopeEvent );
}
_aGuard.reset();
diff --git a/sd/source/ui/slideshow/slideshowviewimpl.cxx b/sd/source/ui/slideshow/slideshowviewimpl.cxx
index d0829f8f1e8f..c8935469ed95 100644
--- a/sd/source/ui/slideshow/slideshowviewimpl.cxx
+++ b/sd/source/ui/slideshow/slideshowviewimpl.cxx
@@ -109,71 +109,49 @@ void SlideShowViewListeners::disposing( const lang::EventObject& _rEventSource )
maListeners.clear();
}
-// SlideShowViewPaintListeners
-SlideShowViewPaintListeners::SlideShowViewPaintListeners( ::osl::Mutex& rMutex )
-: SlideShowViewPaintListeners_Base( rMutex )
+void SlideShowViewMouseListeners::notify( const WrappedMouseEvent& rEvent )
{
-}
-
-bool SlideShowViewPaintListeners::implTypedNotify( const Reference< awt::XPaintListener >& rListener,
- const awt::PaintEvent& rEvent )
-{
- rListener->windowPaint( rEvent );
- return true; // continue calling listeners
-}
-
-// SlideShowViewMouseListeners
-SlideShowViewMouseListeners::SlideShowViewMouseListeners( ::osl::Mutex& rMutex ) :
- SlideShowViewMouseListeners_Base( rMutex )
-{
-}
-
-bool SlideShowViewMouseListeners::implTypedNotify( const Reference< awt::XMouseListener >& rListener,
- const WrappedMouseEvent& rEvent )
-{
- switch( rEvent.meType )
- {
- case WrappedMouseEvent::PRESSED:
- rListener->mousePressed( rEvent.maEvent );
- break;
-
- case WrappedMouseEvent::RELEASED:
- rListener->mouseReleased( rEvent.maEvent );
- break;
+ forEach(
+ [&rEvent] (const Reference<css::awt::XMouseListener>& rListener)
+ {
+ switch( rEvent.meType )
+ {
+ case WrappedMouseEvent::PRESSED:
+ rListener->mousePressed( rEvent.maEvent );
+ break;
- case WrappedMouseEvent::ENTERED:
- rListener->mouseEntered( rEvent.maEvent );
- break;
+ case WrappedMouseEvent::RELEASED:
+ rListener->mouseReleased( rEvent.maEvent );
+ break;
- case WrappedMouseEvent::EXITED:
- rListener->mouseExited( rEvent.maEvent );
- break;
- }
+ case WrappedMouseEvent::ENTERED:
+ rListener->mouseEntered( rEvent.maEvent );
+ break;
- return true; // continue calling listeners
+ case WrappedMouseEvent::EXITED:
+ rListener->mouseExited( rEvent.maEvent );
+ break;
+ }
+ });
}
-// SlideShowViewMouseMotionListeners
-SlideShowViewMouseMotionListeners::SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex ) :
- SlideShowViewMouseMotionListeners_Base( rMutex )
-{
-}
-bool SlideShowViewMouseMotionListeners::implTypedNotify( const Reference< awt::XMouseMotionListener >& rListener,
- const WrappedMouseMotionEvent& rEvent )
+void SlideShowViewMouseMotionListeners::notify( const WrappedMouseMotionEvent& rEvent )
{
- switch( rEvent.meType )
- {
- case WrappedMouseMotionEvent::DRAGGED:
- rListener->mouseDragged( rEvent.maEvent );
- break;
-
- case WrappedMouseMotionEvent::MOVED:
- rListener->mouseMoved( rEvent.maEvent );
- break;
- }
+ forEach(
+ [&rEvent] (const Reference< awt::XMouseMotionListener >& rListener)
+ {
+ switch( rEvent.meType )
+ {
+ case WrappedMouseMotionEvent::DRAGGED:
+ rListener->mouseDragged( rEvent.maEvent );
+ break;
- return true; // continue calling listeners
+ case WrappedMouseMotionEvent::MOVED:
+ rListener->mouseMoved( rEvent.maEvent );
+ break;
+ }
+ });
}
// SlideShowView
@@ -247,17 +225,17 @@ void SAL_CALL SlideShowView::disposing( const lang::EventObject& )
}
if (mpPaintListeners != nullptr)
{
- mpPaintListeners->disposing( evt );
+ mpPaintListeners->disposeAndClear( evt );
mpPaintListeners.reset();
}
if (mpMouseListeners != nullptr)
{
- mpMouseListeners->disposing( evt );
+ mpMouseListeners->disposeAndClear( evt );
mpMouseListeners.reset();
}
if (mpMouseMotionListeners != nullptr)
{
- mpMouseMotionListeners->disposing( evt );
+ mpMouseMotionListeners->disposeAndClear( evt );
mpMouseMotionListeners.reset();
}
}
@@ -280,7 +258,7 @@ void SlideShowView::paint( const awt::PaintEvent& e )
// with view
awt::PaintEvent aEvent( e );
aEvent.Source = static_cast< ::cppu::OWeakObject* >( this );
- mpPaintListeners->notify( aEvent );
+ mpPaintListeners->notifyEach( &css::awt::XPaintListener::windowPaint, aEvent );
updateimpl( aGuard, mpSlideShow ); // warning: clears guard!
}
}
@@ -401,7 +379,7 @@ void SAL_CALL SlideShowView::addPaintListener( const Reference< awt::XPaintListe
::osl::MutexGuard aGuard( m_aMutex );
if (mpPaintListeners)
- mpPaintListeners->addTypedListener( xListener );
+ mpPaintListeners->addInterface( xListener );
}
void SAL_CALL SlideShowView::removePaintListener( const Reference< awt::XPaintListener >& xListener )
@@ -409,7 +387,7 @@ void SAL_CALL SlideShowView::removePaintListener( const Reference< awt::XPaintLi
::osl::MutexGuard aGuard( m_aMutex );
if (mpPaintListeners)
- mpPaintListeners->removeTypedListener( xListener );
+ mpPaintListeners->removeInterface( xListener );
}
void SAL_CALL SlideShowView::addMouseListener( const Reference< awt::XMouseListener >& xListener )
@@ -417,7 +395,7 @@ void SAL_CALL SlideShowView::addMouseListener( const Reference< awt::XMouseListe
::osl::MutexGuard aGuard( m_aMutex );
if (mpMouseListeners)
- mpMouseListeners->addTypedListener( xListener );
+ mpMouseListeners->addInterface( xListener );
}
void SAL_CALL SlideShowView::removeMouseListener( const Reference< awt::XMouseListener >& xListener )
@@ -425,7 +403,7 @@ void SAL_CALL SlideShowView::removeMouseListener( const Reference< awt::XMouseLi
::osl::MutexGuard aGuard( m_aMutex );
if (mpMouseListeners)
- mpMouseListeners->removeTypedListener( xListener );
+ mpMouseListeners->removeInterface( xListener );
}
void SAL_CALL SlideShowView::addMouseMotionListener( const Reference< awt::XMouseMotionListener >& xListener )
@@ -441,7 +419,7 @@ void SAL_CALL SlideShowView::addMouseMotionListener( const Reference< awt::XMous
}
if (mpMouseMotionListeners)
- mpMouseMotionListeners->addTypedListener( xListener );
+ mpMouseMotionListeners->addInterface( xListener );
}
void SAL_CALL SlideShowView::removeMouseMotionListener( const Reference< awt::XMouseMotionListener >& xListener )
@@ -449,7 +427,7 @@ void SAL_CALL SlideShowView::removeMouseMotionListener( const Reference< awt::XM
::osl::MutexGuard aGuard( m_aMutex );
if (mpMouseMotionListeners)
- mpMouseMotionListeners->removeTypedListener( xListener );
+ mpMouseMotionListeners->removeInterface( xListener );
// TODO(P1): Might be nice to deregister for mouse motion
// events, when the last listener is gone.
diff --git a/sd/source/ui/slideshow/slideshowviewimpl.hxx b/sd/source/ui/slideshow/slideshowviewimpl.hxx
index 85e433107c45..0f090ed13d03 100644
--- a/sd/source/ui/slideshow/slideshowviewimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowviewimpl.hxx
@@ -22,7 +22,7 @@
#include <memory>
#include <cppuhelper/compbase.hxx>
#include <cppuhelper/basemutex.hxx>
-#include <comphelper/listenernotification.hxx>
+#include <comphelper/interfacecontainer3.hxx>
#include <com/sun/star/awt/XWindowListener.hpp>
#include <com/sun/star/util/XModifyListener.hpp>
#include <com/sun/star/awt/XPaintListener.hpp>
@@ -86,44 +86,30 @@ private:
};
// SlideShowViewPaintListeners
-typedef ::comphelper::OListenerContainerBase< css::awt::XPaintListener,
- css::awt::PaintEvent > SlideShowViewPaintListeners_Base;
+typedef ::comphelper::OInterfaceContainerHelper3< css::awt::XPaintListener > SlideShowViewPaintListeners;
-class SlideShowViewPaintListeners : public SlideShowViewPaintListeners_Base
-{
-public:
- SlideShowViewPaintListeners( ::osl::Mutex& rMutex );
-
-protected:
- virtual bool implTypedNotify( const css::uno::Reference< css::awt::XPaintListener >& rListener, const css::awt::PaintEvent& rEvent ) override;
-};
// SlideShowViewMouseListeners
-typedef ::comphelper::OListenerContainerBase< css::awt::XMouseListener, WrappedMouseEvent > SlideShowViewMouseListeners_Base;
+typedef ::comphelper::OInterfaceContainerHelper3< css::awt::XMouseListener > SlideShowViewMouseListeners_Base;
class SlideShowViewMouseListeners : public SlideShowViewMouseListeners_Base
{
public:
- SlideShowViewMouseListeners( ::osl::Mutex& rMutex );
+ SlideShowViewMouseListeners( ::osl::Mutex& rMutex ) : SlideShowViewMouseListeners_Base(rMutex) {}
-protected:
- virtual bool implTypedNotify( const css::uno::Reference< css::awt::XMouseListener >& rListener,
- const WrappedMouseEvent& rEvent ) override;
+ void notify(const WrappedMouseEvent& rEvent);
};
// SlideShowViewMouseMotionListeners
-typedef ::comphelper::OListenerContainerBase< css::awt::XMouseMotionListener,
- WrappedMouseMotionEvent > SlideShowViewMouseMotionListeners_Base;
+typedef ::comphelper::OInterfaceContainerHelper3< css::awt::XMouseMotionListener > SlideShowViewMouseMotionListeners_Base;
class SlideShowViewMouseMotionListeners : public SlideShowViewMouseMotionListeners_Base
{
public:
- SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex );
+ SlideShowViewMouseMotionListeners( ::osl::Mutex& rMutex ) : SlideShowViewMouseMotionListeners_Base(rMutex) {}
-protected:
- virtual bool implTypedNotify( const css::uno::Reference< css::awt::XMouseMotionListener >& rListener,
- const WrappedMouseMotionEvent& rEvent ) override;
+ void notify( const WrappedMouseMotionEvent& rEvent );
};
// SlideShowView
diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist
index 2448a00b08f9..0c2f856a2187 100644
--- a/solenv/clang-format/excludelist
+++ b/solenv/clang-format/excludelist
@@ -1398,7 +1398,6 @@ comphelper/source/misc/hash.cxx
comphelper/source/misc/instancelocker.cxx
comphelper/source/misc/instancelocker.hxx
comphelper/source/misc/interaction.cxx
-comphelper/source/misc/listenernotification.cxx
comphelper/source/misc/logging.cxx
comphelper/source/misc/lok.cxx
comphelper/source/misc/mimeconfighelper.cxx
@@ -4954,7 +4953,6 @@ include/comphelper/guarding.hxx
include/comphelper/hash.hxx
include/comphelper/interaction.hxx
include/comphelper/interfacecontainer2.hxx
-include/comphelper/listenernotification.hxx
include/comphelper/logging.hxx
include/comphelper/mimeconfighelper.hxx
include/comphelper/namedvaluecollection.hxx