summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-03-04 18:27:13 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-03-23 09:09:07 +0100
commit52ce03c8e27a36f21cf2e70bc335f10fc3251ffd (patch)
tree7ecbdec83aa0a79fc35b1bc579e4c2bae1a1718b
parenta5c5034f048926d7cb5eb6c99bce2e5aab8a8775 (diff)
remove more hardcoded MAXROW
Change-Id: Ica57f18d3fd1bf9ec06f05869f4a956d7d1097b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131036 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--sc/inc/attarray.hxx6
-rw-r--r--sc/inc/column.hxx3
-rw-r--r--sc/source/core/data/table1.cxx8
3 files changed, 9 insertions, 8 deletions
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 52c2793c3f3c..f55a4ee8206e 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -21,6 +21,7 @@
#include "global.hxx"
#include "attrib.hxx"
+#include "document.hxx"
#include "patattr.hxx"
#include <algorithm>
@@ -114,6 +115,7 @@ public:
~ScAttrArray();
ScDocument& GetDoc() { return rDocument; }
+ const ScDocument& GetDoc() const { return rDocument; }
void SetTab(SCTAB nNewTab) { nTab = nNewTab; }
void SetCol(SCCOL nNewCol) { nCol = nNewCol; }
#if DEBUG_SC_TESTATTRARRAY
@@ -266,10 +268,10 @@ inline const ScPatternAttr* ScAttrIterator::Next( SCROW& rTop, SCROW& rBottom )
if ( !nPos )
{
++nPos;
- if ( nRow > MAXROW )
+ if ( nRow > pArray->GetDoc().MaxRow())
return nullptr;
rTop = nRow;
- rBottom = std::min( nEndRow, MAXROW );
+ rBottom = std::min( nEndRow, pArray->GetDoc().MaxRow());
nRow = rBottom + 1;
return pDefPattern;
}
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index d010f8d068c1..09945433a1be 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -281,8 +281,7 @@ public:
bool GetFirstVisibleAttr( SCROW& rFirstRow ) const;
bool GetLastVisibleAttr( SCROW& rLastRow ) const;
bool HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const;
- bool IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0,
- SCROW nEndRow = MAXROW ) const;
+ bool IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
bool IsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const;
bool TestInsertCol( SCROW nStartRow, SCROW nEndRow) const;
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7329b4f455b9..99c673eb5d6a 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -631,7 +631,7 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bC
if (nMaxX == rDocument.MaxCol()) // omit attribute at the right
{
--nMaxX;
- while ( nMaxX>0 && aCol[nMaxX].IsVisibleAttrEqual(aCol[nMaxX+1]) )
+ while ( nMaxX>0 && aCol[nMaxX].IsVisibleAttrEqual(aCol[nMaxX+1], 0, rDocument.MaxRow()) )
--nMaxX;
}
@@ -645,7 +645,7 @@ bool ScTable::GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, bool bNotes, bool bC
while ( nAttrStartX < (aCol.size()-1) )
{
SCCOL nAttrEndX = nAttrStartX;
- while ( nAttrEndX < (aCol.size()-1) && aCol[nAttrStartX].IsVisibleAttrEqual(aCol[nAttrEndX+1]) )
+ while ( nAttrEndX < (aCol.size()-1) && aCol[nAttrStartX].IsVisibleAttrEqual(aCol[nAttrEndX+1], 0, rDocument.MaxRow()) )
++nAttrEndX;
if ( nAttrEndX + 1 - nAttrStartX >= SC_COLUMNS_STOP )
{
@@ -770,10 +770,10 @@ bool ScTable::GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const
if (nMinX == 0) // omit attribute at the right
{
- if ( aCol.size() > 1 && aCol[0].IsVisibleAttrEqual(aCol[1]) ) // no single ones
+ if ( aCol.size() > 1 && aCol[0].IsVisibleAttrEqual(aCol[1], 0, rDocument.MaxRow())) // no single ones
{
++nMinX;
- while ( nMinX<(aCol.size()-1) && aCol[nMinX].IsVisibleAttrEqual(aCol[nMinX-1]) )
+ while ( nMinX<(aCol.size()-1) && aCol[nMinX].IsVisibleAttrEqual(aCol[nMinX-1], 0, rDocument.MaxRow()))
++nMinX;
}
}