summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-12-28 21:33:57 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-12-29 19:50:15 +0100
commitf55f46594cf43b46ed092af415a8a3af6972a7cd (patch)
tree48514cbd323498ad2f8392dfdae6c3da52788155 /chart2
parent94fbd711d0184b847ba78b70114ce9bdde04a63b (diff)
use comphelper::WeakComponentImplHelper in RangeHighlighter
Change-Id: I38d14bb253981db18885355c64accaa91c3accd7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127694 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/inc/RangeHighlighter.hxx12
-rw-r--r--chart2/source/tools/RangeHighlighter.cxx15
2 files changed, 12 insertions, 15 deletions
diff --git a/chart2/source/inc/RangeHighlighter.hxx b/chart2/source/inc/RangeHighlighter.hxx
index 43f22d985763..3c9278fc1328 100644
--- a/chart2/source/inc/RangeHighlighter.hxx
+++ b/chart2/source/inc/RangeHighlighter.hxx
@@ -18,8 +18,8 @@
*/
#pragma once
-#include <cppuhelper/basemutex.hxx>
-#include <cppuhelper/compbase.hxx>
+#include <comphelper/compbase.hxx>
+#include <comphelper/interfacecontainer4.hxx>
#include <com/sun/star/chart2/data/XRangeHighlighter.hpp>
#include <com/sun/star/view/XSelectionChangeListener.hpp>
@@ -38,15 +38,14 @@ namespace chart
namespace impl
{
-typedef ::cppu::WeakComponentImplHelper<
+typedef comphelper::WeakComponentImplHelper<
css::chart2::data::XRangeHighlighter,
css::view::XSelectionChangeListener
>
RangeHighlighter_Base;
}
-class RangeHighlighter :
- public cppu::BaseMutex,
+class RangeHighlighter final :
public impl::RangeHighlighter_Base
{
public:
@@ -72,7 +71,7 @@ protected:
// ____ WeakComponentImplHelperBase ____
// is called when dispose() is called at this component
- virtual void SAL_CALL disposing() override;
+ virtual void disposing(std::unique_lock<std::mutex>&) override;
private:
void fireSelectionEvent();
@@ -95,6 +94,7 @@ private:
m_aSelectedRanges;
sal_Int32 m_nAddedListenerCount;
bool m_bIncludeHiddenCells;
+ comphelper::OInterfaceContainerHelper4<css::view::XSelectionChangeListener> maSelectionChangeListeners;
};
} // namespace chart
diff --git a/chart2/source/tools/RangeHighlighter.cxx b/chart2/source/tools/RangeHighlighter.cxx
index 3dc667bfd043..247daaaae7e0 100644
--- a/chart2/source/tools/RangeHighlighter.cxx
+++ b/chart2/source/tools/RangeHighlighter.cxx
@@ -69,7 +69,6 @@ namespace chart
RangeHighlighter::RangeHighlighter(
const Reference< view::XSelectionSupplier > & xSelectionSupplier ) :
- impl::RangeHighlighter_Base( m_aMutex ),
m_xSelectionSupplier( xSelectionSupplier ),
m_nAddedListenerCount( 0 ),
m_bIncludeHiddenCells(true)
@@ -307,7 +306,7 @@ void SAL_CALL RangeHighlighter::addSelectionChangeListener( const Reference< vie
if( m_nAddedListenerCount == 0 )
startListening();
- rBHelper.addListener( cppu::UnoType<decltype(xListener)>::get(), xListener);
+ maSelectionChangeListeners.addInterface( xListener);
++m_nAddedListenerCount;
//bring the new listener up to the current state
@@ -317,7 +316,7 @@ void SAL_CALL RangeHighlighter::addSelectionChangeListener( const Reference< vie
void SAL_CALL RangeHighlighter::removeSelectionChangeListener( const Reference< view::XSelectionChangeListener >& xListener )
{
- rBHelper.removeListener( cppu::UnoType<decltype(xListener)>::get(), xListener );
+ maSelectionChangeListeners.removeInterface( xListener );
--m_nAddedListenerCount;
if( m_nAddedListenerCount == 0 )
stopListening();
@@ -335,15 +334,13 @@ void SAL_CALL RangeHighlighter::selectionChanged( const lang::EventObject& /*aEv
void RangeHighlighter::fireSelectionEvent()
{
- ::cppu::OInterfaceContainerHelper* pIC = rBHelper.getContainer(
- cppu::UnoType< view::XSelectionChangeListener >::get() );
- if( pIC )
+ if( maSelectionChangeListeners.getLength() )
{
lang::EventObject aEvent( static_cast< lang::XComponent* >( this ) );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
+ comphelper::OInterfaceIteratorHelper4 aIt( maSelectionChangeListeners );
while( aIt.hasMoreElements() )
{
- static_cast< view::XSelectionChangeListener* >( aIt.next() )->selectionChanged( aEvent );
+ aIt.next()->selectionChanged( aEvent );
}
}
}
@@ -382,7 +379,7 @@ void RangeHighlighter::stopListening()
// ____ WeakComponentImplHelperBase ____
// is called when dispose() is called at this component
-void SAL_CALL RangeHighlighter::disposing()
+void RangeHighlighter::disposing(std::unique_lock<std::mutex>&)
{
// @todo: remove listener. Currently the controller shows an assertion
// because it is already disposed