diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2021-11-28 13:06:24 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-11-28 18:11:00 +0100 |
commit | ba8e7113fa8172533be736a25f936fc52f96e6a4 (patch) | |
tree | 7f5d6d7d8a952dc0c7ee0886515dc48eb448904b /slideshow | |
parent | 8d9c4792129e3dcf263ffffe39324c94b2ffe2bf (diff) |
use more OInterfaceContainerHelper3 in slideshow
Change-Id: I8f098b57411758cfbb5d5f41e319cf085a23f66b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125973
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/slide/shapemanagerimpl.cxx | 11 | ||||
-rw-r--r-- | slideshow/source/engine/slide/shapemanagerimpl.hxx | 3 | ||||
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 19 | ||||
-rw-r--r-- | slideshow/source/inc/shapemaps.hxx | 5 |
4 files changed, 20 insertions, 18 deletions
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<comphelper::OInterfaceContainerHelper2> const pCont( - aCurrBroadcaster->second ); + std::shared_ptr<comphelper::OInterfaceContainerHelper3<css::presentation::XShapeEventListener>> const & pCont = + aCurrBroadcaster->second; uno::Reference<drawing::XShape> const xShape( aCurrBroadcaster->first->getXShape() ); // DON'T do anything with /this/ after this point! - pCont->forEach<presentation::XShapeEventListener>( + 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<drawing::XShape>& 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 <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/uno/Reference.hxx> +#include <comphelper/interfacecontainer3.hxx> #include <shape.hxx> #include <subsettableshapemanager.hxx> #include <eventmultiplexer.hxx> @@ -157,7 +158,7 @@ private: typedef std::map<ShapeSharedPtr, - std::shared_ptr< ::comphelper::OInterfaceContainerHelper2 >, + std::shared_ptr< ::comphelper::OInterfaceContainerHelper3<css::presentation::XShapeEventListener> >, Shape::lessThanShape> ShapeToListenersMap; typedef std::map<ShapeSharedPtr, sal_Int16, Shape::lessThanShape> 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 <cppuhelper/interfacecontainer.h> #include <cppuhelper/supportsservice.hxx> +#include <comphelper/interfacecontainer3.hxx> #include <comphelper/scopeguard.hxx> #include <comphelper/storagehelper.hxx> #include <cppcanvas/polypolygon.hxx> @@ -400,7 +401,7 @@ private: UnoViewContainer maViewContainer; /// all registered slide show listeners - comphelper::OInterfaceContainerHelper2 maListenerContainer; + comphelper::OInterfaceContainerHelper3<presentation::XSlideShowListener> maListenerContainer; /// map of vectors, containing all registered listeners for a shape ShapeEventListenerMap maShapeEventListeners; @@ -1161,7 +1162,7 @@ void SlideShowImpl::displaySlide( } } // finally - maListenerContainer.forEach<presentation::XSlideShowListener>( + maListenerContainer.forEach( [](uno::Reference<presentation::XSlideShowListener> const& xListener) { xListener->slideTransitionStarted(); @@ -1195,7 +1196,7 @@ void SlideShowImpl::redisplayCurrentSlide() makeEvent( [this] () { this->notifySlideTransitionEnded(true); }, "SlideShowImpl::notifySlideTransitionEnded")); - maListenerContainer.forEach<presentation::XSlideShowListener>( + maListenerContainer.forEach( [](uno::Reference<presentation::XSlideShowListener> 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<comphelper::OInterfaceContainerHelper2>( + std::make_shared<comphelper::OInterfaceContainerHelper3<css::presentation::XShapeEventListener>>( m_aMutex)).first; } @@ -2252,7 +2253,7 @@ void SlideShowImpl::notifySlideAnimationsEnded() } } // finally - maListenerContainer.forEach<presentation::XSlideShowListener>( + maListenerContainer.forEach( [](uno::Reference<presentation::XSlideShowListener> 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<presentation::XSlideShowListener>( + 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<presentation::XSlideShowListener>( + 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<presentation::XSlideShowListener>( + maListenerContainer.forEach( [&xNode]( const uno::Reference< animations::XAnimationListener >& xListener ) { return xListener->beginEvent( xNode ); } ); break; case AnimationNode::FROZEN: case AnimationNode::ENDED: - maListenerContainer.forEach<presentation::XSlideShowListener>( + 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 <comphelper/interfacecontainer2.hxx> +#include <comphelper/interfacecontainer3.hxx> #include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/presentation/XShapeEventListener.hpp> #include <memory> #include <map> @@ -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<css::presentation::XShapeEventListener> > > ShapeEventListenerMap; /// Maps XShape to mouse cursor |