Use const_iterator when possible (svx/gallery2,items,sdr,stbctrls)

Change-Id: Idd8992fcb76c25120202b24a23820d85ca09e434
Reviewed-on: https://gerrit.libreoffice.org/24174
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet
2016-04-17 22:54:57 +02:00
parent 92ddd584f1
commit 101e5bbc8a
9 changed files with 28 additions and 29 deletions

View File

@@ -299,8 +299,9 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos
GalleryBrowser2::GetFrame(), css::uno::UNO_QUERY ); GalleryBrowser2::GetFrame(), css::uno::UNO_QUERY );
css::uno::Reference< css::util::XURLTransformer > xTransformer( css::uno::Reference< css::util::XURLTransformer > xTransformer(
mpBrowser->GetURLTransformer() ); mpBrowser->GetURLTransformer() );
CommandInfoMap::const_iterator aEnd = m_aCommandInfo.end();
for ( CommandInfoMap::iterator it = m_aCommandInfo.begin(); for ( CommandInfoMap::iterator it = m_aCommandInfo.begin();
it != m_aCommandInfo.end(); ++it ) it != aEnd; ++it )
{ {
try try
{ {

View File

@@ -570,7 +570,8 @@ bool Gallery::RemoveTheme( const OUString& rThemeName )
KillFile( aStrURL ); KillFile( aStrURL );
} }
for ( GalleryThemeList::iterator it = aThemeList.begin(); it != aThemeList.end(); ++it ) GalleryThemeList::const_iterator aEnd = aThemeList.end();
for ( GalleryThemeList::iterator it = aThemeList.begin(); it != aEnd; ++it )
{ {
if ( pThemeEntry == *it ) { if ( pThemeEntry == *it ) {
delete pThemeEntry; delete pThemeEntry;
@@ -641,7 +642,8 @@ GalleryTheme* Gallery::ImplGetCachedTheme(const GalleryThemeEntry* pThemeEntry)
void Gallery::ImplDeleteCachedTheme( GalleryTheme* pTheme ) void Gallery::ImplDeleteCachedTheme( GalleryTheme* pTheme )
{ {
for (GalleryCacheThemeList::iterator it = aThemeCache.begin(); it != aThemeCache.end(); ++it) GalleryCacheThemeList::const_iterator aEnd = aThemeCache.end();
for (GalleryCacheThemeList::iterator it = aThemeCache.begin(); it != aEnd; ++it)
{ {
if (pTheme == (*it)->GetTheme()) if (pTheme == (*it)->GetTheme())
{ {

View File

@@ -592,7 +592,7 @@ void GalleryTheme::Actualize( const Link<const INetURLObject&, void>& rActualize
// remove all entries with set flag // remove all entries with set flag
GalleryObjectList::const_iterator aEnd = aObjectList.end(); GalleryObjectList::const_iterator aEnd = aObjectList.end();
for ( GalleryObjectList::iterator it = aObjectList.begin(); it != aEnd ; /* increment is in the body ofloop */) for ( GalleryObjectList::iterator it = aObjectList.begin(); it != aEnd ; /* increment is in the body of loop */)
{ {
if( (*it)->mbDelete ) if( (*it)->mbDelete )
{ {

View File

@@ -786,9 +786,7 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
if(nCurCategory!=css::util::NumberFormat::ALL) if(nCurCategory!=css::util::NumberFormat::ALL)
{ {
SvNumberFormatTable::iterator it = pCurFmtTable->begin(); for( SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it )
while ( it != pCurFmtTable->end() )
{ {
sal_uInt32 nKey = it->first; sal_uInt32 nKey = it->first;
const SvNumberformat* pNumEntry = it->second; const SvNumberformat* pNumEntry = it->second;
@@ -821,7 +819,6 @@ short SvxNumberFormatShell::FillEListWithSysCurrencys( std::vector<OUString>& rL
aCurEntryList.push_back( nKey ); aCurEntryList.push_back( nKey );
} }
} }
++it;
} }
} }
return nSelPos; return nSelPos;
@@ -887,8 +884,7 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
rShortSymbol = pTmpCurrencyEntry->BuildSymbolString(bTmpBanking,true); rShortSymbol = pTmpCurrencyEntry->BuildSymbolString(bTmpBanking,true);
} }
SvNumberFormatTable::iterator it = pCurFmtTable->begin(); for ( SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it )
while ( it != pCurFmtTable->end() )
{ {
sal_uInt32 nKey = it->first; sal_uInt32 nKey = it->first;
const SvNumberformat* pNumEntry = it->second; const SvNumberformat* pNumEntry = it->second;
@@ -938,7 +934,6 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys( std::vector<OUString>& r
} }
} }
} }
++it;
} }
NfWSStringsDtor aWSStringsDtor; NfWSStringsDtor aWSStringsDtor;
@@ -1040,8 +1035,7 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<OUString>& rList,
bool bAdditional = (nPrivCat != CAT_USERDEFINED && bool bAdditional = (nPrivCat != CAT_USERDEFINED &&
nCurCategory != css::util::NumberFormat::ALL); nCurCategory != css::util::NumberFormat::ALL);
SvNumberFormatTable::iterator it = pCurFmtTable->begin(); for( SvNumberFormatTable::const_iterator it = pCurFmtTable->begin(), aEnd = pCurFmtTable->end(); it != aEnd; ++it )
while ( it != pCurFmtTable->end() )
{ {
sal_uInt32 nKey = it->first; sal_uInt32 nKey = it->first;
const SvNumberformat* pNumEntry = it->second; const SvNumberformat* pNumEntry = it->second;
@@ -1071,7 +1065,6 @@ short SvxNumberFormatShell::FillEListWithUsD_Impl( std::vector<OUString>& rList,
} }
} }
} }
++it;
} }
return nSelPos; return nSelPos;
} }

View File

@@ -190,8 +190,9 @@ namespace sdr
} }
// execute events from the vector // execute events from the vector
::std::vector< Event* >::const_iterator aEnd = EventPointerVector.end();
for(::std::vector< Event* >::iterator aCandidate = EventPointerVector.begin(); for(::std::vector< Event* >::iterator aCandidate = EventPointerVector.begin();
aCandidate != EventPointerVector.end(); ++aCandidate) aCandidate != aEnd; ++aCandidate)
{ {
// trigger event. This may re-insert the event to the scheduler again // trigger event. This may re-insert the event to the scheduler again
(*aCandidate)->Trigger(mnTime); (*aCandidate)->Trigger(mnTime);

View File

@@ -94,7 +94,8 @@ namespace sdr
if(nSize) if(nSize)
{ {
for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); ++aIter) OverlayObjectVector::const_iterator aEnd(maOverlayObjects.end());
for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != aEnd; ++aIter)
{ {
OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)"); OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
OverlayObject& rCandidate = **aIter; OverlayObject& rCandidate = **aIter;
@@ -223,7 +224,8 @@ namespace sdr
if(nSize) if(nSize)
{ {
for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != maOverlayObjects.end(); ++aIter) OverlayObjectVector::const_iterator aEnd = maOverlayObjects.end();
for(OverlayObjectVector::iterator aIter(maOverlayObjects.begin()); aIter != aEnd; ++aIter)
{ {
OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)"); OSL_ENSURE(*aIter, "Corrupted OverlayObject List (!)");
OverlayObject& rCandidate = **aIter; OverlayObject& rCandidate = **aIter;

View File

@@ -362,8 +362,8 @@ namespace sdr
SfxStyleSheetBase* pLastSheet = nullptr; SfxStyleSheetBase* pLastSheet = nullptr;
SfxStyleSheetBase* pForThisObject = nullptr; SfxStyleSheetBase* pForThisObject = nullptr;
std::vector<SfxStyleSheetBase*>::iterator iter; for (std::vector<SfxStyleSheetBase*>::const_iterator iter = aStyleList.begin(), aEnd = aStyleList.end()
for (iter = aStyleList.begin(); iter != aStyleList.end(); ++iter) ; iter != aEnd; ++iter)
{ {
pNewSheet = &pNewPool->Make((*iter)->GetName(), (*iter)->GetFamily(), (*iter)->GetMask()); pNewSheet = &pNewPool->Make((*iter)->GetName(), (*iter)->GetFamily(), (*iter)->GetMask());
pNewSheet->GetItemSet().Put((*iter)->GetItemSet(), false); pNewSheet->GetItemSet().Put((*iter)->GetItemSet(), false);

View File

@@ -461,7 +461,7 @@ namespace sdr
std::vector<EECharAttrib> aAttribs; std::vector<EECharAttrib> aAttribs;
pEditEngine->GetCharAttribs(nPara, aAttribs); pEditEngine->GetCharAttribs(nPara, aAttribs);
for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i) for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(), aEnd = aAttribs.end(); i != aEnd; ++i)
{ {
if(EE_FEATURE_FIELD == i->pAttr->Which()) if(EE_FEATURE_FIELD == i->pAttr->Which())
{ {
@@ -490,7 +490,7 @@ namespace sdr
ESelection aSel(nPara, 0); ESelection aSel(nPara, 0);
for(std::vector<EECharAttrib>::iterator i = aAttribs.begin(); i < aAttribs.end(); ++i) for(std::vector<EECharAttrib>::const_iterator i = aAttribs.begin(), aEnd = aAttribs.end(); i != aEnd; ++i)
{ {
if(EE_FEATURE_FIELD == i->pAttr->Which()) if(EE_FEATURE_FIELD == i->pAttr->Which())
{ {

View File

@@ -79,9 +79,9 @@ sal_uInt16 SvxZoomSliderControl::Offset2Zoom( long nOffset ) const
// check for snapping points: // check for snapping points:
sal_uInt16 nCount = 0; sal_uInt16 nCount = 0;
std::vector< long >::iterator aSnappingPointIter; for ( std::vector< long >::const_iterator aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin(),
for ( aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin(); aEnd = mxImpl->maSnappingPointOffsets.end();
aSnappingPointIter != mxImpl->maSnappingPointOffsets.end(); aSnappingPointIter != aEnd;
++aSnappingPointIter ) ++aSnappingPointIter )
{ {
const long nCurrent = *aSnappingPointIter; const long nCurrent = *aSnappingPointIter;
@@ -223,10 +223,10 @@ void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eStat
} }
// remove snapping points that are to close to each other: // remove snapping points that are to close to each other:
std::set< sal_uInt16 >::iterator aSnappingPointIter;
long nLastOffset = 0; long nLastOffset = 0;
for ( aSnappingPointIter = aTmpSnappingPoints.begin(); aSnappingPointIter != aTmpSnappingPoints.end(); ++aSnappingPointIter ) for ( std::set< sal_uInt16 >::const_iterator aSnappingPointIter = aTmpSnappingPoints.begin(),
aEnd = aTmpSnappingPoints.end(); aSnappingPointIter != aEnd; ++aSnappingPointIter )
{ {
const sal_uInt16 nCurrent = *aSnappingPointIter; const sal_uInt16 nCurrent = *aSnappingPointIter;
const long nCurrentOffset = Zoom2Offset( nCurrent ); const long nCurrentOffset = Zoom2Offset( nCurrent );
@@ -270,9 +270,9 @@ void SvxZoomSliderControl::Paint( const UserDrawEvent& rUsrEvt )
// draw snapping points: // draw snapping points:
std::vector< long >::iterator aSnappingPointIter; for ( std::vector< long >::const_iterator aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin(),
for ( aSnappingPointIter = mxImpl->maSnappingPointOffsets.begin(); aEnd = mxImpl->maSnappingPointOffsets.end();
aSnappingPointIter != mxImpl->maSnappingPointOffsets.end(); aSnappingPointIter != aEnd;
++aSnappingPointIter ) ++aSnappingPointIter )
{ {
long nSnapPosX = aRect.Left() + *aSnappingPointIter; long nSnapPosX = aRect.Left() + *aSnappingPointIter;