summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Robertson <danlrobertson89@gmail.com>2015-10-12 17:36:14 -0400
committerNoel Grandin <noelgrandin@gmail.com>2015-10-13 08:05:18 +0000
commit4038b27a0be01fbf6eab9b28cfe00f29e8eba1b7 (patch)
tree7764554aba96204c12ef4e59da653e644973c8c6
parent3f7d7a218eac78e8bcbb8575f2727074baf4b924 (diff)
tdf#93243 slideshow: boost::bind -> C++11 lambdas
Replace boost::bind with C++11 lambdas Change-Id: I37e769c88d997eaecf46c07e510cef6a30fbce8e Reviewed-on: https://gerrit.libreoffice.org/19334 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--slideshow/source/engine/effectrewinder.cxx8
-rw-r--r--slideshow/source/engine/rehearsetimingsactivity.cxx32
-rw-r--r--slideshow/source/engine/transitions/combtransition.cxx9
-rw-r--r--slideshow/source/engine/transitions/slidechangebase.cxx15
-rw-r--r--slideshow/source/engine/unoviewcontainer.cxx27
-rw-r--r--slideshow/source/engine/usereventqueue.cxx24
6 files changed, 44 insertions, 71 deletions
diff --git a/slideshow/source/engine/effectrewinder.cxx b/slideshow/source/engine/effectrewinder.cxx
index 5fcf1f5b4bb2..a84b6fd38df4 100644
--- a/slideshow/source/engine/effectrewinder.cxx
+++ b/slideshow/source/engine/effectrewinder.cxx
@@ -30,7 +30,6 @@
#include <com/sun/star/animations/EventTrigger.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
-#include <boost/bind.hpp>
#include <boost/enable_shared_from_this.hpp>
using ::com::sun::star::uno::Reference;
@@ -104,17 +103,18 @@ void EffectRewinder::initialize()
mpAnimationStartHandler.reset(
new RewinderAnimationEventHandler(
- ::boost::bind(&EffectRewinder::notifyAnimationStart, this, _1)));
+ [this]( const AnimationNodeSharedPtr& pNode)
+ { return this->notifyAnimationStart( pNode ); } ) );
mrEventMultiplexer.addAnimationStartHandler(mpAnimationStartHandler);
mpSlideStartHandler.reset(
new RewinderEventHandler(
- ::boost::bind(&EffectRewinder::resetEffectCount, this)));
+ [this]() { return this->resetEffectCount(); } ) );
mrEventMultiplexer.addSlideStartHandler(mpSlideStartHandler);
mpSlideEndHandler.reset(
new RewinderEventHandler(
- ::boost::bind(&EffectRewinder::resetEffectCount, this)));
+ [this]() { return this->resetEffectCount(); } ) );
mrEventMultiplexer.addSlideEndHandler(mpSlideEndHandler);
}
diff --git a/slideshow/source/engine/rehearsetimingsactivity.cxx b/slideshow/source/engine/rehearsetimingsactivity.cxx
index adfb7ea74506..c631a80af675 100644
--- a/slideshow/source/engine/rehearsetimingsactivity.cxx
+++ b/slideshow/source/engine/rehearsetimingsactivity.cxx
@@ -45,8 +45,6 @@
#include "mouseeventhandler.hxx"
#include "rehearsetimingsactivity.hxx"
-#include <boost/bind.hpp>
-#include <boost/noncopyable.hpp>
#include <algorithm>
using namespace com::sun::star;
@@ -55,8 +53,7 @@ using namespace com::sun::star::uno;
namespace slideshow {
namespace internal {
-class RehearseTimingsActivity::WakeupEvent : public Event,
- private ::boost::noncopyable
+class RehearseTimingsActivity::WakeupEvent : public Event
{
public:
WakeupEvent( std::shared_ptr< ::canvas::tools::ElapsedTime > const& pTimeBase,
@@ -69,6 +66,9 @@ public:
mrActivityQueue( rActivityQueue )
{}
+ WakeupEvent( const WakeupEvent& ) = delete;
+ WakeupEvent& operator=( const WakeupEvent& ) = delete;
+
virtual void dispose() override {}
virtual bool fire() override
{
@@ -108,12 +108,14 @@ private:
ActivitiesQueue& mrActivityQueue;
};
-class RehearseTimingsActivity::MouseHandler : public MouseEventHandler,
- private boost::noncopyable
+class RehearseTimingsActivity::MouseHandler : public MouseEventHandler
{
public:
explicit MouseHandler( RehearseTimingsActivity& rta );
+ MouseHandler( const MouseHandler& ) = delete;
+ MouseHandler& operator=( const MouseHandler& ) = delete;
+
void reset();
bool hasBeenClicked() const { return mbHasBeenClicked; }
@@ -213,7 +215,8 @@ void RehearseTimingsActivity::start()
// paint and show all sprites:
paintAllSprites();
- for_each_sprite( boost::bind( &cppcanvas::Sprite::show, _1 ) );
+ for_each_sprite( []( const ::cppcanvas::CustomSpriteSharedPtr& pSprite )
+ { return pSprite->show(); } );
mrActivitiesQueue.addActivity( shared_from_this() );
@@ -231,7 +234,8 @@ double RehearseTimingsActivity::stop()
mbActive = false; // will be removed from queue
- for_each_sprite( boost::bind( &cppcanvas::Sprite::hide, _1 ) );
+ for_each_sprite( []( const ::cppcanvas::CustomSpriteSharedPtr& pSprite )
+ { return pSprite->hide(); } );
return maElapsedTime.getElapsedTime();
}
@@ -392,10 +396,10 @@ void RehearseTimingsActivity::viewsChanged()
// new sprite pos, transformation might have changed:
maSpriteRectangle = calcSpriteRectangle( maViews.front().first );
+ ::basegfx::B2DPoint nMin = maSpriteRectangle.getMinimum();
// reposition sprites
- for_each_sprite( boost::bind( &cppcanvas::Sprite::move,
- _1,
- maSpriteRectangle.getMinimum()) );
+ for_each_sprite( [nMin]( const ::cppcanvas::CustomSpriteSharedPtr& pSprite )
+ { return pSprite->move( nMin ); } );
// sprites changed, need screen update
mrScreenUpdater.notifyUpdate();
@@ -405,10 +409,8 @@ void RehearseTimingsActivity::viewsChanged()
void RehearseTimingsActivity::paintAllSprites() const
{
for_each_sprite(
- boost::bind( &RehearseTimingsActivity::paint, this,
- // call getContentCanvas() on each sprite:
- boost::bind(
- &cppcanvas::CustomSprite::getContentCanvas, _1 ) ) );
+ [this]( const ::cppcanvas::CustomSpriteSharedPtr& pSprite )
+ { return this->paint( pSprite->getContentCanvas() ); } );
}
void RehearseTimingsActivity::paint( cppcanvas::CanvasSharedPtr const & canvas ) const
diff --git a/slideshow/source/engine/transitions/combtransition.cxx b/slideshow/source/engine/transitions/combtransition.cxx
index 81a6bc851307..71a22f388f5c 100644
--- a/slideshow/source/engine/transitions/combtransition.cxx
+++ b/slideshow/source/engine/transitions/combtransition.cxx
@@ -27,9 +27,6 @@
#include "combtransition.hxx"
-#include <boost/bind.hpp>
-
-
namespace slideshow {
namespace internal {
@@ -171,10 +168,8 @@ bool CombTransition::operator()( double t )
{
std::for_each( beginViews(),
endViews(),
- boost::bind( &CombTransition::renderComb,
- this,
- t,
- _1 ));
+ [this, &t]( const ViewEntry& rViewEntry )
+ { return this->renderComb( t, rViewEntry ); } );
getScreenUpdater().notifyUpdate();
diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx
index 941d0ab1128d..07ca4eb8b20b 100644
--- a/slideshow/source/engine/transitions/slidechangebase.cxx
+++ b/slideshow/source/engine/transitions/slidechangebase.cxx
@@ -29,7 +29,6 @@
#include "slidechangebase.hxx"
#include "tools.hxx"
-#include <boost/bind.hpp>
#include <algorithm>
using namespace com::sun::star;
@@ -412,11 +411,8 @@ void SlideChangeBase::viewRemoved( const UnoViewSharedPtr& rView )
std::remove_if(
maViewData.begin(),
maViewData.end(),
- boost::bind(
- std::equal_to<UnoViewSharedPtr>(),
- rView,
- // select view:
- boost::bind( &ViewEntry::getView, _1 ))),
+ [rView]( const ViewEntry& rViewEntry )
+ { return rView == rViewEntry.getView(); } ),
maViewData.end() );
}
@@ -431,11 +427,8 @@ void SlideChangeBase::viewChanged( const UnoViewSharedPtr& rView )
std::find_if(
maViewData.begin(),
maViewData.end(),
- boost::bind(
- std::equal_to<UnoViewSharedPtr>(),
- rView,
- // select view:
- boost::bind( &ViewEntry::getView, _1 ) )));
+ [rView]( const ViewEntry& rViewEntry )
+ { return rView == rViewEntry.getView(); } ) );
OSL_ASSERT( aModifiedEntry != maViewData.end() );
if( aModifiedEntry == maViewData.end() )
diff --git a/slideshow/source/engine/unoviewcontainer.cxx b/slideshow/source/engine/unoviewcontainer.cxx
index 5fc69456f097..692b1040a212 100644
--- a/slideshow/source/engine/unoviewcontainer.cxx
+++ b/slideshow/source/engine/unoviewcontainer.cxx
@@ -22,8 +22,6 @@
#include <osl/diagnose.h>
-#include <boost/bind.hpp>
-
#include <algorithm>
@@ -44,15 +42,12 @@ namespace slideshow
{
// check whether same view is already added
+ uno::Reference< presentation::XSlideShowView > rTmpView = rView->getUnoView();
// already added?
if( ::std::any_of( maViews.begin(),
maViews.end(),
- ::boost::bind(
- ::std::equal_to< uno::Reference< presentation::XSlideShowView > >(),
- rView->getUnoView(),
- ::boost::bind(
- &UnoView::getUnoView,
- _1 ) ) ) )
+ [&rTmpView]( const UnoViewSharedPtr& pView )
+ { return rTmpView == pView->getUnoView(); } ) )
{
// yes, nothing to do
return false;
@@ -73,12 +68,8 @@ namespace slideshow
// added in the first place?
if( (aIter=::std::find_if( maViews.begin(),
aEnd,
- ::boost::bind(
- ::std::equal_to< uno::Reference< presentation::XSlideShowView > >(),
- ::boost::cref( xView ),
- ::boost::bind(
- &UnoView::getUnoView,
- _1 ) ) ) ) == aEnd )
+ [&xView]( const UnoViewSharedPtr& pView )
+ { return xView == pView->getUnoView(); } )) == aEnd )
{
// nope, nothing to do
return UnoViewSharedPtr();
@@ -88,12 +79,8 @@ namespace slideshow
::std::count_if(
maViews.begin(),
aEnd,
- ::boost::bind(
- ::std::equal_to< uno::Reference< presentation::XSlideShowView > >(),
- ::boost::cref( xView ),
- ::boost::bind(
- &UnoView::getUnoView,
- _1 ))) == 1,
+ [&xView]( const UnoViewSharedPtr& pView )
+ { return xView == pView->getUnoView(); } ) == 1,
"UnoViewContainer::removeView(): View was added multiple times" );
UnoViewSharedPtr pView( *aIter );
diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx
index 4f38849d022d..d38499628053 100644
--- a/slideshow/source/engine/usereventqueue.cxx
+++ b/slideshow/source/engine/usereventqueue.cxx
@@ -27,8 +27,6 @@
#include <com/sun/star/awt/MouseButton.hpp>
#include <com/sun/star/awt/MouseEvent.hpp>
-#include <boost/bind.hpp>
-
#include "delayevent.hxx"
#include "usereventqueue.hxx"
#include "cursormanager.hxx"
@@ -636,8 +634,8 @@ void UserEventQueue::registerAnimationStartEvent(
registerEvent( mpAnimationStartEventHandler,
rEvent,
xNode,
- boost::bind( &EventMultiplexer::addAnimationStartHandler,
- boost::ref( mrMultiplexer ), _1 ) );
+ [this]( const AnimationEventHandlerSharedPtr& rHandler )
+ { return this->mrMultiplexer.addAnimationStartHandler( rHandler ); } );
}
void UserEventQueue::registerAnimationEndEvent(
@@ -647,8 +645,8 @@ void UserEventQueue::registerAnimationEndEvent(
registerEvent( mpAnimationEndEventHandler,
rEvent,
xNode,
- boost::bind( &EventMultiplexer::addAnimationEndHandler,
- boost::ref( mrMultiplexer ), _1 ) );
+ [this]( const AnimationEventHandlerSharedPtr& rHandler )
+ { return this->mrMultiplexer.addAnimationEndHandler( rHandler ); } );
}
void UserEventQueue::registerAudioStoppedEvent(
@@ -658,8 +656,8 @@ void UserEventQueue::registerAudioStoppedEvent(
registerEvent( mpAudioStoppedEventHandler,
rEvent,
xNode,
- boost::bind( &EventMultiplexer::addAudioStoppedHandler,
- boost::ref( mrMultiplexer ), _1 ) );
+ [this]( const AnimationEventHandlerSharedPtr& rHandler )
+ { return this->mrMultiplexer.addAudioStoppedHandler( rHandler ); } );
}
void UserEventQueue::registerShapeClickEvent( const EventSharedPtr& rEvent,
@@ -783,9 +781,8 @@ void UserEventQueue::registerMouseEnterEvent( const EventSharedPtr& rEvent,
registerEvent( mpMouseEnterHandler,
rEvent,
rShape,
- boost::bind( &EventMultiplexer::addMouseMoveHandler,
- boost::ref( mrMultiplexer ), _1,
- 0.0 /* default prio */ ) );
+ [this]( const MouseEventHandlerSharedPtr& rHandler )
+ { return this->mrMultiplexer.addMouseMoveHandler( rHandler, 0.0 ); } );
}
void UserEventQueue::registerMouseLeaveEvent( const EventSharedPtr& rEvent,
@@ -794,9 +791,8 @@ void UserEventQueue::registerMouseLeaveEvent( const EventSharedPtr& rEvent,
registerEvent( mpMouseLeaveHandler,
rEvent,
rShape,
- boost::bind( &EventMultiplexer::addMouseMoveHandler,
- boost::ref( mrMultiplexer ), _1,
- 0.0 /* default prio */ ) );
+ [this]( const MouseEventHandlerSharedPtr& rHandler )
+ { return this->mrMultiplexer.addMouseMoveHandler( rHandler, 0.0 ); } );
}
void UserEventQueue::callSkipEffectEventHandler()