Kaydet (Commit) 91e0161d authored tarafından Daniel Robertson's avatar Daniel Robertson Kaydeden (comit) Noel Grandin

tdf#93243 slideshow: replace boost::bind

Replace boost::bind with C++11 lambdas

Change-Id: I13c500d085e6b8e80b2c067139db4ed0fffb2c71
Reviewed-on: https://gerrit.libreoffice.org/19299Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst b6297280
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <basegfx/numeric/ftools.hxx> #include <basegfx/numeric/ftools.hxx>
#include <boost/bind.hpp>
#include <cmath> #include <cmath>
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
...@@ -169,11 +167,8 @@ namespace slideshow ...@@ -169,11 +167,8 @@ namespace slideshow
// already added? // already added?
if( ::std::any_of( maViewShapes.begin(), if( ::std::any_of( maViewShapes.begin(),
maViewShapes.end(), maViewShapes.end(),
::boost::bind<bool>( [&rNewLayer]( const ViewBackgroundShapeSharedPtr& pBgShape )
::std::equal_to< ViewLayerSharedPtr >(), { return pBgShape->getViewLayer() == rNewLayer; } ) )
::boost::bind( &ViewBackgroundShape::getViewLayer,
_1 ),
::boost::cref( rNewLayer ) ) ) )
{ {
// yes, nothing to do // yes, nothing to do
return; return;
...@@ -195,22 +190,16 @@ namespace slideshow ...@@ -195,22 +190,16 @@ namespace slideshow
OSL_ENSURE( ::std::count_if(maViewShapes.begin(), OSL_ENSURE( ::std::count_if(maViewShapes.begin(),
aEnd, aEnd,
::boost::bind<bool>( [&rLayer]( const ViewBackgroundShapeSharedPtr& pBgShape )
::std::equal_to< ViewLayerSharedPtr >(), { return pBgShape->getViewLayer() == rLayer; } ) < 2,
::boost::bind( &ViewBackgroundShape::getViewLayer,
_1 ),
::boost::cref( rLayer ) ) ) < 2,
"BackgroundShape::removeViewLayer(): Duplicate ViewLayer entries!" ); "BackgroundShape::removeViewLayer(): Duplicate ViewLayer entries!" );
ViewBackgroundShapeVector::iterator aIter; ViewBackgroundShapeVector::iterator aIter;
if( (aIter=::std::remove_if( maViewShapes.begin(), if( (aIter=::std::remove_if( maViewShapes.begin(),
aEnd, aEnd,
::boost::bind<bool>( [&rLayer]( const ViewBackgroundShapeSharedPtr& pBgShape )
::std::equal_to< ViewLayerSharedPtr >(), { return pBgShape->getViewLayer() == rLayer; } )) == aEnd )
::boost::bind( &ViewBackgroundShape::getViewLayer,
_1 ),
::boost::cref( rLayer ) ) )) == aEnd )
{ {
// view layer seemingly was not added, failed // view layer seemingly was not added, failed
return false; return false;
...@@ -280,9 +269,8 @@ namespace slideshow ...@@ -280,9 +269,8 @@ namespace slideshow
// redraw all view shapes, by calling their render() method // redraw all view shapes, by calling their render() method
if( ::std::count_if( maViewShapes.begin(), if( ::std::count_if( maViewShapes.begin(),
maViewShapes.end(), maViewShapes.end(),
::boost::bind( &ViewBackgroundShape::render, [this]( const ViewBackgroundShapeSharedPtr& pBgShape )
_1, { return pBgShape->render( this->mpMtf ); } )
::boost::cref( mpMtf ) ) )
!= static_cast<ViewBackgroundShapeVector::difference_type>(maViewShapes.size()) ) != static_cast<ViewBackgroundShapeVector::difference_type>(maViewShapes.size()) )
{ {
// at least one of the ViewBackgroundShape::render() calls did return // at least one of the ViewBackgroundShape::render() calls did return
......
...@@ -44,9 +44,6 @@ ...@@ -44,9 +44,6 @@
#include "viewshape.hxx" #include "viewshape.hxx"
#include "tools.hxx" #include "tools.hxx"
#include <boost/bind.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
namespace slideshow namespace slideshow
...@@ -742,12 +739,8 @@ namespace slideshow ...@@ -742,12 +739,8 @@ namespace slideshow
// already there? // already there?
if( (aIter=::std::find_if( maRenderers.begin(), if( (aIter=::std::find_if( maRenderers.begin(),
aEnd, aEnd,
::boost::bind( [&rDestinationCanvas]( const RendererCacheEntry& rCacheEntry )
::std::equal_to< ::cppcanvas::CanvasSharedPtr >(), { return rDestinationCanvas == rCacheEntry.getDestinationCanvas(); } ) ) == aEnd )
::boost::cref( rDestinationCanvas ),
::boost::bind(
&RendererCacheEntry::getDestinationCanvas,
_1 ) ) ) ) == aEnd )
{ {
if( maRenderers.size() >= MAX_RENDER_CACHE_ENTRIES ) if( maRenderers.size() >= MAX_RENDER_CACHE_ENTRIES )
{ {
......
...@@ -25,13 +25,9 @@ ...@@ -25,13 +25,9 @@
#include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx>
#include <basegfx/polygon/b2dpolypolygontools.hxx> #include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx> #include <basegfx/polygon/b2dpolypolygoncutter.hxx>
#include <boost/noncopyable.hpp>
#include "layer.hxx" #include "layer.hxx"
#include <boost/bind.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
namespace slideshow namespace slideshow
...@@ -69,10 +65,8 @@ namespace slideshow ...@@ -69,10 +65,8 @@ namespace slideshow
const ViewEntryVector::iterator aEnd( maViewEntries.end() ); const ViewEntryVector::iterator aEnd( maViewEntries.end() );
if( (aIter=std::find_if( maViewEntries.begin(), if( (aIter=std::find_if( maViewEntries.begin(),
aEnd, aEnd,
boost::bind<bool>( [&rNewView]( const ViewEntry& rViewEntry )
std::equal_to< ViewSharedPtr >(), { return rViewEntry.getView() == rNewView; } ) ) != aEnd )
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rNewView )))) != aEnd )
{ {
// already added - just return existing layer // already added - just return existing layer
return aIter->mpViewLayer; return aIter->mpViewLayer;
...@@ -102,10 +96,8 @@ namespace slideshow ...@@ -102,10 +96,8 @@ namespace slideshow
const ViewEntryVector::iterator aEnd( maViewEntries.end() ); const ViewEntryVector::iterator aEnd( maViewEntries.end() );
if( (aIter=std::find_if( maViewEntries.begin(), if( (aIter=std::find_if( maViewEntries.begin(),
aEnd, aEnd,
boost::bind<bool>( [&rView]( const ViewEntry& rViewEntry )
std::equal_to< ViewSharedPtr >(), { return rViewEntry.getView() == rView; } ) ) == aEnd )
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rView )))) == aEnd )
{ {
// View was not added/is already removed // View was not added/is already removed
return ViewLayerSharedPtr(); return ViewLayerSharedPtr();
...@@ -113,10 +105,8 @@ namespace slideshow ...@@ -113,10 +105,8 @@ namespace slideshow
OSL_ENSURE( std::count_if( maViewEntries.begin(), OSL_ENSURE( std::count_if( maViewEntries.begin(),
aEnd, aEnd,
boost::bind<bool>( [&rView]( const ViewEntry& rViewEntry )
std::equal_to< ViewSharedPtr >(), { return rViewEntry.getView() == rView; } ) == 1,
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rView ))) == 1,
"Layer::removeView(): view added multiple times" ); "Layer::removeView(): view added multiple times" );
ViewLayerSharedPtr pRet( aIter->mpViewLayer ); ViewLayerSharedPtr pRet( aIter->mpViewLayer );
...@@ -176,10 +166,9 @@ namespace slideshow ...@@ -176,10 +166,9 @@ namespace slideshow
maBounds = maNewBounds; maBounds = maNewBounds;
if( std::count_if( maViewEntries.begin(), if( std::count_if( maViewEntries.begin(),
maViewEntries.end(), maViewEntries.end(),
boost::bind( &ViewLayer::resize, [this]( const ViewEntry& rViewEntry )
boost::bind( &ViewEntry::getViewLayer, { return rViewEntry.getViewLayer()->resize( this->maBounds ); }
_1 ), ) == 0 )
boost::cref(maBounds)) ) == 0 )
{ {
return false; return false;
} }
...@@ -207,9 +196,11 @@ namespace slideshow ...@@ -207,9 +196,11 @@ namespace slideshow
clearUpdateRanges(); clearUpdateRanges();
} }
class LayerEndUpdate : private boost::noncopyable class LayerEndUpdate
{ {
public: public:
LayerEndUpdate( const LayerEndUpdate& ) = delete;
LayerEndUpdate& operator=( const LayerEndUpdate& ) = delete;
explicit LayerEndUpdate( LayerSharedPtr const& rLayer ) : explicit LayerEndUpdate( LayerSharedPtr const& rLayer ) :
mpLayer( rLayer ) mpLayer( rLayer )
{} {}
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <comphelper/anytostring.hxx> #include <comphelper/anytostring.hxx>
#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/exc_hlp.hxx>
#include <boost/bind.hpp> #include <boost/mem_fn.hpp>
#include <algorithm> #include <algorithm>
#include "layermanager.hxx" #include "layermanager.hxx"
...@@ -166,14 +166,10 @@ namespace slideshow ...@@ -166,14 +166,10 @@ namespace slideshow
// add View to all registered shapes // add View to all registered shapes
manageViews( manageViews(
boost::bind(&Layer::addView, [&rView]( const LayerSharedPtr& pLayer )
_1, { return pLayer->addView( rView ); },
boost::cref(rView)), []( const ShapeSharedPtr& pShape, const ViewLayerSharedPtr& pLayer )
// repaint on view add { return pShape->addViewLayer( pLayer, true ); } );
boost::bind(&Shape::addViewLayer,
_1,
_2,
true) );
// in case we haven't reached all layers from the // in case we haven't reached all layers from the
// maAllShapes, issue addView again for good measure // maAllShapes, issue addView again for good measure
...@@ -190,12 +186,10 @@ namespace slideshow ...@@ -190,12 +186,10 @@ namespace slideshow
// remove View from all registered shapes // remove View from all registered shapes
manageViews( manageViews(
boost::bind(&Layer::removeView, [&rView]( const LayerSharedPtr& pLayer )
_1, { return pLayer->removeView( rView ); },
boost::cref(rView)), []( const ShapeSharedPtr& pShape, const ViewLayerSharedPtr& pLayer )
boost::bind(&Shape::removeViewLayer, { return pShape->removeViewLayer( pLayer ); } );
_1,
_2) );
// in case we haven't reached all layers from the // in case we haven't reached all layers from the
// maAllShapes, issue removeView again for good measure // maAllShapes, issue removeView again for good measure
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "shapemanagerimpl.hxx" #include "shapemanagerimpl.hxx"
#include <boost/bind.hpp> #include <boost/mem_fn.hpp>
using namespace com::sun::star; using namespace com::sun::star;
...@@ -151,10 +151,8 @@ bool ShapeManagerImpl::handleMouseReleased( awt::MouseEvent const& e ) ...@@ -151,10 +151,8 @@ bool ShapeManagerImpl::handleMouseReleased( awt::MouseEvent const& e )
// DON'T do anything with /this/ after this point! // DON'T do anything with /this/ after this point!
pCont->forEach<presentation::XShapeEventListener>( pCont->forEach<presentation::XShapeEventListener>(
boost::bind( &presentation::XShapeEventListener::click, [&xShape, &e]( const uno::Reference< presentation::XShapeEventListener >& rListener )
_1, { return rListener->click( xShape, e ); } );
boost::cref(xShape),
boost::cref(e) ));
return true; // handled this event return true; // handled this event
} }
......
...@@ -61,8 +61,6 @@ ...@@ -61,8 +61,6 @@
#include "targetpropertiescreator.hxx" #include "targetpropertiescreator.hxx"
#include "tools.hxx" #include "tools.hxx"
#include <boost/bind.hpp>
#include <iterator> #include <iterator>
#include <functional> #include <functional>
#include <iostream> #include <iostream>
......
...@@ -95,9 +95,7 @@ ...@@ -95,9 +95,7 @@
#include "framerate.hxx" #include "framerate.hxx"
#include "pointersymbol.hxx" #include "pointersymbol.hxx"
#include <boost/noncopyable.hpp> #include <boost/mem_fn.hpp>
#include <boost/bind.hpp>
#include <map> #include <map>
#include <vector> #include <vector>
#include <iterator> #include <iterator>
...@@ -505,8 +503,7 @@ private: ...@@ -505,8 +503,7 @@ private:
struct SlideShowImpl::SeparateListenerImpl : public EventHandler, struct SlideShowImpl::SeparateListenerImpl : public EventHandler,
public ViewRepaintHandler, public ViewRepaintHandler,
public HyperlinkHandler, public HyperlinkHandler,
public AnimationEventHandler, public AnimationEventHandler
private boost::noncopyable
{ {
SlideShowImpl& mrShow; SlideShowImpl& mrShow;
ScreenUpdater& mrScreenUpdater; ScreenUpdater& mrScreenUpdater;
...@@ -520,6 +517,9 @@ struct SlideShowImpl::SeparateListenerImpl : public EventHandler, ...@@ -520,6 +517,9 @@ struct SlideShowImpl::SeparateListenerImpl : public EventHandler,
mrEventQueue( rEventQueue ) mrEventQueue( rEventQueue )
{} {}
SeparateListenerImpl( const SeparateListenerImpl& ) = delete;
SeparateListenerImpl& operator=( const SeparateListenerImpl& ) = delete;
// EventHandler // EventHandler
virtual bool handleEvent() SAL_OVERRIDE virtual bool handleEvent() SAL_OVERRIDE
{ {
...@@ -1241,8 +1241,8 @@ sal_Bool SlideShowImpl::previousEffect() throw (uno::RuntimeException, std::exce ...@@ -1241,8 +1241,8 @@ sal_Bool SlideShowImpl::previousEffect() throw (uno::RuntimeException, std::exce
{ {
return maEffectRewinder.rewind( return maEffectRewinder.rewind(
maScreenUpdater.createLock(false), maScreenUpdater.createLock(false),
::boost::bind<void>(::boost::mem_fn(&SlideShowImpl::redisplayCurrentSlide), this), [this]() { return this->redisplayCurrentSlide(); },
::boost::bind<void>(::boost::mem_fn(&SlideShowImpl::rewindEffectToPreviousSlide), this)); [this]() { return this->rewindEffectToPreviousSlide(); } );
} }
} }
...@@ -1996,8 +1996,7 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) ...@@ -1996,8 +1996,7 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout )
//::dispose clearing mpPresTimer //::dispose clearing mpPresTimer
std::shared_ptr<canvas::tools::ElapsedTime> xTimer(mpPresTimer); std::shared_ptr<canvas::tools::ElapsedTime> xTimer(mpPresTimer);
comphelper::ScopeGuard scopeGuard( comphelper::ScopeGuard scopeGuard(
boost::bind( &canvas::tools::ElapsedTime::releaseTimer, [&xTimer]() { return xTimer->releaseTimer(); } );
boost::cref(xTimer) ) );
xTimer->holdTimer(); xTimer->holdTimer();
// process queues // process queues
...@@ -2206,7 +2205,7 @@ void SlideShowImpl::notifySlideAnimationsEnded() ...@@ -2206,7 +2205,7 @@ void SlideShowImpl::notifySlideAnimationsEnded()
// schedule a slide end event, with automatic mode's // schedule a slide end event, with automatic mode's
// delay // delay
aNotificationEvents = makeInterruptableDelay( aNotificationEvents = makeInterruptableDelay(
boost::bind<void>( boost::mem_fn(&SlideShowImpl::notifySlideEnded), this, false ), [this]() { return this->notifySlideEnded( false ); },
maEventMultiplexer.getAutomaticTimeout() ); maEventMultiplexer.getAutomaticTimeout() );
} }
else else
...@@ -2231,7 +2230,7 @@ void SlideShowImpl::notifySlideAnimationsEnded() ...@@ -2231,7 +2230,7 @@ void SlideShowImpl::notifySlideAnimationsEnded()
bHasAutomaticNextSlide ) bHasAutomaticNextSlide )
{ {
aNotificationEvents = makeInterruptableDelay( aNotificationEvents = makeInterruptableDelay(
boost::bind<void>( boost::mem_fn(&SlideShowImpl::notifySlideEnded), this, false ), [this]() { return this->notifySlideEnded( false ); },
nAutomaticNextSlideTimeout); nAutomaticNextSlideTimeout);
// TODO(F2): Provide a mechanism to let the user override // TODO(F2): Provide a mechanism to let the user override
...@@ -2331,10 +2330,8 @@ void SlideShowImpl::notifySlideEnded (const bool bReverse) ...@@ -2331,10 +2330,8 @@ void SlideShowImpl::notifySlideEnded (const bool bReverse)
// GIF) will not be stopped. // GIF) will not be stopped.
maListenerContainer.forEach<presentation::XSlideShowListener>( maListenerContainer.forEach<presentation::XSlideShowListener>(
boost::bind<void>( [&bReverse]( const uno::Reference< presentation::XSlideShowListener >& xListener )
::boost::mem_fn(&presentation::XSlideShowListener::slideEnded), { return xListener->slideEnded( bReverse ); } );
_1,
bReverse));
} }
bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink ) bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink )
...@@ -2342,9 +2339,8 @@ bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink ) ...@@ -2342,9 +2339,8 @@ bool SlideShowImpl::notifyHyperLinkClicked( OUString const& hyperLink )
osl::MutexGuard const guard( m_aMutex ); osl::MutexGuard const guard( m_aMutex );
maListenerContainer.forEach<presentation::XSlideShowListener>( maListenerContainer.forEach<presentation::XSlideShowListener>(
boost::bind( &presentation::XSlideShowListener::hyperLinkClicked, [&hyperLink]( const uno::Reference< presentation::XSlideShowListener >& xListener )
_1, { return xListener->hyperLinkClicked( hyperLink ); } );
boost::cref(hyperLink) ));
return true; return true;
} }
...@@ -2361,17 +2357,15 @@ bool SlideShowImpl::handleAnimationEvent( const AnimationNodeSharedPtr& rNode ) ...@@ -2361,17 +2357,15 @@ bool SlideShowImpl::handleAnimationEvent( const AnimationNodeSharedPtr& rNode )
{ {
case AnimationNode::ACTIVE: case AnimationNode::ACTIVE:
maListenerContainer.forEach<presentation::XSlideShowListener>( maListenerContainer.forEach<presentation::XSlideShowListener>(
boost::bind( &animations::XAnimationListener::beginEvent, [&xNode]( const uno::Reference< animations::XAnimationListener >& xListener )
_1, { return xListener->beginEvent( xNode ); } );
boost::cref(xNode) ));
break; break;
case AnimationNode::FROZEN: case AnimationNode::FROZEN:
case AnimationNode::ENDED: case AnimationNode::ENDED:
maListenerContainer.forEach<presentation::XSlideShowListener>( maListenerContainer.forEach<presentation::XSlideShowListener>(
boost::bind( &animations::XAnimationListener::endEvent, [&xNode]( const uno::Reference< animations::XAnimationListener >& xListener )
_1, { return xListener->endEvent( xNode ); } );
boost::cref(xNode) ));
if(mpCurrentSlide->isPaintOverlayActive()) if(mpCurrentSlide->isPaintOverlayActive())
mpCurrentSlide->drawPolygons(); mpCurrentSlide->drawPolygons();
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment