diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-06 10:14:38 +0200 |
---|---|---|
committer | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2016-05-07 12:24:31 +0000 |
commit | 9613b493172fe9aa8efd9c9c090f82ca2e89cf21 (patch) | |
tree | 3cc0d212aea1de270160e295a70c9f08f2e84334 /sc/source/ui | |
parent | 464348e82d8cbb0a6d3e5638da3f737f3e6f2d00 (diff) |
clang-tidy modernize-loop-convert in sc
Change-Id: I620028d69b11ea0469efd7b02ac7bbc7edab1066
Reviewed-on: https://gerrit.libreoffice.org/24690
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jochen Nitschke <j.nitschke+logerrit@ok.de>
Diffstat (limited to 'sc/source/ui')
26 files changed, 216 insertions, 222 deletions
diff --git a/sc/source/ui/dbgui/dpgroupdlg.cxx b/sc/source/ui/dbgui/dpgroupdlg.cxx index 214cf1612023..6ade3f464178 100644 --- a/sc/source/ui/dbgui/dpgroupdlg.cxx +++ b/sc/source/ui/dbgui/dpgroupdlg.cxx @@ -228,8 +228,8 @@ ScDPDateGroupDlg::ScDPDateGroupDlg( vcl::Window* pParent, maEndHelper ( mpRbAutoEnd, mpRbManEnd, mpEdEnd, rNullDate ) { static const size_t nCount = SAL_N_ELEMENTS( nDatePartResIds ); - for( size_t nIdx = 0 ; nIdx < nCount; ++nIdx ) - mpLbUnits->InsertEntry( ScGlobal::GetRscString( nDatePartResIds[nIdx] ) ); + for(sal_uInt16 nDatePartResId : nDatePartResIds) + mpLbUnits->InsertEntry( ScGlobal::GetRscString( nDatePartResId ) ); mpEdStart->SetShowDateCentury( true ); mpEdEnd->SetShowDateCentury( true ); diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx index 8440c71af158..cee52271c4d5 100644 --- a/sc/source/ui/docshell/datastream.cxx +++ b/sc/source/ui/docshell/datastream.cxx @@ -234,9 +234,8 @@ private: } // Read & store new lines from stream. - for (size_t i = 0, n = pLines->size(); i < n; ++i) + for (DataStream::Line & rLine : *pLines) { - DataStream::Line& rLine = (*pLines)[i]; rLine.maCells.clear(); mpStream->ReadLine(rLine.maLine); #if ENABLE_ORCUS diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index e7918c6efa01..398a761cf61b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -3432,10 +3432,10 @@ bool ScDocFunc::SetWidthOrHeight( bool bShow = nSizeTwips > 0 || eMode != SC_SIZE_DIRECT; bool bOutline = false; - for (size_t i = 0, n = rRanges.size(); i < n; ++i) + for (const sc::ColRowSpan& rRange : rRanges) { - SCCOLROW nStartNo = rRanges[i].mnStart; - SCCOLROW nEndNo = rRanges[i].mnEnd; + SCCOLROW nStartNo = rRange.mnStart; + SCCOLROW nEndNo = rRange.mnEnd; if ( !bWidth ) // Hoehen immer blockweise { diff --git a/sc/source/ui/docshell/documentlinkmgr.cxx b/sc/source/ui/docshell/documentlinkmgr.cxx index 3b17a662f271..02f00e9068df 100644 --- a/sc/source/ui/docshell/documentlinkmgr.cxx +++ b/sc/source/ui/docshell/documentlinkmgr.cxx @@ -98,9 +98,9 @@ bool DocumentLinkManager::idleCheckLinks() bool bAnyLeft = false; const sfx2::SvBaseLinks& rLinks = mpImpl->mpLinkManager->GetLinks(); - for (size_t i = 0, n = rLinks.size(); i < n; ++i) + for (const auto & rLink : rLinks) { - sfx2::SvBaseLink* pBase = rLinks[i].get(); + sfx2::SvBaseLink* pBase = rLink.get(); ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>(pBase); if (!pDdeLink || !pDdeLink->NeedsUpdate()) continue; @@ -119,9 +119,9 @@ bool DocumentLinkManager::hasDdeLinks() const return false; const sfx2::SvBaseLinks& rLinks = mpImpl->mpLinkManager->GetLinks(); - for (size_t i = 0, n = rLinks.size(); i < n; ++i) + for (const auto & rLink : rLinks) { - sfx2::SvBaseLink* pBase = rLinks[i].get(); + sfx2::SvBaseLink* pBase = rLink.get(); if (dynamic_cast<ScDdeLink*>(pBase)) return true; } @@ -140,9 +140,9 @@ bool DocumentLinkManager::updateDdeLinks( vcl::Window* pWin ) // If the update takes longer, reset all values so that nothing // old (wrong) is left behind bool bAny = false; - for (size_t i = 0, n = rLinks.size(); i < n; ++i) + for (const auto & rLink : rLinks) { - sfx2::SvBaseLink* pBase = rLinks[i].get(); + sfx2::SvBaseLink* pBase = rLink.get(); ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>(pBase); if (!pDdeLink) continue; @@ -183,9 +183,9 @@ void DocumentLinkManager::updateDdeLink( const OUString& rAppl, const OUString& sfx2::LinkManager* pMgr = mpImpl->mpLinkManager.get(); const sfx2::SvBaseLinks& rLinks = pMgr->GetLinks(); - for (size_t i = 0, n = rLinks.size(); i < n; ++i) + for (const auto & rLink : rLinks) { - ::sfx2::SvBaseLink* pBase = rLinks[i].get(); + ::sfx2::SvBaseLink* pBase = rLink.get(); ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>(pBase); if (!pDdeLink) continue; @@ -207,9 +207,9 @@ size_t DocumentLinkManager::getDdeLinkCount() const size_t nDdeCount = 0; const sfx2::SvBaseLinks& rLinks = mpImpl->mpLinkManager->GetLinks(); - for (size_t i = 0, n = rLinks.size(); i < n; ++i) + for (const auto & rLink : rLinks) { - ::sfx2::SvBaseLink* pBase = rLinks[i].get(); + ::sfx2::SvBaseLink* pBase = rLink.get(); ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>(pBase); if (!pDdeLink) continue; @@ -226,9 +226,9 @@ void DocumentLinkManager::disconnectDdeLinks() return; const sfx2::SvBaseLinks& rLinks = mpImpl->mpLinkManager->GetLinks(); - for (size_t i = 0, n = rLinks.size(); i < n; ++i) + for (const auto & rLink : rLinks) { - ::sfx2::SvBaseLink* pBase = rLinks[i].get(); + ::sfx2::SvBaseLink* pBase = rLink.get(); ScDdeLink* pDdeLink = dynamic_cast<ScDdeLink*>(pBase); if (pDdeLink) pDdeLink->Disconnect(); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index 87d51ee52721..471ff0086707 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -1312,9 +1312,8 @@ void ScExternalRefCache::clearCacheTables(sal_uInt16 nFileId) // Clear all cache table content, but keep the tables. std::vector<TableTypeRef>& rTabs = pDocItem->maTables; - for (size_t i = 0, n = rTabs.size(); i < n; ++i) + for (TableTypeRef & pTab : rTabs) { - TableTypeRef pTab = rTabs[i]; if (!pTab) continue; diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 596fc8ace56e..d8276e090c72 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -367,9 +367,9 @@ void ScOptSolverDlg::Init(const ScAddress& rCursorPos) uno::Reference<frame::XFrame> xFrame = GetBindings().GetActiveFrame(); Image aDelNm = ::GetImage( xFrame, aSlotURL, false ); - for ( sal_uInt16 nRow = 0; nRow < EDIT_ROW_COUNT; ++nRow ) + for (VclPtr<PushButton> & pButton : mpDelButton) { - mpDelButton[nRow]->SetModeImage( aDelNm ); + pButton->SetModeImage( aDelNm ); } m_pBtnOpt->SetClickHdl( LINK( this, ScOptSolverDlg, BtnHdl ) ); diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx index b0e26329b9f9..324eeeae7846 100644 --- a/sc/source/ui/pagedlg/areasdlg.cxx +++ b/sc/source/ui/pagedlg/areasdlg.cxx @@ -146,11 +146,11 @@ void ScPrintAreasDlg::dispose() // Extra-Data an ListBox-Entries abraeumen ListBox* aLb[3] = { pLbPrintArea, pLbRepeatRow, pLbRepeatCol }; - for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aLb); ++i) + for (ListBox* pBox : aLb) { - const sal_Int32 nCount = aLb[i]->GetEntryCount(); + const sal_Int32 nCount = pBox->GetEntryCount(); for ( sal_Int32 j=0; j<nCount; j++ ) - delete static_cast<OUString*>(aLb[i]->GetEntryData(j)); + delete static_cast<OUString*>(pBox->GetEntryData(j)); } pLbPrintArea.clear(); pEdPrintArea.clear(); diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx index 13f0f5312f32..10d0c185147a 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -257,9 +257,9 @@ void NumberFormatPropertyPanel::NotifyItemUpdate( OUString aCode = pItem->GetValue(); sal_Int32 nIndex = 0; sal_Int32 aFormat[4] = {0}; - for (size_t i=0; i<SAL_N_ELEMENTS(aFormat); ++i) + for (sal_Int32 & rn : aFormat) { - aFormat[i] = aCode.getToken(0, ',', nIndex).toInt32(); + rn = aCode.getToken(0, ',', nIndex).toInt32(); if (nIndex<0) break; } diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 2dbdb4da0ac0..41a5a83e6ca3 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -56,9 +56,9 @@ namespace HelperNotifyChanges { ScRangeList aChangeRanges; - for (size_t i = 0, n = rOldValues.size(); i < n; ++i) + for (const auto & rOldValue : rOldValues) { - aChangeRanges.Append( ScRange(rPos.Col(), rPos.Row(), rOldValues[i].mnTab)); + aChangeRanges.Append( ScRange(rPos.Col(), rPos.Row(), rOldValue.mnTab)); } Notify(*pModelObj, aChangeRanges, "cell-change"); @@ -199,8 +199,8 @@ OUString ScUndoEnterData::GetComment() const void ScUndoEnterData::DoChange() const { // only when needed (old or new Edit cell, or Attribute)? - for (size_t i = 0, n = maOldValues.size(); i < n; ++i) - pDocShell->AdjustRowHeight(maPos.Row(), maPos.Row(), maOldValues[i].mnTab); + for (const auto & i : maOldValues) + pDocShell->AdjustRowHeight(maPos.Row(), maPos.Row(), i.mnTab); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) @@ -219,13 +219,13 @@ void ScUndoEnterData::SetChangeTrack() { mnEndChangeAction = pChangeTrack->GetActionMax() + 1; ScAddress aPos(maPos); - for (size_t i = 0, n = maOldValues.size(); i < n; ++i) + for (Value & rOldValue : maOldValues) { - aPos.SetTab(maOldValues[i].mnTab); + aPos.SetTab(rOldValue.mnTab); sal_uLong nFormat = 0; - if (maOldValues[i].mbHasFormat) - nFormat = maOldValues[i].mnFormat; - pChangeTrack->AppendContent(aPos, maOldValues[i].maCell, nFormat); + if (rOldValue.mbHasFormat) + nFormat = rOldValue.mnFormat; + pChangeTrack->AppendContent(aPos, rOldValue.maCell, nFormat); } if ( mnEndChangeAction > pChangeTrack->GetActionMax() ) mnEndChangeAction = 0; // nothing is appended @@ -239,9 +239,8 @@ void ScUndoEnterData::Undo() BeginUndo(); ScDocument& rDoc = pDocShell->GetDocument(); - for (size_t i = 0, n = maOldValues.size(); i < n; ++i) + for (Value & rVal : maOldValues) { - Value& rVal = maOldValues[i]; ScCellValue aNewCell; aNewCell.assign(rVal.maCell, rDoc, SC_CLONECELL_STARTLISTENING); ScAddress aPos = maPos; @@ -276,9 +275,9 @@ void ScUndoEnterData::Redo() BeginRedo(); ScDocument& rDoc = pDocShell->GetDocument(); - for (size_t i = 0, n = maOldValues.size(); i < n; ++i) + for (Value & rOldValue : maOldValues) { - SCTAB nTab = maOldValues[i].mnTab; + SCTAB nTab = rOldValue.mnTab; if (mpNewEditData) { ScAddress aPos = maPos; diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 4a3c984a0499..1247ab21aa2c 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1611,8 +1611,8 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) lang::EventObject aEvent; aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - for ( size_t n=0; n<aValueListeners.size(); n++ ) - aValueListeners[n]->disposing( aEvent ); + for (uno::Reference<util::XModifyListener> & xValueListener : aValueListeners) + xValueListener->disposing( aEvent ); aValueListeners.clear(); @@ -1641,8 +1641,8 @@ void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) // the EventObject holds a Ref to this object until after the listener calls ScDocument& rDoc = pDocShell->GetDocument(); - for ( size_t n=0; n<aValueListeners.size(); n++ ) - rDoc.AddUnoListenerCall( aValueListeners[n], aEvent ); + for (uno::Reference<util::XModifyListener> & xValueListener : aValueListeners) + rDoc.AddUnoListenerCall( xValueListener, aEvent ); bGotDataChangedHint = false; } @@ -4525,12 +4525,12 @@ static bool lcl_FindRangeOrEntry( const ScNamedEntryArr_Impl& rNamedEntries, if ( !rNamedEntries.empty() ) { - for ( size_t n=0; n<rNamedEntries.size(); n++ ) - if ( rNamedEntries[n].GetName() == rName ) + for (const auto & rNamedEntry : rNamedEntries) + if ( rNamedEntry.GetName() == rName ) { // test if named entry is contained in rRanges - const ScRange& rComp = rNamedEntries[n].GetRange(); + const ScRange& rComp = rNamedEntry.GetRange(); ScMarkData aMarkData; aMarkData.MarkFromRangeList( rRanges, false ); aMarkData.MarkToMulti(); // needed for IsAllMarked diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 529fda20587b..afe109d3159f 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -2834,8 +2834,8 @@ void ScChart2DataSequence::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint if( m_pDocument ) { - for ( size_t n=0; n<m_aValueListeners.size(); n++ ) - m_pDocument->AddUnoListenerCall( m_aValueListeners[n], aEvent ); + for (uno::Reference<util::XModifyListener> & xListener: m_aValueListeners) + m_pDocument->AddUnoListenerCall( xListener, aEvent ); } m_bGotDataChangedHint = false; diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index 5fce4c2f2489..b598649c2278 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -767,11 +767,11 @@ void SAL_CALL ScConditionEntryObj::setPropertyValue( sal_Int32 nVal; if (aValue >>= nVal) { - for (size_t i = 0; i < SAL_N_ELEMENTS(aConditionEntryMap); ++i) + for (ConditionEntryApiMap & rEntry : aConditionEntryMap) { - if (aConditionEntryMap[i].nApiMode == nVal) + if (rEntry.nApiMode == nVal) { - getCoreObject()->SetOperation(aConditionEntryMap[i].eMode); + getCoreObject()->SetOperation(rEntry.eMode); break; } } @@ -817,11 +817,11 @@ uno::Any SAL_CALL ScConditionEntryObj::getPropertyValue( const OUString& aProper case Operator: { ScConditionMode eMode = getCoreObject()->GetOperation(); - for (size_t i = 0; i < SAL_N_ELEMENTS(aConditionEntryMap); ++i) + for (ConditionEntryApiMap & rEntry : aConditionEntryMap) { - if (aConditionEntryMap[i].eMode == eMode) + if (rEntry.eMode == eMode) { - aAny <<= aConditionEntryMap[i].nApiMode; + aAny <<= rEntry.nApiMode; break; } } @@ -907,11 +907,11 @@ void setColorScaleEntry(ScColorScaleEntry* pEntry, uno::Reference<sheet::XColorS ScColorScaleEntryType eType = ScColorScaleEntryType(); sal_Int32 nApiType = xEntry->getType(); bool bFound = false; - for (size_t i = 0; i < SAL_N_ELEMENTS(aColorScaleEntryTypeMap); ++i) + for (ColorScaleEntryTypeApiMap & rEntry : aColorScaleEntryTypeMap) { - if (aColorScaleEntryTypeMap[i].nApiType == nApiType) + if (rEntry.nApiType == nApiType) { - eType = aColorScaleEntryTypeMap[i].eType; + eType = rEntry.eType; bFound = true; break; } @@ -1078,11 +1078,11 @@ sal_Int32 ScColorScaleEntryObj::getType() throw(uno::RuntimeException, std::exception) { ScColorScaleEntry* pEntry = getCoreObject(); - for (size_t i = 0; i < SAL_N_ELEMENTS(aColorScaleEntryTypeMap); ++i) + for (ColorScaleEntryTypeApiMap & rEntry : aColorScaleEntryTypeMap) { - if (aColorScaleEntryTypeMap[i].eType == pEntry->GetType()) + if (rEntry.eType == pEntry->GetType()) { - return aColorScaleEntryTypeMap[i].nApiType; + return rEntry.nApiType; } } @@ -1093,11 +1093,11 @@ void ScColorScaleEntryObj::setType(sal_Int32 nType) throw(uno::RuntimeException, std::exception) { ScColorScaleEntry* pEntry = getCoreObject(); - for (size_t i = 0; i < SAL_N_ELEMENTS(aColorScaleEntryTypeMap); ++i) + for (ColorScaleEntryTypeApiMap & rEntry : aColorScaleEntryTypeMap) { - if (aColorScaleEntryTypeMap[i].nApiType == nType) + if (rEntry.nApiType == nType) { - pEntry->SetType(aColorScaleEntryTypeMap[i].eType); + pEntry->SetType(rEntry.eType); return; } } @@ -1180,11 +1180,11 @@ void setDataBarEntry(ScColorScaleEntry* pEntry, uno::Reference<sheet::XDataBarEn ScColorScaleEntryType eType = ScColorScaleEntryType(); sal_Int32 nApiType = xEntry->getType(); bool bFound = false; - for (size_t i = 0; i < SAL_N_ELEMENTS(aDataBarEntryTypeMap); ++i) + for (DataBarEntryTypeApiMap & rEntry : aDataBarEntryTypeMap) { - if (aDataBarEntryTypeMap[i].nApiType == nApiType) + if (rEntry.nApiType == nApiType) { - eType = aDataBarEntryTypeMap[i].eType; + eType = rEntry.eType; bFound = true; break; } @@ -1230,12 +1230,12 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue( sal_Int32 nVal; if (aValue >>= nVal) { - for (size_t i = 0; i < SAL_N_ELEMENTS(aDataBarAxisMap); ++i) + for (DataBarAxisApiMap & rEntry : aDataBarAxisMap) { - if (aDataBarAxisMap[i].nApiPos == nVal) + if (rEntry.nApiPos == nVal) { getCoreObject()->GetDataBarData()->meAxisPosition = - aDataBarAxisMap[i].ePos; + rEntry.ePos; break; } } @@ -1360,11 +1360,11 @@ uno::Any SAL_CALL ScDataBarFormatObj::getPropertyValue( const OUString& aPropert { databar::ScAxisPosition ePos = getCoreObject()->GetDataBarData()->meAxisPosition; sal_Int32 nApiPos = sheet::DataBarAxis::AXIS_NONE; - for (size_t i = 0; i < SAL_N_ELEMENTS(aDataBarAxisMap); ++i) + for (DataBarAxisApiMap & rEntry : aDataBarAxisMap) { - if (aDataBarAxisMap[i].ePos == ePos) + if (rEntry.ePos == ePos) { - nApiPos = aDataBarAxisMap[i].nApiPos; + nApiPos = rEntry.nApiPos; } } @@ -1478,11 +1478,11 @@ sal_Int32 ScDataBarEntryObj::getType() throw(uno::RuntimeException, std::exception) { ScColorScaleEntry* pEntry = getCoreObject(); - for (size_t i = 0; i < SAL_N_ELEMENTS(aDataBarEntryTypeMap); ++i) + for (DataBarEntryTypeApiMap & rEntry : aDataBarEntryTypeMap) { - if (aDataBarEntryTypeMap[i].eType == pEntry->GetType()) + if (rEntry.eType == pEntry->GetType()) { - return aDataBarEntryTypeMap[i].nApiType; + return rEntry.nApiType; } } @@ -1493,11 +1493,11 @@ void ScDataBarEntryObj::setType(sal_Int32 nType) throw(uno::RuntimeException, std::exception) { ScColorScaleEntry* pEntry = getCoreObject(); - for (size_t i = 0; i < SAL_N_ELEMENTS(aDataBarEntryTypeMap); ++i) + for (DataBarEntryTypeApiMap & rEntry : aDataBarEntryTypeMap) { - if (aDataBarEntryTypeMap[i].nApiType == nType) + if (rEntry.nApiType == nType) { - pEntry->SetType(aDataBarEntryTypeMap[i].eType); + pEntry->SetType(rEntry.eType); return; } } @@ -1581,11 +1581,11 @@ void setIconSetEntry(ScIconSetFormat* pFormat, uno::Reference<sheet::XIconSetEnt ScColorScaleEntryType eType = ScColorScaleEntryType(); sal_Int32 nApiType = xEntry->getType(); bool bFound = false; - for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetEntryTypeMap); ++i) + for (IconSetEntryTypeApiMap & rEntry : aIconSetEntryTypeMap) { - if (aIconSetEntryTypeMap[i].nApiType == nApiType) + if (rEntry.nApiType == nApiType) { - eType = aIconSetEntryTypeMap[i].eType; + eType = rEntry.eType; bFound = true; break; } @@ -1646,11 +1646,11 @@ void SAL_CALL ScIconSetFormatObj::setPropertyValue( aValue >>= nApiType; ScIconSetType eType = IconSet_3Arrows; bool bFound = false; - for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetApiMap); ++i) + for (const IconSetTypeApiMap & rEntry : aIconSetApiMap) { - if (aIconSetApiMap[i].nApiType == nApiType) + if (rEntry.nApiType == nApiType) { - eType = aIconSetApiMap[i].eType; + eType = rEntry.eType; bFound = true; break; } @@ -1711,11 +1711,11 @@ uno::Any SAL_CALL ScIconSetFormatObj::getPropertyValue( const OUString& aPropert case Icons: { ScIconSetType eType = getCoreObject()->GetIconSetData()->eIconSetType; - for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetApiMap); ++i) + for (const IconSetTypeApiMap & rEntry : aIconSetApiMap) { - if (aIconSetApiMap[i].eType == eType) + if (rEntry.eType == eType) { - aAny <<= aIconSetApiMap[i].nApiType; + aAny <<= rEntry.nApiType; break; } } @@ -1798,11 +1798,11 @@ sal_Int32 ScIconSetEntryObj::getType() if (mnPos == 0) return sheet::IconSetFormatEntry::ICONSET_MIN; - for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetEntryTypeMap); ++i) + for (IconSetEntryTypeApiMap & rEntry : aIconSetEntryTypeMap) { - if (aIconSetEntryTypeMap[i].eType == pEntry->GetType()) + if (rEntry.eType == pEntry->GetType()) { - return aIconSetEntryTypeMap[i].nApiType; + return rEntry.nApiType; } } @@ -1817,11 +1817,11 @@ void ScIconSetEntryObj::setType(sal_Int32 nType) return; ScColorScaleEntry* pEntry = getCoreObject(); - for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetEntryTypeMap); ++i) + for (IconSetEntryTypeApiMap & rEntry : aIconSetEntryTypeMap) { - if (aIconSetEntryTypeMap[i].nApiType == nType) + if (rEntry.nApiType == nType) { - pEntry->SetType(aIconSetEntryTypeMap[i].eType); + pEntry->SetType(rEntry.eType); return; } } @@ -1928,11 +1928,11 @@ void SAL_CALL ScCondDateFormatObj::setPropertyValue( if (!(aValue >>= nApiType)) throw lang::IllegalArgumentException(); - for (size_t i = 0; i < SAL_N_ELEMENTS(aDateTypeApiMap); ++i) + for (DateTypeApiMap & rEntry : aDateTypeApiMap) { - if (aDateTypeApiMap[i].nApiType == nApiType) + if (rEntry.nApiType == nApiType) { - getCoreObject()->SetDateType(aDateTypeApiMap[i].eType); + getCoreObject()->SetDateType(rEntry.eType); break; } } @@ -1967,11 +1967,11 @@ uno::Any SAL_CALL ScCondDateFormatObj::getPropertyValue( const OUString& aProper case DateType: { condformat::ScCondFormatDateType eType = getCoreObject()->GetDateType(); - for (size_t i = 0; i < SAL_N_ELEMENTS(aDateTypeApiMap); ++i) + for (DateTypeApiMap & rEntry : aDateTypeApiMap) { - if (aDateTypeApiMap[i].eType == eType) + if (rEntry.eType == eType) { - aAny <<= aDateTypeApiMap[i].nApiType; + aAny <<= rEntry.nApiType; break; } } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index f19bb887853e..646ddace83fb 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1369,8 +1369,8 @@ void ScDataPilotTableObj::Refreshed_Impl() // the EventObject holds a Ref to this object until after the listener calls ScDocument& rDoc = GetDocShell()->GetDocument(); - for ( size_t n=0; n<aModifyListeners.size(); n++ ) - rDoc.AddUnoListenerCall( aModifyListeners[n], aEvent ); + for (uno::Reference<util::XModifyListener> & xModifyListener : aModifyListeners) + rDoc.AddUnoListenerCall( xModifyListener, aEvent ); } ScDataPilotDescriptor::ScDataPilotDescriptor(ScDocShell* pDocSh) : diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index ed79338a329b..2772aa2cb536 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -557,8 +557,8 @@ void SAL_CALL ScSubTotalDescriptorBase::clear() throw(uno::RuntimeException, std ScSubTotalParam aParam; GetData(aParam); - for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++) - aParam.bGroupActive[i] = false; + for (bool & rn : aParam.bGroupActive) + rn = false; //! Notify oder so fuer die Field-Objekte??? @@ -1953,8 +1953,8 @@ void ScDatabaseRangeObj::Refreshed_Impl() { lang::EventObject aEvent; aEvent.Source = static_cast<cppu::OWeakObject*>(this); - for ( size_t n=0; n<aRefreshListeners.size(); n++ ) - aRefreshListeners[n]->refreshed( aEvent ); + for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners) + xRefreshListener->refreshed( aEvent ); } // XCellRangeSource diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx index 278507820d10..a28503943575 100644 --- a/sc/source/ui/unoobj/dispuno.cxx +++ b/sc/source/ui/unoobj/dispuno.cxx @@ -358,8 +358,8 @@ void SAL_CALL ScDispatch::selectionChanged( const css::lang::EventObject& /* aEv lcl_FillDataSource( aEvent, aNewImport ); // modifies State, IsEnabled - for ( size_t n=0; n<aDataSourceListeners.size(); n++ ) - aDataSourceListeners[n]->statusChanged( aEvent ); + for (uno::Reference<frame::XStatusListener> & xDataSourceListener : aDataSourceListeners) + xDataSourceListener->statusChanged( aEvent ); aLastImport = aNewImport; } @@ -377,8 +377,8 @@ void SAL_CALL ScDispatch::disposing( const css::lang::EventObject& rSource ) lang::EventObject aEvent; aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - for ( size_t n=0; n<aDataSourceListeners.size(); n++ ) - aDataSourceListeners[n]->disposing( aEvent ); + for (uno::Reference<frame::XStatusListener> & xDataSourceListener : aDataSourceListeners) + xDataSourceListener->disposing( aEvent ); pViewShell = nullptr; } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index bf5292ccc523..fbe2a19052bd 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -328,10 +328,10 @@ void ScPrintUIOptions::SetDefaults() sal_Int32 nContent = rPrintOpt.GetAllSheets() ? 0 : 1; bool bSuppress = rPrintOpt.GetSkipEmpty(); - for (size_t nUIPos=0; nUIPos<m_aUIProperties.size(); ++nUIPos) + for (beans::PropertyValue & rPropValue : m_aUIProperties) { uno::Sequence<beans::PropertyValue> aUIProp; - if ( m_aUIProperties[nUIPos].Value >>= aUIProp ) + if ( rPropValue.Value >>= aUIProp ) { for (sal_Int32 nPropPos=0; nPropPos<aUIProp.getLength(); ++nPropPos) { @@ -354,7 +354,7 @@ void ScPrintUIOptions::SetDefaults() } } } - m_aUIProperties[nUIPos].Value <<= aUIProp; + rPropValue.Value <<= aUIProp; } } } diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index abe81aa75f36..85e19f468784 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -185,8 +185,8 @@ void ScSheetLinkObj::Refreshed_Impl() { lang::EventObject aEvent; aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - for ( size_t n=0; n<aRefreshListeners.size(); n++ ) - aRefreshListeners[n]->refreshed( aEvent ); + for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners) + xRefreshListener->refreshed( aEvent ); } void ScSheetLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefresh ) @@ -728,8 +728,8 @@ void ScAreaLinkObj::Refreshed_Impl() { lang::EventObject aEvent; aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - for ( size_t n=0; n<aRefreshListeners.size(); n++ ) - aRefreshListeners[n]->refreshed( aEvent ); + for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners) + xRefreshListener->refreshed( aEvent ); } // XPropertySet @@ -1219,8 +1219,8 @@ void ScDDELinkObj::Refreshed_Impl() { lang::EventObject aEvent; aEvent.Source.set(static_cast<cppu::OWeakObject*>(this)); - for ( size_t n=0; n<aRefreshListeners.size(); n++ ) - aRefreshListeners[n]->refreshed( aEvent ); + for (uno::Reference<util::XRefreshListener> & xRefreshListener : aRefreshListeners) + xRefreshListener->refreshed( aEvent ); } ScDDELinksObj::ScDDELinksObj(ScDocShell* pDocSh) : diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 6d9a1db57f9c..0d242d73df34 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -366,21 +366,21 @@ ScServiceProvider::Type ScServiceProvider::GetProviderType(const OUString& rServ { if (!rServiceName.isEmpty()) { - for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aProvNamesId); i++) + for (const ProvNamesId_Type & i : aProvNamesId) { - if (rServiceName.equalsAscii( aProvNamesId[i].pName )) + if (rServiceName.equalsAscii( i.pName )) { - return aProvNamesId[i].nType; + return i.nType; } } - for (sal_uInt16 i=0; i < SAL_N_ELEMENTS(aOldNames); i++) + for (const ProvNamesId_Type & rOldName : aOldNames) { - OSL_ENSURE( aOldNames[i].pName, "ScServiceProvider::GetProviderType: no oldname => crash"); - if (rServiceName.equalsAscii( aOldNames[i].pName )) + OSL_ENSURE( rOldName.pName, "ScServiceProvider::GetProviderType: no oldname => crash"); + if (rServiceName.equalsAscii( rOldName.pName )) { OSL_FAIL("old service name used"); - return aOldNames[i].nType; + return rOldName.nType; } } } diff --git a/sc/source/ui/unoobj/targuno.cxx b/sc/source/ui/unoobj/targuno.cxx index 8512c8603e8b..5d714f688521 100644 --- a/sc/source/ui/unoobj/targuno.cxx +++ b/sc/source/ui/unoobj/targuno.cxx @@ -114,8 +114,8 @@ uno::Sequence<OUString> SAL_CALL ScLinkTargetTypesObj::getElementNames() throw( sal_Bool SAL_CALL ScLinkTargetTypesObj::hasByName(const OUString& aName) throw( uno::RuntimeException, std::exception ) { - for (sal_uInt16 i=0; i<SC_LINKTARGETTYPE_COUNT; i++) - if ( aNames[i] == aName ) + for (const auto & i : aNames) + if ( i == aName ) return true; return false; } diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index e781d5acd462..0abbfa970629 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -6023,10 +6023,9 @@ void ScGridWindow::UpdateCursorOverlay() std::vector< basegfx::B2DRange > aRanges; const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); - for(size_t a(0); a < aPixelRects.size(); a++) + for(const Rectangle & rRA : aPixelRects) { - const Rectangle aRA(aPixelRects[a]); - basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1); + basegfx::B2DRange aRB(rRA.Left(), rRA.Top(), rRA.Right() + 1, rRA.Bottom() + 1); aRB.transform(aTransform); aRanges.push_back(aRB); } @@ -6087,18 +6086,17 @@ void ScGridWindow::UpdateSelectionOverlay() SCTAB nTab = pViewData->GetTabNo(); bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); - for(size_t a(0); a < aPixelRects.size(); a++) + for(const Rectangle & rRA : aPixelRects) { - const Rectangle aRA(aPixelRects[a]); if (bLayoutRTL) { - basegfx::B2DRange aRB(aRA.Left(), aRA.Top() - 1, aRA.Right() + 1, aRA.Bottom()); + basegfx::B2DRange aRB(rRA.Left(), rRA.Top() - 1, rRA.Right() + 1, rRA.Bottom()); aRB.transform(aTransform); aRanges.push_back(aRB); } else { - basegfx::B2DRange aRB(aRA.Left() - 1, aRA.Top() - 1, aRA.Right(), aRA.Bottom()); + basegfx::B2DRange aRB(rRA.Left() - 1, rRA.Top() - 1, rRA.Right(), rRA.Bottom()); aRB.transform(aTransform); aRanges.push_back(aRB); } @@ -6324,10 +6322,9 @@ void ScGridWindow::UpdateDragRectOverlay() std::vector< basegfx::B2DRange > aRanges; const basegfx::B2DHomMatrix aTransform(GetInverseViewTransformation()); - for(size_t a(0); a < aPixelRects.size(); a++) + for(const Rectangle & rRA : aPixelRects) { - const Rectangle aRA(aPixelRects[a]); - basegfx::B2DRange aRB(aRA.Left(), aRA.Top(), aRA.Right() + 1, aRA.Bottom() + 1); + basegfx::B2DRange aRB(rRA.Left(), rRA.Top(), rRA.Right() + 1, rRA.Bottom() + 1); aRB.transform(aTransform); aRanges.push_back(aRB); } diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 9cd85e6028be..e4671f6da2ed 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -908,9 +908,9 @@ ScGridWindow* ScTabView::GetActiveWin() void ScTabView::SetActivePointer( const Pointer& rPointer ) { - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i]) - pGridWin[i]->SetPointer( rPointer ); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin) + pWin->SetPointer( rPointer ); } void ScTabView::ActiveGrabFocus() @@ -1516,12 +1516,12 @@ void ScTabView::UpdateShow() bool ScTabView::UpdateVisibleRange() { bool bChanged = false; - for (int i = 0; i < 4; ++i) + for (VclPtr<ScGridWindow> & pWin : pGridWin) { - if (!pGridWin[i] || !pGridWin[i]->IsVisible()) + if (!pWin || !pWin->IsVisible()) continue; - if (pGridWin[i]->UpdateVisibleRange()) + if (pWin->UpdateVisibleRange()) bChanged = true; } @@ -1602,9 +1602,9 @@ void ScTabView::DoHSplit(long nSplitPos) // Form Layer needs to know the visible part of all windows // that is why MapMode must already be correct here - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i]) - pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() ); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin) + pWin->SetMapMode( pWin->GetDrawMapMode() ); SetNewVisArea(); PaintGrid(); @@ -1674,9 +1674,9 @@ void ScTabView::DoVSplit(long nSplitPos) // Form Layer needs to know the visible part of all windows // that is why MapMode must already be correct here - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i]) - pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() ); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin) + pWin->SetMapMode( pWin->GetDrawMapMode() ); SetNewVisArea(); PaintGrid(); @@ -2058,9 +2058,9 @@ void ScTabView::FreezeSplitters( bool bFreeze, SplitMethod eSplitMetod) // Form Layer needs to know the visible part of all windows // that is why MapMode must already be correct here - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i]) - pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() ); + for (VclPtr<ScGridWindow> & p : pGridWin) + if (p) + p->SetMapMode( p->GetDrawMapMode() ); SetNewVisArea(); RepeatResize(false); @@ -2258,12 +2258,12 @@ void ScTabView::EnableRefInput(bool bFlag) bool ScTabView::ContinueOnlineSpelling() { bool bChanged = false; - for (int i = 0; i < 4; ++i) + for (VclPtr<ScGridWindow> & pWin : pGridWin) { - if (!pGridWin[i] || !pGridWin[i]->IsVisible()) + if (!pWin || !pWin->IsVisible()) continue; - if (pGridWin[i]->ContinueOnlineSpelling()) + if (pWin->ContinueOnlineSpelling()) bChanged = true; } @@ -2272,34 +2272,34 @@ bool ScTabView::ContinueOnlineSpelling() void ScTabView::EnableAutoSpell( bool bEnable ) { - for (int i = 0; i < 4; ++i) + for (VclPtr<ScGridWindow> & pWin : pGridWin) { - if (!pGridWin[i]) + if (!pWin) continue; - pGridWin[i]->EnableAutoSpell(bEnable); + pWin->EnableAutoSpell(bEnable); } } void ScTabView::ResetAutoSpell() { - for (int i = 0; i < 4; ++i) + for (VclPtr<ScGridWindow> & pWin : pGridWin) { - if (!pGridWin[i]) + if (!pWin) continue; - pGridWin[i]->ResetAutoSpell(); + pWin->ResetAutoSpell(); } } void ScTabView::SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges ) { - for (int i = 0; i < 4; ++i) + for (VclPtr<ScGridWindow> & pWin: pGridWin) { - if (!pGridWin[i]) + if (!pWin) continue; - pGridWin[i]->SetAutoSpellData(nPosX, nPosY, pRanges); + pWin->SetAutoSpellData(nPosX, nPosY, pRanges); } } diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index 556390daecb7..3468d086d8dd 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -977,30 +977,30 @@ void ScTabView::ExpandBlockArea(SCsCOL nMovX, SCsROW nMovY) void ScTabView::UpdateCopySourceOverlay() { - for (sal_uInt8 i = 0; i < 4; ++i) - if (pGridWin[i] && pGridWin[i]->IsVisible()) - pGridWin[i]->UpdateCopySourceOverlay(); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin && pWin->IsVisible()) + pWin->UpdateCopySourceOverlay(); } void ScTabView::UpdateSelectionOverlay() { - for (sal_uInt16 i=0; i<4; i++) - if ( pGridWin[i] && pGridWin[i]->IsVisible() ) - pGridWin[i]->UpdateSelectionOverlay(); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if ( pWin && pWin->IsVisible() ) + pWin->UpdateSelectionOverlay(); } void ScTabView::UpdateShrinkOverlay() { - for (sal_uInt16 i=0; i<4; i++) - if ( pGridWin[i] && pGridWin[i]->IsVisible() ) - pGridWin[i]->UpdateShrinkOverlay(); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if ( pWin && pWin->IsVisible() ) + pWin->UpdateShrinkOverlay(); } void ScTabView::UpdateAllOverlays() { - for (sal_uInt16 i=0; i<4; i++) - if ( pGridWin[i] && pGridWin[i]->IsVisible() ) - pGridWin[i]->UpdateAllOverlays(); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if ( pWin && pWin->IsVisible() ) + pWin->UpdateAllOverlays(); } //! @@ -1384,9 +1384,9 @@ void ScTabView::StopMarking() void ScTabView::HideNoteMarker() { - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i] && pGridWin[i]->IsVisible()) - pGridWin[i]->HideNoteMarker(); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin && pWin->IsVisible()) + pWin->HideNoteMarker(); } void ScTabView::MakeDrawLayer() @@ -1398,11 +1398,11 @@ void ScTabView::MakeDrawLayer() // pDrawView is set per Notify OSL_ENSURE(pDrawView,"ScTabView::MakeDrawLayer does not work"); - for(sal_uInt16 a(0); a < 4; a++) + for(VclPtr<ScGridWindow> & pWin : pGridWin) { - if(pGridWin[a]) + if(pWin) { - pGridWin[a]->DrawLayerCreated(); + pWin->DrawLayerCreated(); } } } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index d5b151eca60a..acd14b23751a 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -152,27 +152,27 @@ void ScTabView::FakeButtonUp( ScSplitPos eWhich ) void ScTabView::HideAllCursors() { - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i]) - if (pGridWin[i]->IsVisible()) + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin) + if (pWin->IsVisible()) { - vcl::Cursor* pCur = pGridWin[i]->GetCursor(); + vcl::Cursor* pCur = pWin->GetCursor(); if (pCur) if (pCur->IsVisible()) pCur->Hide(); - pGridWin[i]->HideCursor(); + pWin->HideCursor(); } } void ScTabView::ShowAllCursors() { - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i]) - if (pGridWin[i]->IsVisible()) + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin) + if (pWin->IsVisible()) { - pGridWin[i]->ShowCursor(); + pWin->ShowCursor(); - pGridWin[i]->CursorChanged(); + pWin->CursorChanged(); } } @@ -652,9 +652,9 @@ void ScTabView::TestHintWindow() else mpInputHintWindow.disposeAndClear(); - for ( sal_uInt16 i=0; i<4; i++ ) - if ( pGridWin[i] && pGridWin[i]->IsVisible() ) - pGridWin[i]->UpdateListValPos( bListValButton, aListValPos ); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if ( pWin && pWin->IsVisible() ) + pWin->UpdateListValPos( bListValButton, aListValPos ); } bool ScTabView::HasHintWindow() const @@ -1710,9 +1710,9 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa if ( bRefMode ) // hide EditView if necessary (after aViewData.SetTabNo !) { - for (sal_uInt16 i = 0; i < 4; ++i) - if (pGridWin[i] && pGridWin[i]->IsVisible()) - pGridWin[i]->UpdateEditViewPos(); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin && pWin->IsVisible()) + pWin->UpdateEditViewPos(); } TabChanged(bSameTabButMoved); // DrawView @@ -1774,9 +1774,9 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa // Form Layer must know the visible area of the new sheet // that is why MapMode must already be correct here - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i]) - pGridWin[i]->SetMapMode( pGridWin[i]->GetDrawMapMode() ); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin) + pWin->SetMapMode( pWin->GetDrawMapMode() ); SetNewVisArea(); PaintGrid(); @@ -2584,9 +2584,9 @@ void ScTabView::ActivatePart( ScSplitPos eWhich ) void ScTabView::HideListBox() { - for (sal_uInt16 i=0; i<4; i++) - if (pGridWin[i]) - pGridWin[i]->ClickExtern(); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin) + pWin->ClickExtern(); } void ScTabView::UpdateInputContext() @@ -2686,8 +2686,8 @@ void ScTabView::CheckNeedsRepaint() bool ScTabView::NeedsRepaint() { - for (size_t i = 0; i < 4; i++) - if (pGridWin[i] && pGridWin[i]->IsVisible() && pGridWin[i]->NeedsRepaint()) + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if (pWin && pWin->IsVisible() && pWin->NeedsRepaint()) return true; return false; } diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 76b8562b883a..6e5e3bf27caa 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -504,9 +504,9 @@ void ScTabView::UpdateDrawTextOutliner() void ScTabView::DigitLanguageChanged() { LanguageType eNewLang = SC_MOD()->GetOptDigitLanguage(); - for (sal_uInt16 i=0; i<4; i++) - if ( pGridWin[i] ) - pGridWin[i]->SetDigitLanguage( eNewLang ); + for (VclPtr<ScGridWindow> & pWin : pGridWin) + if ( pWin ) + pWin->SetDigitLanguage( eNewLang ); } void ScTabView::ScrollToObject( SdrObject* pDrawObj ) diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index ed2414a2c516..13bfe1042fde 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2656,9 +2656,9 @@ void ScViewFunc::MoveTable( if ( nErrVal > 0 ) { nDestTab1 = nDestTab; - for(size_t i=0; i<TheTabs.size();++i) + for(SCTAB nTab : TheTabs) { - nErrVal = pDestShell->TransferTab( *pDocShell, TheTabs[i], static_cast<SCTAB>(nDestTab1), false, false ); + nErrVal = pDestShell->TransferTab( *pDocShell, nTab, static_cast<SCTAB>(nDestTab1), false, false ); nDestTab1++; } } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index ead991170192..b0ae4d0039bf 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1646,10 +1646,10 @@ void ScViewFunc::DeleteMulti( bool bRows ) pUndoDoc = new ScDocument( SCDOCMODE_UNDO ); pUndoDoc->InitUndo( &rDoc, nTab, nTab, !bRows, bRows ); // row height - for (size_t i = 0, n = aSpans.size(); i < n; ++i) + for (sc::ColRowSpan & rSpan : aSpans) { - SCCOLROW nStart = aSpans[i].mnStart; - SCCOLROW nEnd = aSpans[i].mnEnd; + SCCOLROW nStart = rSpan.mnStart; + SCCOLROW nEnd = rSpan.mnEnd; if (bRows) rDoc.CopyToDocument( 0,nStart,nTab, MAXCOL,nEnd,nTab, InsertDeleteFlags::ALL,false,pUndoDoc ); else @@ -1928,10 +1928,10 @@ void ScViewFunc::SetWidthOrHeight( { nTab = *itr; - for (size_t i = 0, n = rRanges.size(); i < n; ++i) + for (const sc::ColRowSpan & rRange : rRanges) { - SCCOLROW nStartNo = rRanges[i].mnStart; - SCCOLROW nEndNo = rRanges[i].mnEnd; + SCCOLROW nStartNo = rRange.mnStart; + SCCOLROW nEndNo = rRange.mnEnd; if ( !bWidth ) // height always blockwise { @@ -2090,10 +2090,10 @@ void ScViewFunc::SetWidthOrHeight( for (; itr != itrEnd; ++itr) { nTab = *itr; - for (size_t i = 0, n = rRanges.size(); i < n; ++i) + for (const sc::ColRowSpan & rRange : rRanges) { - SCCOL nStartCol = rRanges[i].mnStart; - SCCOL nEndCol = rRanges[i].mnEnd; + SCCOL nStartCol = rRange.mnStart; + SCCOL nEndCol = rRange.mnEnd; for ( SCCOL nCol = nStartCol; nCol <= nEndCol; ++nCol ) { aChangeRanges.Append( ScRange( nCol, 0, nTab ) ); |