From ba8e7113fa8172533be736a25f936fc52f96e6a4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 28 Nov 2021 13:06:24 +0200 Subject: use more OInterfaceContainerHelper3 in slideshow Change-Id: I8f098b57411758cfbb5d5f41e319cf085a23f66b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125973 Tested-by: Jenkins Reviewed-by: Noel Grandin --- slideshow/source/engine/slide/shapemanagerimpl.cxx | 11 +++++------ slideshow/source/engine/slide/shapemanagerimpl.hxx | 3 ++- slideshow/source/engine/slideshowimpl.cxx | 19 ++++++++++--------- slideshow/source/inc/shapemaps.hxx | 5 +++-- 4 files changed, 20 insertions(+), 18 deletions(-) (limited to 'slideshow') diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx index 73c7cda1ac02..7ef3f455996f 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.cxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx @@ -161,13 +161,13 @@ bool ShapeManagerImpl::handleMouseReleased( awt::MouseEvent const& e ) // shape hit, and shape is visible. Raise // event. - std::shared_ptr const pCont( - aCurrBroadcaster->second ); + std::shared_ptr> const & pCont = + aCurrBroadcaster->second; uno::Reference const xShape( aCurrBroadcaster->first->getXShape() ); // DON'T do anything with /this/ after this point! - pCont->forEach( + pCont->forEach( [&xShape, &e]( const uno::Reference< presentation::XShapeEventListener >& rListener ) { return rListener->click( xShape, e ); } ); @@ -297,9 +297,8 @@ void ShapeManagerImpl::revokeSubset( const AttributableShapeSharedPtr& rOrigShap bool ShapeManagerImpl::listenerAdded( const uno::Reference& xShape ) { - ShapeEventListenerMap::const_iterator aIter; - if( (aIter = mrGlobalListenersMap.find( xShape )) == - mrGlobalListenersMap.end() ) + ShapeEventListenerMap::const_iterator aIter = mrGlobalListenersMap.find( xShape ); + if( aIter == mrGlobalListenersMap.end() ) { ENSURE_OR_RETURN_FALSE(false, "ShapeManagerImpl::listenerAdded(): global " diff --git a/slideshow/source/engine/slide/shapemanagerimpl.hxx b/slideshow/source/engine/slide/shapemanagerimpl.hxx index 5025450326e1..20bbe0340242 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.hxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.hxx @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -157,7 +158,7 @@ private: typedef std::map, + std::shared_ptr< ::comphelper::OInterfaceContainerHelper3 >, Shape::lessThanShape> ShapeToListenersMap; typedef std::map ShapeToCursorMap; diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 5647170f9c4d..2cd77518bb19 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -400,7 +401,7 @@ private: UnoViewContainer maViewContainer; /// all registered slide show listeners - comphelper::OInterfaceContainerHelper2 maListenerContainer; + comphelper::OInterfaceContainerHelper3 maListenerContainer; /// map of vectors, containing all registered listeners for a shape ShapeEventListenerMap maShapeEventListeners; @@ -1161,7 +1162,7 @@ void SlideShowImpl::displaySlide( } } // finally - maListenerContainer.forEach( + maListenerContainer.forEach( [](uno::Reference const& xListener) { xListener->slideTransitionStarted(); @@ -1195,7 +1196,7 @@ void SlideShowImpl::redisplayCurrentSlide() makeEvent( [this] () { this->notifySlideTransitionEnded(true); }, "SlideShowImpl::notifySlideTransitionEnded")); - maListenerContainer.forEach( + maListenerContainer.forEach( [](uno::Reference const& xListener) { xListener->slideTransitionStarted(); @@ -1832,7 +1833,7 @@ void SlideShowImpl::addShapeEventListener( // no entry for this shape -> create one aIter = maShapeEventListeners.emplace( xShape, - std::make_shared( + std::make_shared>( m_aMutex)).first; } @@ -2252,7 +2253,7 @@ void SlideShowImpl::notifySlideAnimationsEnded() } } // finally - maListenerContainer.forEach( + maListenerContainer.forEach( [](uno::Reference const& xListener) { xListener->slideAnimationsEnded(); @@ -2298,7 +2299,7 @@ void SlideShowImpl::notifySlideEnded (const bool bReverse) // shape animations (drawing layer and // GIF) will not be stopped. - maListenerContainer.forEach( + maListenerContainer.forEach( [&bReverse]( const uno::Reference< presentation::XSlideShowListener >& xListener ) { return xListener->slideEnded( bReverse ); } ); } @@ -2307,7 +2308,7 @@ bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink ) { osl::MutexGuard const guard( m_aMutex ); - maListenerContainer.forEach( + maListenerContainer.forEach( [&hyperLink]( const uno::Reference< presentation::XSlideShowListener >& xListener ) { return xListener->hyperLinkClicked( hyperLink ); } ); return true; @@ -2325,14 +2326,14 @@ bool SlideShowImpl::handleAnimationEvent( const AnimationNodeSharedPtr& rNode ) switch( rNode->getState() ) { case AnimationNode::ACTIVE: - maListenerContainer.forEach( + maListenerContainer.forEach( [&xNode]( const uno::Reference< animations::XAnimationListener >& xListener ) { return xListener->beginEvent( xNode ); } ); break; case AnimationNode::FROZEN: case AnimationNode::ENDED: - maListenerContainer.forEach( + maListenerContainer.forEach( [&xNode]( const uno::Reference< animations::XAnimationListener >& xListener ) { return xListener->endEvent( xNode ); } ); if(mpCurrentSlide->isPaintOverlayActive()) diff --git a/slideshow/source/inc/shapemaps.hxx b/slideshow/source/inc/shapemaps.hxx index aefd8c5df423..cb5ba095089e 100644 --- a/slideshow/source/inc/shapemaps.hxx +++ b/slideshow/source/inc/shapemaps.hxx @@ -20,8 +20,9 @@ #ifndef INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEMAPS_HXX #define INCLUDED_SLIDESHOW_SOURCE_INC_SHAPEMAPS_HXX -#include +#include #include +#include #include #include @@ -34,7 +35,7 @@ namespace slideshow::internal { /// Maps XShape to shape listener typedef ::std::map< css::uno::Reference< css::drawing::XShape>, - std::shared_ptr< ::comphelper::OInterfaceContainerHelper2 > + std::shared_ptr< ::comphelper::OInterfaceContainerHelper3 > > ShapeEventListenerMap; /// Maps XShape to mouse cursor -- cgit