diff options
-rw-r--r-- | sc/inc/document.hxx | 1 | ||||
-rw-r--r-- | sc/source/core/data/dociter.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/documen3.cxx | 5 |
3 files changed, 8 insertions, 2 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 48dbe6c04e69..cdeab88fdfcb 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -787,6 +787,7 @@ public: ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; } SC_DLLPUBLIC SCCOL ClampToAllocatedColumns(SCTAB nTab, SCCOL nCol) const; + SC_DLLPUBLIC SCCOL GetAllocatedColumnsCount(SCTAB nTab) const; SC_DLLPUBLIC ScDBCollection* GetDBCollection() const { return pDBCollection.get();} void SetDBCollection( std::unique_ptr<ScDBCollection> pNewDBCollection, diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 8458e2895684..ec81363846f2 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -829,7 +829,6 @@ ScCellIterator::ScCellIterator( ScDocument* pDoc, const ScRange& rRange, Subtota maEndPos(rRange.aEnd), mnSubTotalFlags(nSubTotalFlags) { - maEndPos.SetCol( pDoc->ClampToAllocatedColumns(maStartPos.Tab(), maEndPos.Col()) ); init(); } @@ -914,7 +913,8 @@ bool ScCellIterator::getCurrent() do { maCurPos.IncCol(); - if (maCurPos.Col() > maEndPos.Col()) + if (maCurPos.Col() >= mpDoc->GetAllocatedColumnsCount(maCurPos.Tab()) + || maCurPos.Col() > maEndPos.Col()) { maCurPos.SetCol(maStartPos.Col()); maCurPos.IncTab(); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 75f1cdab071a..0bcf1aa37580 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -2103,4 +2103,9 @@ SCCOL ScDocument::ClampToAllocatedColumns(SCTAB nTab, SCCOL nCol) const return maTabs[nTab]->ClampToAllocatedColumns(nCol); } +SCCOL ScDocument::GetAllocatedColumnsCount(SCTAB nTab) const +{ + return maTabs[nTab]->GetAllocatedColumnsCount(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |