[Libreoffice-commits] core.git: slideshow/source

Daniel Robertson danlrobertson89 at gmail.com
Tue Oct 13 01:05:52 PDT 2015


 slideshow/source/engine/effectrewinder.cxx              |    8 ++--
 slideshow/source/engine/rehearsetimingsactivity.cxx     |   32 ++++++++--------
 slideshow/source/engine/transitions/combtransition.cxx  |    9 +---
 slideshow/source/engine/transitions/slidechangebase.cxx |   15 ++-----
 slideshow/source/engine/unoviewcontainer.cxx            |   27 +++----------
 slideshow/source/engine/usereventqueue.cxx              |   24 +++++-------
 6 files changed, 44 insertions(+), 71 deletions(-)

New commits:
commit 4038b27a0be01fbf6eab9b28cfe00f29e8eba1b7
Author: Daniel Robertson <danlrobertson89 at gmail.com>
Date:   Mon Oct 12 17:36:14 2015 -0400

    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 at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/slideshow/source/engine/effectrewinder.cxx b/slideshow/source/engine/effectrewinder.cxx
index 5fcf1f5..a84b6fd 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 adfb7ea..c631a80 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 81a6bc8..71a22f3 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 941d0ab..07ca4eb 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 5fc6945..692b104 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 4f38849..d384996 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()


More information about the Libreoffice-commits mailing list