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@libreoffice.org>
Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
This commit is contained in:
Daniel Robertson
2015-08-21 21:51:09 -04:00
committed by Thorsten Behrens
parent 0a76c1fd68
commit ead5bc3cfb
13 changed files with 145 additions and 314 deletions

View File

@@ -28,9 +28,6 @@
#include "layer.hxx" #include "layer.hxx"
#include <boost/bind.hpp>
using namespace ::com::sun::star; using namespace ::com::sun::star;
namespace slideshow namespace slideshow
@@ -68,10 +65,8 @@ namespace slideshow
const ViewEntryVector::iterator aEnd( maViewEntries.end() ); const ViewEntryVector::iterator aEnd( maViewEntries.end() );
if( (aIter=std::find_if( maViewEntries.begin(), if( (aIter=std::find_if( maViewEntries.begin(),
aEnd, aEnd,
boost::bind<bool>( [&rNewView]( const ViewEntry& rViewEntry )
std::equal_to< ViewSharedPtr >(), { return rNewView == rViewEntry.getView(); } ) ) != aEnd )
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rNewView )))) != aEnd )
{ {
// already added - just return existing layer // already added - just return existing layer
return aIter->mpViewLayer; return aIter->mpViewLayer;
@@ -101,10 +96,8 @@ namespace slideshow
const ViewEntryVector::iterator aEnd( maViewEntries.end() ); const ViewEntryVector::iterator aEnd( maViewEntries.end() );
if( (aIter=std::find_if( maViewEntries.begin(), if( (aIter=std::find_if( maViewEntries.begin(),
aEnd, aEnd,
boost::bind<bool>( [&rView]( const ViewEntry& rViewEntry )
std::equal_to< ViewSharedPtr >(), { return rView == rViewEntry.getView(); } ) ) == aEnd )
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rView )))) == aEnd )
{ {
// View was not added/is already removed // View was not added/is already removed
return ViewLayerSharedPtr(); return ViewLayerSharedPtr();
@@ -112,10 +105,8 @@ namespace slideshow
OSL_ENSURE( std::count_if( maViewEntries.begin(), OSL_ENSURE( std::count_if( maViewEntries.begin(),
aEnd, aEnd,
boost::bind<bool>( [&rView]( const ViewEntry& rViewEntry )
std::equal_to< ViewSharedPtr >(), { return rView == rViewEntry.getView(); } ) == 1,
boost::bind( &ViewEntry::getView, _1 ),
boost::cref( rView ))) == 1,
"Layer::removeView(): view added multiple times" ); "Layer::removeView(): view added multiple times" );
ViewLayerSharedPtr pRet( aIter->mpViewLayer ); ViewLayerSharedPtr pRet( aIter->mpViewLayer );
@@ -128,25 +119,16 @@ namespace slideshow
{ {
rShape->clearAllViewLayers(); rShape->clearAllViewLayers();
std::for_each( maViewEntries.begin(), for( const auto& rViewEntry : maViewEntries )
maViewEntries.end(), rShape->addViewLayer( rViewEntry.getViewLayer(), false );
boost::bind(&Shape::addViewLayer,
boost::cref(rShape),
boost::bind(&ViewEntry::getViewLayer,
_1),
false ));
} }
void Layer::setPriority( const ::basegfx::B1DRange& rPrioRange ) void Layer::setPriority( const ::basegfx::B1DRange& rPrioRange )
{ {
if( !mbBackgroundLayer ) if( !mbBackgroundLayer )
{ {
std::for_each( maViewEntries.begin(), for( const auto& rViewEntry : maViewEntries )
maViewEntries.end(), rViewEntry.getViewLayer()->setPriority( rPrioRange );
boost::bind( &ViewLayer::setPriority,
boost::bind( &ViewEntry::getViewLayer,
_1 ),
boost::cref(rPrioRange)));
} }
} }
@@ -182,12 +164,12 @@ namespace slideshow
return false; return false;
maBounds = maNewBounds; maBounds = maNewBounds;
if( std::count_if( maViewEntries.begin(), if( std::count_if( maViewEntries.begin(),
maViewEntries.end(), maViewEntries.end(),
boost::bind( &ViewLayer::resize, [this](const ViewEntry& rViewEntry)
boost::bind( &ViewEntry::getViewLayer, { return rViewEntry.getViewLayer()->resize( this->maBounds ); }
_1 ), ) == 0 )
boost::cref(maBounds)) ) == 0 )
{ {
return false; return false;
} }
@@ -207,13 +189,8 @@ namespace slideshow
void Layer::clearContent() void Layer::clearContent()
{ {
// clear content on all view layers // clear content on all view layers
std::for_each( maViewEntries.begin(), for( const auto& rViewEntry : maViewEntries )
maViewEntries.end(), rViewEntry.getViewLayer()->clearAll();
boost::bind(
&ViewLayer::clearAll,
boost::bind(
&ViewEntry::getViewLayer,
_1)));
// layer content cleared, update areas are not sensible // layer content cleared, update areas are not sensible
// anymore. // anymore.
@@ -249,24 +226,15 @@ namespace slideshow
// resulting clip polygon will be empty. // resulting clip polygon will be empty.
if( aClip.count() ) if( aClip.count() )
{ {
// set clip to all view layers for( const auto& rViewEntry : maViewEntries ) {
std::for_each( maViewEntries.begin(), ViewLayerSharedPtr pViewLayer = rViewEntry.getViewLayer();
maViewEntries.end(),
boost::bind(
&ViewLayer::setClip,
boost::bind(
&ViewEntry::getViewLayer,
_1),
boost::cref(aClip)));
// clear update area on all view layers // set clip to all view layers
std::for_each( maViewEntries.begin(), pViewLayer->setClip( aClip );
maViewEntries.end(),
boost::bind( // clear update area of view layer
&ViewLayer::clear, pViewLayer->clear();
boost::bind( }
&ViewEntry::getViewLayer,
_1)));
mbClipSet = true; mbClipSet = true;
} }
@@ -282,14 +250,8 @@ namespace slideshow
mbClipSet = false; mbClipSet = false;
basegfx::B2DPolyPolygon aEmptyClip; basegfx::B2DPolyPolygon aEmptyClip;
std::for_each( maViewEntries.begin(), for( const auto& rViewEntry : maViewEntries )
maViewEntries.end(), rViewEntry.getViewLayer()->setClip( aEmptyClip );
boost::bind(
&ViewLayer::setClip,
boost::bind(
&ViewEntry::getViewLayer,
_1),
boost::cref(aEmptyClip)));
} }
clearUpdateRanges(); clearUpdateRanges();

View File

@@ -53,11 +53,9 @@ namespace slideshow
{ {
LayerSharedPtr pCurrLayer; LayerSharedPtr pCurrLayer;
ViewLayerSharedPtr pCurrViewLayer; ViewLayerSharedPtr pCurrViewLayer;
LayerShapeMap::const_iterator aIter( maAllShapes.begin() ); for( const auto& rShape : maAllShapes )
const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() );
while( aIter != aEnd )
{ {
LayerSharedPtr pLayer = aIter->second.lock(); LayerSharedPtr pLayer = rShape.second.lock();
if( pLayer && pLayer != pCurrLayer ) if( pLayer && pLayer != pCurrLayer )
{ {
pCurrLayer = pLayer; pCurrLayer = pLayer;
@@ -65,9 +63,7 @@ namespace slideshow
} }
if( pCurrViewLayer ) if( pCurrViewLayer )
shapeFunc(aIter->first,pCurrViewLayer); shapeFunc( rShape.first, pCurrViewLayer );
++aIter;
} }
} }
@@ -95,11 +91,8 @@ namespace slideshow
maPageBounds )); maPageBounds ));
// init views // init views
std::for_each( mrViews.begin(), for( const auto& rView : mrViews )
mrViews.end(), this->viewAdded( rView );
::boost::bind(&LayerManager::viewAdded,
this,
_1) );
} }
void LayerManager::activate( bool bSlideBackgoundPainted ) void LayerManager::activate( bool bSlideBackgoundPainted )
@@ -110,24 +103,19 @@ namespace slideshow
if( !bSlideBackgoundPainted ) if( !bSlideBackgoundPainted )
{ {
std::for_each(mrViews.begin(), for( const auto& rView : mrViews )
mrViews.end(), rView->clearAll();
boost::mem_fn(&View::clearAll));
// force update of whole slide area // force update of whole slide area
std::for_each( maLayers.begin(), for( const auto& pLayer : maLayers )
maLayers.end(), pLayer->addUpdateRange( maPageBounds );
boost::bind( &Layer::addUpdateRange,
_1,
boost::cref(maPageBounds) ));
} }
else else
{ {
// clear all possibly pending update areas - content // clear all possibly pending update areas - content
// is there, already // is there, already
std::for_each( maLayers.begin(), for( const auto& pLayer : maLayers )
maLayers.end(), pLayer->clearUpdateRanges();
boost::mem_fn( &Layer::clearUpdateRanges ));
} }
updateShapeLayers( bSlideBackgoundPainted ); updateShapeLayers( bSlideBackgoundPainted );
@@ -189,11 +177,8 @@ namespace slideshow
// in case we haven't reached all layers from the // in case we haven't reached all layers from the
// maAllShapes, issue addView again for good measure // maAllShapes, issue addView again for good measure
std::for_each( maLayers.begin(), for( const auto& pLayer : maLayers )
maLayers.end(), pLayer->addView( rView );
boost::bind( &Layer::addView,
_1,
boost::cref(rView) ));
} }
void LayerManager::viewRemoved( const UnoViewSharedPtr& rView ) void LayerManager::viewRemoved( const UnoViewSharedPtr& rView )
@@ -214,11 +199,8 @@ namespace slideshow
// in case we haven't reached all layers from the // in case we haven't reached all layers from the
// maAllShapes, issue removeView again for good measure // maAllShapes, issue removeView again for good measure
std::for_each( maLayers.begin(), for( const auto& pLayer : maLayers )
maLayers.end(), pLayer->removeView( rView );
boost::bind( &Layer::removeView,
_1,
boost::cref(rView) ));
} }
void LayerManager::viewChanged( const UnoViewSharedPtr& rView ) void LayerManager::viewChanged( const UnoViewSharedPtr& rView )
@@ -240,17 +222,14 @@ namespace slideshow
return; return;
// clear view area // clear view area
::std::for_each( mrViews.begin(), for( const auto& rView : mrViews )
mrViews.end(), rView->clearAll();
::boost::mem_fn(&View::clearAll) );
// TODO(F3): resize and repaint all layers // TODO(F3): resize and repaint all layers
// render all shapes // render all shapes
std::for_each( maAllShapes.begin(), for( const auto& rShape : maAllShapes )
maAllShapes.end(), rShape.first->render();
[]( const LayerShapeMap::value_type& cp )
{ cp.first->render(); } );
} }
void LayerManager::addShape( const ShapeSharedPtr& rShape ) void LayerManager::addShape( const ShapeSharedPtr& rShape )
@@ -487,16 +466,14 @@ namespace slideshow
// send update() calls to every shape in the // send update() calls to every shape in the
// maUpdateShapes set, which is _animated_ (i.e. a // maUpdateShapes set, which is _animated_ (i.e. a
// sprite). // sprite).
const ShapeUpdateSet::const_iterator aEnd=maUpdateShapes.end(); for( const auto& pShape : maUpdateShapes )
ShapeUpdateSet::const_iterator aCurrShape=maUpdateShapes.begin();
while( aCurrShape != aEnd )
{ {
if( (*aCurrShape)->isBackgroundDetached() ) if( pShape->isBackgroundDetached() )
{ {
// can update shape directly, without // can update shape directly, without
// affecting layer content (shape is // affecting layer content (shape is
// currently displayed in a sprite) // currently displayed in a sprite)
if( !(*aCurrShape)->update() ) if( !pShape->update() )
bRet = false; // delay error exit bRet = false; // delay error exit
} }
else else
@@ -509,10 +486,8 @@ namespace slideshow
// cannot update shape directly, it's not // cannot update shape directly, it's not
// animated and update() calls will prolly // animated and update() calls will prolly
// overwrite other page content. // overwrite other page content.
addUpdateArea( *aCurrShape ); addUpdateArea( pShape );
} }
++aCurrShape;
} }
maUpdateShapes.clear(); maUpdateShapes.clear();
@@ -545,11 +520,9 @@ namespace slideshow
bool bIsCurrLayerUpdating(false); bool bIsCurrLayerUpdating(false);
Layer::EndUpdater aEndUpdater; Layer::EndUpdater aEndUpdater;
LayerSharedPtr pCurrLayer; LayerSharedPtr pCurrLayer;
LayerShapeMap::const_iterator aIter( maAllShapes.begin() ); for( const auto& rShape : maAllShapes )
const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() );
while( aIter != aEnd )
{ {
LayerSharedPtr pLayer = aIter->second.lock(); LayerSharedPtr pLayer = rShape.second.lock();
if( pLayer != pCurrLayer ) if( pLayer != pCurrLayer )
{ {
pCurrLayer = pLayer; pCurrLayer = pLayer;
@@ -560,14 +533,12 @@ namespace slideshow
} }
if( bIsCurrLayerUpdating && if( bIsCurrLayerUpdating &&
!aIter->first->isBackgroundDetached() && rShape.first->isBackgroundDetached() &&
pCurrLayer->isInsideUpdateArea(aIter->first) ) pCurrLayer->isInsideUpdateArea( rShape.first ) )
{ {
if( !aIter->first->render() ) if( rShape.first->render() )
bRet = false; bRet = false;
} }
++aIter;
} }
return bRet; return bRet;
@@ -656,9 +627,7 @@ namespace slideshow
bool bRet( true ); bool bRet( true );
ViewLayerSharedPtr pTmpLayer( new DummyLayer( rTargetCanvas ) ); ViewLayerSharedPtr pTmpLayer( new DummyLayer( rTargetCanvas ) );
LayerShapeMap::const_iterator aIter( maAllShapes.begin() ); for( const auto& rShape : maAllShapes )
const LayerShapeMap::const_iterator aEnd ( maAllShapes.end() );
while( aIter != aEnd )
{ {
try try
{ {
@@ -667,11 +636,11 @@ namespace slideshow
// ViewLayer. Since we add the shapes in the // ViewLayer. Since we add the shapes in the
// maShapeSet order (which is also the render order), // maShapeSet order (which is also the render order),
// this is equivalent to a subsequent render() call) // this is equivalent to a subsequent render() call)
aIter->first->addViewLayer( pTmpLayer, rShape.first->addViewLayer( pTmpLayer,
true ); true );
// and remove again, this is only temporary // and remove again, this is only temporary
aIter->first->removeViewLayer( pTmpLayer ); rShape.first->removeViewLayer( pTmpLayer );
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
@@ -684,8 +653,6 @@ namespace slideshow
// at least one shape could not be rendered // at least one shape could not be rendered
bRet = false; bRet = false;
} }
++aIter;
} }
return bRet; return bRet;
@@ -744,11 +711,8 @@ namespace slideshow
// create ViewLayers for all registered views, and add to // create ViewLayers for all registered views, and add to
// newly created layer. // newly created layer.
::std::for_each( mrViews.begin(), for( const auto& rView : mrViews )
mrViews.end(), pLayer->addView( rView );
boost::bind( &Layer::addView,
boost::cref(pLayer),
_1 ));
return pLayer; return pLayer;
} }

View File

@@ -64,16 +64,12 @@ void ShapeManagerImpl::activate( bool bSlideBackgoundPainted )
// clone listener map // clone listener map
uno::Reference<presentation::XShapeEventListener> xDummyListener; uno::Reference<presentation::XShapeEventListener> xDummyListener;
std::for_each( mrGlobalListenersMap.begin(), for( const auto& rListener : mrGlobalListenersMap )
mrGlobalListenersMap.end(), this->listenerAdded( xDummyListener, rListener.first );
[&xDummyListener, this]( const ShapeEventListenerMap::value_type& cp )
{ this->listenerAdded(xDummyListener, cp.first); } );
// clone cursor map // clone cursor map
std::for_each( mrGlobalCursorMap.begin(), for( const auto& rListener : mrGlobalCursorMap )
mrGlobalCursorMap.end(), this->cursorChanged( rListener.first, rListener.second );
[this]( const ShapeCursorMap::value_type& cp )
{ this->cursorChanged(cp.first, cp.second); } );
if( mpLayerManager ) if( mpLayerManager )
mpLayerManager->activate( bSlideBackgoundPainted ); mpLayerManager->activate( bSlideBackgoundPainted );

View File

@@ -61,8 +61,6 @@
#include "targetpropertiescreator.hxx" #include "targetpropertiescreator.hxx"
#include "tools.hxx" #include "tools.hxx"
#include <boost/bind.hpp>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
#include <functional> #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, SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDrawPage,
const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages, const uno::Reference<drawing::XDrawPagesSupplier>& xDrawPages,
const uno::Reference< animations::XAnimationNode >& xRootNode, const uno::Reference< animations::XAnimationNode >& xRootNode,
@@ -388,11 +343,8 @@ SlideImpl::SlideImpl( const uno::Reference< drawing::XDrawPage >& xDra
mbPaintOverlayActive( false ) mbPaintOverlayActive( false )
{ {
// clone already existing views for slide bitmaps // clone already existing views for slide bitmaps
std::for_each( rViewContainer.begin(), for( const auto& rView : rViewContainer )
rViewContainer.end(), this->viewAdded( rView );
boost::bind( &SlideImpl::viewAdded,
this,
_1 ));
// register screen update (LayerManager needs to signal pending // register screen update (LayerManager needs to signal pending
// updates) // updates)
@@ -462,13 +414,30 @@ bool SlideImpl::show( bool bSlideBackgoundPainted )
// render slide to screen, if requested // render slide to screen, if requested
if( !bSlideBackgoundPainted ) if( !bSlideBackgoundPainted )
{ {
std::for_each(maContext.mrViewContainer.begin(), for( const auto& rView : maContext.mrViewContainer ) {
maContext.mrViewContainer.end(), // fully clear view content to background color
boost::mem_fn(&View::clearAll)); 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(); maContext.mrScreenUpdater.notifyUpdate();
} }

View File

@@ -332,27 +332,23 @@ namespace internal
uno::Sequence< animations::TargetProperties > aRes( aShapeHash.size() ); uno::Sequence< animations::TargetProperties > aRes( aShapeHash.size() );
::std::size_t nCurrIndex(0); ::std::size_t nCurrIndex(0);
XShapeHash::const_iterator aCurr( aShapeHash.begin() ); for( const auto& rShapeHash : aShapeHash )
const XShapeHash::const_iterator aEnd ( aShapeHash.end() );
while( aCurr != aEnd )
{ {
animations::TargetProperties& rCurrProps( aRes[ nCurrIndex++ ] ); 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 else
{ {
rCurrProps.Target = uno::makeAny( rCurrProps.Target = uno::makeAny(
presentation::ParagraphTarget( presentation::ParagraphTarget(
aCurr->first.mxRef, rShapeHash.first.mxRef,
aCurr->first.mnParagraphIndex ) ); rShapeHash.first.mnParagraphIndex ) );
} }
rCurrProps.Properties = ::comphelper::containerToSequence( aCurr->second ); rCurrProps.Properties = ::comphelper::containerToSequence( rShapeHash.second );
++aCurr;
} }
return aRes; return aRes;

View File

@@ -36,7 +36,6 @@
#include "screenupdater.hxx" #include "screenupdater.hxx"
#include "vieweventhandler.hxx" #include "vieweventhandler.hxx"
#include <boost/bind.hpp>
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
#include "slide.hxx" #include "slide.hxx"
#include "cursormanager.hxx" #include "cursormanager.hxx"
@@ -76,11 +75,9 @@ namespace slideshow
mnSize(100), mnSize(100),
mbActive( bActive ) mbActive( bActive )
{ {
std::for_each( rViews.begin(), for( const auto& rView : rViews )
rViews.end(), this->viewAdded( rView );
boost::bind( &PaintOverlayHandler::viewAdded,
this,
_1 ));
drawPolygons(); drawPolygons();
} }

View File

@@ -886,18 +886,17 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition(
PolygonMap::iterator SlideShowImpl::findPolygons( uno::Reference<drawing::XDrawPage> const& xDrawPage) PolygonMap::iterator SlideShowImpl::findPolygons( uno::Reference<drawing::XDrawPage> const& xDrawPage)
{ {
// TODO(P2) : Optimze research in the map. // TODO(P2) : Optimze research in the map.
bool bFound = false; PolygonMap::iterator aEnd = maPolygons.end();
PolygonMap::iterator aIter=maPolygons.begin(); for( auto aIter = maPolygons.begin();
aIter != aEnd;
while(aIter!=maPolygons.end() && !bFound) ++aIter )
{ {
if(aIter->first == xDrawPage) if(aIter->first == xDrawPage)
bFound = true; return aIter;
else
++aIter;
} }
// if no element is found return the element
return aIter; // one past the last valid element in the map
return aEnd;
} }
SlideSharedPtr SlideShowImpl::makeSlide( SlideSharedPtr SlideShowImpl::makeSlide(
@@ -1131,10 +1130,8 @@ void SlideShowImpl::displaySlide(
// push new transformation to all views, if size changed // push new transformation to all views, if size changed
if( !mpPreviousSlide || oldSlideSize != slideSize ) if( !mpPreviousSlide || oldSlideSize != slideSize )
{ {
std::for_each( maViewContainer.begin(), for( const auto& rView : maViewContainer )
maViewContainer.end(), rView->setViewSize( slideSize );
boost::bind( &View::setViewSize, _1,
boost::cref(slideSize) ));
// explicitly notify view change here, // explicitly notify view change here,
// because transformation might have changed: // because transformation might have changed:
@@ -1447,18 +1444,16 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult
aPropLayer <<= false; aPropLayer <<= false;
xLayerPropSet->setPropertyValue("IsLocked", aPropLayer); xLayerPropSet->setPropertyValue("IsLocked", aPropLayer);
PolygonMap::iterator aIter=maPolygons.begin();
PolyPolygonVector aPolygons; PolyPolygonVector aPolygons;
::cppcanvas::PolyPolygonSharedPtr pPolyPoly; ::cppcanvas::PolyPolygonSharedPtr pPolyPoly;
::basegfx::B2DPolyPolygon b2DPolyPoly; ::basegfx::B2DPolyPolygon b2DPolyPoly;
//Register polygons for each slide //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 //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 //Retrieve polygons for one slide
for( PolyPolygonVector::iterator aIterPoly=aPolygons.begin(), for( PolyPolygonVector::iterator aIterPoly=aPolygons.begin(),
aEnd=aPolygons.end(); 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); const sal_Int16 nActualCursor = calcActiveCursor(mnCurrentCursor);
// change all views to the requested cursor ID // change all views to the requested cursor ID
std::for_each( maViewContainer.begin(), for( const auto& rView : maViewContainer )
maViewContainer.end(), rView->setCursorShape( nActualCursor );
boost::bind( &View::setCursorShape,
_1,
nActualCursor ));
return nActualCursor==nCursorShape; return nActualCursor==nCursorShape;
} }
@@ -1974,12 +1965,11 @@ void SlideShowImpl::resetCursor()
{ {
mnCurrentCursor = awt::SystemPointer::ARROW; mnCurrentCursor = awt::SystemPointer::ARROW;
const sal_Int16 nActualCursor = calcActiveCursor( mnCurrentCursor );
// change all views to the default cursor ID // change all views to the default cursor ID
std::for_each( maViewContainer.begin(), for( const auto& rView : maViewContainer )
maViewContainer.end(), rView->setCursorShape( nActualCursor );
boost::bind( &View::setCursorShape,
_1,
calcActiveCursor(mnCurrentCursor) ));
} }
sal_Bool SlideShowImpl::update( double & nNextTimeout ) sal_Bool SlideShowImpl::update( double & nNextTimeout )
@@ -2121,13 +2111,11 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout )
(!bRet || (!bRet ||
nNextTimeout > 1.0) ) nNextTimeout > 1.0) )
{ {
UnoViewVector::const_iterator aCurr(maViewContainer.begin()); for( const auto& pView : maViewContainer )
const UnoViewVector::const_iterator aEnd(maViewContainer.end());
while( aCurr != aEnd )
{ {
try try
{ {
uno::Reference< presentation::XSlideShowView > xView( (*aCurr)->getUnoView(), uno::Reference< presentation::XSlideShowView > xView( pView->getUnoView(),
uno::UNO_QUERY_THROW ); uno::UNO_QUERY_THROW );
uno::Reference< util::XUpdatable > xUpdatable( xView->getCanvas(), uno::Reference< util::XUpdatable > xUpdatable( xView->getCanvas(),
uno::UNO_QUERY_THROW ); uno::UNO_QUERY_THROW );
@@ -2143,8 +2131,6 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout )
comphelper::anyToString( cppu::getCaughtException() ), comphelper::anyToString( cppu::getCaughtException() ),
RTL_TEXTENCODING_UTF8 ).getStr() ); RTL_TEXTENCODING_UTF8 ).getStr() );
} }
++aCurr;
} }
mbSlideShowIdle = true; mbSlideShowIdle = true;

View File

@@ -283,23 +283,19 @@ class LayerSpriteContainer
SpriteVector aValidSprites; SpriteVector aValidSprites;
// check all sprites for validity and set new priority // check all sprites for validity and set new priority
SpriteVector::iterator aCurrSprite( maSprites.begin() ); for( const auto& rSprite : maSprites )
const SpriteVector::iterator aEnd( maSprites.end() );
while( aCurrSprite != aEnd )
{ {
cppcanvas::CustomSpriteSharedPtr pCurrSprite( aCurrSprite->mpSprite.lock() ); cppcanvas::CustomSpriteSharedPtr pCurrSprite( rSprite.mpSprite.lock() );
if( pCurrSprite ) if( pCurrSprite )
{ {
// only copy still valid sprites over to the refreshed // only copy still valid sprites over to the refreshed
// sprite vector. // sprite vector.
aValidSprites.push_back( *aCurrSprite ); aValidSprites.push_back( rSprite );
pCurrSprite->setPriority( pCurrSprite->setPriority(
getSpritePriority( aValidSprites.size()-1 )); getSpritePriority( aValidSprites.size()-1 ));
} }
++aCurrSprite;
} }
// replace sprite list with pruned one // replace sprite list with pruned one
@@ -1147,11 +1143,9 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const
getTransformation() ); getTransformation() );
// check all layers for validity, and retain only the live ones // check all layers for validity, and retain only the live ones
ViewLayerVector::const_iterator aCurr( maViewLayers.begin() ); for( const auto& rViewLayer : maViewLayers )
const ViewLayerVector::const_iterator aEnd( maViewLayers.end() );
while( aCurr != aEnd )
{ {
boost::shared_ptr< SlideViewLayer > pCurrLayer( aCurr->lock() ); boost::shared_ptr< SlideViewLayer > pCurrLayer( rViewLayer.lock() );
if( pCurrLayer ) if( pCurrLayer )
{ {
@@ -1161,8 +1155,6 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const
pCurrLayer->updateView( rCurrTransform, pCurrLayer->updateView( rCurrTransform,
maUserSize ); maUserSize );
} }
++aCurr;
} }
// replace layer list with pruned one // replace layer list with pruned one

View File

@@ -29,7 +29,6 @@
#include "slidechangebase.hxx" #include "slidechangebase.hxx"
#include "tools.hxx" #include "tools.hxx"
#include <boost/bind.hpp>
#include <algorithm> #include <algorithm>
using namespace com::sun::star; using namespace com::sun::star;
@@ -180,11 +179,8 @@ void SlideChangeBase::prefetch( const AnimatableShapeSharedPtr&,
mrEventMultiplexer.addViewHandler( shared_from_this() ); mrEventMultiplexer.addViewHandler( shared_from_this() );
// init views and create slide bitmaps // init views and create slide bitmaps
std::for_each( mrViewContainer.begin(), for( const auto& rView : mrViewContainer )
mrViewContainer.end(), this->viewAdded( rView );
boost::bind( &SlideChangeBase::viewAdded,
this,
_1 ));
mbPrefetched = true; mbPrefetched = true;
} }
@@ -415,11 +411,9 @@ void SlideChangeBase::viewRemoved( const UnoViewSharedPtr& rView )
std::remove_if( std::remove_if(
maViewData.begin(), maViewData.begin(),
maViewData.end(), maViewData.end(),
boost::bind( [&rView]( const ViewEntry& rViewEntry )
std::equal_to<UnoViewSharedPtr>(), // select and compare view
rView, { return rView == rViewEntry.getView(); } ),
// select view:
boost::bind( &ViewEntry::getView, _1 ))),
maViewData.end() ); maViewData.end() );
} }
@@ -434,11 +428,8 @@ void SlideChangeBase::viewChanged( const UnoViewSharedPtr& rView )
std::find_if( std::find_if(
maViewData.begin(), maViewData.begin(),
maViewData.end(), maViewData.end(),
boost::bind( [&rView]( const ViewEntry& rViewEntry )
std::equal_to<UnoViewSharedPtr>(), { return rView == rViewEntry.getView(); } ) );
rView,
// select view:
boost::bind( &ViewEntry::getView, _1 ) )));
OSL_ASSERT( aModifiedEntry != maViewData.end() ); OSL_ASSERT( aModifiedEntry != maViewData.end() );
if( aModifiedEntry == maViewData.end() ) if( aModifiedEntry == maViewData.end() )

View File

@@ -45,9 +45,6 @@
#include "combtransition.hxx" #include "combtransition.hxx"
#include "tools.hxx" #include "tools.hxx"
#include <boost/bind.hpp>
/*************************************************** /***************************************************
*** *** *** ***
*** Slide Transition Effects *** *** Slide Transition Effects ***
@@ -189,10 +186,8 @@ public:
virtual bool operator()( double t ) SAL_OVERRIDE virtual bool operator()( double t ) SAL_OVERRIDE
{ {
std::for_each(maTransitions.begin(), for( const auto& pTransition : maTransitions )
maTransitions.end(), pTransition->update( t );
boost::bind( &TransitionViewPair::update,
_1, t) );
return true; return true;
} }

View File

@@ -22,8 +22,6 @@
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <boost/bind.hpp>
#include <algorithm> #include <algorithm>
@@ -45,14 +43,11 @@ namespace slideshow
// check whether same view is already added // check whether same view is already added
// already added? // already added?
const uno::Reference< presentation::XSlideShowView > rShowView = rView->getUnoView();
if( ::std::any_of( maViews.begin(), if( ::std::any_of( maViews.begin(),
maViews.end(), maViews.end(),
::boost::bind( [&rShowView]( const UnoViewSharedPtr& pUnoView )
::std::equal_to< uno::Reference< presentation::XSlideShowView > >(), { return rShowView == pUnoView->getUnoView(); } ) )
rView->getUnoView(),
::boost::bind(
&UnoView::getUnoView,
_1 ) ) ) )
{ {
// yes, nothing to do // yes, nothing to do
return false; return false;
@@ -73,12 +68,8 @@ namespace slideshow
// added in the first place? // added in the first place?
if( (aIter=::std::find_if( maViews.begin(), if( (aIter=::std::find_if( maViews.begin(),
aEnd, aEnd,
::boost::bind( [&xView]( const UnoViewSharedPtr& pUnoView )
::std::equal_to< uno::Reference< presentation::XSlideShowView > >(), { return xView == pUnoView->getUnoView(); } ) ) == aEnd )
::boost::cref( xView ),
::boost::bind(
&UnoView::getUnoView,
_1 ) ) ) ) == aEnd )
{ {
// nope, nothing to do // nope, nothing to do
return UnoViewSharedPtr(); return UnoViewSharedPtr();
@@ -88,12 +79,8 @@ namespace slideshow
::std::count_if( ::std::count_if(
maViews.begin(), maViews.begin(),
aEnd, aEnd,
::boost::bind( [&xView]( const UnoViewSharedPtr& pUnoView )
::std::equal_to< uno::Reference< presentation::XSlideShowView > >(), { return xView == pUnoView->getUnoView(); } ) == 1,
::boost::cref( xView ),
::boost::bind(
&UnoView::getUnoView,
_1 ))) == 1,
"UnoViewContainer::removeView(): View was added multiple times" ); "UnoViewContainer::removeView(): View was added multiple times" );
UnoViewSharedPtr pView( *aIter ); UnoViewSharedPtr pView( *aIter );
@@ -106,9 +93,8 @@ namespace slideshow
void UnoViewContainer::dispose() void UnoViewContainer::dispose()
{ {
::std::for_each( maViews.begin(), for( const auto& rView : maViews )
maViews.end(), rView->_dispose();
::boost::mem_fn(&UnoView::_dispose) );
maViews.clear(); maViews.clear();
} }
} }

View File

@@ -143,9 +143,8 @@ public:
bRet = !rVec.empty(); bRet = !rVec.empty();
// registered node found -> fire all events in the vector // registered node found -> fire all events in the vector
std::for_each( rVec.begin(), rVec.end(), for( const auto& pEvent : rVec )
boost::bind( &EventQueue::addEvent, mrEventQueue.addEvent( pEvent );
boost::ref( mrEventQueue ), _1 ) );
rVec.clear(); rVec.clear();
} }

View File

@@ -67,10 +67,8 @@ WaitSymbol::WaitSymbol( uno::Reference<rendering::XBitmap> const & xBitmap,
mrScreenUpdater( rScreenUpdater ), mrScreenUpdater( rScreenUpdater ),
mbVisible(false) mbVisible(false)
{ {
std::for_each( rViewContainer.begin(), for( const auto& pView : rViewContainer )
rViewContainer.end(), this->viewAdded( pView );
[this]( const UnoViewSharedPtr& sp )
{ this->viewAdded(sp); } );
} }
void WaitSymbol::setVisible( const bool bVisible ) void WaitSymbol::setVisible( const bool bVisible )