Kaydet (Commit) b6297280 authored tarafından Daniel Robertson's avatar Daniel Robertson Kaydeden (comit) Noel Grandin

Replace simple while loops with range-based for

Replace simple while loops with range-based for-loops when apropriate.
There should be no side effects due to this change.

Change-Id: I0c39d4c10c991354248e864a09333144974c953c
Reviewed-on: https://gerrit.libreoffice.org/19281Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
Tested-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 143fb0a4
...@@ -490,12 +490,10 @@ void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xP ...@@ -490,12 +490,10 @@ void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xP
aPoint.setY((*pInnerSequence).Y); aPoint.setY((*pInnerSequence).Y);
aPoly.append( aPoint ); aPoly.append( aPoint );
} }
UnoViewVector::const_iterator aIter=(mrContext.mrViewContainer).begin(); for( const auto& pView : mrContext.mrViewContainer )
UnoViewVector::const_iterator aEnd=(mrContext.mrViewContainer).end();
while(aIter != aEnd)
{ {
::cppcanvas::PolyPolygonSharedPtr pPolyPoly( ::cppcanvas::PolyPolygonSharedPtr pPolyPoly(
::cppcanvas::BaseGfxFactory::createPolyPolygon( (*aIter)->getCanvas(), ::cppcanvas::BaseGfxFactory::createPolyPolygon( pView->getCanvas(),
aPoly ) ); aPoly ) );
if( pPolyPoly ) if( pPolyPoly )
{ {
...@@ -504,7 +502,6 @@ void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xP ...@@ -504,7 +502,6 @@ void ShapeImporter::importPolygons(uno::Reference<beans::XPropertySet> const& xP
pPolyPoly->draw(); pPolyPoly->draw();
maPolygons.push_back(pPolyPoly); maPolygons.push_back(pPolyPoly);
} }
++aIter;
} }
} }
......
...@@ -231,15 +231,11 @@ namespace slideshow ...@@ -231,15 +231,11 @@ namespace slideshow
bool bRet(true); bool bRet(true);
VectorOfDocTreeNodes::const_iterator aIter( rSubsets.begin() ); for( const auto& rSubset : rSubsets )
const VectorOfDocTreeNodes::const_iterator aEnd ( rSubsets.end() );
while( aIter != aEnd )
{ {
if( !pRenderer->drawSubset( aIter->getStartIndex(), if( !pRenderer->drawSubset( rSubset.getStartIndex(),
aIter->getEndIndex() ) ) rSubset.getEndIndex() ) )
bRet = false; bRet = false;
++aIter;
} }
return bRet; return bRet;
......
...@@ -53,11 +53,9 @@ namespace slideshow ...@@ -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 ...@@ -65,9 +63,7 @@ namespace slideshow
} }
if( pCurrViewLayer ) if( pCurrViewLayer )
shapeFunc(aIter->first,pCurrViewLayer); shapeFunc(rShape.first,pCurrViewLayer);
++aIter;
} }
} }
...@@ -470,16 +466,14 @@ namespace slideshow ...@@ -470,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
...@@ -492,10 +486,8 @@ namespace slideshow ...@@ -492,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();
...@@ -528,11 +520,9 @@ namespace slideshow ...@@ -528,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;
...@@ -543,14 +533,12 @@ namespace slideshow ...@@ -543,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;
...@@ -639,9 +627,7 @@ namespace slideshow ...@@ -639,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
{ {
...@@ -650,11 +636,11 @@ namespace slideshow ...@@ -650,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& )
{ {
...@@ -667,8 +653,6 @@ namespace slideshow ...@@ -667,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;
......
...@@ -332,27 +332,23 @@ namespace internal ...@@ -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& rIter : 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( rIter.first.mnParagraphIndex == -1 )
{ {
rCurrProps.Target = uno::makeAny( aCurr->first.mxRef ); rCurrProps.Target = uno::makeAny( rIter.first.mxRef );
} }
else else
{ {
rCurrProps.Target = uno::makeAny( rCurrProps.Target = uno::makeAny(
presentation::ParagraphTarget( presentation::ParagraphTarget(
aCurr->first.mxRef, rIter.first.mxRef,
aCurr->first.mnParagraphIndex ) ); rIter.first.mnParagraphIndex ) );
} }
rCurrProps.Properties = ::comphelper::containerToSequence( aCurr->second ); rCurrProps.Properties = ::comphelper::containerToSequence( rIter.second );
++aCurr;
} }
return aRes; return aRes;
......
...@@ -885,18 +885,14 @@ ActivitySharedPtr SlideShowImpl::createSlideTransition( ...@@ -885,18 +885,14 @@ 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( PolygonMap::iterator aIter = maPolygons.begin();
aIter != aEnd;
while(aIter!=maPolygons.end() && !bFound) ++aIter )
{ if( aIter->first == xDrawPage )
if(aIter->first == xDrawPage) return aIter;
bFound = true;
else return aEnd;
++aIter;
}
return aIter;
} }
SlideSharedPtr SlideShowImpl::makeSlide( SlideSharedPtr SlideShowImpl::makeSlide(
...@@ -1444,25 +1440,16 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult ...@@ -1444,25 +1440,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;
::cppcanvas::PolyPolygonSharedPtr pPolyPoly;
::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; PolyPolygonVector 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( const auto pPolyPoly : aPolygons )
aEnd=aPolygons.end();
aIterPoly!=aEnd; ++aIterPoly )
{ {
pPolyPoly = (*aIterPoly); ::basegfx::B2DPolyPolygon b2DPolyPoly = ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(pPolyPoly->getUNOPolyPolygon());
b2DPolyPoly = ::basegfx::unotools::b2DPolyPolygonFromXPolyPolygon2D(pPolyPoly->getUNOPolyPolygon());
//Normally there is only one polygon //Normally there is only one polygon
for(sal_uInt32 i=0; i< b2DPolyPoly.count();i++) for(sal_uInt32 i=0; i< b2DPolyPoly.count();i++)
...@@ -1531,7 +1518,6 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult ...@@ -1531,7 +1518,6 @@ void SlideShowImpl::registerUserPaintPolygons( const uno::Reference< lang::XMult
} }
} }
} }
++aIter;
} }
} }
...@@ -2113,13 +2099,11 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) ...@@ -2113,13 +2099,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 );
...@@ -2135,8 +2119,6 @@ sal_Bool SlideShowImpl::update( double & nNextTimeout ) ...@@ -2135,8 +2119,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;
......
...@@ -283,23 +283,19 @@ class LayerSpriteContainer ...@@ -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
...@@ -1173,22 +1169,18 @@ void SlideView::pruneLayers( bool bWithViewLayerUpdate ) const ...@@ -1173,22 +1169,18 @@ 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& rView : maViewLayers )
const ViewLayerVector::const_iterator aEnd( maViewLayers.end() );
while( aCurr != aEnd )
{ {
std::shared_ptr< SlideViewLayer > xCurrLayer( aCurr->lock() ); std::shared_ptr< SlideViewLayer > xCurrLayer( rView.lock() );
if (xCurrLayer) if ( xCurrLayer )
{ {
aValidLayers.push_back(xCurrLayer); aValidLayers.push_back( xCurrLayer );
if( bWithViewLayerUpdate ) if( bWithViewLayerUpdate )
xCurrLayer->updateView( rCurrTransform, xCurrLayer->updateView( rCurrTransform,
maUserSize ); maUserSize );
} }
++aCurr;
} }
// replace layer list with pruned one // replace layer list with pruned one
......
...@@ -453,16 +453,12 @@ void SlideChangeBase::viewsChanged() ...@@ -453,16 +453,12 @@ void SlideChangeBase::viewsChanged()
if( mbFinished ) if( mbFinished )
return; return;
ViewsVecT::iterator aIter( maViewData.begin() ); for( auto& pView : maViewData )
ViewsVecT::iterator const aEnd ( maViewData.end() );
while( aIter != aEnd )
{ {
// clear stale info (both bitmaps and sprites prolly need a // clear stale info (both bitmaps and sprites prolly need a
// resize) // resize)
clearViewEntry( *aIter ); clearViewEntry( pView );
addSprites( *aIter ); addSprites( pView );
++aIter;
} }
} }
......
...@@ -141,16 +141,13 @@ public: ...@@ -141,16 +141,13 @@ public:
mxFactory( xFactory ) mxFactory( xFactory )
{ {
// create one transition per view // create one transition per view
UnoViewVector::const_iterator aCurrView (rViewContainer.begin()); for( const auto& rView : rViewContainer )
const UnoViewVector::const_iterator aEnd(rViewContainer.end());
while( aCurrView != aEnd )
{ {
if(! addTransition( *aCurrView ) ) if( !addTransition( rView ) )
return; return;
ENSURE_OR_THROW(maTransitions.back() && maTransitions.back()->mxTransition.is(), ENSURE_OR_THROW(maTransitions.back() && maTransitions.back()->mxTransition.is(),
"Failed to create plugin transition"); "Failed to create plugin transition");
++aCurrView;
} }
mbSuccess = true; mbSuccess = true;
} }
...@@ -159,13 +156,11 @@ public: ...@@ -159,13 +156,11 @@ public:
{ {
mxFactory.clear(); mxFactory.clear();
::std::vector< TransitionViewPair* >::const_iterator aCurrView (maTransitions.begin()); for( const auto& pCurrView : maTransitions )
::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end());
while( aCurrView != aEnd )
{ {
delete (*aCurrView); delete pCurrView;
++aCurrView;
} }
maTransitions.clear(); maTransitions.clear();
} }
...@@ -204,24 +199,14 @@ public: ...@@ -204,24 +199,14 @@ public:
OSL_TRACE("PluginSlideChange viewAdded"); OSL_TRACE("PluginSlideChange viewAdded");
SlideChangeBase::viewAdded( rView ); SlideChangeBase::viewAdded( rView );
::std::vector< TransitionViewPair* >::const_iterator aCurrView (maTransitions.begin()); for( const auto& pCurrView : maTransitions )
::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end());
bool bKnown = false;
while( aCurrView != aEnd )
{ {
if( (*aCurrView)->mpView == rView ) if( pCurrView->mpView == rView )
{ return;
bKnown = true;
break;
}
++aCurrView;
} }
if( !bKnown ) OSL_TRACE( "need to be added" );
{ addTransition( rView );
OSL_TRACE("need to be added");
addTransition( rView );
}
} }
virtual void viewRemoved( const UnoViewSharedPtr& rView ) SAL_OVERRIDE virtual void viewRemoved( const UnoViewSharedPtr& rView ) SAL_OVERRIDE
...@@ -229,18 +214,18 @@ public: ...@@ -229,18 +214,18 @@ public:
OSL_TRACE("PluginSlideChange viewRemoved"); OSL_TRACE("PluginSlideChange viewRemoved");
SlideChangeBase::viewRemoved( rView ); SlideChangeBase::viewRemoved( rView );
::std::vector< TransitionViewPair* >::iterator aCurrView (maTransitions.begin());
::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end()); ::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end());
while( aCurrView != aEnd ) for( ::std::vector< TransitionViewPair* >::iterator aIter =maTransitions.begin();
aIter != aEnd;
++aIter )
{ {
if( (*aCurrView)->mpView == rView ) if( ( *aIter )->mpView == rView )
{ {
OSL_TRACE( "view removed" ); OSL_TRACE( "view removed" );
delete (*aCurrView); delete ( *aIter );
maTransitions.erase( aCurrView ); maTransitions.erase( aIter );
break; break;
} }
++aCurrView;
} }
} }
...@@ -249,21 +234,17 @@ public: ...@@ -249,21 +234,17 @@ public:
OSL_TRACE("PluginSlideChange viewChanged"); OSL_TRACE("PluginSlideChange viewChanged");
SlideChangeBase::viewChanged( rView ); SlideChangeBase::viewChanged( rView );
::std::vector< TransitionViewPair* >::const_iterator aCurrView (maTransitions.begin()); for( const auto& pCurrView : maTransitions )
::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end());
while( aCurrView != aEnd )
{ {
if( (*aCurrView)->mpView == rView ) if( pCurrView->mpView == rView )
{ {
OSL_TRACE( "view changed" ); OSL_TRACE( "view changed" );
(*aCurrView)->mxTransition->viewChanged( rView->getUnoView(), pCurrView->mxTransition->viewChanged( rView->getUnoView(),
getLeavingBitmap(ViewEntry(rView))->getXBitmap(), getLeavingBitmap(ViewEntry(rView))->getXBitmap(),
getEnteringBitmap(ViewEntry(rView))->getXBitmap() ); getEnteringBitmap(ViewEntry(rView))->getXBitmap() );
} }
else else
OSL_TRACE( "view did not changed" ); OSL_TRACE( "view did not changed" );
++aCurrView;
} }
} }
...@@ -272,15 +253,13 @@ public: ...@@ -272,15 +253,13 @@ public:
OSL_TRACE("PluginSlideChange viewsChanged"); OSL_TRACE("PluginSlideChange viewsChanged");
SlideChangeBase::viewsChanged(); SlideChangeBase::viewsChanged();
::std::vector< TransitionViewPair* >::const_iterator aCurrView (maTransitions.begin()); for( const auto& pCurrView : maTransitions )
::std::vector< TransitionViewPair* >::const_iterator aEnd(maTransitions.end());
while( aCurrView != aEnd )
{ {
OSL_TRACE( "view changed" ); OSL_TRACE( "view changed" );
(*aCurrView)->mxTransition->viewChanged( (*aCurrView)->mpView->getUnoView(), UnoViewSharedPtr pView = pCurrView->mpView;
getLeavingBitmap(ViewEntry((*aCurrView)->mpView))->getXBitmap(), pCurrView->mxTransition->viewChanged( pView->getUnoView(),
getEnteringBitmap(ViewEntry((*aCurrView)->mpView))->getXBitmap() ); getLeavingBitmap(ViewEntry(pView))->getXBitmap(),
++aCurrView; getEnteringBitmap(ViewEntry(pView))->getXBitmap() );
} }
} }
......
...@@ -77,19 +77,15 @@ void WaitSymbol::setVisible( const bool bVisible ) ...@@ -77,19 +77,15 @@ void WaitSymbol::setVisible( const bool bVisible )
{ {
mbVisible = bVisible; mbVisible = bVisible;
ViewsVecT::const_iterator aIter( maViews.begin() ); for( const auto& rView : maViews )
ViewsVecT::const_iterator const aEnd ( maViews.end() );
while( aIter != aEnd )
{ {
if( aIter->second ) if( rView.second )
{ {
if( bVisible ) if( bVisible )
aIter->second->show(); rView.second->show();
else else
aIter->second->hide(); rView.second->hide();
} }
++aIter;
} }
// sprites changed, need a screen update for this frame. // sprites changed, need a screen update for this frame.
...@@ -176,14 +172,11 @@ void WaitSymbol::viewChanged( const UnoViewSharedPtr& rView ) ...@@ -176,14 +172,11 @@ void WaitSymbol::viewChanged( const UnoViewSharedPtr& rView )
void WaitSymbol::viewsChanged() void WaitSymbol::viewsChanged()
{ {
// reposition sprites on all views // reposition sprites on all views
ViewsVecT::const_iterator aIter( maViews.begin() ); for( const auto& rView : maViews )
ViewsVecT::const_iterator const aEnd ( maViews.end() );
while( aIter != aEnd )
{ {
if( aIter->second ) if( rView.second )
aIter->second->movePixel( rView.second->movePixel(
calcSpritePos( aIter->first )); calcSpritePos( rView.first ) );
++aIter;
} }
} }
......
...@@ -102,19 +102,15 @@ template< typename ListenerT > struct ListenerOperations ...@@ -102,19 +102,15 @@ template< typename ListenerT > struct ListenerOperations
FuncT func ) FuncT func )
{ {
bool bRet(false); bool bRet(false);
typename ContainerT::const_iterator aCurr( rContainer.begin() ); for( const auto& rCurr : rContainer )
typename ContainerT::const_iterator const aEnd ( rContainer.end() );
while( aCurr != aEnd )
{ {
if( FunctionApply< typename FuncT::result_type, if( FunctionApply< typename FuncT::result_type,
typename ContainerT::value_type >::apply( typename ContainerT::value_type >::apply(
func, func,
*aCurr) ) rCurr) )
{ {
bRet = true; bRet = true;
} }
++aCurr;
} }
// true: at least one handler returned true // true: at least one handler returned true
...@@ -137,16 +133,12 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> > ...@@ -137,16 +133,12 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> >
static bool notifySingleListener( ContainerT& rContainer, static bool notifySingleListener( ContainerT& rContainer,
FuncT func ) FuncT func )
{ {
typename ContainerT::const_iterator aCurr( rContainer.begin() ); for( const auto& rCurr : rContainer )
typename ContainerT::const_iterator const aEnd ( rContainer.end() );
while( aCurr != aEnd )
{ {
boost::shared_ptr<ListenerTargetT> pListener( aCurr->lock() ); boost::shared_ptr<ListenerTargetT> pListener( rCurr.lock() );
if( pListener && func(pListener) ) if( pListener && func(pListener) )
return true; return true;
++aCurr;
} }
return false; return false;
...@@ -158,11 +150,9 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> > ...@@ -158,11 +150,9 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> >
FuncT func ) FuncT func )
{ {
bool bRet(false); bool bRet(false);
typename ContainerT::const_iterator aCurr( rContainer.begin() ); for( const auto& rCurr : rContainer )
typename ContainerT::const_iterator const aEnd ( rContainer.end() );
while( aCurr != aEnd )
{ {
boost::shared_ptr<ListenerTargetT> pListener( aCurr->lock() ); boost::shared_ptr<ListenerTargetT> pListener( rCurr.lock() );
if( pListener.get() && if( pListener.get() &&
FunctionApply< typename FuncT::result_type, FunctionApply< typename FuncT::result_type,
...@@ -170,8 +160,6 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> > ...@@ -170,8 +160,6 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> >
{ {
bRet = true; bRet = true;
} }
++aCurr;
} }
return bRet; return bRet;
...@@ -186,14 +174,10 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> > ...@@ -186,14 +174,10 @@ struct ListenerOperations< boost::weak_ptr<ListenerTargetT> >
ContainerT aAliveListeners; ContainerT aAliveListeners;
aAliveListeners.reserve(rContainer.size()); aAliveListeners.reserve(rContainer.size());
typename ContainerT::const_iterator aCurr( rContainer.begin() ); for( const auto& rCurr : rContainer )
typename ContainerT::const_iterator const aEnd ( rContainer.end() );
while( aCurr != aEnd )
{ {
if( !aCurr->expired() ) if( !rCurr.expired() )
aAliveListeners.push_back( *aCurr ); aAliveListeners.push_back( rCurr );
++aCurr;
} }
std::swap( rContainer, aAliveListeners ); std::swap( rContainer, aAliveListeners );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment