diff options
author | Daniel Robertson <danlrobertson89@gmail.com> | 2015-10-10 12:43:34 -0400 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-10-11 06:15:35 +0000 |
commit | 91e0161dc5a0de0dcce1696aea318d919d5d04a1 (patch) | |
tree | c2e27d7137b6a81852b01eade6181ecfc372b44f /slideshow | |
parent | b6297280853a7325ac0fa226b783652b22daebd0 (diff) |
tdf#93243 slideshow: replace boost::bind
Replace boost::bind with C++11 lambdas
Change-Id: I13c500d085e6b8e80b2c067139db4ed0fffb2c71
Reviewed-on: https://gerrit.libreoffice.org/19299
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/shapes/backgroundshape.cxx | 28 | ||||
-rw-r--r-- | slideshow/source/engine/shapes/viewshape.cxx | 11 | ||||
-rw-r--r-- | slideshow/source/engine/slide/layer.cxx | 33 | ||||
-rw-r--r-- | slideshow/source/engine/slide/layermanager.cxx | 24 | ||||
-rw-r--r-- | slideshow/source/engine/slide/shapemanagerimpl.cxx | 8 | ||||
-rw-r--r-- | slideshow/source/engine/slide/slideimpl.cxx | 2 | ||||
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 42 |
7 files changed, 52 insertions, 96 deletions
diff --git a/slideshow/source/engine/shapes/backgroundshape.cxx b/slideshow/source/engine/shapes/backgroundshape.cxx index d53105e45b74..dc71e0d4dc1d 100644 --- a/slideshow/source/engine/shapes/backgroundshape.cxx +++ b/slideshow/source/engine/shapes/backgroundshape.cxx @@ -27,8 +27,6 @@ #include <basegfx/numeric/ftools.hxx> -#include <boost/bind.hpp> - #include <cmath> #include <algorithm> #include <functional> @@ -169,11 +167,8 @@ namespace slideshow // already added? if( ::std::any_of( maViewShapes.begin(), maViewShapes.end(), - ::boost::bind<bool>( - ::std::equal_to< ViewLayerSharedPtr >(), - ::boost::bind( &ViewBackgroundShape::getViewLayer, - _1 ), - ::boost::cref( rNewLayer ) ) ) ) + [&rNewLayer]( const ViewBackgroundShapeSharedPtr& pBgShape ) + { return pBgShape->getViewLayer() == rNewLayer; } ) ) { // yes, nothing to do return; @@ -195,22 +190,16 @@ namespace slideshow OSL_ENSURE( ::std::count_if(maViewShapes.begin(), aEnd, - ::boost::bind<bool>( - ::std::equal_to< ViewLayerSharedPtr >(), - ::boost::bind( &ViewBackgroundShape::getViewLayer, - _1 ), - ::boost::cref( rLayer ) ) ) < 2, + [&rLayer]( const ViewBackgroundShapeSharedPtr& pBgShape ) + { return pBgShape->getViewLayer() == rLayer; } ) < 2, "BackgroundShape::removeViewLayer(): Duplicate ViewLayer entries!" ); ViewBackgroundShapeVector::iterator aIter; if( (aIter=::std::remove_if( maViewShapes.begin(), aEnd, - ::boost::bind<bool>( - ::std::equal_to< ViewLayerSharedPtr >(), - ::boost::bind( &ViewBackgroundShape::getViewLayer, - _1 ), - ::boost::cref( rLayer ) ) )) == aEnd ) + [&rLayer]( const ViewBackgroundShapeSharedPtr& pBgShape ) + { return pBgShape->getViewLayer() == rLayer; } )) == aEnd ) { // view layer seemingly was not added, failed return false; @@ -280,9 +269,8 @@ namespace slideshow // redraw all view shapes, by calling their render() method if( ::std::count_if( maViewShapes.begin(), maViewShapes.end(), - ::boost::bind( &ViewBackgroundShape::render, - _1, - ::boost::cref( mpMtf ) ) ) + [this]( const ViewBackgroundShapeSharedPtr& pBgShape ) + { return pBgShape->render( this->mpMtf ); } ) != static_cast<ViewBackgroundShapeVector::difference_type>(maViewShapes.size()) ) { // at least one of the ViewBackgroundShape::render() calls did return diff --git a/slideshow/source/engine/shapes/viewshape.cxx b/slideshow/source/engine/shapes/viewshape.cxx index 05507e53afff..ed2ac3c2ea98 100644 --- a/slideshow/source/engine/shapes/viewshape.cxx +++ b/slideshow/source/engine/shapes/viewshape.cxx @@ -44,9 +44,6 @@ #include "viewshape.hxx" #include "tools.hxx" -#include <boost/bind.hpp> - - using namespace ::com::sun::star; namespace slideshow @@ -742,12 +739,8 @@ namespace slideshow // already there? if( (aIter=::std::find_if( maRenderers.begin(), aEnd, - ::boost::bind( - ::std::equal_to< ::cppcanvas::CanvasSharedPtr >(), - ::boost::cref( rDestinationCanvas ), - ::boost::bind( - &RendererCacheEntry::getDestinationCanvas, - _1 ) ) ) ) == aEnd ) + [&rDestinationCanvas]( const RendererCacheEntry& rCacheEntry ) + { return rDestinationCanvas == rCacheEntry.getDestinationCanvas(); } ) ) == aEnd ) { if( maRenderers.size() >= MAX_RENDER_CACHE_ENTRIES ) { diff --git a/slideshow/source/engine/slide/layer.cxx b/slideshow/source/engine/slide/layer.cxx index 5f6ebfadc965..48dc741b9cd0 100644 --- a/slideshow/source/engine/slide/layer.cxx +++ b/slideshow/source/engine/slide/layer.cxx @@ -25,13 +25,9 @@ #include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx> -#include <boost/noncopyable.hpp> #include "layer.hxx" -#include <boost/bind.hpp> - - using namespace ::com::sun::star; namespace slideshow @@ -69,10 +65,8 @@ namespace slideshow const ViewEntryVector::iterator aEnd( maViewEntries.end() ); if( (aIter=std::find_if( maViewEntries.begin(), aEnd, - boost::bind<bool>( - std::equal_to< ViewSharedPtr >(), - boost::bind( &ViewEntry::getView, _1 ), - boost::cref( rNewView )))) != aEnd ) + [&rNewView]( const ViewEntry& rViewEntry ) + { return rViewEntry.getView() == rNewView; } ) ) != aEnd ) { // already added - just return existing layer return aIter->mpViewLayer; @@ -102,10 +96,8 @@ namespace slideshow const ViewEntryVector::iterator aEnd( maViewEntries.end() ); if( (aIter=std::find_if( maViewEntries.begin(), aEnd, - boost::bind<bool>( - std::equal_to< ViewSharedPtr >(), - boost::bind( &ViewEntry::getView, _1 ), - boost::cref( rView )))) == aEnd ) + [&rView]( const ViewEntry& rViewEntry ) + { return rViewEntry.getView() == rView; } ) ) == aEnd ) { // View was not added/is already removed return ViewLayerSharedPtr(); @@ -113,10 +105,8 @@ namespace slideshow OSL_ENSURE( std::count_if( maViewEntries.begin(), aEnd, - boost::bind<bool>( - std::equal_to< ViewSharedPtr >(), - boost::bind( &ViewEntry::getView, _1 ), - boost::cref( rView ))) == 1, + [&rView]( const ViewEntry& rViewEntry ) + { return rViewEntry.getView() == rView; } ) == 1, "Layer::removeView(): view added multiple times" ); ViewLayerSharedPtr pRet( aIter->mpViewLayer ); @@ -176,10 +166,9 @@ namespace slideshow maBounds = maNewBounds; if( std::count_if( maViewEntries.begin(), maViewEntries.end(), - boost::bind( &ViewLayer::resize, - boost::bind( &ViewEntry::getViewLayer, - _1 ), - boost::cref(maBounds)) ) == 0 ) + [this]( const ViewEntry& rViewEntry ) + { return rViewEntry.getViewLayer()->resize( this->maBounds ); } + ) == 0 ) { return false; } @@ -207,9 +196,11 @@ namespace slideshow clearUpdateRanges(); } - class LayerEndUpdate : private boost::noncopyable + class LayerEndUpdate { public: + LayerEndUpdate( const LayerEndUpdate& ) = delete; + LayerEndUpdate& operator=( const LayerEndUpdate& ) = delete; explicit LayerEndUpdate( LayerSharedPtr const& rLayer ) : mpLayer( rLayer ) {} diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx index 3dbb554a53bb..332da3d823c1 100644 --- a/slideshow/source/engine/slide/layermanager.cxx +++ b/slideshow/source/engine/slide/layermanager.cxx @@ -25,7 +25,7 @@ #include <comphelper/anytostring.hxx> #include <cppuhelper/exc_hlp.hxx> -#include <boost/bind.hpp> +#include <boost/mem_fn.hpp> #include <algorithm> #include "layermanager.hxx" @@ -166,14 +166,10 @@ namespace slideshow // add View to all registered shapes manageViews( - boost::bind(&Layer::addView, - _1, - boost::cref(rView)), - // repaint on view add - boost::bind(&Shape::addViewLayer, - _1, - _2, - true) ); + [&rView]( const LayerSharedPtr& pLayer ) + { return pLayer->addView( rView ); }, + []( const ShapeSharedPtr& pShape, const ViewLayerSharedPtr& pLayer ) + { return pShape->addViewLayer( pLayer, true ); } ); // in case we haven't reached all layers from the // maAllShapes, issue addView again for good measure @@ -190,12 +186,10 @@ namespace slideshow // remove View from all registered shapes manageViews( - boost::bind(&Layer::removeView, - _1, - boost::cref(rView)), - boost::bind(&Shape::removeViewLayer, - _1, - _2) ); + [&rView]( const LayerSharedPtr& pLayer ) + { return pLayer->removeView( rView ); }, + []( const ShapeSharedPtr& pShape, const ViewLayerSharedPtr& pLayer ) + { return pShape->removeViewLayer( pLayer ); } ); // in case we haven't reached all layers from the // maAllShapes, issue removeView again for good measure diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx index 9867f09684b0..a484cae6a309 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.cxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx @@ -26,7 +26,7 @@ #include "shapemanagerimpl.hxx" -#include <boost/bind.hpp> +#include <boost/mem_fn.hpp> using namespace com::sun::star; @@ -151,10 +151,8 @@ bool ShapeManagerImpl::handleMouseReleased( awt::MouseEvent const& e ) // DON'T do anything with /this/ after this point! pCont->forEach<presentation::XShapeEventListener>( - boost::bind( &presentation::XShapeEventListener::click, - _1, - boost::cref(xShape), - boost::cref(e) )); + [&xShape, &e]( const uno::Reference< presentation::XShapeEventListener >& rListener ) + { return rListener->click( xShape, e ); } ); return true; // handled this event } diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 4bb090b9e84a..0e2cf1a614aa 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -61,8 +61,6 @@ #include "targetpropertiescreator.hxx" #include "tools.hxx" - -#include <boost/bind.hpp> #include <iterator> #include <functional> #include <iostream> diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 2144d33b9512..039f4ae240ba 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -95,9 +95,7 @@ #include "framerate.hxx" #include "pointersymbol.hxx" -#include <boost/noncopyable.hpp> -#include <boost/bind.hpp> - +#include <boost/mem_fn.hpp> #include <map> #include <vector> #include <iterator> @@ -505,8 +503,7 @@ private: struct SlideShowImpl::SeparateListenerImpl : public EventHandler, public ViewRepaintHandler, public HyperlinkHandler, - public AnimationEventHandler, - private boost::noncopyable + public AnimationEventHandler { SlideShowImpl& mrShow; ScreenUpdater& mrScreenUpdater; @@ -520,6 +517,9 @@ struct SlideShowImpl::SeparateListenerImpl : public EventHandler, mrEventQueue( rEventQueue ) {} + SeparateListenerImpl( const SeparateListenerImpl& ) = delete; + SeparateListenerImpl& operator=( const SeparateListenerImpl& ) = delete; + // EventHandler virtual bool handleEvent() SAL_OVERRIDE { @@ -1241,8 +1241,8 @@ sal_Bool SlideShowImpl::previousEffect() throw (uno::RuntimeException, std::exce { return maEffectRewinder.rewind( maScreenUpdater.createLock(false), - ::boost::bind<void>(::boost::mem_fn(&SlideShowImpl::redisplayCurrentSlide), this), - ::boost::bind<void>(::boost::mem_fn(&SlideShowImpl::rewindEffectToPreviousSlide), this)); + [this]() { return this->redisplayCurrentSlide(); }, + [this]() { return this->rewindEffectToPreviousSlide(); } ); } } @@ -1996,8 +1996,7 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) //::dispose clearing mpPresTimer std::shared_ptr<canvas::tools::ElapsedTime> xTimer(mpPresTimer); comphelper::ScopeGuard scopeGuard( - boost::bind( &canvas::tools::ElapsedTime::releaseTimer, - boost::cref(xTimer) ) ); + [&xTimer]() { return xTimer->releaseTimer(); } ); xTimer->holdTimer(); // process queues @@ -2206,7 +2205,7 @@ void SlideShowImpl::notifySlideAnimationsEnded() // schedule a slide end event, with automatic mode's // delay aNotificationEvents = makeInterruptableDelay( - boost::bind<void>( boost::mem_fn(&SlideShowImpl::notifySlideEnded), this, false ), + [this]() { return this->notifySlideEnded( false ); }, maEventMultiplexer.getAutomaticTimeout() ); } else @@ -2231,7 +2230,7 @@ void SlideShowImpl::notifySlideAnimationsEnded() bHasAutomaticNextSlide ) { aNotificationEvents = makeInterruptableDelay( - boost::bind<void>( boost::mem_fn(&SlideShowImpl::notifySlideEnded), this, false ), + [this]() { return this->notifySlideEnded( false ); }, nAutomaticNextSlideTimeout); // TODO(F2): Provide a mechanism to let the user override @@ -2331,10 +2330,8 @@ void SlideShowImpl::notifySlideEnded (const bool bReverse) // GIF) will not be stopped. maListenerContainer.forEach<presentation::XSlideShowListener>( - boost::bind<void>( - ::boost::mem_fn(&presentation::XSlideShowListener::slideEnded), - _1, - bReverse)); + [&bReverse]( const uno::Reference< presentation::XSlideShowListener >& xListener ) + { return xListener->slideEnded( bReverse ); } ); } bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink ) @@ -2342,9 +2339,8 @@ bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink ) osl::MutexGuard const guard( m_aMutex ); maListenerContainer.forEach<presentation::XSlideShowListener>( - boost::bind( &presentation::XSlideShowListener::hyperLinkClicked, - _1, - boost::cref(hyperLink) )); + [&hyperLink]( const uno::Reference< presentation::XSlideShowListener >& xListener ) + { return xListener->hyperLinkClicked( hyperLink ); } ); return true; } @@ -2361,17 +2357,15 @@ bool SlideShowImpl::handleAnimationEvent( const AnimationNodeSharedPtr& rNode ) { case AnimationNode::ACTIVE: maListenerContainer.forEach<presentation::XSlideShowListener>( - boost::bind( &animations::XAnimationListener::beginEvent, - _1, - boost::cref(xNode) )); + [&xNode]( const uno::Reference< animations::XAnimationListener >& xListener ) + { return xListener->beginEvent( xNode ); } ); break; case AnimationNode::FROZEN: case AnimationNode::ENDED: maListenerContainer.forEach<presentation::XSlideShowListener>( - boost::bind( &animations::XAnimationListener::endEvent, - _1, - boost::cref(xNode) )); + [&xNode]( const uno::Reference< animations::XAnimationListener >& xListener ) + { return xListener->endEvent( xNode ); } ); if(mpCurrentSlide->isPaintOverlayActive()) mpCurrentSlide->drawPolygons(); break; |