tdf#145538 Use range-based for loops in sc column

Replace index-based loops with C++ range-based for loops
to improve readability and reduce indexing errors.

Change-Id: I6a1f102df3fe321f0de2d649efdbec327d27a879
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203829
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
This commit is contained in:
Yoon6
2026-05-01 11:54:30 +02:00
committed by Ilmari Lauhakangas
parent d21d87868d
commit 563c496dd4
+4 -5
View File
@@ -202,16 +202,15 @@ bool ScColumn::HasSelectionMatrixFragment(const ScMarkData& rMark, const ScRange
ScAddress aCurOrigin = aOrigin;
bool bOpen = false;
for (size_t i = 0, n = rRangeList.size(); i < n; ++i)
for (const ScRange &rRange : rRangeList)
{
const ScRange& r = rRangeList[i];
if (nTab < r.aStart.Tab() || r.aEnd.Tab() < nTab)
if (nTab < rRange.aStart.Tab() || rRange.aEnd.Tab() < nTab)
continue;
if (nCol < r.aStart.Col() || r.aEnd.Col() < nCol)
if (nCol < rRange.aStart.Col() || rRange.aEnd.Col() < nCol)
continue;
SCROW nTop = r.aStart.Row(), nBottom = r.aEnd.Row();
SCROW nTop = rRange.aStart.Row(), nBottom = rRange.aEnd.Row();
SCROW nRow = nTop;
std::pair<sc::CellStoreType::const_iterator,size_t> aPos = maCells.position(nRow);
sc::CellStoreType::const_iterator it = aPos.first;