diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2018-03-03 12:54:07 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2018-03-03 19:20:53 +0100 |
commit | ba7191ed0d4da2f5a2ebd2ef40387b26145860f1 (patch) | |
tree | e019dbd2dcc947c155e63841c2ec3a53eca427fb /chart2/source/controller/accessibility/AccessibleBase.cxx | |
parent | 301514183d471cfeb085673eb4563f8c310162b7 (diff) |
Use for-range loops in chart2 (part1)
Change-Id: I9310a6dc79d47f9058df8a3b463667389af1b2cb
Reviewed-on: https://gerrit.libreoffice.org/50672
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'chart2/source/controller/accessibility/AccessibleBase.cxx')
-rw-r--r-- | chart2/source/controller/accessibility/AccessibleBase.cxx | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/chart2/source/controller/accessibility/AccessibleBase.cxx b/chart2/source/controller/accessibility/AccessibleBase.cxx index 768a09e52e88..8c26f4629229 100644 --- a/chart2/source/controller/accessibility/AccessibleBase.cxx +++ b/chart2/source/controller/accessibility/AccessibleBase.cxx @@ -157,15 +157,14 @@ bool AccessibleBase::NotifyEvent( EventType eEventType, const AccessibleUniqueId ChildListVectorType aLocalChildList( m_aChildList ); aGuard.clear(); - ChildListVectorType::iterator aEndIter = aLocalChildList.end(); - for( ChildListVectorType::iterator aIter = aLocalChildList.begin() ; - ( aIter != aEndIter ) && ( ! bStop ) ; - ++aIter ) + for (auto const& localChild : aLocalChildList) { // Note: at this place we must be sure to have an AccessibleBase // object in the UNO reference to XAccessible ! bStop = (*static_cast< AccessibleBase * > - ( (*aIter).get() )).NotifyEvent( eEventType, rId ); + ( localChild.get() )).NotifyEvent( eEventType, rId ); + if (bStop) + break; } return bStop; } @@ -231,23 +230,22 @@ bool AccessibleBase::ImplUpdateChildren() aModelChildren.begin(), aModelChildren.end(), std::back_inserter( aChildrenToRemove )); - std::vector< ObjectIdentifier >::const_iterator aIt( aChildrenToRemove.begin()); - for( ; aIt != aChildrenToRemove.end(); ++aIt ) + for (auto const& childToRemove : aChildrenToRemove) { - RemoveChildByOId( *aIt ); + RemoveChildByOId(childToRemove); } AccessibleElementInfo aAccInfo( GetInfo()); aAccInfo.m_pParent = this; - for( aIt = aChildrenToAdd.begin(); aIt != aChildrenToAdd.end(); ++aIt ) + for (auto const& childToAdd : aChildrenToAdd) { - aAccInfo.m_aOID = *aIt; - if ( aIt->isAutoGeneratedObject() ) + aAccInfo.m_aOID = childToAdd; + if ( childToAdd.isAutoGeneratedObject() ) { AddChild( ChartElementFactory::CreateChartElement( aAccInfo ) ); } - else if ( aIt->isAdditionalShape() ) + else if ( childToAdd.isAdditionalShape() ) { AddChild( new AccessibleChartShape( aAccInfo ) ); } @@ -395,14 +393,12 @@ void AccessibleBase::KillAllChildren() // and notify listeners Reference< lang::XComponent > xComp; Any aEmpty, aOld; - ChildListVectorType::const_iterator aEndIter = aLocalChildList.end(); - for( ChildListVectorType::const_iterator aIter = aLocalChildList.begin(); - aIter != aEndIter; ++aIter ) + for (auto const& localChild : aLocalChildList) { - aOld <<= (*aIter); + aOld <<= localChild; BroadcastAccEvent( AccessibleEventId::CHILD, aEmpty, aOld ); - xComp.set( *aIter, UNO_QUERY ); + xComp.set(localChild, UNO_QUERY); if( xComp.is()) xComp->dispose(); } @@ -619,17 +615,16 @@ Reference< XAccessible > SAL_CALL AccessibleBase::getAccessibleAtPoint( const aw aGuard.clear(); Reference< XAccessibleComponent > aComp; - for( ChildListVectorType::const_iterator aIter = aLocalChildList.begin(); - aIter != aLocalChildList.end(); ++aIter ) + for (auto const& localChild : aLocalChildList) { - aComp.set( *aIter, UNO_QUERY ); + aComp.set(localChild, UNO_QUERY); if( aComp.is()) { aRect = aComp->getBounds(); if( ( aRect.X <= aPoint.X && aPoint.X <= (aRect.X + aRect.Width) ) && ( aRect.Y <= aPoint.Y && aPoint.Y <= (aRect.Y + aRect.Height))) { - aResult = (*aIter); + aResult = localChild; break; } } |