diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-26 09:08:01 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-04-26 07:43:58 +0000 |
commit | 17c4f7f0bc986ed2623a60eea99be01036899af3 (patch) | |
tree | ce231cac5d9b2d91fb175f22a45bf9dd664057f8 | |
parent | 501720afbf226443c1121379efb661d2902113df (diff) |
clang-tidy modernize-loop-convert in e*
Change-Id: If56abefa81b41479e3ea9890dee1c43f006086de
Reviewed-on: https://gerrit.libreoffice.org/24384
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
31 files changed, 148 insertions, 179 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index f728553e068c..7ac78d69dd70 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -803,9 +803,9 @@ void ParaPortionList::Reset() long ParaPortionList::GetYOffset(const ParaPortion* pPPortion) const { long nHeight = 0; - for (sal_Int32 i = 0, n = maPortions.size(); i < n; ++i) + for (const auto & maPortion : maPortions) { - const ParaPortion* pTmpPortion = maPortions[i].get(); + const ParaPortion* pTmpPortion = maPortion.get(); if ( pTmpPortion == pPPortion ) return nHeight; nHeight += pTmpPortion->GetHeight(); diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index aa66312d8e5f..74f5f7198baf 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -397,9 +397,8 @@ void EditEngine::SetPaperSize( const Size& rNewSize ) bool bAutoPageSize = pImpEditEngine->GetStatus().AutoPageSize(); if ( bAutoPageSize || ( aNewSize.Width() != aOldSize.Width() ) ) { - for (size_t nView = 0; nView < pImpEditEngine->aEditViews.size(); ++nView) + for (EditView* pView : pImpEditEngine->aEditViews) { - EditView* pView = pImpEditEngine->aEditViews[nView]; if ( bAutoPageSize ) pView->pImpEditView->RecalcOutputArea(); else if ( pView->pImpEditView->DoAutoSize() ) diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index eadcd4cfb471..fe784e0d097d 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -127,9 +127,9 @@ ContentInfo::ContentInfo( const ContentInfo& rCopyFrom, SfxItemPool& rPoolToUse // this should ensure that the Items end up in the correct Pool! aParaAttribs.Set( rCopyFrom.GetParaAttribs() ); - for (size_t i = 0; i < rCopyFrom.aAttribs.size(); ++i) + for (const auto & aAttrib : rCopyFrom.aAttribs) { - const XEditAttribute& rAttr = *rCopyFrom.aAttribs[i].get(); + const XEditAttribute& rAttr = *aAttrib.get(); XEditAttribute* pMyAttr = MakeXEditAttribute( rPoolToUse, *rAttr.GetItem(), rAttr.GetStart(), rAttr.GetEnd()); aAttribs.push_back(std::unique_ptr<XEditAttribute>(pMyAttr)); @@ -712,9 +712,9 @@ void EditTextObjectImpl::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttr rLst.clear(); const ContentInfo& rC = *aContents[nPara].get(); - for (size_t nAttr = 0; nAttr < rC.aAttribs.size(); ++nAttr) + for (const auto & aAttrib : rC.aAttribs) { - const XEditAttribute& rAttr = *rC.aAttribs[nAttr].get(); + const XEditAttribute& rAttr = *aAttrib.get(); EECharAttrib aEEAttr; aEEAttr.pAttr = rAttr.GetItem(); aEEAttr.nPara = nPara; @@ -880,9 +880,9 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs ) SectionBordersType& rBorders = aParaBorders[nPara]; rBorders.push_back(0); rBorders.push_back(rC.GetText().getLength()); - for (size_t nAttr = 0; nAttr < rC.aAttribs.size(); ++nAttr) + for (const auto & aAttrib : rC.aAttribs) { - const XEditAttribute& rAttr = *rC.aAttribs[nAttr].get(); + const XEditAttribute& rAttr = *aAttrib.get(); const SfxPoolItem* pItem = rAttr.GetItem(); if (!pItem) continue; @@ -946,9 +946,9 @@ void EditTextObjectImpl::GetAllSections( std::vector<editeng::Section>& rAttrs ) return; } - for (size_t i = 0; i < rC.aAttribs.size(); ++i) + for (const auto & aAttrib : rC.aAttribs) { - const XEditAttribute& rXAttr = *rC.aAttribs[i].get(); + const XEditAttribute& rXAttr = *aAttrib.get(); const SfxPoolItem* pItem = rXAttr.GetItem(); if (!pItem) continue; @@ -1524,9 +1524,9 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream ) // Works only if tab positions are set, not when DefTab. if ( nVersion < 500 ) { - for (size_t i = 0, n = aContents.size(); i < n; ++i) + for (std::unique_ptr<ContentInfo> & aContent : aContents) { - ContentInfo& rC = *aContents[i].get(); + ContentInfo& rC = *aContent.get(); const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rC.GetParaAttribs().Get(EE_PARA_LRSPACE)); if ( rLRSpace.GetTextLeft() && ( rC.GetParaAttribs().GetItemState( EE_PARA_TABS ) == SfxItemState::SET ) ) { diff --git a/editeng/source/editeng/editundo.cxx b/editeng/source/editeng/editundo.cxx index 63ced0a9457a..fdaeefa8450a 100644 --- a/editeng/source/editeng/editundo.cxx +++ b/editeng/source/editeng/editundo.cxx @@ -538,9 +538,9 @@ void EditUndoSetAttribs::Undo() pEE->RemoveCharAttribs(nPara, 0, true); DBG_ASSERT( pEE->GetEditDoc().GetObject( nPara ), "Undo (SetAttribs): pNode = NULL!" ); ContentNode* pNode = pEE->GetEditDoc().GetObject( nPara ); - for (size_t nAttr = 0; nAttr < rInf.GetPrevCharAttribs().size(); ++nAttr) + for (const auto & nAttr : rInf.GetPrevCharAttribs()) { - const EditCharAttrib& rX = *rInf.GetPrevCharAttribs()[nAttr].get(); + const EditCharAttrib& rX = *nAttr.get(); // is automatically "poolsized" pEE->GetEditDoc().InsertAttrib(pNode, rX.GetStart(), rX.GetEnd(), *rX.GetItem()); if (rX.Which() == EE_FEATURE_FIELD) diff --git a/editeng/source/editeng/eehtml.cxx b/editeng/source/editeng/eehtml.cxx index cb3c14442f34..410d99f17f88 100644 --- a/editeng/source/editeng/eehtml.cxx +++ b/editeng/source/editeng/eehtml.cxx @@ -705,9 +705,8 @@ void EditHTMLParser::StartPara( bool bReal ) { const HTMLOptions& aOptions = GetOptions(); SvxAdjust eAdjust = SVX_ADJUST_LEFT; - for ( size_t i = 0, n = aOptions.size(); i < n; ++i ) + for (const auto & aOption : aOptions) { - const HTMLOption& aOption = aOptions[i]; switch( aOption.GetToken() ) { case HTML_O_ALIGN: @@ -766,9 +765,8 @@ void EditHTMLParser::AnchorStart() const HTMLOptions& aOptions = GetOptions(); OUString aRef; - for ( size_t i = 0, n = aOptions.size(); i < n; ++i ) + for (const auto & aOption : aOptions) { - const HTMLOption& aOption = aOptions[i]; switch( aOption.GetToken() ) { case HTML_O_HREF: diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx index 210181c41346..fa8b36b0efe2 100644 --- a/editeng/source/editeng/eertfpar.cxx +++ b/editeng/source/editeng/eertfpar.cxx @@ -313,15 +313,15 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet ) if (eDestUnit != eSrcUnit) { sal_uInt16 aFntHeightIems[3] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL }; - for (size_t i = 0; i < SAL_N_ELEMENTS(aFntHeightIems); ++i) + for (unsigned short aFntHeightIem : aFntHeightIems) { - if (SfxItemState::SET == rSet.GetAttrSet().GetItemState( aFntHeightIems[i], false, &pItem )) + if (SfxItemState::SET == rSet.GetAttrSet().GetItemState( aFntHeightIem, false, &pItem )) { sal_uInt32 nHeight = static_cast<const SvxFontHeightItem*>(pItem)->GetHeight(); long nNewHeight; nNewHeight = OutputDevice::LogicToLogic( (long)nHeight, eSrcUnit, eDestUnit ); - SvxFontHeightItem aFntHeightItem( nNewHeight, 100, aFntHeightIems[i] ); + SvxFontHeightItem aFntHeightItem( nNewHeight, 100, aFntHeightIem ); aFntHeightItem.SetProp( static_cast<const SvxFontHeightItem*>(pItem)->GetProp(), static_cast<const SvxFontHeightItem*>(pItem)->GetPropUnit()); diff --git a/editeng/source/editeng/fieldupdater.cxx b/editeng/source/editeng/fieldupdater.cxx index a5db406e112b..5a2e93751277 100644 --- a/editeng/source/editeng/fieldupdater.cxx +++ b/editeng/source/editeng/fieldupdater.cxx @@ -29,13 +29,13 @@ public: { SfxItemPool* pPool = mrObj.GetPool(); EditTextObjectImpl::ContentInfosType& rContents = mrObj.GetContents(); - for (size_t i = 0; i < rContents.size(); ++i) + for (std::unique_ptr<ContentInfo> & i : rContents) { - ContentInfo& rContent = *rContents[i].get(); + ContentInfo& rContent = *i.get(); ContentInfo::XEditAttributesType& rAttribs = rContent.GetAttribs(); - for (size_t j = 0; j < rAttribs.size(); ++j) + for (std::unique_ptr<XEditAttribute> & rAttrib : rAttribs) { - XEditAttribute& rAttr = *rAttribs[j].get(); + XEditAttribute& rAttr = *rAttrib.get(); const SfxPoolItem* pItem = rAttr.GetItem(); if (pItem->Which() != EE_FEATURE_FIELD) // This is not a field item. diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index f4a6dcc32611..59f20a4587b3 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -349,9 +349,8 @@ void ImpEditView::DrawSelection( EditSelection aTmpSel, vcl::Region* pRegion, Ou } std::vector<OString> v; - for (size_t i = 0; i < aRectangles.size(); ++i) + for (Rectangle & rRectangle : aRectangles) { - Rectangle& rRectangle = aRectangles[i]; if (bMm100ToTwip) rRectangle = OutputDevice::LogicToLogic(rRectangle, MAP_100TH_MM, MAP_TWIP); rRectangle.Move(aOrigin.getX(), aOrigin.getY()); diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 6d19ff01ce87..95329d2f10ac 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -636,9 +636,8 @@ EditPaM ImpEditEngine::RemoveText() EditPaM aStartPaM = aEditDoc.GetStartPaM(); EditSelection aEmptySel( aStartPaM, aStartPaM ); - for (size_t nView = 0; nView < aEditViews.size(); ++nView) + for (EditView* pView : aEditViews) { - EditView* pView = aEditViews[nView]; pView->pImpEditView->SetEditSelection( aEmptySel ); } ResetUndoManager(); @@ -659,9 +658,8 @@ void ImpEditEngine::SetText(const OUString& rText) if (!rText.isEmpty()) aPaM = ImpInsertText( aEmptySel, rText ); - for (size_t nView = 0; nView < aEditViews.size(); ++nView) + for (EditView* pView : aEditViews) { - EditView* pView = aEditViews[nView]; pView->pImpEditView->SetEditSelection( EditSelection( aPaM, aPaM ) ); // If no text then also no Format&Update // => The text remains. @@ -1684,11 +1682,11 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara ) // i89825: Use CTL font for numbers embedded into an RTL run: WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; - for ( size_t n = 0; n < rDirInfos.size(); ++n ) + for (WritingDirectionInfo & rDirInfo : rDirInfos) { - const sal_Int32 nStart = rDirInfos[n].nStartPos; - const sal_Int32 nEnd = rDirInfos[n].nEndPos; - const sal_uInt8 nCurrDirType = rDirInfos[n].nType; + const sal_Int32 nStart = rDirInfo.nStartPos; + const sal_Int32 nEnd = rDirInfo.nEndPos; + const sal_uInt8 nCurrDirType = rDirInfo.nType; if ( nCurrDirType % 2 == UBIDI_RTL || // text in RTL run ( nCurrDirType > UBIDI_LTR && !lcl_HasStrongLTR( aText, nStart, nEnd ) ) ) // non-strong text in embedded LTR run @@ -1805,15 +1803,15 @@ SvtScriptType ImpEditEngine::GetItemScriptType( const EditSelection& rSel ) cons ++nE; } - for (size_t n = 0; n < rTypes.size(); ++n) + for (const ScriptTypePosInfo & rType : rTypes) { - bool bStartInRange = rTypes[n].nStartPos <= nS && nS < rTypes[n].nEndPos; - bool bEndInRange = rTypes[n].nStartPos < nE && nE <= rTypes[n].nEndPos; + bool bStartInRange = rType.nStartPos <= nS && nS < rType.nEndPos; + bool bEndInRange = rType.nStartPos < nE && nE <= rType.nEndPos; if (bStartInRange || bEndInRange) { - if ( rTypes[n].nScriptType != i18n::ScriptType::WEAK ) - nScriptType |= SvtLanguageOptions::FromI18NToSvtScriptType( rTypes[n].nScriptType ); + if ( rType.nScriptType != i18n::ScriptType::WEAK ) + nScriptType |= SvtLanguageOptions::FromI18NToSvtScriptType( rType.nScriptType ); } } } @@ -1833,9 +1831,9 @@ bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; const sal_Int32 nPos = rPaM.GetIndex(); - for ( size_t n = 0; n < rTypes.size(); n++ ) + for (const ScriptTypePosInfo & rType : rTypes) { - if ( rTypes[n].nStartPos == nPos ) + if ( rType.nStartPos == nPos ) { bScriptChange = true; break; @@ -1870,9 +1868,9 @@ void ImpEditEngine::InitWritingDirections( sal_Int32 nPara ) bool bCTL = false; ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( size_t n = 0; n < rTypes.size(); n++ ) + for (ScriptTypePosInfo & rType : rTypes) { - if ( rTypes[n].nScriptType == i18n::ScriptType::COMPLEX ) + if ( rType.nScriptType == i18n::ScriptType::COMPLEX ) { bCTL = true; break; @@ -1984,15 +1982,15 @@ sal_uInt8 ImpEditEngine::GetRightToLeft( sal_Int32 nPara, sal_Int32 nPos, sal_In InitWritingDirections( nPara ); WritingDirectionInfos& rDirInfos = pParaPortion->aWritingDirectionInfos; - for ( size_t n = 0; n < rDirInfos.size(); n++ ) + for (const WritingDirectionInfo & rDirInfo : rDirInfos) { - if ( ( rDirInfos[n].nStartPos <= nPos ) && ( rDirInfos[n].nEndPos >= nPos ) ) + if ( ( rDirInfo.nStartPos <= nPos ) && ( rDirInfo.nEndPos >= nPos ) ) { - nRightToLeft = rDirInfos[n].nType; + nRightToLeft = rDirInfo.nType; if ( pStart ) - *pStart = rDirInfos[n].nStartPos; + *pStart = rDirInfo.nStartPos; if ( pEnd ) - *pEnd = rDirInfos[n].nEndPos; + *pEnd = rDirInfo.nEndPos; break; } } @@ -2044,9 +2042,9 @@ void ImpEditEngine::ImpRemoveChars( const EditPaM& rPaM, sal_Int32 nChars ) const sal_Int32 nStart = rPaM.GetIndex(); const sal_Int32 nEnd = nStart + nChars; const CharAttribList::AttribsType& rAttribs = rPaM.GetNode()->GetCharAttribs().GetAttribs(); - for (size_t i = 0, n = rAttribs.size(); i < n; ++i) + for (const auto & rAttrib : rAttribs) { - const EditCharAttrib& rAttr = *rAttribs[i].get(); + const EditCharAttrib& rAttr = *rAttrib.get(); if (rAttr.GetEnd() >= nStart && rAttr.GetStart() < nEnd) { EditSelection aSel( rPaM ); @@ -2919,9 +2917,9 @@ bool ImpEditEngine::UpdateFields() ContentNode* pNode = GetEditDoc().GetObject( nPara ); OSL_ENSURE( pNode, "NULL-Pointer in Doc" ); CharAttribList::AttribsType& rAttribs = pNode->GetCharAttribs().GetAttribs(); - for (size_t nAttr = 0; nAttr < rAttribs.size(); ++nAttr) + for (std::unique_ptr<EditCharAttrib> & rAttrib : rAttribs) { - EditCharAttrib& rAttr = *rAttribs[nAttr].get(); + EditCharAttrib& rAttr = *rAttrib.get(); if (rAttr.Which() == EE_FEATURE_FIELD) { EditCharAttribField& rField = static_cast<EditCharAttribField&>(rAttr); @@ -3279,14 +3277,13 @@ void ImpEditEngine::UpdateSelections() { // Check whether one of the selections is at a deleted node... // If the node is valid, the index has yet to be examined! - for (size_t nView = 0; nView < aEditViews.size(); ++nView) + for (EditView* pView : aEditViews) { - EditView* pView = aEditViews[nView]; EditSelection aCurSel( pView->pImpEditView->GetEditSelection() ); bool bChanged = false; - for (size_t i = 0, n = aDeletedNodes.size(); i < n; ++i) + for (std::unique_ptr<DeletedNodeInfo> & aDeletedNode : aDeletedNodes) { - const DeletedNodeInfo& rInf = *aDeletedNodes[i].get(); + const DeletedNodeInfo& rInf = *aDeletedNode.get(); if ( ( aCurSel.Min().GetNode() == rInf.GetNode() ) || ( aCurSel.Max().GetNode() == rInf.GetNode() ) ) { diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index 41d84715c35d..aa131dbc6f16 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -276,9 +276,8 @@ void ImpEditEngine::UpdateViews( EditView* pCurView ) DBG_ASSERT( IsFormatted(), "UpdateViews: Doc not formatted!" ); - for (size_t nView = 0; nView < aEditViews.size(); ++nView) + for (EditView* pView : aEditViews) { - EditView* pView = aEditViews[nView]; pView->HideCursor(); Rectangle aClipRect( aInvalidRect ); @@ -319,9 +318,9 @@ IMPL_LINK_NOARG_TYPED(ImpEditEngine, IdleFormatHdl, Idle *, void) // else probably the idle format timer fired while we're already // downing EditView* pView = aIdleFormatter.GetView(); - for (size_t nView = 0; nView < aEditViews.size(); ++nView) + for (EditView* aEditView : aEditViews) { - if( aEditViews[nView] == pView ) + if( aEditView == pView ) { FormatAndUpdate( pView ); break; @@ -445,9 +444,8 @@ void ImpEditEngine::FormatDoc() CheckAutoPageSize(); else if ( nDiff ) { - for (size_t nView = 0; nView < aEditViews.size(); ++nView) + for (EditView* pView : aEditViews) { - EditView* pView = aEditViews[nView]; ImpEditView* pImpView = pView->pImpEditView; if ( pImpView->DoAutoHeight() ) { @@ -548,9 +546,8 @@ void ImpEditEngine::CheckAutoPageSize() aInvalidRect = Rectangle( Point(), aSz ); - for (size_t nView = 0; nView < aEditViews.size(); ++nView) + for (EditView* pView : aEditViews) { - EditView* pView = aEditViews[nView]; pView->pImpEditView->RecalcOutputArea(); } } @@ -2336,12 +2333,12 @@ void ImpEditEngine::CreateTextPortions( ParaPortion* pParaPortion, sal_Int32& rS InitScriptTypes( GetParaPortions().GetPos( pParaPortion ) ); const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos; - for ( size_t nT = 0; nT < rTypes.size(); nT++ ) - aPositions.insert( rTypes[nT].nStartPos ); + for (const ScriptTypePosInfo& rType : rTypes) + aPositions.insert( rType.nStartPos ); const WritingDirectionInfos& rWritingDirections = pParaPortion->aWritingDirectionInfos; - for ( size_t nD = 0; nD < rWritingDirections.size(); nD++ ) - aPositions.insert( rWritingDirections[nD].nStartPos ); + for (const WritingDirectionInfo & rWritingDirection : rWritingDirections) + aPositions.insert( rWritingDirection.nStartPos ); if ( mpIMEInfos && mpIMEInfos->nLen && mpIMEInfos->pAttribs && ( mpIMEInfos->aPos.GetNode() == pNode ) ) { @@ -4429,9 +4426,9 @@ void ImpEditEngine::ImplExpandCompressedPortions( EditLine* pLine, ParaPortion* nCompressPercent /= nCompressed; } - for (size_t i = 0, n = aCompressedPortions.size(); i < n; ++i) + for (TextPortion* pTP2 : aCompressedPortions) { - pTP = aCompressedPortions[i]; + pTP = pTP2; pTP->GetExtraInfos()->bCompressed = false; pTP->GetSize().Width() = pTP->GetExtraInfos()->nOrgWidth; if ( nCompressPercent ) diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 64960f1396cb..fb6e284c7dd4 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -2407,9 +2407,8 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC } else if ( bSimpleRepaint ) { - for (size_t nView = 0; nView < aEditViews.size(); ++nView) + for (EditView* pView : aEditViews) { - EditView* pView = aEditViews[nView]; Rectangle aClipRect( aInvalidRect ); aClipRect.Intersection( pView->GetVisArea() ); if ( !aClipRect.IsEmpty() ) @@ -2952,9 +2951,9 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection, if ( !pUndo && IsUndoEnabled() && !IsInUndo() ) { // adjust selection to include all changes - for (size_t i = 0; i < aChanges.size(); ++i) + for (eeTransliterationChgData & aChange : aChanges) { - const EditSelection &rSel = aChanges[i].aSelection; + const EditSelection &rSel = aChange.aSelection; if (aSel.Min().GetNode() == rSel.Min().GetNode() && aSel.Min().GetIndex() > rSel.Min().GetIndex()) aSel.Min().SetIndex( rSel.Min().GetIndex() ); diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx index bab347ee53e7..0d10336de6cd 100644 --- a/editeng/source/editeng/impedit5.cxx +++ b/editeng/source/editeng/impedit5.cxx @@ -424,9 +424,9 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int pNode->GetCharAttribs().OptimizeRanges(const_cast<SfxItemPool&>(rPool)); const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs(); - for (size_t nAttr = 0; nAttr < rAttrs.size(); ++nAttr) + for (const auto & nAttr : rAttrs) { - const EditCharAttrib& rAttr = *rAttrs[nAttr].get(); + const EditCharAttrib& rAttr = *nAttr.get(); if ( nStart == nEnd ) { @@ -538,9 +538,9 @@ void ImpEditEngine::SetAttribs( EditSelection aSel, const SfxItemSet& rSet, sal_ if ( nSpecial == ATTRSPECIAL_EDGE ) { CharAttribList::AttribsType& rAttribs = pNode->GetCharAttribs().GetAttribs(); - for (size_t i = 0, n = rAttribs.size(); i < n; ++i) + for (std::unique_ptr<EditCharAttrib> & rAttrib : rAttribs) { - EditCharAttrib& rAttr = *rAttribs[i].get(); + EditCharAttrib& rAttr = *rAttrib.get(); if (rAttr.GetStart() > nEndPos) break; @@ -726,9 +726,9 @@ void ImpEditEngine::GetCharAttribs( sal_Int32 nPara, std::vector<EECharAttrib>& { rLst.reserve(pNode->GetCharAttribs().Count()); const CharAttribList::AttribsType& rAttrs = pNode->GetCharAttribs().GetAttribs(); - for (size_t i = 0; i < rAttrs.size(); ++i) + for (const auto & i : rAttrs) { - const EditCharAttrib& rAttr = *rAttrs[i].get(); + const EditCharAttrib& rAttr = *i.get(); EECharAttrib aEEAttr; aEEAttr.pAttr = rAttr.GetItem(); aEEAttr.nPara = nPara; diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx index ee96b672e60f..62e4a42141df 100644 --- a/editeng/source/items/frmitems.cxx +++ b/editeng/source/items/frmitems.cxx @@ -2255,11 +2255,11 @@ SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const if( nIVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 ) { - for( sal_uInt16 i=0; i < 4; i++ ) + for(SvxBoxItemLine & i : aLineMap) { sal_uInt16 nDist; rStrm.ReadUInt16( nDist ); - pAttr->SetDistance( nDist, aLineMap[i] ); + pAttr->SetDistance( nDist, i ); } } else diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 44205833db53..41ef9f0d992d 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -716,8 +716,8 @@ void SvxNumRule::Store( SvStream &rStream ) SvxNumRule::~SvxNumRule() { - for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) - delete aFmts[i]; + for(SvxNumberFormat* aFmt : aFmts) + delete aFmt; if(!--nRefCount) { DELETEZ(pStdNumFmt); diff --git a/editeng/source/lookuptree/Trie.cxx b/editeng/source/lookuptree/Trie.cxx index 234a8f5e344f..8f2fddbd4bfd 100644 --- a/editeng/source/lookuptree/Trie.cxx +++ b/editeng/source/lookuptree/Trie.cxx @@ -41,9 +41,9 @@ TrieNode::TrieNode(sal_Unicode aCharacter) : mCharacter(aCharacter), mMarker(false) { - for (int i=0; i<LATIN_ARRAY_SIZE; i++) + for (TrieNode* & i : mLatinArray) { - mLatinArray[i] = nullptr; + i = nullptr; } } @@ -55,9 +55,9 @@ TrieNode::~TrieNode() delete *iNode; } - for (int i=0; i<LATIN_ARRAY_SIZE; i++) + for (TrieNode* i : mLatinArray) { - delete mLatinArray[i]; + delete i; } } @@ -102,9 +102,8 @@ TrieNode* TrieNode::findChild(sal_Unicode aInputCharacter) void TrieNode::collectSuggestions(const OUString& sPath, vector<OUString>& rSuggestionList) { // first traverse nodes for alphabet characters - for (int i=0; i<LATIN_ARRAY_SIZE; i++) + for (TrieNode* pCurrent : mLatinArray) { - TrieNode* pCurrent = mLatinArray[i]; if (pCurrent != nullptr) collectSuggestionsForCurrentNode(pCurrent, sPath, rSuggestionList); } diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index 641c59fc7d56..e3552f79bbc2 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2475,9 +2475,8 @@ bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWo if( bRet ) { - for ( size_t i=0; i < aDeleteEntries.size(); i++ ) + for (SvxAutocorrWord & aWordToDelete : aDeleteEntries) { - SvxAutocorrWord aWordToDelete = aDeleteEntries[i]; SvxAutocorrWord *pFoundEntry = pAutocorr_List->FindAndRemove( &aWordToDelete ); if( pFoundEntry ) { @@ -2499,9 +2498,9 @@ bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWo } } - for ( size_t i=0; i < aNewEntries.size(); i++ ) + for (SvxAutocorrWord & aNewEntrie : aNewEntries) { - SvxAutocorrWord *pWordToAdd = new SvxAutocorrWord( aNewEntries[i].GetShort(), aNewEntries[i].GetLong(), true ); + SvxAutocorrWord *pWordToAdd = new SvxAutocorrWord( aNewEntrie.GetShort(), aNewEntrie.GetLong(), true ); SvxAutocorrWord *pRemoved = pAutocorr_List->FindAndRemove( pWordToAdd ); if( pRemoved ) { diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx index 257316810b28..c39f8d610321 100644 --- a/editeng/source/outliner/outliner.cxx +++ b/editeng/source/outliner/outliner.cxx @@ -1072,9 +1072,8 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos, void Outliner::InvalidateBullet(sal_Int32 nPara) { long nLineHeight = (long)pEditEngine->GetLineHeight(nPara ); - for ( size_t i = 0, n = aViewList.size(); i < n; ++i ) + for (OutlinerView* pView : aViewList) { - OutlinerView* pView = aViewList[ i ]; Point aPos( pView->pEditView->GetWindowPosTopLeft(nPara ) ); Rectangle aRect( pView->GetOutputArea() ); aRect.Right() = aPos.X(); diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 2bfbbed02f5a..dc3f77477a42 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -54,9 +54,8 @@ SvxItemPropertySet::~SvxItemPropertySet() uno::Any* SvxItemPropertySet::GetUsrAnyForID(sal_uInt16 nWID) const { - for ( size_t i = 0, n = aCombineList.size(); i < n; ++i ) + for (SvxIDPropertyCombine* pActual : aCombineList) { - SvxIDPropertyCombine* pActual = aCombineList[ i ]; if( pActual->nWID == nWID ) return &pActual->aAny; } @@ -75,8 +74,8 @@ void SvxItemPropertySet::AddUsrAnyForID(const uno::Any& rAny, sal_uInt16 nWID) void SvxItemPropertySet::ClearAllUsrAny() { - for ( size_t i = 0, n = aCombineList.size(); i < n; ++i ) - delete aCombineList[ i ]; + for (SvxIDPropertyCombine* i : aCombineList) + delete i; aCombineList.clear(); } diff --git a/extensions/source/bibliography/bibconfig.cxx b/extensions/source/bibliography/bibconfig.cxx index e4639a0ee0f8..e5779e2249aa 100644 --- a/extensions/source/bibliography/bibconfig.cxx +++ b/extensions/source/bibliography/bibconfig.cxx @@ -294,9 +294,9 @@ void BibConfig::ImplCommit() const Mapping* BibConfig::GetMapping(const BibDBDescriptor& rDesc) const { - for(size_t i = 0; i < pMappingsArr->size(); i++) + for(std::unique_ptr<Mapping> & i : *pMappingsArr) { - Mapping& rMapping = *(*pMappingsArr)[i].get(); + Mapping& rMapping = *i.get(); bool bURLEqual = rDesc.sDataSource.equals(rMapping.sURL); if(rDesc.sTableOrQuery == rMapping.sTableName && bURLEqual) return &rMapping; diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index e0d0ac5568b0..ce394a16d289 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -422,11 +422,11 @@ static OUString lcl_AddProperty(const Reference< XNameAccess >& xColumns, OUString sColumnName(rColumnName); if(pMapping) { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) + for(const auto & aColumnPair : pMapping->aColumnPairs) { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == rColumnName) + if(aColumnPair.sLogicalColumnName == rColumnName) { - sColumnName = pMapping->aColumnPairs[nEntry].sRealColumnName; + sColumnName = aColumnPair.sRealColumnName; break; } } diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 418f6b2ffe9c..a11d6310c1bd 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -365,12 +365,12 @@ MappingDialog_Impl::MappingDialog_Impl(vcl::Window* pParent, BibDataManager* pMa const Mapping* pMapping = pConfig->GetMapping(aDesc); if(pMapping) { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) + for(const auto & aColumnPair : pMapping->aColumnPairs) { - sal_uInt16 nListBoxIndex = lcl_FindLogicalName( pConfig, pMapping->aColumnPairs[nEntry].sLogicalColumnName); + sal_uInt16 nListBoxIndex = lcl_FindLogicalName( pConfig, aColumnPair.sLogicalColumnName); if(nListBoxIndex < COLUMN_COUNT) { - aListBoxes[nListBoxIndex]->SelectEntry(pMapping->aColumnPairs[nEntry].sRealColumnName); + aListBoxes[nListBoxIndex]->SelectEntry(aColumnPair.sRealColumnName); } } } @@ -425,10 +425,10 @@ IMPL_LINK_TYPED(MappingDialog_Impl, ListBoxSelectHdl, ListBox&, rListBox, void) const sal_Int32 nEntryPos = rListBox.GetSelectEntryPos(); if(0 < nEntryPos) { - for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++) + for(VclPtr<ListBox> & aListBoxe : aListBoxes) { - if(&rListBox != aListBoxes[i] && aListBoxes[i]->GetSelectEntryPos() == nEntryPos) - aListBoxes[i]->SelectEntryPos(0); + if(&rListBox != aListBoxe && aListBoxe->GetSelectEntryPos() == nEntryPos) + aListBoxe->SelectEntryPos(0); } } SetModified(); @@ -1578,11 +1578,11 @@ const OUString& BibDataManager::GetIdentifierMapping() sIdentifierMapping = pConfig->GetDefColumnName(IDENTIFIER_POS); if(pMapping) { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) + for(const auto & aColumnPair : pMapping->aColumnPairs) { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sIdentifierMapping) + if(aColumnPair.sLogicalColumnName == sIdentifierMapping) { - sIdentifierMapping = pMapping->aColumnPairs[nEntry].sRealColumnName; + sIdentifierMapping = aColumnPair.sRealColumnName; break; } } diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index 440d59e17eb2..2e422250ea6d 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -57,11 +57,11 @@ static OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos BibConfig* pBibConfig = BibModul::GetConfig(); OUString sRet = pBibConfig->GetDefColumnName(nIndexPos); if(pMapping) - for(sal_uInt16 i = 0; i < COLUMN_COUNT; i++) + for(const auto & aColumnPair : pMapping->aColumnPairs) { - if(pMapping->aColumnPairs[i].sLogicalColumnName == sRet) + if(aColumnPair.sLogicalColumnName == sRet) { - sRet = pMapping->aColumnPairs[i].sRealColumnName; + sRet = aColumnPair.sRealColumnName; break; } } @@ -108,11 +108,11 @@ void BibPosListener::cursorMoved(const lang::EventObject& /*aEvent*/) throw( uno OUString sTypeMapping = pBibConfig->GetDefColumnName(AUTHORITYTYPE_POS); if(pMapping) { - for(sal_uInt16 nEntry = 0; nEntry < COLUMN_COUNT; nEntry++) + for(const auto & aColumnPair : pMapping->aColumnPairs) { - if(pMapping->aColumnPairs[nEntry].sLogicalColumnName == sTypeMapping) + if(aColumnPair.sLogicalColumnName == sTypeMapping) { - sTypeMapping = pMapping->aColumnPairs[nEntry].sRealColumnName; + sTypeMapping = aColumnPair.sRealColumnName; break; } } @@ -393,13 +393,13 @@ void BibGeneralPage::dispose() void BibGeneralPage::RemoveListeners() { - for(sal_uInt16 i = 0; i < FIELD_COUNT; i++) + for(uno::Reference<awt::XWindow> & aControl : aControls) { - if(aControls[i].is()) + if(aControl.is()) { - uno::Reference< awt::XWindow > xCtrWin(aControls[i], uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xCtrWin(aControl, uno::UNO_QUERY ); xCtrWin->removeFocusListener( mxBibGeneralPageFocusListener.get() ); - aControls[i] = nullptr; + aControl = nullptr; } } } diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx index 109c05b69816..521446ca7515 100644 --- a/extensions/source/bibliography/toolbar.cxx +++ b/extensions/source/bibliography/toolbar.cxx @@ -524,9 +524,8 @@ IMPL_LINK_NOARG_TYPED( BibToolBar, MenuHdl, ToolBox*, void) void BibToolBar::statusChanged(const frame::FeatureStateEvent& rEvent) throw( uno::RuntimeException ) { - for(size_t i = 0; i < aListenerArr.size(); i++) + for(uno::Reference<frame::XStatusListener> & rListener : aListenerArr) { - css::uno::Reference< css::frame::XStatusListener>& rListener = aListenerArr[i]; rListener->statusChanged(rEvent); } } diff --git a/extensions/source/logging/loggerconfig.cxx b/extensions/source/logging/loggerconfig.cxx index 19ef3e4d4d17..607a0d220766 100644 --- a/extensions/source/logging/loggerconfig.cxx +++ b/extensions/source/logging/loggerconfig.cxx @@ -141,9 +141,9 @@ namespace logging Variable( RTL_CONSTASCII_USTRINGPARAM( "$(pid)" ), aPID ) }; - for ( size_t i = 0; i < SAL_N_ELEMENTS( aVariables ); ++i ) + for (Variable & aVariable : aVariables) { - OUString sPattern( aVariables[i].pVariablePattern, aVariables[i].nPatternLength, aVariables[i].eEncoding ); + OUString sPattern( aVariable.pVariablePattern, aVariable.nPatternLength, aVariable.eEncoding ); sal_Int32 nVariableIndex = _inout_rFileURL.indexOf( sPattern ); if ( ( nVariableIndex == 0 ) || ( ( nVariableIndex > 0 ) @@ -152,7 +152,7 @@ namespace logging ) { // found an (unescaped) variable - _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, sPattern.getLength(), aVariables[i].sVariableValue ); + _inout_rFileURL = _inout_rFileURL.replaceAt( nVariableIndex, sPattern.getLength(), aVariable.sVariableValue ); } } } diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 35835048d077..fdfb3a53b01f 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -1705,12 +1705,12 @@ namespace pcr // propagate the changes to the min/max/default fields OUString aAffectedProps[] = { OUString(PROPERTY_VALUE), OUString(PROPERTY_DEFAULT_VALUE), OUString(PROPERTY_VALUEMIN), OUString(PROPERTY_VALUEMAX) }; - for (sal_uInt16 i=0; i<SAL_N_ELEMENTS(aAffectedProps); ++i) + for (OUString & aAffectedProp : aAffectedProps) { Reference< XPropertyControl > xControl; try { - xControl = _rxInspectorUI->getPropertyControl( aAffectedProps[i] ); + xControl = _rxInspectorUI->getPropertyControl( aAffectedProp ); } catch( const UnknownPropertyException& ) {} if ( xControl.is() ) @@ -1752,12 +1752,12 @@ namespace pcr OUString aFormattedPropertyControls[] = { OUString(PROPERTY_EFFECTIVE_MIN), OUString(PROPERTY_EFFECTIVE_MAX), OUString(PROPERTY_EFFECTIVE_DEFAULT), OUString(PROPERTY_EFFECTIVE_VALUE) }; - for ( sal_uInt16 i=0; i<SAL_N_ELEMENTS(aFormattedPropertyControls); ++i ) + for (OUString & aFormattedPropertyControl : aFormattedPropertyControls) { Reference< XPropertyControl > xControl; try { - xControl = _rxInspectorUI->getPropertyControl( aFormattedPropertyControls[i] ); + xControl = _rxInspectorUI->getPropertyControl( aFormattedPropertyControl ); } catch( const UnknownPropertyException& ) {} if ( xControl.is() ) diff --git a/extensions/source/propctrlr/formlinkdialog.cxx b/extensions/source/propctrlr/formlinkdialog.cxx index 73ea806defd8..326d9a6b75ce 100644 --- a/extensions/source/propctrlr/formlinkdialog.cxx +++ b/extensions/source/propctrlr/formlinkdialog.cxx @@ -229,11 +229,11 @@ namespace pcr m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() }; - for ( sal_Int32 i = 0; i < 4; ++i ) + for (const FieldLinkRow* aRow : aRows) { OUString sDetailField, sMasterField; - aRows[ i ]->GetFieldName( FieldLinkRow::eDetailField, sDetailField ); - aRows[ i ]->GetFieldName( FieldLinkRow::eMasterField, sMasterField ); + aRow->GetFieldName( FieldLinkRow::eDetailField, sDetailField ); + aRow->GetFieldName( FieldLinkRow::eMasterField, sMasterField ); if ( sDetailField.isEmpty() && sMasterField.isEmpty() ) continue; @@ -280,10 +280,10 @@ namespace pcr FieldLinkRow* aRows[] = { m_aRow1.get(), m_aRow2.get(), m_aRow3.get(), m_aRow4.get() }; - for ( sal_Int32 i = 0; i < 4 ; ++i ) + for (FieldLinkRow* aRow : aRows) { - aRows[i]->fillList( FieldLinkRow::eDetailField, sDetailFields ); - aRows[i]->fillList( FieldLinkRow::eMasterField, sMasterFields ); + aRow->fillList( FieldLinkRow::eDetailField, sDetailFields ); + aRow->fillList( FieldLinkRow::eMasterField, sMasterFields ); } } diff --git a/extensions/source/propctrlr/propcontroller.cxx b/extensions/source/propctrlr/propcontroller.cxx index 4fc9df5b3858..a9aa624770ad 100644 --- a/extensions/source/propctrlr/propcontroller.cxx +++ b/extensions/source/propctrlr/propcontroller.cxx @@ -1001,19 +1001,16 @@ namespace pcr // append these properties to our "all properties" array aProperties.reserve( aProperties.size() + aThisHandlersProperties.size() ); - for ( StlSyntaxSequence< Property >::const_iterator copyProperty = aThisHandlersProperties.begin(); - copyProperty != aThisHandlersProperties.end(); - ++copyProperty - ) + for (const auto & aThisHandlersPropertie : aThisHandlersProperties) { ::std::vector< Property >::const_iterator previous = ::std::find_if( aProperties.begin(), aProperties.end(), - FindPropertyByName( copyProperty->Name ) + FindPropertyByName( aThisHandlersPropertie.Name ) ); if ( previous == aProperties.end() ) { - aProperties.push_back( *copyProperty ); + aProperties.push_back( aThisHandlersPropertie ); continue; } @@ -1026,21 +1023,18 @@ namespace pcr // which means it can give it a completely different meaning than the previous // handler for this property is prepared for. ::std::pair< PropertyHandlerMultiRepository::iterator, PropertyHandlerMultiRepository::iterator > - aDepHandlers = m_aDependencyHandlers.equal_range( copyProperty->Name ); + aDepHandlers = m_aDependencyHandlers.equal_range( aThisHandlersPropertie.Name ); m_aDependencyHandlers.erase( aDepHandlers.first, aDepHandlers.second ); } // determine the superseded properties StlSyntaxSequence< OUString > aSupersededByThisHandler( (*aHandler)->getSupersededProperties() ); - for ( StlSyntaxSequence< OUString >::const_iterator superseded = aSupersededByThisHandler.begin(); - superseded != aSupersededByThisHandler.end(); - ++superseded - ) + for (const auto & superseded : aSupersededByThisHandler) { ::std::vector< Property >::iterator existent = ::std::find_if( aProperties.begin(), aProperties.end(), - FindPropertyByName( *superseded ) + FindPropertyByName( superseded ) ); if ( existent != aProperties.end() ) // one of the properties superseded by this handler was supported by a previous @@ -1053,25 +1047,19 @@ namespace pcr // remember this handler for every of the properties which it is responsible // for - for ( StlSyntaxSequence< Property >::const_iterator remember = aThisHandlersProperties.begin(); - remember != aThisHandlersProperties.end(); - ++remember - ) + for (const auto & aThisHandlersPropertie : aThisHandlersProperties) { - m_aPropertyHandlers[ remember->Name ] = *aHandler; + m_aPropertyHandlers[ aThisHandlersPropertie.Name ] = *aHandler; // note that this implies that if two handlers support the same property, // the latter wins } // see if the handler expresses interest in any actuating properties StlSyntaxSequence< OUString > aInterestingActuations( (*aHandler)->getActuatingProperties() ); - for ( StlSyntaxSequence< OUString >::const_iterator aLoop = aInterestingActuations.begin(); - aLoop != aInterestingActuations.end(); - ++aLoop - ) + for (const auto & aInterestingActuation : aInterestingActuations) { m_aDependencyHandlers.insert( PropertyHandlerMultiRepository::value_type( - *aLoop, *aHandler ) ); + aInterestingActuation, *aHandler ) ); } ++aHandler; diff --git a/extensions/source/propctrlr/propertycomposer.cxx b/extensions/source/propctrlr/propertycomposer.cxx index 7c1d6fe7e9b1..98f67468cb0c 100644 --- a/extensions/source/propctrlr/propertycomposer.cxx +++ b/extensions/source/propctrlr/propertycomposer.cxx @@ -397,12 +397,9 @@ namespace pcr { // TODO: make this cheaper (cache it?) const StlSyntaxSequence< OUString > aThisHandlersActuatingProps( (*loop)->getActuatingProperties() ); - for ( StlSyntaxSequence< OUString >::const_iterator loopProps = aThisHandlersActuatingProps.begin(); - loopProps != aThisHandlersActuatingProps.end(); - ++loopProps - ) + for (const auto & aThisHandlersActuatingProp : aThisHandlersActuatingProps) { - if ( *loopProps == _rActuatingPropertyName ) + if ( aThisHandlersActuatingProp == _rActuatingPropertyName ) { (*loop)->actuatingPropertyChanged( _rActuatingPropertyName, _rNewValue, _rOldValue, m_pUIRequestComposer->getUIForPropertyHandler( *loop ), diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx index 08dffad52f39..40234aec61dd 100644 --- a/extensions/source/scanner/grid.cxx +++ b/extensions/source/scanner/grid.cxx @@ -519,9 +519,9 @@ void GridWindow::drawNew(vcl::RenderContext& rRenderContext) void GridWindow::drawHandles(vcl::RenderContext& rRenderContext) { - for(size_t i(0L); i < m_aHandles.size(); i++) + for(impHandle & m_aHandle : m_aHandles) { - m_aHandles[i].draw(rRenderContext, m_aMarkerBitmap); + m_aHandle.draw(rRenderContext, m_aMarkerBitmap); } } diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx index bb21e1e595a4..eb3f6f5c6efc 100644 --- a/extensions/source/scanner/sanedlg.cxx +++ b/extensions/source/scanner/sanedlg.cxx @@ -1413,10 +1413,10 @@ void SaneDlg::SaveState() "br-x", "br-y" }; - for( size_t i = 0; i < SAL_N_ELEMENTS(pSaveOptions); ++i ) + for(const char * pSaveOption : pSaveOptions) { - OString aOption = pSaveOptions[i]; - int nOption = mrSane.GetOptionByName( pSaveOptions[i] ); + OString aOption = pSaveOption; + int nOption = mrSane.GetOptionByName( pSaveOption ); if( nOption > -1 ) { SANE_Value_Type nType = mrSane.GetOptionType( nOption ); diff --git a/extensions/source/update/check/updatecheckconfig.cxx b/extensions/source/update/check/updatecheckconfig.cxx index 4bec357302e0..35f5e60477e6 100644 --- a/extensions/source/update/check/updatecheckconfig.cxx +++ b/extensions/source/update/check/updatecheckconfig.cxx @@ -346,10 +346,10 @@ UpdateCheckConfig::clearLocalFileName() const sal_uInt8 nItems = 2; const OUString aNameList[nItems] = { OUString(LOCAL_FILE), OUString(DOWNLOAD_SIZE) }; - for( sal_uInt8 i=0; i < nItems; ++i ) + for(const auto & i : aNameList) { - if( m_xContainer->hasByName(aNameList[i]) ) - m_xContainer->removeByName(aNameList[i]); + if( m_xContainer->hasByName(i) ) + m_xContainer->removeByName(i); } commitChanges(); @@ -413,9 +413,9 @@ UpdateCheckConfig::clearUpdateFound() { OUString aName; - for( sal_uInt32 n=0; n < nUpdateEntryProperties; ++n ) + for(const char* aUpdateEntryPropertie : aUpdateEntryProperties) { - aName = OUString::createFromAscii(aUpdateEntryProperties[n]); + aName = OUString::createFromAscii(aUpdateEntryPropertie); try { if( m_xContainer->hasByName(aName) ) |