diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-08-30 08:51:50 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2017-08-31 18:29:42 +0200 |
commit | 1cdaec1931e0012506726c773373e46fa6ef81c0 (patch) | |
tree | 864587764cd3d3c5f6e06e4f0c9c6273c610363a /sc/source | |
parent | 0aad6244eb1a894fc399769b7dc52e23888b6982 (diff) |
make the ScColumnsRange iterator return SCCOL
since we don't want to expose internal details like the ScColumn to most
of the code, make the ScColumnsRange iterators return SCCOL instead of
ScColumn*
Change-Id: I67a58df90959170105255d18e7dd38ef0d6e3c11
Reviewed-on: https://gerrit.libreoffice.org/41719
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/document.cxx | 9 | ||||
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 12 | ||||
-rw-r--r-- | sc/source/core/data/table1.cxx | 11 | ||||
-rw-r--r-- | sc/source/core/data/table2.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/table3.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/data/table5.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/view/tabview.cxx | 3 |
7 files changed, 25 insertions, 25 deletions
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 6bb050d6dcf0..94a91edd96e7 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2523,7 +2523,8 @@ ScColumnsRange ScDocument::GetColumnsRange( SCTAB nTab, SCCOL nColBegin, SCCOL n if (!TableExists(nTab)) { std::vector<ScColumn*> aEmptyVector; - return ScColumnsRange(aEmptyVector.begin(), aEmptyVector.end()); + return ScColumnsRange(ScColumnsRange::Iterator(aEmptyVector.begin()), + ScColumnsRange::Iterator(aEmptyVector.end())); } return maTabs[nTab]->GetColumnsRange(nColBegin, nColEnd); @@ -6591,9 +6592,8 @@ ScAddress ScDocument::GetNotePosition( size_t nIndex ) const { for (size_t nTab = 0; nTab < maTabs.size(); ++nTab) { - for (const ScColumn* pCol : GetColumnsRange(nTab, 0, MAXCOL)) + for (SCCOL nCol : GetColumnsRange(nTab, 0, MAXCOL)) { - SCCOL nCol = pCol->GetCol(); size_t nColNoteCount = GetNoteCount(nTab, nCol); if (!nColNoteCount) continue; @@ -6619,9 +6619,8 @@ ScAddress ScDocument::GetNotePosition( size_t nIndex ) const ScAddress ScDocument::GetNotePosition( size_t nIndex, SCTAB nTab ) const { - for (const ScColumn * pCol : GetColumnsRange(nTab, 0, MAXCOL)) + for (SCCOL nCol : GetColumnsRange(nTab, 0, MAXCOL)) { - SCCOL nCol = pCol->GetCol(); size_t nColNoteCount = GetNoteCount(nTab, nCol); if (!nColNoteCount) continue; diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index ddf2cf41dfb6..0d84f78ff146 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -1070,12 +1070,12 @@ bool ScDrawLayer::GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) co rRange.aStart.SetCol( 0 ); if (nWidth <= nStartX) { - for (const ScColumn* pCol : pDoc->GetColumnsRange(nTab, 0, MAXCOL)) + for (SCCOL nCol : pDoc->GetColumnsRange(nTab, 0, MAXCOL)) { - nWidth += pDoc->GetColWidth(pCol->GetCol(),nTab); + nWidth += pDoc->GetColWidth(nCol,nTab); if (nWidth > nStartX) { - rRange.aStart.SetCol( pCol->GetCol() ); + rRange.aStart.SetCol( nCol ); break; } } @@ -1085,12 +1085,12 @@ bool ScDrawLayer::GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) co rRange.aEnd.SetCol( 0 ); if (nWidth <= nEndX) { - for (const ScColumn* pCol : pDoc->GetColumnsRange(nTab, 0, MAXCOL)) //TODO: start at Start + for (SCCOL nCol : pDoc->GetColumnsRange(nTab, 0, MAXCOL)) //TODO: start at Start { - nWidth += pDoc->GetColWidth(pCol->GetCol(),nTab); + nWidth += pDoc->GetColWidth(nCol,nTab); if (nWidth > nEndX) { - rRange.aEnd.SetCol( pCol->GetCol() ); + rRange.aEnd.SetCol( nCol ); break; } } diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index c10100d4777b..c2416406abb4 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -1681,14 +1681,14 @@ void ScTable::UpdateReference( void ScTable::UpdateTranspose( const ScRange& rSource, const ScAddress& rDest, ScDocument* pUndoDoc ) { - for (ScColumn* pCol : GetColumnsRange(0, MAXCOL)) - pCol->UpdateTranspose( rSource, rDest, pUndoDoc ); + for (auto const & rpCol : aCol) + rpCol->UpdateTranspose( rSource, rDest, pUndoDoc ); } void ScTable::UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ) { - for (ScColumn* pCol : GetColumnsRange(0, MAXCOL)) - pCol->UpdateGrow( rArea, nGrowX, nGrowY ); + for (auto const & rpCol : aCol) + rpCol->UpdateGrow( rArea, nGrowX, nGrowY ); } void ScTable::UpdateInsertTab( sc::RefUpdateInsertTabContext& rCxt ) @@ -2386,7 +2386,8 @@ const ScConditionalFormatList* ScTable::GetCondFormList() const ScColumnsRange ScTable::GetColumnsRange(SCCOL nColBegin, SCCOL nColEnd) const { // because the range is inclusive, some code will pass nColEnd<nColBegin to indicate an empty range - return ScColumnsRange(aCol.begin() + nColBegin, nColEnd < nColBegin ? (aCol.begin() + nColBegin) : (aCol.begin() + nColEnd + 1)); + return ScColumnsRange(ScColumnsRange::Iterator(aCol.begin() + nColBegin), + ScColumnsRange::Iterator(nColEnd < nColBegin ? (aCol.begin() + nColBegin) : (aCol.begin() + nColEnd + 1))); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx index 7871f04318fb..8ae63775f3c4 100644 --- a/sc/source/core/data/table2.cxx +++ b/sc/source/core/data/table2.cxx @@ -2107,9 +2107,8 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC SCROW nY1 = pRowInfo[0].nRowNo; SCROW nY2 = pRowInfo[nArrCount-1].nRowNo; - for (ScColumn* pCol : GetColumnsRange(0, MAXCOL)) + for (SCCOL nCol : GetColumnsRange(0, MAXCOL)) { - SCCOL nCol = pCol->GetCol(); if (!ColHidden(nCol)) { SCSIZE nArrY = 0; diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 926301cd4582..5f4a101e2e3d 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1849,14 +1849,14 @@ public: SCCOL nStartCol = mrParam.nCol1; SCCOL nEndCol = mrParam.nCol2; - for (const ScColumn* pCol : mrTab.GetColumnsRange(0, nStartCol - 1)) + for (SCCOL nCol : mrTab.GetColumnsRange(0, nStartCol - 1)) { - if (mrTab.HasData(pCol->GetCol(), nRow)) + if (mrTab.HasData(nCol, nRow)) return true; } - for (const ScColumn* pCol : mrTab.GetColumnsRange(nEndCol + 1, MAXCOL)) + for (SCCOL nCol : mrTab.GetColumnsRange(nEndCol + 1, MAXCOL)) { - if (mrTab.HasData(pCol->GetCol(), nRow)) + if (mrTab.HasData(nCol, nRow)) return true; } return false; diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx index 46f36b11bba0..14d38e5be129 100644 --- a/sc/source/core/data/table5.cxx +++ b/sc/source/core/data/table5.cxx @@ -290,8 +290,8 @@ void ScTable::UpdatePageBreaks( const ScRange* pUserArea ) if (nEndCol < MAXCOL) { SetColBreak(nEndCol+1, true, false); // AREABREAK - for (const ScColumn* pCol : GetColumnsRange(nEndCol + 2, MAXCOL)) - RemoveColBreak(pCol->GetCol(), true, false); + for (SCCOL nCol : GetColumnsRange(nEndCol + 2, MAXCOL)) + RemoveColBreak(nCol, true, false); } if (nEndRow < MAXROW) { diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 27e9e45cc1e3..576c564ec2b3 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -44,6 +44,7 @@ #include "AccessibilityHints.hxx" #include "appoptio.hxx" #include "attrib.hxx" +#include "table.hxx" #include <comphelper/lok.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <sfx2/lokhelper.hxx> @@ -2454,7 +2455,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) long nLeftBoundPx = rRectangle.Left() / TWIPS_PER_PIXEL; long nRightBoundPx = rRectangle.Right() / TWIPS_PER_PIXEL; nEndCol = MAXCOL; - for (SCCOL nCol = 0; nCol <= MAXCOL; ++nCol) + for (SCCOL nCol : pDoc->GetColumnsRange(aViewData.GetTabNo(), 0, MAXCOL)) { if (nTotalPixels > nRightBoundPx) { |