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

Daniel Robertson danlrobertson89 at gmail.com
Mon Aug 24 14:20:34 PDT 2015


 slideshow/source/engine/slide/layer.cxx                        |   92 ++-------
 slideshow/source/engine/slide/layermanager.cxx                 |  102 +++-------
 slideshow/source/engine/slide/shapemanagerimpl.cxx             |   12 -
 slideshow/source/engine/slide/slideimpl.cxx                    |   81 ++-----
 slideshow/source/engine/slide/targetpropertiescreator.cxx      |   16 -
 slideshow/source/engine/slide/userpaintoverlay.cxx             |    9 
 slideshow/source/engine/slideshowimpl.cxx                      |   56 ++---
 slideshow/source/engine/slideview.cxx                          |   18 -
 slideshow/source/engine/transitions/slidechangebase.cxx        |   23 --
 slideshow/source/engine/transitions/slidetransitionfactory.cxx |    9 
 slideshow/source/engine/unoviewcontainer.cxx                   |   32 ---
 slideshow/source/engine/usereventqueue.cxx                     |    5 
 slideshow/source/engine/waitsymbol.cxx                         |    6 
 13 files changed, 146 insertions(+), 315 deletions(-)

New commits:
commit ead5bc3cfb07a4e96e367e7904dc674ee5f5ccd6
Author: Daniel Robertson <danlrobertson89 at gmail.com>
Date:   Fri Aug 21 21:51:09 2015 -0400

    slideshow: replace for_each with range-based loop
    
    Replace ::std::for_each for a more readable range-based for loop in
    cases in which the function object to be applied by for_each is more
    readable as the body of a for loop.
    
    Change-Id: Ib0b488b36ed58c65c56357e04391b85096d043aa
    Reviewed-on: https://gerrit.libreoffice.org/17930
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/slideshow/source/engine/slide/layer.cxx b/slideshow/source/engine/slide/layer.cxx
index 7bda7c23..a5ac852 100644
--- a/slideshow/source/engine/slide/layer.cxx
+++ b/slideshow/source/engine/slide/layer.cxx
@@ -28,9 +28,6 @@
 
 #include "layer.hxx"
 
-#include <boost/bind.hpp>
-
-
 using namespace ::com::sun::star;
 
 namespace slideshow
@@ -68,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 rNewView == rViewEntry.getView(); } ) ) != aEnd )
             {
                 // already added - just return existing layer
                 return aIter->mpViewLayer;
@@ -101,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 rView == rViewEntry.getView(); } ) ) == aEnd )
             {
                 // View was not added/is already removed
                 return ViewLayerSharedPtr();
@@ -112,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 rView == rViewEntry.getView(); } ) == 1,
                         "Layer::removeView(): view added multiple times" );
 
             ViewLayerSharedPtr pRet( aIter->mpViewLayer );
@@ -128,25 +119,16 @@ namespace slideshow
         {
             rShape->clearAllViewLayers();
 
-            std::for_each( maViewEntries.begin(),
-                           maViewEntries.end(),
-                           boost::bind(&Shape::addViewLayer,
-                                       boost::cref(rShape),
-                                       boost::bind(&ViewEntry::getViewLayer,
-                                                   _1),
-                                       false ));
+            for( const auto& rViewEntry : maViewEntries )
+                rShape->addViewLayer( rViewEntry.getViewLayer(), false );
         }
 
         void Layer::setPriority( const ::basegfx::B1DRange& rPrioRange )
         {
             if( !mbBackgroundLayer )
             {
-                std::for_each( maViewEntries.begin(),
-                               maViewEntries.end(),
-                               boost::bind( &ViewLayer::setPriority,
-                                            boost::bind( &ViewEntry::getViewLayer,
-                                                         _1 ),
-                                            boost::cref(rPrioRange)));
+                for( const auto& rViewEntry : maViewEntries )
+                    rViewEntry.getViewLayer()->setPriority( rPrioRange );
             }
         }
 
@@ -182,12 +164,12 @@ namespace slideshow
                 return false;
 
             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,13 +189,8 @@ namespace slideshow
         void Layer::clearContent()
         {
             // clear content on all view layers
-            std::for_each( maViewEntries.begin(),
-                           maViewEntries.end(),
-                           boost::bind(
-                               &ViewLayer::clearAll,
-                               boost::bind(
-                                   &ViewEntry::getViewLayer,
-                                   _1)));
+            for( const auto& rViewEntry : maViewEntries )
+                rViewEntry.getViewLayer()->clearAll();
 
             // layer content cleared, update areas are not sensible
             // anymore.
@@ -249,24 +226,15 @@ namespace slideshow
                 // resulting clip polygon will be empty.
                 if( aClip.count() )
                 {
-                    // set clip to all view layers
-                    std::for_each( maViewEntries.begin(),
-                                   maViewEntries.end(),
-                                   boost::bind(
-                                       &ViewLayer::setClip,
-                                       boost::bind(
-                                           &ViewEntry::getViewLayer,
-                                           _1),
-                                       boost::cref(aClip)));
-
-                    // clear update area on all view layers
-                    std::for_each( maViewEntries.begin(),
-                                   maViewEntries.end(),
-                                   boost::bind(
-                                       &ViewLayer::clear,
-                                       boost::bind(
-                                           &ViewEntry::getViewLayer,
-                                           _1)));
+                    for( const auto& rViewEntry : maViewEntries ) {
+                        ViewLayerSharedPtr pViewLayer = rViewEntry.getViewLayer();
+
+                        // set clip to all view layers
+                        pViewLayer->setClip( aClip );
+
+                        // clear update area of view layer
+                        pViewLayer->clear();
+                    }
 
                     mbClipSet = true;
                 }
@@ -282,14 +250,8 @@ namespace slideshow
                 mbClipSet = false;
 
                 basegfx::B2DPolyPolygon aEmptyClip;
-                std::for_each( maViewEntries.begin(),
-                               maViewEntries.end(),
-                               boost::bind(
-                                   &ViewLayer::setClip,
-                                   boost::bind(
-                                       &ViewEntry::getViewLayer,
-                                       _1),
-                                   boost::cref(aEmptyClip)));
+                for( const auto& rViewEntry : maViewEntries )
+                    rViewEntry.getViewLayer()->setClip( aEmptyClip );
             }
 
             clearUpdateRanges();
diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx
index 2440672..fa73942 100644
--- a/slideshow/source/engine/slide/layermanager.cxx
+++ b/slideshow/source/engine/slide/layermanager.cxx
@@ -53,11 +53,9 @@ namespace slideshow
         {
             LayerSharedPtr                      pCurrLayer;
             ViewLayerSharedPtr                  pCurrViewLayer;
-            LayerShapeMap::const_iterator       aIter( maAllShapes.begin() );
-            const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() );
-            while( aIter != aEnd )
+            for( const auto& rShape : maAllShapes )
             {
-                LayerSharedPtr pLayer = aIter->second.lock();
+                LayerSharedPtr pLayer = rShape.second.lock();
                 if( pLayer && pLayer != pCurrLayer )
                 {
                     pCurrLayer = pLayer;
@@ -65,9 +63,7 @@ namespace slideshow
                 }
 
                 if( pCurrViewLayer )
-                    shapeFunc(aIter->first,pCurrViewLayer);
-
-                ++aIter;
+                    shapeFunc( rShape.first, pCurrViewLayer );
             }
         }
 
@@ -95,11 +91,8 @@ namespace slideshow
                         maPageBounds ));
 
             // init views
-            std::for_each( mrViews.begin(),
-                           mrViews.end(),
-                           ::boost::bind(&LayerManager::viewAdded,
-                                         this,
-                                         _1) );
+            for( const auto& rView : mrViews )
+                this->viewAdded( rView );
         }
 
         void LayerManager::activate( bool bSlideBackgoundPainted )
@@ -110,24 +103,19 @@ namespace slideshow
 
             if( !bSlideBackgoundPainted )
             {
-                std::for_each(mrViews.begin(),
-                              mrViews.end(),
-                              boost::mem_fn(&View::clearAll));
+                for( const auto& rView : mrViews )
+                    rView->clearAll();
 
                 // force update of whole slide area
-                std::for_each( maLayers.begin(),
-                               maLayers.end(),
-                               boost::bind( &Layer::addUpdateRange,
-                                            _1,
-                                            boost::cref(maPageBounds) ));
+                for( const auto& pLayer : maLayers )
+                    pLayer->addUpdateRange( maPageBounds );
             }
             else
             {
                 // clear all possibly pending update areas - content
                 // is there, already
-                std::for_each( maLayers.begin(),
-                               maLayers.end(),
-                               boost::mem_fn( &Layer::clearUpdateRanges ));
+                for( const auto& pLayer : maLayers )
+                    pLayer->clearUpdateRanges();
             }
 
             updateShapeLayers( bSlideBackgoundPainted );
@@ -189,11 +177,8 @@ namespace slideshow
 
             // in case we haven't reached all layers from the
             // maAllShapes, issue addView again for good measure
-            std::for_each( maLayers.begin(),
-                           maLayers.end(),
-                           boost::bind( &Layer::addView,
-                                        _1,
-                                        boost::cref(rView) ));
+            for( const auto& pLayer : maLayers )
+                pLayer->addView( rView );
         }
 
         void LayerManager::viewRemoved( const UnoViewSharedPtr& rView )
@@ -214,11 +199,8 @@ namespace slideshow
 
             // in case we haven't reached all layers from the
             // maAllShapes, issue removeView again for good measure
-            std::for_each( maLayers.begin(),
-                           maLayers.end(),
-                           boost::bind( &Layer::removeView,
-                                        _1,
-                                        boost::cref(rView) ));
+            for( const auto& pLayer : maLayers )
+                pLayer->removeView( rView );
         }
 
         void LayerManager::viewChanged( const UnoViewSharedPtr& rView )
@@ -240,17 +222,14 @@ namespace slideshow
                 return;
 
             // clear view area
-            ::std::for_each( mrViews.begin(),
-                             mrViews.end(),
-                             ::boost::mem_fn(&View::clearAll) );
+            for( const auto& rView : mrViews )
+                rView->clearAll();
 
             // TODO(F3): resize and repaint all layers
 
             // render all shapes
-            std::for_each( maAllShapes.begin(),
-                           maAllShapes.end(),
-                           []( const LayerShapeMap::value_type& cp )
-                           { cp.first->render(); } );
+            for( const auto& rShape : maAllShapes )
+                rShape.first->render();
         }
 
         void LayerManager::addShape( const ShapeSharedPtr& rShape )
@@ -487,16 +466,14 @@ namespace slideshow
             // send update() calls to every shape in the
             // maUpdateShapes set, which is _animated_ (i.e. a
             // sprite).
-            const ShapeUpdateSet::const_iterator aEnd=maUpdateShapes.end();
-            ShapeUpdateSet::const_iterator       aCurrShape=maUpdateShapes.begin();
-            while( aCurrShape != aEnd )
+            for( const auto& pShape : maUpdateShapes )
             {
-                if( (*aCurrShape)->isBackgroundDetached() )
+                if( pShape->isBackgroundDetached() )
                 {
                     // can update shape directly, without
                     // affecting layer content (shape is
                     // currently displayed in a sprite)
-                    if( !(*aCurrShape)->update() )
+                    if( !pShape->update() )
                         bRet = false; // delay error exit
                 }
                 else
@@ -509,10 +486,8 @@ namespace slideshow
                     // cannot update shape directly, it's not
                     // animated and update() calls will prolly
                     // overwrite other page content.
-                    addUpdateArea( *aCurrShape );
+                    addUpdateArea( pShape );
                 }
-
-                ++aCurrShape;
             }
 
             maUpdateShapes.clear();
@@ -545,11 +520,9 @@ namespace slideshow
             bool                                bIsCurrLayerUpdating(false);
             Layer::EndUpdater                   aEndUpdater;
             LayerSharedPtr                      pCurrLayer;
-            LayerShapeMap::const_iterator       aIter( maAllShapes.begin() );
-            const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() );
-            while( aIter != aEnd )
+            for( const auto& rShape : maAllShapes )
             {
-                LayerSharedPtr pLayer = aIter->second.lock();
+                LayerSharedPtr pLayer = rShape.second.lock();
                 if( pLayer != pCurrLayer )
                 {
                     pCurrLayer = pLayer;
@@ -560,14 +533,12 @@ namespace slideshow
                 }
 
                 if( bIsCurrLayerUpdating &&
-                    !aIter->first->isBackgroundDetached() &&
-                    pCurrLayer->isInsideUpdateArea(aIter->first) )
+                    rShape.first->isBackgroundDetached() &&
+                    pCurrLayer->isInsideUpdateArea( rShape.first ) )
                 {
-                    if( !aIter->first->render() )
+                    if( rShape.first->render() )
                         bRet = false;
                 }
-
-                ++aIter;
             }
 
             return bRet;
@@ -656,9 +627,7 @@ namespace slideshow
             bool bRet( true );
             ViewLayerSharedPtr pTmpLayer( new DummyLayer( rTargetCanvas ) );
 
-            LayerShapeMap::const_iterator       aIter( maAllShapes.begin() );
-            const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() );
-            while( aIter != aEnd )
+            for( const auto& rShape : maAllShapes )
             {
                 try
                 {
@@ -667,11 +636,11 @@ namespace slideshow
                     // ViewLayer. Since we add the shapes in the
                     // maShapeSet order (which is also the render order),
                     // this is equivalent to a subsequent render() call)
-                    aIter->first->addViewLayer( pTmpLayer,
+                    rShape.first->addViewLayer( pTmpLayer,
                                                 true );
 
                     // and remove again, this is only temporary
-                    aIter->first->removeViewLayer( pTmpLayer );
+                    rShape.first->removeViewLayer( pTmpLayer );
                 }
                 catch( uno::Exception& )
                 {
@@ -684,8 +653,6 @@ namespace slideshow
                     // at least one shape could not be rendered
                     bRet = false;
                 }
-
-                ++aIter;
             }
 
             return bRet;
@@ -744,11 +711,8 @@ namespace slideshow
 
             // create ViewLayers for all registered views, and add to
             // newly created layer.
-            ::std::for_each( mrViews.begin(),
-                             mrViews.end(),
-                             boost::bind( &Layer::addView,
-                                          boost::cref(pLayer),
-                                          _1 ));
+            for( const auto& rView : mrViews )
+                pLayer->addView( rView );
 
             return pLayer;
         }
diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx
index a74253f..9867f09 100644
--- a/slideshow/source/engine/slide/shapemanagerimpl.cxx
+++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx
@@ -64,16 +64,12 @@ void ShapeManagerImpl::activate( bool bSlideBackgoundPainted )
 
         // clone listener map
         uno::Reference<presentation::XShapeEventListener> xDummyListener;
-        std::for_each( mrGlobalListenersMap.begin(),
-                       mrGlobalListenersMap.end(),
-                       [&xDummyListener, this]( const ShapeEventListenerMap::value_type& cp )
-                       { this->listenerAdded(xDummyListener, cp.first); } );
+        for( const auto& rListener : mrGlobalListenersMap )
+            this->listenerAdded( xDummyListener, rListener.first );
 
         // clone cursor map
-        std::for_each( mrGlobalCursorMap.begin(),
-                       mrGlobalCursorMap.end(),
-                       [this]( const ShapeCursorMap::value_type& cp )
-                       { this->cursorChanged(cp.first, cp.second); } );
+        for( const auto& rListener : mrGlobalCursorMap )
+            this->cursorChanged( rListener.first, rListener.second );
 
         if( mpLayerManager )
             mpLayerManager->activate( bSlideBackgoundPainted );
diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx
index 0d26285..9a6e83c 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 <algorithm>
 #include <functional>
@@ -282,49 +280,6 @@ private:
 
 
 
-
-
-class SlideRenderer
-{
-public:
-    explicit SlideRenderer( SlideImpl& rSlide ) :
-        mrSlide( rSlide )
-    {
-    }
-
-    void operator()( const UnoViewSharedPtr& rView )
-    {
-        // fully clear view content to background color
-        rView->clearAll();
-
-        SlideBitmapSharedPtr         pBitmap( mrSlide.getCurrentSlideBitmap( rView ) );
-        ::cppcanvas::CanvasSharedPtr pCanvas( rView->getCanvas() );
-
-        const ::basegfx::B2DHomMatrix   aViewTransform( rView->getTransformation() );
-        const ::basegfx::B2DPoint       aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
-
-        // setup a canvas with device coordinate space, the slide
-        // bitmap already has the correct dimension.
-        ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() );
-        pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
-
-        // render at given output position
-        pBitmap->move( aOutPosPixel );
-
-        // clear clip (might have been changed, e.g. from comb
-        // transition)
-        pBitmap->clip( ::basegfx::B2DPolyPolygon() );
-        pBitmap->draw( pDevicePixelCanvas );
-    }
-
-private:
-    SlideImpl& mrSlide;
-};
-
-
-
-
-
 SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >&           xDrawPage,
                       const uno::Reference<drawing::XDrawPagesSupplier>&    xDrawPages,
                       const uno::Reference< animations::XAnimationNode >&   xRootNode,
@@ -388,11 +343,8 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >&           xDra
     mbPaintOverlayActive( false )
 {
     // clone already existing views for slide bitmaps
-    std::for_each( rViewContainer.begin(),
-                   rViewContainer.end(),
-                   boost::bind( &SlideImpl::viewAdded,
-                                this,
-                                _1 ));
+    for( const auto& rView : rViewContainer )
+        this->viewAdded( rView );
 
     // register screen update (LayerManager needs to signal pending
     // updates)
@@ -462,13 +414,30 @@ bool SlideImpl::show( bool bSlideBackgoundPainted )
     // render slide to screen, if requested
     if( !bSlideBackgoundPainted )
     {
-        std::for_each(maContext.mrViewContainer.begin(),
-                      maContext.mrViewContainer.end(),
-                      boost::mem_fn(&View::clearAll));
+        for( const auto& rView : maContext.mrViewContainer ) {
+            // fully clear view content to background color
+            rView->clearAll();
+
+            SlideBitmapSharedPtr          pBitmap( this->getCurrentSlideBitmap( rView ) );
+            ::cppcanvas::CanvasSharedPtr  pCanvas( rView->getCanvas() );
+
+            const ::basegfx::B2DHomMatrix aViewTransform( rView->getTransformation() );
+            const ::basegfx::B2DPoint     aOutPosPixel( aViewTransform * ::basegfx::B2DPoint() );
+
+            // setup a canvas with device coordinate space, the slide
+            // bitmap already has the correct dimension.
+            ::cppcanvas::CanvasSharedPtr pDevicePixelCanvas( pCanvas->clone() );
+            pDevicePixelCanvas->setTransformation( ::basegfx::B2DHomMatrix() );
+
+            // render at given output position
+            pBitmap->move( aOutPosPixel );
+
+            // clear clip (might have been changed, e.g. from comb
+            // transition)
+            pBitmap->clip( ::basegfx::B2DPolyPolygon() );
+            pBitmap->draw( pDevicePixelCanvas );
+        }
 
-        std::for_each( maContext.mrViewContainer.begin(),
-                       maContext.mrViewContainer.end(),
-                       SlideRenderer(*this) );
         maContext.mrScreenUpdater.notifyUpdate();
     }
 
diff --git a/slideshow/source/engine/slide/targetpropertiescreator.cxx b/slideshow/source/engine/slide/targetpropertiescreator.cxx
index d1877c6..2eafaf1 100644
--- a/slideshow/source/engine/slide/targetpropertiescreator.cxx
+++ b/slideshow/source/engine/slide/targetpropertiescreator.cxx
@@ -332,27 +332,23 @@ namespace internal
         uno::Sequence< animations::TargetProperties > aRes( aShapeHash.size() );
 
         ::std::size_t                       nCurrIndex(0);
-        XShapeHash::const_iterator          aCurr( aShapeHash.begin() );
-        const XShapeHash::const_iterator    aEnd ( aShapeHash.end()   );
-        while( aCurr != aEnd )
+        for( const auto& rShapeHash : aShapeHash )
         {
             animations::TargetProperties& rCurrProps( aRes[ nCurrIndex++ ] );
 
-            if( aCurr->first.mnParagraphIndex == -1 )
+            if( rShapeHash.first.mnParagraphIndex == -1 )
             {
-                rCurrProps.Target = uno::makeAny( aCurr->first.mxRef );
+                rCurrProps.Target = uno::makeAny( rShapeHash.first.mxRef );
             }
             else
             {
                 rCurrProps.Target = uno::makeAny(
                     presentation::ParagraphTarget(
-                        aCurr->first.mxRef,
-                        aCurr->first.mnParagraphIndex ) );
+                        rShapeHash.first.mxRef,
+                        rShapeHash.first.mnParagraphIndex ) );
             }
 
-            rCurrProps.Properties = ::comphelper::containerToSequence( aCurr->second );
-
-            ++aCurr;
+            rCurrProps.Properties = ::comphelper::containerToSequence( rShapeHash.second );
         }
 
         return aRes;
diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx
index 3389912..960794f 100644
--- a/slideshow/source/engine/slide/userpaintoverlay.cxx
+++ b/slideshow/source/engine/slide/userpaintoverlay.cxx
@@ -36,7 +36,6 @@
 #include "screenupdater.hxx"
 #include "vieweventhandler.hxx"
 
-#include <boost/bind.hpp>
 #include <boost/noncopyable.hpp>
 #include "slide.hxx"
 #include "cursormanager.hxx"
@@ -76,11 +75,9 @@ namespace slideshow
                 mnSize(100),
                 mbActive( bActive )
             {
-                std::for_each( rViews.begin(),
-                               rViews.end(),
-                               boost::bind( &PaintOverlayHandler::viewAdded,
-                                            this,
-                                            _1 ));
+                for( const auto& rView : rViews )
+                    this->viewAdded( rView );
+
                 drawPolygons();
             }
 
diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx
index d1c417d..2633d11 100644
--- a/slideshow/source/engine/slideshowimpl.cxx
+++ b/slideshow/source/engine/slideshowimpl.cxx
@@ -886,18 +886,17 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition(
 PolygonMap::iterator SlideShowImpl::findPolygons( uno::Reference<drawing::XDrawPage> const& xDrawPage)
 {
     // TODO(P2) : Optimze research in the map.
-    bool bFound = false;
-    PolygonMap::iterator aIter=maPolygons.begin();
-
-    while(aIter!=maPolygons.end() && !bFound)
+    PolygonMap::iterator aEnd = maPolygons.end();
+    for( auto aIter = maPolygons.begin();
+            aIter != aEnd;
+            ++aIter )
     {
         if(aIter->first == xDrawPage)
-            bFound = true;
-        else
-            ++aIter;
+            return aIter;
     }
-
-    return aIter;
+    // if no element is found return the element
+    // one past the last valid element in the map
+    return aEnd;
 }
 
 SlideSharedPtr SlideShowImpl::makeSlide(
@@ -1131,10 +1130,8 @@ void SlideShowImpl::displaySlide(
             // push new transformation to all views, if size changed
             if( !mpPreviousSlide || oldSlideSize != slideSize )
             {
-                std::for_each( maViewContainer.begin(),
-                               maViewContainer.end(),
-                               boost::bind( &View::setViewSize, _1,
-                                            boost::cref(slideSize) ));
+                for( const auto& rView : maViewContainer )
+                    rView->setViewSize( slideSize );
 
                 // explicitly notify view change here,
                 // because transformation might have changed:
@@ -1447,18 +1444,16 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult
     aPropLayer <<= false;
     xLayerPropSet->setPropertyValue("IsLocked", aPropLayer);
 
-    PolygonMap::iterator aIter=maPolygons.begin();
-
     PolyPolygonVector aPolygons;
     ::cppcanvas::PolyPolygonSharedPtr pPolyPoly;
     ::basegfx::B2DPolyPolygon b2DPolyPoly;
 
     //Register polygons for each slide
-    while(aIter!=maPolygons.end())
+    for( const auto& rPoly : maPolygons )
     {
-        aPolygons = aIter->second;
+        aPolygons = rPoly.second;
         //Get shapes for the slide
-        ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > Shapes(aIter->first, ::com::sun::star::uno::UNO_QUERY);
+        ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > Shapes(rPoly.first, ::com::sun::star::uno::UNO_QUERY);
         //Retrieve polygons for one slide
         for( PolyPolygonVector::iterator aIterPoly=aPolygons.begin(),
                  aEnd=aPolygons.end();
@@ -1534,7 +1529,6 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult
                 }
             }
         }
-        ++aIter;
     }
 }
 
@@ -1961,11 +1955,8 @@ bool SlideShowImpl::requestCursor( sal_Int16 nCursorShape )
     const sal_Int16 nActualCursor = calcActiveCursor(mnCurrentCursor);
 
     // change all views to the requested cursor ID
-    std::for_each( maViewContainer.begin(),
-                   maViewContainer.end(),
-                   boost::bind( &View::setCursorShape,
-                                _1,
-                                nActualCursor ));
+    for( const auto& rView : maViewContainer )
+        rView->setCursorShape( nActualCursor );
 
     return nActualCursor==nCursorShape;
 }
@@ -1974,12 +1965,11 @@ void SlideShowImpl::resetCursor()
 {
     mnCurrentCursor = awt::SystemPointer::ARROW;
 
+    const sal_Int16 nActualCursor = calcActiveCursor( mnCurrentCursor );
+
     // change all views to the default cursor ID
-    std::for_each( maViewContainer.begin(),
-                   maViewContainer.end(),
-                   boost::bind( &View::setCursorShape,
-                                _1,
-                                calcActiveCursor(mnCurrentCursor) ));
+    for( const auto& rView : maViewContainer )
+        rView->setCursorShape( nActualCursor );
 }
 
 sal_Bool SlideShowImpl::update( double & nNextTimeout )
@@ -2121,13 +2111,11 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout )
             (!bRet ||
              nNextTimeout > 1.0) )
         {
-            UnoViewVector::const_iterator       aCurr(maViewContainer.begin());
-            const UnoViewVector::const_iterator aEnd(maViewContainer.end());
-            while( aCurr != aEnd )
+            for( const auto& pView : maViewContainer )
             {
                 try
                 {
-                    uno::Reference< presentation::XSlideShowView > xView( (*aCurr)->getUnoView(),
+                    uno::Reference< presentation::XSlideShowView > xView( pView->getUnoView(),
                                                                           uno::UNO_QUERY_THROW );
                     uno::Reference< util::XUpdatable >             xUpdatable( xView->getCanvas(),
                                                                                uno::UNO_QUERY_THROW );
@@ -2143,8 +2131,6 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout )
                                     comphelper::anyToString( cppu::getCaughtException() ),
                                     RTL_TEXTENCODING_UTF8 ).getStr() );
                 }
-
-                ++aCurr;
             }
 
             mbSlideShowIdle = true;
diff --git a/slideshow/source/engine/slideview.cxx b/slideshow/source/engine/slideview.cxx
index 11f156b..55c810d 100644
--- a/slideshow/source/engine/slideview.cxx
+++ b/slideshow/source/engine/slideview.cxx
@@ -283,23 +283,19 @@ class LayerSpriteContainer
         SpriteVector aValidSprites;
 
         // check all sprites for validity and set new priority
-        SpriteVector::iterator       aCurrSprite( maSprites.begin() );
-        const SpriteVector::iterator aEnd( maSprites.end() );
-        while( aCurrSprite != aEnd )
+        for( const auto& rSprite : maSprites )
         {
-            cppcanvas::CustomSpriteSharedPtr pCurrSprite( aCurrSprite->mpSprite.lock() );
+            cppcanvas::CustomSpriteSharedPtr pCurrSprite( rSprite.mpSprite.lock() );
 
             if( pCurrSprite )
             {
                 // only copy still valid sprites over to the refreshed
                 // sprite vector.
-                aValidSprites.push_back( *aCurrSprite );
+                aValidSprites.push_back( rSprite );
 
                 pCurrSprite->setPriority(
                     getSpritePriority( aValidSprites.size()-1 ));
             }
-
-            ++aCurrSprite;
         }
 
         // replace sprite list with pruned one
@@ -1147,11 +1143,9 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const
         getTransformation() );
 
     // check all layers for validity, and retain only the live ones
-    ViewLayerVector::const_iterator       aCurr( maViewLayers.begin() );
-    const ViewLayerVector::const_iterator aEnd( maViewLayers.end() );
-    while( aCurr != aEnd )
+    for( const auto& rViewLayer : maViewLayers )
     {
-        boost::shared_ptr< SlideViewLayer > pCurrLayer( aCurr->lock() );
+        boost::shared_ptr< SlideViewLayer > pCurrLayer( rViewLayer.lock() );
 
         if( pCurrLayer )
         {
@@ -1161,8 +1155,6 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const
                 pCurrLayer->updateView( rCurrTransform,
                                         maUserSize );
         }
-
-        ++aCurr;
     }
 
     // replace layer list with pruned one
diff --git a/slideshow/source/engine/transitions/slidechangebase.cxx b/slideshow/source/engine/transitions/slidechangebase.cxx
index 0a99eeb..a39d401 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;
@@ -180,11 +179,8 @@ void SlideChangeBase::prefetch( const AnimatableShapeSharedPtr&,
     mrEventMultiplexer.addViewHandler( shared_from_this() );
 
     // init views and create slide bitmaps
-    std::for_each( mrViewContainer.begin(),
-                   mrViewContainer.end(),
-                   boost::bind( &SlideChangeBase::viewAdded,
-                                this,
-                                _1 ));
+    for( const auto& rView : mrViewContainer )
+        this->viewAdded( rView );
 
     mbPrefetched = true;
 }
@@ -415,11 +411,9 @@ 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 )
+            // select and compare view
+            { return rView == rViewEntry.getView(); } ),
         maViewData.end() );
 }
 
@@ -434,11 +428,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/transitions/slidetransitionfactory.cxx b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
index fbe7001..103757d 100644
--- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx
+++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx
@@ -45,9 +45,6 @@
 #include "combtransition.hxx"
 #include "tools.hxx"
 
-#include <boost/bind.hpp>
-
-
 /***************************************************
  ***                                             ***
  ***          Slide Transition Effects           ***
@@ -189,10 +186,8 @@ public:
 
     virtual bool operator()( double t ) SAL_OVERRIDE
     {
-        std::for_each(maTransitions.begin(),
-                      maTransitions.end(),
-                      boost::bind( &TransitionViewPair::update,
-                                   _1, t) );
+        for( const auto& pTransition : maTransitions )
+            pTransition->update( t );
         return true;
     }
 
diff --git a/slideshow/source/engine/unoviewcontainer.cxx b/slideshow/source/engine/unoviewcontainer.cxx
index f51f104..0215b3c 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>
 
 
@@ -45,14 +43,11 @@ namespace slideshow
             // check whether same view is already added
 
             // already added?
+            const uno::Reference< presentation::XSlideShowView > rShowView = rView->getUnoView();
             if( ::std::any_of( maViews.begin(),
                                maViews.end(),
-                               ::boost::bind(
-                                    ::std::equal_to< uno::Reference< presentation::XSlideShowView > >(),
-                                    rView->getUnoView(),
-                                    ::boost::bind(
-                                        &UnoView::getUnoView,
-                                        _1 ) ) ) )
+                               [&rShowView]( const UnoViewSharedPtr& pUnoView )
+                               { return rShowView == pUnoView->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& pUnoView )
+                                       { return xView == pUnoView->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& pUnoView )
+                    { return xView == pUnoView->getUnoView(); } ) == 1,
                 "UnoViewContainer::removeView(): View was added multiple times" );
 
             UnoViewSharedPtr pView( *aIter );
@@ -106,9 +93,8 @@ namespace slideshow
 
         void UnoViewContainer::dispose()
         {
-            ::std::for_each( maViews.begin(),
-                             maViews.end(),
-                             ::boost::mem_fn(&UnoView::_dispose) );
+            for( const auto& rView : maViews )
+                rView->_dispose();
             maViews.clear();
         }
     }
diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx
index 53f043a..6eb579c 100644
--- a/slideshow/source/engine/usereventqueue.cxx
+++ b/slideshow/source/engine/usereventqueue.cxx
@@ -143,9 +143,8 @@ public:
             bRet = !rVec.empty();
 
             // registered node found -> fire all events in the vector
-            std::for_each( rVec.begin(), rVec.end(),
-                           boost::bind( &EventQueue::addEvent,
-                                        boost::ref( mrEventQueue ), _1 ) );
+            for( const auto& pEvent : rVec )
+                mrEventQueue.addEvent( pEvent );
 
             rVec.clear();
         }
diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx
index 48da4c7..ab3dbbf 100644
--- a/slideshow/source/engine/waitsymbol.cxx
+++ b/slideshow/source/engine/waitsymbol.cxx
@@ -67,10 +67,8 @@ WaitSymbol::WaitSymbol( uno::Reference<rendering::XBitmap> const &   xBitmap,
     mrScreenUpdater( rScreenUpdater ),
     mbVisible(false)
 {
-    std::for_each( rViewContainer.begin(),
-                   rViewContainer.end(),
-                   [this]( const UnoViewSharedPtr& sp )
-                   { this->viewAdded(sp); } );
+    for( const auto& pView : rViewContainer )
+        this->viewAdded( pView );
 }
 
 void WaitSymbol::setVisible( const bool bVisible )


More information about the Libreoffice-commits mailing list