diff options
author | Jan Holesovsky <kendy@collabora.com> | 2015-10-08 15:35:06 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2015-10-08 15:35:47 +0200 |
commit | 862bd364390a05ad0b07f9280fb9a0f8b2cc4ed6 (patch) | |
tree | b2e86b04abc1cb675eb17ff09bbfbf8a453bb3a8 /slideshow | |
parent | bd0e0dc7bdf0b4e027a93ff0db330472e0b90897 (diff) |
tdf#94222: Revert "slideshow: replace for_each with range-based loop"
This reverts commit ead5bc3cfb07a4e96e367e7904dc674ee5f5ccd6.
Change-Id: Icc2778cf904a71c4deaff4575d0de231acfc1335
Diffstat (limited to 'slideshow')
-rw-r--r-- | slideshow/source/engine/slide/layer.cxx | 92 | ||||
-rw-r--r-- | slideshow/source/engine/slide/layermanager.cxx | 102 | ||||
-rw-r--r-- | slideshow/source/engine/slide/shapemanagerimpl.cxx | 12 | ||||
-rw-r--r-- | slideshow/source/engine/slide/slideimpl.cxx | 81 | ||||
-rw-r--r-- | slideshow/source/engine/slide/targetpropertiescreator.cxx | 16 | ||||
-rw-r--r-- | slideshow/source/engine/slide/userpaintoverlay.cxx | 9 | ||||
-rw-r--r-- | slideshow/source/engine/slideshowimpl.cxx | 58 | ||||
-rw-r--r-- | slideshow/source/engine/slideview.cxx | 18 | ||||
-rw-r--r-- | slideshow/source/engine/transitions/slidechangebase.cxx | 23 | ||||
-rw-r--r-- | slideshow/source/engine/transitions/slidetransitionfactory.cxx | 9 | ||||
-rw-r--r-- | slideshow/source/engine/unoviewcontainer.cxx | 32 | ||||
-rw-r--r-- | slideshow/source/engine/usereventqueue.cxx | 5 | ||||
-rw-r--r-- | slideshow/source/engine/waitsymbol.cxx | 6 |
13 files changed, 316 insertions, 147 deletions
diff --git a/slideshow/source/engine/slide/layer.cxx b/slideshow/source/engine/slide/layer.cxx index b51fcf3f3203..61544aff06bb 100644 --- a/slideshow/source/engine/slide/layer.cxx +++ b/slideshow/source/engine/slide/layer.cxx @@ -29,6 +29,9 @@ #include "layer.hxx" +#include <boost/bind.hpp> + + using namespace ::com::sun::star; namespace slideshow @@ -66,8 +69,10 @@ namespace slideshow const ViewEntryVector::iterator aEnd( maViewEntries.end() ); if( (aIter=std::find_if( maViewEntries.begin(), aEnd, - [&rNewView]( const ViewEntry& rViewEntry ) - { return rNewView == rViewEntry.getView(); } ) ) != aEnd ) + boost::bind<bool>( + std::equal_to< ViewSharedPtr >(), + boost::bind( &ViewEntry::getView, _1 ), + boost::cref( rNewView )))) != aEnd ) { // already added - just return existing layer return aIter->mpViewLayer; @@ -97,8 +102,10 @@ namespace slideshow const ViewEntryVector::iterator aEnd( maViewEntries.end() ); if( (aIter=std::find_if( maViewEntries.begin(), aEnd, - [&rView]( const ViewEntry& rViewEntry ) - { return rView == rViewEntry.getView(); } ) ) == aEnd ) + boost::bind<bool>( + std::equal_to< ViewSharedPtr >(), + boost::bind( &ViewEntry::getView, _1 ), + boost::cref( rView )))) == aEnd ) { // View was not added/is already removed return ViewLayerSharedPtr(); @@ -106,8 +113,10 @@ namespace slideshow OSL_ENSURE( std::count_if( maViewEntries.begin(), aEnd, - [&rView]( const ViewEntry& rViewEntry ) - { return rView == rViewEntry.getView(); } ) == 1, + boost::bind<bool>( + std::equal_to< ViewSharedPtr >(), + boost::bind( &ViewEntry::getView, _1 ), + boost::cref( rView ))) == 1, "Layer::removeView(): view added multiple times" ); ViewLayerSharedPtr pRet( aIter->mpViewLayer ); @@ -120,16 +129,25 @@ namespace slideshow { rShape->clearAllViewLayers(); - for( const auto& rViewEntry : maViewEntries ) - rShape->addViewLayer( rViewEntry.getViewLayer(), false ); + std::for_each( maViewEntries.begin(), + maViewEntries.end(), + boost::bind(&Shape::addViewLayer, + boost::cref(rShape), + boost::bind(&ViewEntry::getViewLayer, + _1), + false )); } void Layer::setPriority( const ::basegfx::B1DRange& rPrioRange ) { if( !mbBackgroundLayer ) { - for( const auto& rViewEntry : maViewEntries ) - rViewEntry.getViewLayer()->setPriority( rPrioRange ); + std::for_each( maViewEntries.begin(), + maViewEntries.end(), + boost::bind( &ViewLayer::setPriority, + boost::bind( &ViewEntry::getViewLayer, + _1 ), + boost::cref(rPrioRange))); } } @@ -165,12 +183,12 @@ namespace slideshow return false; maBounds = maNewBounds; - if( std::count_if( maViewEntries.begin(), maViewEntries.end(), - [this](const ViewEntry& rViewEntry) - { return rViewEntry.getViewLayer()->resize( this->maBounds ); } - ) == 0 ) + boost::bind( &ViewLayer::resize, + boost::bind( &ViewEntry::getViewLayer, + _1 ), + boost::cref(maBounds)) ) == 0 ) { return false; } @@ -190,8 +208,13 @@ namespace slideshow void Layer::clearContent() { // clear content on all view layers - for( const auto& rViewEntry : maViewEntries ) - rViewEntry.getViewLayer()->clearAll(); + std::for_each( maViewEntries.begin(), + maViewEntries.end(), + boost::bind( + &ViewLayer::clearAll, + boost::bind( + &ViewEntry::getViewLayer, + _1))); // layer content cleared, update areas are not sensible // anymore. @@ -227,15 +250,24 @@ namespace slideshow // resulting clip polygon will be empty. if( aClip.count() ) { - 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(); - } + // 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))); mbClipSet = true; } @@ -251,8 +283,14 @@ namespace slideshow mbClipSet = false; basegfx::B2DPolyPolygon aEmptyClip; - for( const auto& rViewEntry : maViewEntries ) - rViewEntry.getViewLayer()->setClip( aEmptyClip ); + std::for_each( maViewEntries.begin(), + maViewEntries.end(), + boost::bind( + &ViewLayer::setClip, + boost::bind( + &ViewEntry::getViewLayer, + _1), + boost::cref(aEmptyClip))); } clearUpdateRanges(); diff --git a/slideshow/source/engine/slide/layermanager.cxx b/slideshow/source/engine/slide/layermanager.cxx index 2c78e7866d6c..3a2f07b9d5ac 100644 --- a/slideshow/source/engine/slide/layermanager.cxx +++ b/slideshow/source/engine/slide/layermanager.cxx @@ -53,9 +53,11 @@ namespace slideshow { LayerSharedPtr pCurrLayer; ViewLayerSharedPtr pCurrViewLayer; - for( const auto& rShape : maAllShapes ) + LayerShapeMap::const_iterator aIter( maAllShapes.begin() ); + const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() ); + while( aIter != aEnd ) { - LayerSharedPtr pLayer = rShape.second.lock(); + LayerSharedPtr pLayer = aIter->second.lock(); if( pLayer && pLayer != pCurrLayer ) { pCurrLayer = pLayer; @@ -63,7 +65,9 @@ namespace slideshow } if( pCurrViewLayer ) - shapeFunc( rShape.first, pCurrViewLayer ); + shapeFunc(aIter->first,pCurrViewLayer); + + ++aIter; } } @@ -91,8 +95,11 @@ namespace slideshow maPageBounds )); // init views - for( const auto& rView : mrViews ) - this->viewAdded( rView ); + std::for_each( mrViews.begin(), + mrViews.end(), + ::boost::bind(&LayerManager::viewAdded, + this, + _1) ); } void LayerManager::activate( bool bSlideBackgoundPainted ) @@ -103,19 +110,24 @@ namespace slideshow if( !bSlideBackgoundPainted ) { - for( const auto& rView : mrViews ) - rView->clearAll(); + std::for_each(mrViews.begin(), + mrViews.end(), + boost::mem_fn(&View::clearAll)); // force update of whole slide area - for( const auto& pLayer : maLayers ) - pLayer->addUpdateRange( maPageBounds ); + std::for_each( maLayers.begin(), + maLayers.end(), + boost::bind( &Layer::addUpdateRange, + _1, + boost::cref(maPageBounds) )); } else { // clear all possibly pending update areas - content // is there, already - for( const auto& pLayer : maLayers ) - pLayer->clearUpdateRanges(); + std::for_each( maLayers.begin(), + maLayers.end(), + boost::mem_fn( &Layer::clearUpdateRanges )); } updateShapeLayers( bSlideBackgoundPainted ); @@ -177,8 +189,11 @@ namespace slideshow // in case we haven't reached all layers from the // maAllShapes, issue addView again for good measure - for( const auto& pLayer : maLayers ) - pLayer->addView( rView ); + std::for_each( maLayers.begin(), + maLayers.end(), + boost::bind( &Layer::addView, + _1, + boost::cref(rView) )); } void LayerManager::viewRemoved( const UnoViewSharedPtr& rView ) @@ -199,8 +214,11 @@ namespace slideshow // in case we haven't reached all layers from the // maAllShapes, issue removeView again for good measure - for( const auto& pLayer : maLayers ) - pLayer->removeView( rView ); + std::for_each( maLayers.begin(), + maLayers.end(), + boost::bind( &Layer::removeView, + _1, + boost::cref(rView) )); } void LayerManager::viewChanged( const UnoViewSharedPtr& rView ) @@ -222,14 +240,17 @@ namespace slideshow return; // clear view area - for( const auto& rView : mrViews ) - rView->clearAll(); + ::std::for_each( mrViews.begin(), + mrViews.end(), + ::boost::mem_fn(&View::clearAll) ); // TODO(F3): resize and repaint all layers // render all shapes - for( const auto& rShape : maAllShapes ) - rShape.first->render(); + std::for_each( maAllShapes.begin(), + maAllShapes.end(), + []( const LayerShapeMap::value_type& cp ) + { cp.first->render(); } ); } void LayerManager::addShape( const ShapeSharedPtr& rShape ) @@ -466,14 +487,16 @@ namespace slideshow // send update() calls to every shape in the // maUpdateShapes set, which is _animated_ (i.e. a // sprite). - for( const auto& pShape : maUpdateShapes ) + const ShapeUpdateSet::const_iterator aEnd=maUpdateShapes.end(); + ShapeUpdateSet::const_iterator aCurrShape=maUpdateShapes.begin(); + while( aCurrShape != aEnd ) { - if( pShape->isBackgroundDetached() ) + if( (*aCurrShape)->isBackgroundDetached() ) { // can update shape directly, without // affecting layer content (shape is // currently displayed in a sprite) - if( !pShape->update() ) + if( !(*aCurrShape)->update() ) bRet = false; // delay error exit } else @@ -486,8 +509,10 @@ namespace slideshow // cannot update shape directly, it's not // animated and update() calls will prolly // overwrite other page content. - addUpdateArea( pShape ); + addUpdateArea( *aCurrShape ); } + + ++aCurrShape; } maUpdateShapes.clear(); @@ -520,9 +545,11 @@ namespace slideshow bool bIsCurrLayerUpdating(false); Layer::EndUpdater aEndUpdater; LayerSharedPtr pCurrLayer; - for( const auto& rShape : maAllShapes ) + LayerShapeMap::const_iterator aIter( maAllShapes.begin() ); + const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() ); + while( aIter != aEnd ) { - LayerSharedPtr pLayer = rShape.second.lock(); + LayerSharedPtr pLayer = aIter->second.lock(); if( pLayer != pCurrLayer ) { pCurrLayer = pLayer; @@ -533,12 +560,14 @@ namespace slideshow } if( bIsCurrLayerUpdating && - rShape.first->isBackgroundDetached() && - pCurrLayer->isInsideUpdateArea( rShape.first ) ) + !aIter->first->isBackgroundDetached() && + pCurrLayer->isInsideUpdateArea(aIter->first) ) { - if( rShape.first->render() ) + if( !aIter->first->render() ) bRet = false; } + + ++aIter; } return bRet; @@ -627,7 +656,9 @@ namespace slideshow bool bRet( true ); ViewLayerSharedPtr pTmpLayer( new DummyLayer( rTargetCanvas ) ); - for( const auto& rShape : maAllShapes ) + LayerShapeMap::const_iterator aIter( maAllShapes.begin() ); + const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() ); + while( aIter != aEnd ) { try { @@ -636,11 +667,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) - rShape.first->addViewLayer( pTmpLayer, + aIter->first->addViewLayer( pTmpLayer, true ); // and remove again, this is only temporary - rShape.first->removeViewLayer( pTmpLayer ); + aIter->first->removeViewLayer( pTmpLayer ); } catch( uno::Exception& ) { @@ -653,6 +684,8 @@ namespace slideshow // at least one shape could not be rendered bRet = false; } + + ++aIter; } return bRet; @@ -711,8 +744,11 @@ namespace slideshow // create ViewLayers for all registered views, and add to // newly created layer. - for( const auto& rView : mrViews ) - pLayer->addView( rView ); + ::std::for_each( mrViews.begin(), + mrViews.end(), + boost::bind( &Layer::addView, + boost::cref(pLayer), + _1 )); return pLayer; } diff --git a/slideshow/source/engine/slide/shapemanagerimpl.cxx b/slideshow/source/engine/slide/shapemanagerimpl.cxx index 9867f09684b0..a74253f647d4 100644 --- a/slideshow/source/engine/slide/shapemanagerimpl.cxx +++ b/slideshow/source/engine/slide/shapemanagerimpl.cxx @@ -64,12 +64,16 @@ void ShapeManagerImpl::activate( bool bSlideBackgoundPainted ) // clone listener map uno::Reference<presentation::XShapeEventListener> xDummyListener; - for( const auto& rListener : mrGlobalListenersMap ) - this->listenerAdded( xDummyListener, rListener.first ); + std::for_each( mrGlobalListenersMap.begin(), + mrGlobalListenersMap.end(), + [&xDummyListener, this]( const ShapeEventListenerMap::value_type& cp ) + { this->listenerAdded(xDummyListener, cp.first); } ); // clone cursor map - for( const auto& rListener : mrGlobalCursorMap ) - this->cursorChanged( rListener.first, rListener.second ); + std::for_each( mrGlobalCursorMap.begin(), + mrGlobalCursorMap.end(), + [this]( const ShapeCursorMap::value_type& cp ) + { this->cursorChanged(cp.first, cp.second); } ); if( mpLayerManager ) mpLayerManager->activate( bSlideBackgoundPainted ); diff --git a/slideshow/source/engine/slide/slideimpl.cxx b/slideshow/source/engine/slide/slideimpl.cxx index 9a6e83c06dbf..0d26285a5aec 100644 --- a/slideshow/source/engine/slide/slideimpl.cxx +++ b/slideshow/source/engine/slide/slideimpl.cxx @@ -61,6 +61,8 @@ #include "targetpropertiescreator.hxx" #include "tools.hxx" + +#include <boost/bind.hpp> #include <iterator> #include <algorithm> #include <functional> @@ -280,6 +282,49 @@ 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, @@ -343,8 +388,11 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra mbPaintOverlayActive( false ) { // clone already existing views for slide bitmaps - for( const auto& rView : rViewContainer ) - this->viewAdded( rView ); + std::for_each( rViewContainer.begin(), + rViewContainer.end(), + boost::bind( &SlideImpl::viewAdded, + this, + _1 )); // register screen update (LayerManager needs to signal pending // updates) @@ -414,30 +462,13 @@ bool SlideImpl::show( bool bSlideBackgoundPainted ) // render slide to screen, if requested if( !bSlideBackgoundPainted ) { - 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(), + boost::mem_fn(&View::clearAll)); + 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 2eafaf15235f..d1877c6c222d 100644 --- a/slideshow/source/engine/slide/targetpropertiescreator.cxx +++ b/slideshow/source/engine/slide/targetpropertiescreator.cxx @@ -332,23 +332,27 @@ namespace internal uno::Sequence< animations::TargetProperties > aRes( aShapeHash.size() ); ::std::size_t nCurrIndex(0); - for( const auto& rShapeHash : aShapeHash ) + XShapeHash::const_iterator aCurr( aShapeHash.begin() ); + const XShapeHash::const_iterator aEnd ( aShapeHash.end() ); + while( aCurr != aEnd ) { animations::TargetProperties& rCurrProps( aRes[ nCurrIndex++ ] ); - if( rShapeHash.first.mnParagraphIndex == -1 ) + if( aCurr->first.mnParagraphIndex == -1 ) { - rCurrProps.Target = uno::makeAny( rShapeHash.first.mxRef ); + rCurrProps.Target = uno::makeAny( aCurr->first.mxRef ); } else { rCurrProps.Target = uno::makeAny( presentation::ParagraphTarget( - rShapeHash.first.mxRef, - rShapeHash.first.mnParagraphIndex ) ); + aCurr->first.mxRef, + aCurr->first.mnParagraphIndex ) ); } - rCurrProps.Properties = ::comphelper::containerToSequence( rShapeHash.second ); + rCurrProps.Properties = ::comphelper::containerToSequence( aCurr->second ); + + ++aCurr; } return aRes; diff --git a/slideshow/source/engine/slide/userpaintoverlay.cxx b/slideshow/source/engine/slide/userpaintoverlay.cxx index 960794fbf1fa..33899122264c 100644 --- a/slideshow/source/engine/slide/userpaintoverlay.cxx +++ b/slideshow/source/engine/slide/userpaintoverlay.cxx @@ -36,6 +36,7 @@ #include "screenupdater.hxx" #include "vieweventhandler.hxx" +#include <boost/bind.hpp> #include <boost/noncopyable.hpp> #include "slide.hxx" #include "cursormanager.hxx" @@ -75,9 +76,11 @@ namespace slideshow mnSize(100), mbActive( bActive ) { - for( const auto& rView : rViews ) - this->viewAdded( rView ); - + std::for_each( rViews.begin(), + rViews.end(), + boost::bind( &PaintOverlayHandler::viewAdded, + this, + _1 )); drawPolygons(); } diff --git a/slideshow/source/engine/slideshowimpl.cxx b/slideshow/source/engine/slideshowimpl.cxx index 3d694c41123f..3d127eb75b70 100644 --- a/slideshow/source/engine/slideshowimpl.cxx +++ b/slideshow/source/engine/slideshowimpl.cxx @@ -884,18 +884,19 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition( PolygonMap::iterator SlideShowImpl::findPolygons( uno::Reference<drawing::XDrawPage> const& xDrawPage) { - // TODO(P2): optimize research in the map. - PolygonMap::iterator aEnd = maPolygons.end(); - for( auto aIter = maPolygons.begin(); - aIter != aEnd; - ++aIter ) + // TODO(P2) : Optimze research in the map. + bool bFound = false; + PolygonMap::iterator aIter=maPolygons.begin(); + + while(aIter!=maPolygons.end() && !bFound) { if(aIter->first == xDrawPage) - return aIter; + bFound = true; + else + ++aIter; } - // if no element is found return the element - // one past the last valid element in the map - return aEnd; + + return aIter; } SlideSharedPtr SlideShowImpl::makeSlide( @@ -1129,8 +1130,10 @@ void SlideShowImpl::displaySlide( // push new transformation to all views, if size changed if( !mpPreviousSlide || oldSlideSize != slideSize ) { - for( const auto& rView : maViewContainer ) - rView->setViewSize( slideSize ); + std::for_each( maViewContainer.begin(), + maViewContainer.end(), + boost::bind( &View::setViewSize, _1, + boost::cref(slideSize) )); // explicitly notify view change here, // because transformation might have changed: @@ -1443,16 +1446,18 @@ 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 - for( const auto& rPoly : maPolygons ) + while(aIter!=maPolygons.end()) { - aPolygons = rPoly.second; + aPolygons = aIter->second; //Get shapes for the slide - ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > Shapes(rPoly.first, ::com::sun::star::uno::UNO_QUERY); + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > Shapes(aIter->first, ::com::sun::star::uno::UNO_QUERY); //Retrieve polygons for one slide for( PolyPolygonVector::iterator aIterPoly=aPolygons.begin(), aEnd=aPolygons.end(); @@ -1528,6 +1533,7 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult } } } + ++aIter; } } @@ -1954,8 +1960,11 @@ bool SlideShowImpl::requestCursor( sal_Int16 nCursorShape ) const sal_Int16 nActualCursor = calcActiveCursor(mnCurrentCursor); // change all views to the requested cursor ID - for( const auto& rView : maViewContainer ) - rView->setCursorShape( nActualCursor ); + std::for_each( maViewContainer.begin(), + maViewContainer.end(), + boost::bind( &View::setCursorShape, + _1, + nActualCursor )); return nActualCursor==nCursorShape; } @@ -1964,11 +1973,12 @@ void SlideShowImpl::resetCursor() { mnCurrentCursor = awt::SystemPointer::ARROW; - const sal_Int16 nActualCursor = calcActiveCursor( mnCurrentCursor ); - // change all views to the default cursor ID - for( const auto& rView : maViewContainer ) - rView->setCursorShape( nActualCursor ); + std::for_each( maViewContainer.begin(), + maViewContainer.end(), + boost::bind( &View::setCursorShape, + _1, + calcActiveCursor(mnCurrentCursor) )); } sal_Bool SlideShowImpl::update( double & nNextTimeout ) @@ -2110,11 +2120,13 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) (!bRet || nNextTimeout > 1.0) ) { - for( const auto& pView : maViewContainer ) + UnoViewVector::const_iterator aCurr(maViewContainer.begin()); + const UnoViewVector::const_iterator aEnd(maViewContainer.end()); + while( aCurr != aEnd ) { try { - uno::Reference< presentation::XSlideShowView > xView( pView->getUnoView(), + uno::Reference< presentation::XSlideShowView > xView( (*aCurr)->getUnoView(), uno::UNO_QUERY_THROW ); uno::Reference< util::XUpdatable > xUpdatable( xView->getCanvas(), uno::UNO_QUERY_THROW ); @@ -2130,6 +2142,8 @@ 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 c688442d0a7d..b1755989c70c 100644 --- a/slideshow/source/engine/slideview.cxx +++ b/slideshow/source/engine/slideview.cxx @@ -283,19 +283,23 @@ class LayerSpriteContainer SpriteVector aValidSprites; // check all sprites for validity and set new priority - for( const auto& rSprite : maSprites ) + SpriteVector::iterator aCurrSprite( maSprites.begin() ); + const SpriteVector::iterator aEnd( maSprites.end() ); + while( aCurrSprite != aEnd ) { - cppcanvas::CustomSpriteSharedPtr pCurrSprite( rSprite.mpSprite.lock() ); + cppcanvas::CustomSpriteSharedPtr pCurrSprite( aCurrSprite->mpSprite.lock() ); if( pCurrSprite ) { // only copy still valid sprites over to the refreshed // sprite vector. - aValidSprites.push_back( rSprite ); + aValidSprites.push_back( *aCurrSprite ); pCurrSprite->setPriority( getSpritePriority( aValidSprites.size()-1 )); } + + ++aCurrSprite; } // replace sprite list with pruned one @@ -1169,9 +1173,11 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const getTransformation() ); // check all layers for validity, and retain only the live ones - for( const auto& rViewLayer : maViewLayers ) + ViewLayerVector::const_iterator aCurr( maViewLayers.begin() ); + const ViewLayerVector::const_iterator aEnd( maViewLayers.end() ); + while( aCurr != aEnd ) { - std::shared_ptr< SlideViewLayer > xCurrLayer( rViewLayer.lock() ); + std::shared_ptr< SlideViewLayer > xCurrLayer( aCurr->lock() ); if (xCurrLayer) { @@ -1181,6 +1187,8 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const xCurrLayer->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 a029608ebef5..4d77881b187c 100644 --- a/slideshow/source/engine/transitions/slidechangebase.cxx +++ b/slideshow/source/engine/transitions/slidechangebase.cxx @@ -29,6 +29,7 @@ #include "slidechangebase.hxx" #include "tools.hxx" +#include <boost/bind.hpp> #include <algorithm> using namespace com::sun::star; @@ -179,8 +180,11 @@ void SlideChangeBase::prefetch( const AnimatableShapeSharedPtr&, mrEventMultiplexer.addViewHandler( shared_from_this() ); // init views and create slide bitmaps - for( const auto& rView : mrViewContainer ) - this->viewAdded( rView ); + std::for_each( mrViewContainer.begin(), + mrViewContainer.end(), + boost::bind( &SlideChangeBase::viewAdded, + this, + _1 )); mbPrefetched = true; } @@ -411,9 +415,11 @@ void SlideChangeBase::viewRemoved( const UnoViewSharedPtr& rView ) std::remove_if( maViewData.begin(), maViewData.end(), - [&rView]( const ViewEntry& rViewEntry ) - // select and compare view - { return rView == rViewEntry.getView(); } ), + boost::bind( + std::equal_to<UnoViewSharedPtr>(), + rView, + // select view: + boost::bind( &ViewEntry::getView, _1 ))), maViewData.end() ); } @@ -428,8 +434,11 @@ void SlideChangeBase::viewChanged( const UnoViewSharedPtr& rView ) std::find_if( maViewData.begin(), maViewData.end(), - [&rView]( const ViewEntry& rViewEntry ) - { return rView == rViewEntry.getView(); } ) ); + boost::bind( + std::equal_to<UnoViewSharedPtr>(), + rView, + // select view: + boost::bind( &ViewEntry::getView, _1 ) ))); 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 103757d9c46f..fbe7001c0be4 100644 --- a/slideshow/source/engine/transitions/slidetransitionfactory.cxx +++ b/slideshow/source/engine/transitions/slidetransitionfactory.cxx @@ -45,6 +45,9 @@ #include "combtransition.hxx" #include "tools.hxx" +#include <boost/bind.hpp> + + /*************************************************** *** *** *** Slide Transition Effects *** @@ -186,8 +189,10 @@ public: virtual bool operator()( double t ) SAL_OVERRIDE { - for( const auto& pTransition : maTransitions ) - pTransition->update( t ); + std::for_each(maTransitions.begin(), + maTransitions.end(), + boost::bind( &TransitionViewPair::update, + _1, t) ); return true; } diff --git a/slideshow/source/engine/unoviewcontainer.cxx b/slideshow/source/engine/unoviewcontainer.cxx index 0215b3c4fe41..f51f104ca52e 100644 --- a/slideshow/source/engine/unoviewcontainer.cxx +++ b/slideshow/source/engine/unoviewcontainer.cxx @@ -22,6 +22,8 @@ #include <osl/diagnose.h> +#include <boost/bind.hpp> + #include <algorithm> @@ -43,11 +45,14 @@ 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(), - [&rShowView]( const UnoViewSharedPtr& pUnoView ) - { return rShowView == pUnoView->getUnoView(); } ) ) + ::boost::bind( + ::std::equal_to< uno::Reference< presentation::XSlideShowView > >(), + rView->getUnoView(), + ::boost::bind( + &UnoView::getUnoView, + _1 ) ) ) ) { // yes, nothing to do return false; @@ -68,8 +73,12 @@ namespace slideshow // added in the first place? if( (aIter=::std::find_if( maViews.begin(), aEnd, - [&xView]( const UnoViewSharedPtr& pUnoView ) - { return xView == pUnoView->getUnoView(); } ) ) == aEnd ) + ::boost::bind( + ::std::equal_to< uno::Reference< presentation::XSlideShowView > >(), + ::boost::cref( xView ), + ::boost::bind( + &UnoView::getUnoView, + _1 ) ) ) ) == aEnd ) { // nope, nothing to do return UnoViewSharedPtr(); @@ -79,8 +88,12 @@ namespace slideshow ::std::count_if( maViews.begin(), aEnd, - [&xView]( const UnoViewSharedPtr& pUnoView ) - { return xView == pUnoView->getUnoView(); } ) == 1, + ::boost::bind( + ::std::equal_to< uno::Reference< presentation::XSlideShowView > >(), + ::boost::cref( xView ), + ::boost::bind( + &UnoView::getUnoView, + _1 ))) == 1, "UnoViewContainer::removeView(): View was added multiple times" ); UnoViewSharedPtr pView( *aIter ); @@ -93,8 +106,9 @@ namespace slideshow void UnoViewContainer::dispose() { - for( const auto& rView : maViews ) - rView->_dispose(); + ::std::for_each( maViews.begin(), + maViews.end(), + ::boost::mem_fn(&UnoView::_dispose) ); maViews.clear(); } } diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx index 6eb579c77017..53f043ab03ef 100644 --- a/slideshow/source/engine/usereventqueue.cxx +++ b/slideshow/source/engine/usereventqueue.cxx @@ -143,8 +143,9 @@ public: bRet = !rVec.empty(); // registered node found -> fire all events in the vector - for( const auto& pEvent : rVec ) - mrEventQueue.addEvent( pEvent ); + std::for_each( rVec.begin(), rVec.end(), + boost::bind( &EventQueue::addEvent, + boost::ref( mrEventQueue ), _1 ) ); rVec.clear(); } diff --git a/slideshow/source/engine/waitsymbol.cxx b/slideshow/source/engine/waitsymbol.cxx index ab3dbbf29eb7..48da4c702c9c 100644 --- a/slideshow/source/engine/waitsymbol.cxx +++ b/slideshow/source/engine/waitsymbol.cxx @@ -67,8 +67,10 @@ WaitSymbol::WaitSymbol( uno::Reference<rendering::XBitmap> const & xBitmap, mrScreenUpdater( rScreenUpdater ), mbVisible(false) { - for( const auto& pView : rViewContainer ) - this->viewAdded( pView ); + std::for_each( rViewContainer.begin(), + rViewContainer.end(), + [this]( const UnoViewSharedPtr& sp ) + { this->viewAdded(sp); } ); } void WaitSymbol::setVisible( const bool bVisible ) |