summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2022-02-18 14:30:14 +0100
committerLuboš Luňák <l.lunak@collabora.com>2022-02-18 17:28:50 +0100
commit35cad9f57e761eef78820d092a4bb9d2f0641052 (patch)
treefe11fcb8882e8203f1aeb54d5c7cfc4e0e2ce7ea
parentc58c353d8c57aef62ec0a56c18918156ab7f84b7 (diff)
convert more MAXCOL/MAXROW
Change-Id: Ifb2c9ea7b440890224c7e837422c8a1358f8c5b3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130143 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
-rw-r--r--sc/qa/unit/bugfix-test.cxx4
-rw-r--r--sc/qa/unit/helper/qahelper.cxx2
-rw-r--r--sc/qa/unit/rangelst_test.cxx18
-rw-r--r--sc/qa/unit/subsequent_export_test.cxx4
-rw-r--r--sc/qa/unit/subsequent_filters_test.cxx4
-rw-r--r--sc/qa/unit/subsequent_filters_test2.cxx25
-rw-r--r--sc/qa/unit/ucalc.cxx140
-rw-r--r--sc/qa/unit/ucalc_condformat.cxx20
-rw-r--r--sc/qa/unit/ucalc_copypaste.cxx4
-rw-r--r--sc/qa/unit/ucalc_sharedformula.cxx28
-rw-r--r--sc/qa/unit/ucalc_sort.cxx4
-rw-r--r--sc/source/core/data/colorscale.cxx2
-rw-r--r--sc/source/core/data/conditio.cxx2
-rw-r--r--sc/source/core/data/drwlayer.cxx12
-rw-r--r--sc/source/core/data/formulacell.cxx8
-rw-r--r--sc/source/core/data/stlsheet.cxx2
-rw-r--r--sc/source/core/data/table6.cxx2
-rw-r--r--sc/source/core/data/table7.cxx12
-rw-r--r--sc/source/ui/view/gridwin4.cxx4
19 files changed, 153 insertions, 144 deletions
diff --git a/sc/qa/unit/bugfix-test.cxx b/sc/qa/unit/bugfix-test.cxx
index dc8538590e20..b5b0c92a800e 100644
--- a/sc/qa/unit/bugfix-test.cxx
+++ b/sc/qa/unit/bugfix-test.cxx
@@ -400,10 +400,10 @@ void ScFiltersTest::testTdf91979()
auto& rDoc = aViewData.GetDocument();
// Check coordinates of a distant cell
- Point aPos = aViewData.GetScrPos(MAXCOL - 1, 10000, SC_SPLIT_TOPLEFT, true);
+ Point aPos = aViewData.GetScrPos(rDoc.MaxCol() - 1, 10000, SC_SPLIT_TOPLEFT, true);
int nColWidth = ScViewData::ToPixel(rDoc.GetColWidth(0, 0), aViewData.GetPPTX());
int nRowHeight = ScViewData::ToPixel(rDoc.GetRowHeight(0, 0), aViewData.GetPPTY());
- CPPUNIT_ASSERT_EQUAL(static_cast<tools::Long>((MAXCOL - 1) * nColWidth), aPos.getX());
+ CPPUNIT_ASSERT_EQUAL(static_cast<tools::Long>((rDoc.MaxCol() - 1) * nColWidth), aPos.getX());
CPPUNIT_ASSERT_EQUAL(static_cast<tools::Long>(10000 * nRowHeight), aPos.getY());
}
diff --git a/sc/qa/unit/helper/qahelper.cxx b/sc/qa/unit/helper/qahelper.cxx
index 5f0ae6389df9..8308cdf0b982 100644
--- a/sc/qa/unit/helper/qahelper.cxx
+++ b/sc/qa/unit/helper/qahelper.cxx
@@ -1109,7 +1109,7 @@ void clearRange(ScDocument* pDoc, const ScRange& rRange)
void clearSheet(ScDocument* pDoc, SCTAB nTab)
{
- ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab);
+ ScRange aRange(0,0,nTab,pDoc->MaxCol(),pDoc->MaxRow(),nTab);
clearRange(pDoc, aRange);
}
diff --git a/sc/qa/unit/rangelst_test.cxx b/sc/qa/unit/rangelst_test.cxx
index 883519f5323b..b6a3e3c2d830 100644
--- a/sc/qa/unit/rangelst_test.cxx
+++ b/sc/qa/unit/rangelst_test.cxx
@@ -504,7 +504,7 @@ void Test::testJoin_Case5()
void Test::testUpdateReference_DeleteRow()
{
ScRangeList aList(ScRange(1,1,0,4,4,0));
- bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,MAXCOL,MAXROW,0), 0, -1, 0);
+ bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0), 0, -1, 0);
CPPUNIT_ASSERT(bUpdated);
for(SCCOL nCol = 1; nCol <= 4; ++nCol)
@@ -518,35 +518,35 @@ void Test::testUpdateReference_DeleteRow()
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt64>(12), aList.GetCellCount());
ScRangeList aList2(ScRange(2,2,0,2,2,0));
- aList2.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,MAXCOL,MAXROW,0), 0, -1, 0);
+ aList2.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,3,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0), 0, -1, 0);
CPPUNIT_ASSERT(aList2.empty());
ScRangeList aList3;
aList3.push_back(ScRange(2,2,0,2,8,0));
aList3.push_back(ScRange(4,2,0,4,8,0));
- aList3.UpdateReference(URM_INSDEL, m_pDoc, ScRange(2,5,0,MAXCOL,MAXROW,0), 0, -1, 0);
+ aList3.UpdateReference(URM_INSDEL, m_pDoc, ScRange(2,5,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0), 0, -1, 0);
// Verify all ranges in the list have been updated properly.
CPPUNIT_ASSERT_EQUAL(size_t(2), aList3.size());
CPPUNIT_ASSERT_EQUAL(ScRange(2,2,0,2,7,0), aList3[0]);
CPPUNIT_ASSERT_EQUAL(ScRange(4,2,0,4,7,0), aList3[1]);
- ScRangeList aList4(ScRange(0,0,0,MAXCOL,MAXROW,0));
+ ScRangeList aList4(ScRange(0,0,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0));
ScRangeList aList4Copy = aList4;
- aList4.UpdateReference(URM_INSDEL, m_pDoc, ScRange(14,3,0,MAXCOL,7,0), 0, -2, 0);
+ aList4.UpdateReference(URM_INSDEL, m_pDoc, ScRange(14,3,0,m_pDoc->MaxCol(),7,0), 0, -2, 0);
CPPUNIT_ASSERT_EQUAL(aList4Copy, aList4);
}
void Test::testUpdateReference_DeleteLastRow()
{
ScRangeList aList(ScRange(1,1,0,4,4,0));
- bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,4,0,MAXCOL,4,0), 0, -1, 0);
+ bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(0,4,0,m_pDoc->MaxCol(),4,0), 0, -1, 0);
CPPUNIT_ASSERT(bUpdated);
}
void Test::testUpdateReference_DeleteCol()
{
ScRangeList aList(ScRange(1,1,0,4,4,0));
- bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(3,0,0,MAXCOL,MAXROW,0), -1, 0, 0);
+ bool bUpdated = aList.UpdateReference(URM_INSDEL, m_pDoc, ScRange(3,0,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0), -1, 0, 0);
CPPUNIT_ASSERT(bUpdated);
for(SCROW nRow = 1; nRow <= 4; ++nRow)
@@ -570,14 +570,14 @@ void Test::testGetIntersectedRange()
void Test::testInsertRow()
{
ScRangeList aList(ScRange(1,1,0,4,4,0));
- aList.InsertRow(0, 0, MAXCOL, 5, 2);
+ aList.InsertRow(0, 0, m_pDoc->MaxCol(), 5, 2);
CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(1,1,0,4,6,0)), aList);
}
void Test::testInsertCol()
{
ScRangeList aList(ScRange(1,1,0,4,4,0));
- aList.InsertCol(0, 0, MAXROW, 5, 2);
+ aList.InsertCol(0, 0, m_pDoc->MaxRow(), 5, 2);
CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(1,1,0,6,4,0)), aList);
}
diff --git a/sc/qa/unit/subsequent_export_test.cxx b/sc/qa/unit/subsequent_export_test.cxx
index 0e81567e38a7..79ec1e14b4be 100644
--- a/sc/qa/unit/subsequent_export_test.cxx
+++ b/sc/qa/unit/subsequent_export_test.cxx
@@ -4342,7 +4342,7 @@ void ScExportTest::testMoveCellAnchoredShapesODS()
CPPUNIT_ASSERT_EQUAL(aDataEnd, aNDataEnd);
// Insert 2 rows.
- rDoc.InsertRow(ScRange(0, aDataStart.Row() - 1, 0, MAXCOL, aDataStart.Row(), 0));
+ rDoc.InsertRow(ScRange(0, aDataStart.Row() - 1, 0, rDoc.MaxCol(), aDataStart.Row(), 0));
// Get anchor data
pData = ScDrawLayer::GetObjData(pObj);
@@ -4407,7 +4407,7 @@ void ScExportTest::testMoveCellAnchoredShapesODS()
CPPUNIT_ASSERT_EQUAL(pNData->maEnd, aNDataEnd);
// Insert a column.
- rDoc1.InsertCol(ScRange(aDataStart.Col(), 0, 0, aDataStart.Col(), MAXROW, 0));
+ rDoc1.InsertCol(ScRange(aDataStart.Col(), 0, 0, aDataStart.Col(), rDoc1.MaxRow(), 0));
// Get anchor data
pData = ScDrawLayer::GetObjData(pObj);
diff --git a/sc/qa/unit/subsequent_filters_test.cxx b/sc/qa/unit/subsequent_filters_test.cxx
index a0a589a165bb..85a607503aad 100644
--- a/sc/qa/unit/subsequent_filters_test.cxx
+++ b/sc/qa/unit/subsequent_filters_test.cxx
@@ -1047,7 +1047,7 @@ void testDBRanges_Impl(ScDocument& rDoc, sal_Int32 nFormat)
bHidden = rDoc.RowHidden(6, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("Sheet1: row 6-end should be visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Sheet1: row 6-end should be visible", SCROW(6), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("Sheet1: row 6-end should be visible", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Sheet1: row 6-end should be visible", rDoc.MaxRow(), nRow2);
if (nFormat == FORMAT_ODS) //excel doesn't support named db ranges
{
double aValue = rDoc.GetValue(0,10,1);
@@ -2137,7 +2137,7 @@ void ScFiltersTest::testRowHeightODS()
bManual = rDoc.IsManualRowHeight(++nRow, nTab);
CPPUNIT_ASSERT_MESSAGE("Row should have an automatic height.", !bManual);
- bManual = rDoc.IsManualRowHeight(MAXROW, nTab);
+ bManual = rDoc.IsManualRowHeight(rDoc.MaxRow(), nTab);
CPPUNIT_ASSERT_MESSAGE("Row should have an automatic height.", !bManual);
xDocSh->DoClose();
diff --git a/sc/qa/unit/subsequent_filters_test2.cxx b/sc/qa/unit/subsequent_filters_test2.cxx
index f6ea696f8cfd..b1d1d101a1b2 100644
--- a/sc/qa/unit/subsequent_filters_test2.cxx
+++ b/sc/qa/unit/subsequent_filters_test2.cxx
@@ -2064,8 +2064,13 @@ void ScFiltersTest2::testHiddenRowsColumnsXLSXML()
};
std::vector<Check> aRowChecks = {
- { 0, 0, true }, { 1, 2, false }, { 3, 3, true }, { 4, 4, false },
- { 5, 7, true }, { 8, 8, false }, { 9, MAXROW, true },
+ { 0, 0, true },
+ { 1, 2, false },
+ { 3, 3, true },
+ { 4, 4, false },
+ { 5, 7, true },
+ { 8, 8, false },
+ { 9, rDoc.MaxRow(), true },
};
for (const Check& c : aRowChecks)
@@ -2078,7 +2083,11 @@ void ScFiltersTest2::testHiddenRowsColumnsXLSXML()
}
std::vector<Check> aColChecks = {
- { 0, 1, true }, { 2, 5, false }, { 6, 9, true }, { 10, 10, false }, { 11, MAXCOL, true },
+ { 0, 1, true },
+ { 2, 5, false },
+ { 6, 9, true },
+ { 10, 10, false },
+ { 11, rDoc.MaxCol(), true },
};
for (const Check& c : aColChecks)
@@ -2484,7 +2493,7 @@ void ScFiltersTest2::testXLSDefColWidth()
ScDocShellRef xDocSh = loadDoc(u"chartx.", FORMAT_XLS); // just some XLS with narrow columns
ScDocument& rDoc = xDocSh->GetDocument();
- int nWidth = rDoc.GetColWidth(MAXCOL, 0, false);
+ int nWidth = rDoc.GetColWidth(rDoc.MaxCol(), 0, false);
// This was 1280
CPPUNIT_ASSERT_EQUAL(1005, nWidth);
@@ -2805,14 +2814,14 @@ void ScFiltersTest2::testDeleteCirclesInRowAndCol()
// There should be 6 circle objects!
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(6), pPage->GetObjCount());
- // Delete first row (1023 = MAXCOLS)
- pDrawLayer->DeleteObjectsInArea(0, 0, 0, 1023, 0, true);
+ // Delete first row.
+ pDrawLayer->DeleteObjectsInArea(0, 0, 0, rDoc.MaxCol(), 0, true);
// There should be 3 circle objects!
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), pPage->GetObjCount());
- // Delete first col (1048575 = MAXROWS)
- pDrawLayer->DeleteObjectsInArea(0, 0, 0, 0, 1048575, true);
+ // Delete first col.
+ pDrawLayer->DeleteObjectsInArea(0, 0, 0, 0, rDoc.MaxRow(), true);
// There should not be a circle object!
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(0), pPage->GetObjCount());
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 12748abe5525..ffb8d2fbe4eb 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -643,8 +643,8 @@ void Test::testColumnIterator() // tdf#118620
m_pDoc->InsertTab (0, "foo"));
m_pDoc->SetString(0, 0, 0, "'10.5");
- m_pDoc->SetString(0, MAXROW-5, 0, "42.0");
- std::optional<sc::ColumnIterator> it = m_pDoc->GetColumnIterator(0, 0, MAXROW - 10, MAXROW);
+ m_pDoc->SetString(0, m_pDoc->MaxRow()-5, 0, "42.0");
+ std::optional<sc::ColumnIterator> it = m_pDoc->GetColumnIterator(0, 0, m_pDoc->MaxRow() - 10, m_pDoc->MaxRow());
while (it->hasCell())
{
it->getCell();
@@ -810,7 +810,7 @@ void Test::testDataEntries()
CPPUNIT_ASSERT_MESSAGE("The entries should have ended here.", bool(it == aEntries.end()));
aEntries.clear();
- m_pDoc->GetDataEntries(0, MAXROW, 0, aEntries); // Try at the very bottom.
+ m_pDoc->GetDataEntries(0, m_pDoc->MaxRow(), 0, aEntries); // Try at the very bottom.
CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(3), aEntries.size());
// Make sure we get the same set of suggestions.
@@ -1627,7 +1627,7 @@ void Test::testCellBroadcaster()
CPPUNIT_ASSERT_EQUAL(3.5, m_pDoc->GetValue(2,0,0));
// Insert a column at column B.
- m_pDoc->InsertCol(ScRange(1,0,0,1,MAXROW,0));
+ m_pDoc->InsertCol(ScRange(1,0,0,1,m_pDoc->MaxRow(),0));
pBC = m_pDoc->GetBroadcaster(ScAddress(0,0,0));
CPPUNIT_ASSERT_MESSAGE("Broadcaster should exist here.", pBC);
pBC = m_pDoc->GetBroadcaster(ScAddress(2,0,0));
@@ -2291,7 +2291,7 @@ void Test::testSheetCopy()
bool bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", m_pDoc->MaxRow(), nRow2);
// insert a note
ScAddress aAdrA1 (0,2,0); // empty cell content.
@@ -2306,7 +2306,7 @@ void Test::testSheetCopy()
bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("copied sheet should also have all rows visible as the original.", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("copied sheet should also have all rows visible as the original.", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("copied sheet should also have all rows visible as the original.", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("copied sheet should also have all rows visible as the original.", m_pDoc->MaxRow(), nRow2);
CPPUNIT_ASSERT_MESSAGE("There should be note on A3 in new sheet", m_pDoc->HasNote(ScAddress(0,2,1)));
CPPUNIT_ASSERT_EQUAL(OUString("copy me"), m_pDoc->GetString(ScAddress(0,0,1)));
@@ -2335,7 +2335,7 @@ void Test::testSheetCopy()
bHidden = m_pDoc->RowHidden(11, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("rows 11 - maxrow should be visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", SCROW(11), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", m_pDoc->MaxRow(), nRow2);
// Copy the sheet once again.
m_pDoc->CopyTab(0, 1);
@@ -2352,7 +2352,7 @@ void Test::testSheetCopy()
bHidden = m_pDoc->RowHidden(11, 1, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("rows 11 - maxrow should be visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", SCROW(11), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", m_pDoc->MaxRow(), nRow2);
m_pDoc->DeleteTab(1);
m_pDoc->DeleteTab(0);
}
@@ -2365,7 +2365,7 @@ void Test::testSheetMove()
bool bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", m_pDoc->MaxRow(), nRow2);
//test if inserting before another sheet works
m_pDoc->InsertTab(0, "TestTab2");
@@ -2373,7 +2373,7 @@ void Test::testSheetMove()
bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", m_pDoc->MaxRow(), nRow2);
// Move and test the result.
m_pDoc->MoveTab(0, 1);
@@ -2381,7 +2381,7 @@ void Test::testSheetMove()
bHidden = m_pDoc->RowHidden(0, 1, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("copied sheet should also have all rows visible as the original.", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("copied sheet should also have all rows visible as the original.", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("copied sheet should also have all rows visible as the original.", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("copied sheet should also have all rows visible as the original.", m_pDoc->MaxRow(), nRow2);
OUString aName;
m_pDoc->GetName(0, aName);
CPPUNIT_ASSERT_EQUAL_MESSAGE( "sheets should have changed places", OUString("TestTab1"), aName);
@@ -2398,7 +2398,7 @@ void Test::testSheetMove()
bHidden = m_pDoc->RowHidden(11, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("rows 11 - maxrow should be visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", SCROW(11), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", MAXROW, nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", m_pDoc->MaxRow(), nRow2);
// Move the sheet once again.
m_pDoc->MoveTab(1, 0);
@@ -2414,7 +2414,7 @@ void Test::testSheetMove()
bHidden = m_pDoc->RowHidden(11, 1, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("rows 11 - maxrow should be visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", SCROW(11), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", SCROW(MAXROW), nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 11 - maxrow should be visible", m_pDoc->MaxRow(), nRow2);
m_pDoc->GetName(0, aName);
CPPUNIT_ASSERT_EQUAL_MESSAGE( "sheets should have changed places", OUString("TestTab2"), aName);
m_pDoc->DeleteTab(1);
@@ -2504,7 +2504,7 @@ void Test::testStreamValid()
// Now, insert a new row at row 2 position on Sheet1. This will move cell
// A2 downward but cell A1 remains unmoved.
- m_pDoc->InsertRow(0, 0, MAXCOL, 0, 1, 2);
+ m_pDoc->InsertRow(0, 0, m_pDoc->MaxCol(), 0, 1, 2);
test = m_pDoc->GetString(0, 0, 0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell A1 should not have moved.", test, a1);
test = m_pDoc->GetString(0, 3, 0);
@@ -3018,7 +3018,7 @@ void Test::testGraphicsInGroup()
bool bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", SCROW(MAXROW), nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", m_pDoc->MaxRow(), nRow2);
m_pDoc->InitDrawLayer();
ScDrawLayer *pDrawLayer = m_pDoc->GetDrawLayer();
@@ -3079,7 +3079,7 @@ void Test::testGraphicsInGroup()
const_cast<const tools::Rectangle &>(aOrigRect), rNewRect);
// Insert 2 rows at the top. This should push the circle object down.
- m_pDoc->InsertRow(0, 0, MAXCOL, 0, 0, 2);
+ m_pDoc->InsertRow(0, 0, m_pDoc->MaxCol(), 0, 0, 2);
m_pDoc->SetDrawPageSize(0);
// Make sure the size of the circle is still identical.
@@ -3087,7 +3087,7 @@ void Test::testGraphicsInGroup()
aOrigRect.GetSize(), rNewRect.GetSize());
// Delete 2 rows at the top. This should bring the circle object to its original position.
- m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 2);
+ m_pDoc->DeleteRow(0, 0, m_pDoc->MaxCol(), 0, 0, 2);
m_pDoc->SetDrawPageSize(0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Failed to move back to its original position.",
const_cast<const tools::Rectangle &>(aOrigRect), rNewRect);
@@ -3112,8 +3112,8 @@ void Test::testGraphicsInGroup()
const_cast<const tools::Rectangle &>(aOrigRect), rNewRect);
// Insert 2 rows at the top and delete them immediately.
- m_pDoc->InsertRow(0, 0, MAXCOL, 0, 0, 2);
- m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 2);
+ m_pDoc->InsertRow(0, 0, m_pDoc->MaxCol(), 0, 0, 2);
+ m_pDoc->DeleteRow(0, 0, m_pDoc->MaxCol(), 0, 0, 2);
m_pDoc->SetDrawPageSize(0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Size of a line object changed after row insertion and removal.",
const_cast<const tools::Rectangle &>(aOrigRect), rNewRect);
@@ -3412,7 +3412,7 @@ void Test::testAutofilter()
bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("All rows should be shown.", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("All rows should be shown.", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("All rows should be shown.", SCROW(MAXROW), nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("All rows should be shown.", m_pDoc->MaxRow(), nRow2);
// Filter for non-empty cells by column C.
rEntry.bDoQuery = true;
@@ -3432,7 +3432,7 @@ void Test::testAutofilter()
bHidden = m_pDoc->RowHidden(3, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("row 4 and down should be visible.", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("row 4 and down should be visible.", SCROW(3), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("row 4 and down should be visible.", SCROW(MAXROW), nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("row 4 and down should be visible.", m_pDoc->MaxRow(), nRow2);
// Now, filter for empty cells by column C.
rEntry.SetQueryByEmpty();
@@ -3458,7 +3458,7 @@ void Test::testAutofilter()
bHidden = m_pDoc->RowHidden(5, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("rows 6 and down should be all visible.", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 6 and down should be all visible.", SCROW(5), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 6 and down should be all visible.", SCROW(MAXROW), nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("rows 6 and down should be all visible.", m_pDoc->MaxRow(), nRow2);
m_pDoc->DeleteTab(0);
}
@@ -3611,7 +3611,7 @@ void Test::testAutofilterOptimizations()
m_pDoc->Query(0, aParam, true);
CPPUNIT_ASSERT_MESSAGE("All rows should be shown.", !m_pDoc->RowHidden(0, 0, &nRow1, &nRow2));
CPPUNIT_ASSERT_EQUAL_MESSAGE("All rows should be shown.", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("All rows should be shown.", SCROW(MAXROW), nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("All rows should be shown.", m_pDoc->MaxRow(), nRow2);
m_pDoc->DeleteTab(0);
}
@@ -3968,7 +3968,7 @@ void Test::testMergedCells()
m_pDoc->ExtendMerge( 1, 1, nEndCol, nEndRow, 0);
CPPUNIT_ASSERT_EQUAL_MESSAGE("did not merge cells", SCCOL(3), nEndCol);
CPPUNIT_ASSERT_EQUAL_MESSAGE("did not merge cells", SCROW(3), nEndRow);
- ScRange aRange(0,2,0,MAXCOL,2,0);
+ ScRange aRange(0,2,0,m_pDoc->MaxCol(),2,0);
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SetMarkArea(aRange);
m_xDocShell->GetDocFunc().InsertCells(aRange, &aMark, INS_INSROWS_BEFORE, true, true);
@@ -4130,10 +4130,10 @@ void Test::testUpdateReference()
m_pDoc->SetString(0,0,1, "=MATCH(\"s1\";Sheet1.A:A;0)");
aValue = m_pDoc->GetValue(0,0,1);
ASSERT_DOUBLES_EQUAL_MESSAGE("unexpected MATCH result", 2, aValue);
- m_pDoc->InsertRow(0,0,MAXCOL,0,0,1); // insert 1 row before row 1 in Sheet1
+ m_pDoc->InsertRow(0,0,m_pDoc->MaxCol(),0,0,1); // insert 1 row before row 1 in Sheet1
aValue = m_pDoc->GetValue(0,0,1);
ASSERT_DOUBLES_EQUAL_MESSAGE("unexpected MATCH result", 3, aValue);
- m_pDoc->DeleteRow(0,0,MAXCOL,0,0,1); // delete row 1 in Sheet1
+ m_pDoc->DeleteRow(0,0,m_pDoc->MaxCol(),0,0,1); // delete row 1 in Sheet1
aValue = m_pDoc->GetValue(0,0,1);
ASSERT_DOUBLES_EQUAL_MESSAGE("unexpected MATCH result", 2, aValue);
m_pDoc->DeleteTab(1);
@@ -4385,8 +4385,8 @@ void Test::testAutoFill()
}
// Clear column A for a new test.
- clearRange(m_pDoc, ScRange(0,0,0,0,MAXROW,0));
- m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows.
+ clearRange(m_pDoc, ScRange(0,0,0,0,m_pDoc->MaxRow(),0));
+ m_pDoc->SetRowHidden(0, m_pDoc->MaxRow(), 0, false); // Show all rows.
// Fill A1:A6 with 1,2,3,4,5,6.
ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
@@ -4434,8 +4434,8 @@ void Test::testAutoFill()
}
// Clear column A for a new test.
- clearRange(m_pDoc, ScRange(0,0,0,0,MAXROW,0));
- m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows.
+ clearRange(m_pDoc, ScRange(0,0,0,0,m_pDoc->MaxRow(),0));
+ m_pDoc->SetRowHidden(0, m_pDoc->MaxRow(), 0, false); // Show all rows.
m_pDoc->SetString( 0, 100, 0, "2012-10-31" );
m_pDoc->SetString( 0, 101, 0, "2012-10-31" );
@@ -4449,8 +4449,8 @@ void Test::testAutoFill()
CPPUNIT_ASSERT_EQUAL( OUString("2012-10-31"), m_pDoc->GetString( 0, 104, 0 ) );
// Clear column A for a new test.
- clearRange(m_pDoc, ScRange(0, 0, 0, 0, MAXROW, 0));
- m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows.
+ clearRange(m_pDoc, ScRange(0, 0, 0, 0, m_pDoc->MaxRow(), 0));
+ m_pDoc->SetRowHidden(0, m_pDoc->MaxRow(), 0, false); // Show all rows.
m_pDoc->SetString(0, 100, 0, "2019-10-31");
m_pDoc->SetString(0, 101, 0, "2019-11-30");
@@ -4465,8 +4465,8 @@ void Test::testAutoFill()
CPPUNIT_ASSERT_EQUAL(OUString("2020-03-31"), m_pDoc->GetString(0, 105, 0));
// Clear column A for a new test.
- clearRange(m_pDoc, ScRange(0,0,0,0,MAXROW,0));
- m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows.
+ clearRange(m_pDoc, ScRange(0,0,0,0,m_pDoc->MaxRow(),0));
+ m_pDoc->SetRowHidden(0, m_pDoc->MaxRow(), 0, false); // Show all rows.
m_pDoc->SetString( 0, 50, 0, "1.0" );
m_pDoc->SetString( 0, 51, 0, "1.1" );
@@ -4492,8 +4492,8 @@ void Test::testAutoFill()
CPPUNIT_ASSERT_EQUAL( OUString("4.6"), m_pDoc->GetString( 0, 66, 0 ) );
// Clear column A for a new test.
- clearRange(m_pDoc, ScRange(0,0,0,0,MAXROW,0));
- m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows.
+ clearRange(m_pDoc, ScRange(0,0,0,0,m_pDoc->MaxRow(),0));
+ m_pDoc->SetRowHidden(0, m_pDoc->MaxRow(), 0, false); // Show all rows.
m_pDoc->SetString( 0, 70, 0, "001-001-001" );
m_pDoc->Fill( 0, 70, 0, 70, nullptr, aMarkData, 3, FILL_TO_BOTTOM, FILL_AUTO );
@@ -4506,8 +4506,8 @@ void Test::testAutoFill()
CPPUNIT_ASSERT_EQUAL( OUString("001-001-004"), m_pDoc->GetString( 0, 73, 0 ) );
// Clear column A for a new test.
- clearRange(m_pDoc, ScRange(0,0,0,0,MAXROW,0));
- m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows.
+ clearRange(m_pDoc, ScRange(0,0,0,0,m_pDoc->MaxRow(),0));
+ m_pDoc->SetRowHidden(0, m_pDoc->MaxRow(), 0, false); // Show all rows.
m_pDoc->SetString( 0, 80, 0, "1%" );
m_pDoc->Fill( 0, 80, 0, 80, nullptr, aMarkData, 3, FILL_TO_BOTTOM, FILL_AUTO );
@@ -4520,8 +4520,8 @@ void Test::testAutoFill()
CPPUNIT_ASSERT_EQUAL( OUString("4.00%"), m_pDoc->GetString( 0, 83, 0 ) );
// Clear column A for a new test.
- clearRange(m_pDoc, ScRange(0,0,0,0,MAXROW,0));
- m_pDoc->SetRowHidden(0, MAXROW, 0, false); // Show all rows.
+ clearRange(m_pDoc, ScRange(0,0,0,0,m_pDoc->MaxRow(),0));
+ m_pDoc->SetRowHidden(0, m_pDoc->MaxRow(), 0, false); // Show all rows.
m_pDoc->SetString( 0, 0, 0, "1" );
m_pDoc->SetString( 0, 1, 0, "1.1" );
@@ -4611,7 +4611,7 @@ void Test::testFindAreaPosVertical()
m_pDoc->FindAreaPos(nCol, nRow, 0, SC_MOVE_DOWN);
- CPPUNIT_ASSERT_EQUAL(MAXROW, nRow);
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->MaxRow(), nRow);
CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(0), nCol);
nCol = 1;
@@ -4678,7 +4678,7 @@ void Test::testFindAreaPosColRight()
m_pDoc->FindAreaPos(nCol, nRow, 0, SC_MOVE_RIGHT);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(0), nRow);
- CPPUNIT_ASSERT_EQUAL(MAXCOL, nCol);
+ CPPUNIT_ASSERT_EQUAL(m_pDoc->MaxCol(), nCol);
nCol = 2;
nRow = 1;
@@ -4762,7 +4762,7 @@ void Test::testNoteBasic()
CPPUNIT_ASSERT_EQUAL_MESSAGE("note should be itself", pNote, pGetNote);
// Insert one row at row 1.
- bool bInsertRow = m_pDoc->InsertRow(0, 0, MAXCOL, 0, 1, 1);
+ bool bInsertRow = m_pDoc->InsertRow(0, 0, m_pDoc->MaxCol(), 0, 1, 1);
CPPUNIT_ASSERT_MESSAGE("failed to insert row", bInsertRow );
CPPUNIT_ASSERT_MESSAGE("note hasn't moved", !m_pDoc->GetNote(aAddr));
@@ -4770,7 +4770,7 @@ void Test::testNoteBasic()
CPPUNIT_ASSERT_EQUAL_MESSAGE("note not there", pNote, m_pDoc->GetNote(aAddr));
// Insert column at column A.
- bool bInsertCol = m_pDoc->InsertCol(0, 0, MAXROW, 0, 1, 1);
+ bool bInsertCol = m_pDoc->InsertCol(0, 0, m_pDoc->MaxRow(), 0, 1, 1);
CPPUNIT_ASSERT_MESSAGE("failed to insert column", bInsertCol );
CPPUNIT_ASSERT_MESSAGE("note hasn't moved", !m_pDoc->GetNote(aAddr));
@@ -4802,7 +4802,7 @@ void Test::testNoteBasic()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Note at D4 should have shifted up to D3.", pNote, m_pDoc->GetNote(aAddr));
// Delete column C. This should shift the note one cell left.
- m_pDoc->DeleteCol(0, 0, MAXROW, 0, 2, 1);
+ m_pDoc->DeleteCol(0, 0, m_pDoc->MaxRow(), 0, 2, 1);
aAddr.IncCol(-1); // cell C3
CPPUNIT_ASSERT_EQUAL_MESSAGE("Note at D3 should have shifted left to C3.", pNote, m_pDoc->GetNote(aAddr));
@@ -4810,7 +4810,7 @@ void Test::testNoteBasic()
m_pDoc->SetString(aAddr, "Note is here.");
// Delete row 1. This should shift the note from C3 to C2.
- m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 0, 1);
+ m_pDoc->DeleteRow(0, 0, m_pDoc->MaxCol(), 0, 0, 1);
aAddr.IncRow(-1); // C2
CPPUNIT_ASSERT_EQUAL_MESSAGE("Note at C3 should have shifted up to C2.", pNote, m_pDoc->GetNote(aAddr));
@@ -4837,7 +4837,7 @@ void Test::testNoteDeleteRow()
bIgnoreNotes = false;
CPPUNIT_ASSERT_MESSAGE("The Block should NOT be detected as empty", !m_pDoc->IsBlockEmpty(0, 0, 0, 100, 100, bIgnoreNotes));
- m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 1, 1);
+ m_pDoc->DeleteRow(0, 0, m_pDoc->MaxCol(), 0, 1, 1);
CPPUNIT_ASSERT_MESSAGE("there should be no more note", !m_pDoc->HasNote(1, 1, 0));
@@ -4854,7 +4854,7 @@ void Test::testNoteDeleteRow()
ScDocFunc& rDocFunc = m_xDocShell->GetDocFunc();
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
- rDocFunc.DeleteCells(ScRange(0,1,0,MAXCOL,1,0), &aMark, DelCellCmd::CellsUp, true);
+ rDocFunc.DeleteCells(ScRange(0,1,0,m_pDoc->MaxCol(),1,0), &aMark, DelCellCmd::CellsUp, true);
// Check to make sure the notes have shifted upward.
pNote = m_pDoc->GetNote(ScAddress(1,1,0));
@@ -4883,7 +4883,7 @@ void Test::testNoteDeleteRow()
CPPUNIT_ASSERT_EQUAL(OUString("Second Note"), pNote->GetText());
// Delete row 3.
- rDocFunc.DeleteCells(ScRange(0,2,0,MAXCOL,2,0), &aMark, DelCellCmd::CellsUp, true);
+ rDocFunc.DeleteCells(ScRange(0,2,0,m_pDoc->MaxCol(),2,0), &aMark, DelCellCmd::CellsUp, true);
pNote = m_pDoc->GetNote(ScAddress(1,2,0));
CPPUNIT_ASSERT_MESSAGE("B3 should have a note.", pNote);
@@ -4917,7 +4917,7 @@ void Test::testNoteDeleteCol()
CPPUNIT_ASSERT_MESSAGE("there should be a note", m_pDoc->HasNote(1, 1, 0));
- m_pDoc->DeleteCol(0, 0, MAXROW, 0, 1, 1);
+ m_pDoc->DeleteCol(0, 0, m_pDoc->MaxRow(), 0, 1, 1);
CPPUNIT_ASSERT_MESSAGE("there should be no more note", !m_pDoc->HasNote(1, 1, 0));
@@ -5262,16 +5262,16 @@ void Test::testAnchoredRotatedShape()
bool bHidden = m_pDoc->RowHidden(0, 0, &nRow1, &nRow2);
CPPUNIT_ASSERT_MESSAGE("new sheet should have all rows visible", !bHidden);
CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", SCROW(0), nRow1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", SCROW(MAXROW), nRow2);
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("new sheet should have all rows visible", m_pDoc->MaxRow(), nRow2);
m_pDoc->InitDrawLayer();
ScDrawLayer *pDrawLayer = m_pDoc->GetDrawLayer();
CPPUNIT_ASSERT_MESSAGE("must have a draw layer", pDrawLayer != nullptr);
SdrPage* pPage = pDrawLayer->GetPage(0);
CPPUNIT_ASSERT_MESSAGE("must have a draw page", pPage != nullptr);
- m_pDoc->SetRowHeightRange(0, MAXROW, 0, o3tl::toTwips(1000, o3tl::Length::mm100));
+ m_pDoc->SetRowHeightRange(0, m_pDoc->MaxRow(), 0, o3tl::toTwips(1000, o3tl::Length::mm100));
constexpr tools::Long TOLERANCE = 30; //30 hmm
- for ( SCCOL nCol = 0; nCol < MAXCOL; ++nCol )
+ for ( SCCOL nCol = 0; nCol < m_pDoc->MaxCol(); ++nCol )
m_pDoc->SetColWidth(nCol, 0, o3tl::toTwips(1000, o3tl::Length::mm100));
{
//Add a rect
@@ -5335,12 +5335,12 @@ void Test::testCellTextWidth()
ScAddress aTopCell(0, 0, 0);
// Sheet is empty.
- std::unique_ptr<ScColumnTextWidthIterator> pIter(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW));
+ std::unique_ptr<ScColumnTextWidthIterator> pIter(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, m_pDoc->MaxRow()));
CPPUNIT_ASSERT_MESSAGE("Column should have no text widths stored.", !pIter->hasCell());
// Sheet only has one cell.
m_pDoc->SetString(0, 0, 0, "Only one cell");
- pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW));
+ pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, m_pDoc->MaxRow()));
CPPUNIT_ASSERT_MESSAGE("Column should have a cell.", pIter->hasCell());
CPPUNIT_ASSERT_EQUAL(SCROW(0), pIter->getPos());
@@ -5359,7 +5359,7 @@ void Test::testCellTextWidth()
{
// Full range.
- pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW));
+ pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, m_pDoc->MaxRow()));
SCROW aRows[] = { 0, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18 };
for (size_t i = 0; i < SAL_N_ELEMENTS(aRows); ++i, pIter->next())
{
@@ -5388,7 +5388,7 @@ void Test::testCellTextWidth()
{
// Full range again.
- pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW));
+ pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, m_pDoc->MaxRow()));
SCROW aRows[] = { 0, 2, 18 };
for (size_t i = 0; i < SAL_N_ELEMENTS(aRows); ++i, pIter->next())
{
@@ -5400,10 +5400,10 @@ void Test::testCellTextWidth()
// Delete row 2 which shifts all cells below row 2 upward. After this, we
// should only have cells at rows 0 and 17.
- m_pDoc->DeleteRow(0, 0, MAXCOL, MAXTAB, 2, 1);
+ m_pDoc->DeleteRow(0, 0, m_pDoc->MaxCol(), MAXTAB, 2, 1);
{
// Full range again.
- pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW));
+ pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, m_pDoc->MaxRow()));
SCROW aRows[] = { 0, 17 };
for (size_t i = 0; i < SAL_N_ELEMENTS(aRows); ++i, pIter->next())
{
@@ -5881,7 +5881,7 @@ void Test::testColumnFindEditCells()
// Test the basics with real edit cells, using Column A.
- SCROW nResRow = m_pDoc->GetFirstEditTextRow(ScRange(0,0,0,0,MAXROW,0));
+ SCROW nResRow = m_pDoc->GetFirstEditTextRow(ScRange(0,0,0,0,m_pDoc->MaxRow(),0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no edit cells.", SCROW(-1), nResRow);
nResRow = m_pDoc->GetFirstEditTextRow(ScRange(0,0,0,0,0,0));
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be no edit cells.", SCROW(-1), nResRow);
@@ -5909,7 +5909,7 @@ void Test::testColumnFindEditCells()
CPPUNIT_ASSERT_EQUAL_MESSAGE("There shouldn't be an edit cell in specified range.", SCROW(-1), nResRow);
aRange.aStart.SetRow(0);
- aRange.aEnd.SetRow(MAXROW);
+ aRange.aEnd.SetRow(m_pDoc->MaxRow());
nResRow = m_pDoc->GetFirstEditTextRow(aRange);
CPPUNIT_ASSERT_EQUAL_MESSAGE("There should be an edit cell in specified range.", SCROW(0), nResRow);
@@ -6195,7 +6195,7 @@ void Test::testUndoDataAnchor()
ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
- rFunc.InsertCells(ScRange( 0, aOldStart.Row() - 1, 0, MAXCOL, aOldStart.Row(), 0 ), &aMark, INS_INSROWS_BEFORE, true, true);
+ rFunc.InsertCells(ScRange( 0, aOldStart.Row() - 1, 0, m_pDoc->MaxCol(), aOldStart.Row(), 0 ), &aMark, INS_INSROWS_BEFORE, true, true);
pData = ScDrawLayer::GetObjData(pObj);
CPPUNIT_ASSERT_MESSAGE("Failed to retrieve user data for this object.", pData);
@@ -6502,7 +6502,7 @@ void Test::testProtectedSheetEditByRow()
// Remove protected flags from rows 2-5.
ScPatternAttr aAttr(m_pDoc->GetPool());
aAttr.GetItemSet().Put(ScProtectionAttr(false));
- m_pDoc->ApplyPatternAreaTab(0, 1, MAXCOL, 4, 0, aAttr);
+ m_pDoc->ApplyPatternAreaTab(0, 1, m_pDoc->MaxCol(), 4, 0, aAttr);
// Protect the sheet without any options.
ScTableProtection aProtect;
@@ -6510,7 +6510,7 @@ void Test::testProtectedSheetEditByRow()
m_pDoc->SetTabProtection(0, &aProtect);
// Try to delete row 3. It should fail.
- ScRange aRow3(0,2,0,MAXCOL,2,0);
+ ScRange aRow3(0,2,0,m_pDoc->MaxCol(),2,0);
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
bool bDeleted = rDocFunc.DeleteCells(aRow3, &aMark, DelCellCmd::Rows, true);
@@ -6525,7 +6525,7 @@ void Test::testProtectedSheetEditByRow()
CPPUNIT_ASSERT_MESSAGE("deletion of row 3 should succeed.", bDeleted);
// But, row deletion should still fail on a protected row.
- ScRange aRow10(0,9,0,MAXCOL,9,0);
+ ScRange aRow10(0,9,0,m_pDoc->MaxCol(),9,0);
bDeleted = rDocFunc.DeleteCells(aRow10, &aMark, DelCellCmd::Rows, true);
CPPUNIT_ASSERT_MESSAGE("deletion of row 10 should not be allowed.", !bDeleted);
@@ -6560,7 +6560,7 @@ void Test::testProtectedSheetEditByRow()
// Try to insert a row at row 3. It should fail because of matrix's presence.
- ScRange aRow3(0,2,1,MAXCOL,2,1);
+ ScRange aRow3(0,2,1,m_pDoc->MaxCol(),2,1);
bool bInserted = rDocFunc.InsertCells(aRow3, &aMark, INS_INSROWS_BEFORE, true, true);
CPPUNIT_ASSERT_MESSAGE("row insertion at row 3 should fail.", !bInserted);
}
@@ -6578,7 +6578,7 @@ void Test::testProtectedSheetEditByColumn()
// Remove protected flags from columns B to E.
ScPatternAttr aAttr(m_pDoc->GetPool());
aAttr.GetItemSet().Put(ScProtectionAttr(false));
- m_pDoc->ApplyPatternAreaTab(1, 0, 4, MAXROW, 0, aAttr);
+ m_pDoc->ApplyPatternAreaTab(1, 0, 4, m_pDoc->MaxRow(), 0, aAttr);
// Protect the sheet without any options.
ScTableProtection aProtect;
@@ -6586,7 +6586,7 @@ void Test::testProtectedSheetEditByColumn()
m_pDoc->SetTabProtection(0, &aProtect);
// Try to delete column C. It should fail.
- ScRange aCol3(2,0,0,2,MAXROW,0);
+ ScRange aCol3(2,0,0,2,m_pDoc->MaxRow(),0);
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
bool bDeleted = rDocFunc.DeleteCells(aCol3, &aMark, DelCellCmd::Cols, true);
@@ -6601,7 +6601,7 @@ void Test::testProtectedSheetEditByColumn()
CPPUNIT_ASSERT_MESSAGE("deletion of column 3 should succeed.", bDeleted);
// But, column deletion should still fail on a protected column.
- ScRange aCol10(9,0,0,9,MAXROW,0);
+ ScRange aCol10(9,0,0,9,m_pDoc->MaxRow(),0);
bDeleted = rDocFunc.DeleteCells(aCol10, &aMark, DelCellCmd::Cols, true);
CPPUNIT_ASSERT_MESSAGE("deletion of column 10 should not be allowed.", !bDeleted);
@@ -6636,7 +6636,7 @@ void Test::testProtectedSheetEditByColumn()
// Try to insert a column at column C. It should fail because of matrix's presence.
- ScRange aCol3(2,0,1,2,MAXROW,1);
+ ScRange aCol3(2,0,1,2,m_pDoc->MaxRow(),1);
bool bInserted = rDocFunc.InsertCells(aCol3, &aMark, INS_INSCOLS_BEFORE, true, true);
CPPUNIT_ASSERT_MESSAGE("column insertion at column C should fail.", !bInserted);
}
diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx
index a3d34b69e2c9..c783b8808c46 100644
--- a/sc/qa/unit/ucalc_condformat.cxx
+++ b/sc/qa/unit/ucalc_condformat.cxx
@@ -225,7 +225,7 @@ void TestCondformat::testCondFormatINSDEL()
auto pFormatTmp = pFormat.get();
pList->InsertNew(std::move(pFormat));
- m_pDoc->InsertCol(0,0,MAXROW,0,0,2);
+ m_pDoc->InsertCol(0,0,m_pDoc->MaxRow(),0,0,2);
const ScRangeList& rRange = pFormatTmp->GetRange();
CPPUNIT_ASSERT_EQUAL(static_cast<const ScRangeList&>(ScRange(2,0,0,2,3,0)), rRange);
@@ -251,7 +251,7 @@ void TestCondformat::testCondFormatInsertCol()
auto pFormatTmp = pFormat.get();
pList->InsertNew(std::move(pFormat));
- m_pDoc->InsertCol(0,0,MAXROW,0,4,2);
+ m_pDoc->InsertCol(0,0,m_pDoc->MaxRow(),0,4,2);
const ScRangeList& rRange = pFormatTmp->GetRange();
CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,0,5,3,0)), rRange);
@@ -274,7 +274,7 @@ void TestCondformat::testCondFormatInsertRow()
auto pFormatTmp = pFormat.get();
pList->InsertNew(std::move(pFormat));
- m_pDoc->InsertRow(0,0,MAXCOL,0,4,2);
+ m_pDoc->InsertRow(0,0,m_pDoc->MaxCol(),0,4,2);
const ScRangeList& rRange = pFormatTmp->GetRange();
CPPUNIT_ASSERT_EQUAL(ScRangeList(ScRange(0,0,0,3,5,0)), rRange);
@@ -563,15 +563,15 @@ void TestCondformat::testCondCopyPasteSingleRowToRange()
m_pDoc->AddCondFormat(std::move(pFormat), 0);
ScDocument aClipDoc(SCDOCMODE_CLIP);
- copyToClip(m_pDoc, ScRange(0,0,0,MAXCOL,0,0), &aClipDoc);
- ScRange aTargetRange(0,4,0,MAXCOL,4,0);
+ copyToClip(m_pDoc, ScRange(0,0,0,m_pDoc->MaxCol(),0,0), &aClipDoc);
+ ScRange aTargetRange(0,4,0,m_pDoc->MaxCol(),4,0);
pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc);
ScConditionalFormat* pNewFormat = m_pDoc->GetCondFormat(0, 4, 0);
CPPUNIT_ASSERT(pNewFormat);
CPPUNIT_ASSERT_EQUAL(pNewFormat->GetKey(), pFormatTmp->GetKey());
- for (SCCOL nCol = 1; nCol <= MAXCOL; ++nCol)
+ for (SCCOL nCol = 1; nCol <= m_pDoc->MaxCol(); ++nCol)
{
ScConditionalFormat* pNewFormat2 = m_pDoc->GetCondFormat(nCol, 4, 0);
CPPUNIT_ASSERT(!pNewFormat2);
@@ -595,10 +595,10 @@ void TestCondformat::testCondCopyPasteSingleRowToRange2()
ScDocument aClipDoc(SCDOCMODE_CLIP);
copyToClip(m_pDoc, ScRange(0,0,0,3,0,0), &aClipDoc);
- ScRange aTargetRange(0,4,0,MAXCOL,4,0);
+ ScRange aTargetRange(0,4,0,m_pDoc->MaxCol(),4,0);
pasteOneCellFromClip(m_pDoc, aTargetRange, &aClipDoc);
- for (SCCOL nCol = 0; nCol <= MAXCOL; ++nCol)
+ for (SCCOL nCol = 0; nCol <= m_pDoc->MaxCol(); ++nCol)
{
ScConditionalFormat* pNewFormat = m_pDoc->GetCondFormat(nCol, 4, 0);
if (nCol % 4 == 0)
@@ -1115,7 +1115,7 @@ void TestCondformat::testCondFormatUpdateReferenceDelRow()
pFormatTmp->AddEntry(pEntry);
- m_pDoc->DeleteRow(0, 0, MAXCOL, 0, 4, 1);
+ m_pDoc->DeleteRow(0, 0, m_pDoc->MaxCol(), 0, 4, 1);
OUString aStr = pEntry->GetExpression(ScAddress(0, 4, 0), 0);
CPPUNIT_ASSERT_EQUAL(OUString("B5"), aStr);
@@ -1136,7 +1136,7 @@ void TestCondformat::testCondFormatUpdateReferenceInsRow()
pFormatTmp->AddEntry(pEntry);
- m_pDoc->InsertRow(0, 0, MAXCOL, 0, 4, 1);
+ m_pDoc->InsertRow(0, 0, m_pDoc->MaxCol(), 0, 4, 1);
OUString aStr = pEntry->GetExpression(ScAddress(0, 6, 0), 0);
CPPUNIT_ASSERT_EQUAL(OUString("B7"), aStr);
diff --git a/sc/qa/unit/ucalc_copypaste.cxx b/sc/qa/unit/ucalc_copypaste.cxx
index 110d2ac481ab..78412c4d9820 100644
--- a/sc/qa/unit/ucalc_copypaste.cxx
+++ b/sc/qa/unit/ucalc_copypaste.cxx
@@ -9995,7 +9995,7 @@ void TestCopyPaste::testCopyPasteRepeatOneFormula()
#if !defined(USE_FORMULA_GROUP_LISTENER) || USE_FORMULA_GROUP_LISTENER
// At this point, there should be only one normal area listener listening
// on A1:B1.
- ScRange aWholeSheet(0, 0, 0, MAXCOL, MAXROW, 0);
+ ScRange aWholeSheet(0, 0, 0, m_pDoc->MaxCol(), m_pDoc->MaxRow(), 0);
ScBroadcastAreaSlotMachine* pBASM = m_pDoc->GetBASM();
CPPUNIT_ASSERT(pBASM);
std::vector<sc::AreaListener> aListeners
@@ -10042,7 +10042,7 @@ void TestCopyPaste::testCopyPasteRepeatOneFormula()
#endif
// Insert a new row at row 1.
- ScRange aRowOne(0, 0, 0, MAXCOL, 0, 0);
+ ScRange aRowOne(0, 0, 0, m_pDoc->MaxCol(), 0, 0);
aMark.SetMarkArea(aRowOne);
ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
rFunc.InsertCells(aRowOne, &aMark, INS_INSROWS_BEFORE, true, true);
diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx
index ac4383f4f544..7099b933dff8 100644
--- a/sc/qa/unit/ucalc_sharedformula.cxx
+++ b/sc/qa/unit/ucalc_sharedformula.cxx
@@ -350,7 +350,7 @@ void TestSharedFormula::testSharedFormulas()
// Delete rows 4:8 and shift row 9 and below up to row 4. This should
// re-merge the two into a group of B2:B5.
- m_pDoc->DeleteRow(ScRange(0,3,0,MAXCOL,7,0));
+ m_pDoc->DeleteRow(ScRange(0,3,0,m_pDoc->MaxCol(),7,0));
aPos.SetRow(1);
pFC = m_pDoc->GetFormulaCell(aPos);
CPPUNIT_ASSERT_MESSAGE("B2 should be a formula cell.", pFC);
@@ -359,7 +359,7 @@ void TestSharedFormula::testSharedFormulas()
CPPUNIT_ASSERT_EQUAL_MESSAGE("The token is expected to be shared.", pFC->GetCode(), pFC->GetSharedCode());
// Insert 2 rows at row 4, to split it into B2:B3 and B6:B7.
- m_pDoc->InsertRow(ScRange(0,3,0,MAXCOL,4,0));
+ m_pDoc->InsertRow(ScRange(0,3,0,m_pDoc->MaxCol(),4,0));
pFC = m_pDoc->GetFormulaCell(aPos);
CPPUNIT_ASSERT_MESSAGE("B2 should be a formula cell.", pFC);
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(1), pFC->GetSharedTopRow());
@@ -705,7 +705,7 @@ void TestSharedFormula::testSharedFormulasRefUpdateRange()
CPPUNIT_ASSERT_MESSAGE("B3 should be shared.", pFC->IsShared());
// Insert 2 rows at row 1.
- m_pDoc->InsertRow(ScRange(0,0,0,MAXCOL,1,0));
+ m_pDoc->InsertRow(ScRange(0,0,0,m_pDoc->MaxCol(),1,0));
// B5:B7 should be shared.
pFC = m_pDoc->GetFormulaCell(ScAddress(1,4,0));
@@ -810,7 +810,7 @@ void TestSharedFormula::testSharedFormulasRefUpdateRangeDeleteRow()
ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
- rFunc.DeleteCells(ScRange(0,2,0,MAXCOL,2,0), &aMark, DelCellCmd::Rows, true);
+ rFunc.DeleteCells(ScRange(0,2,0,m_pDoc->MaxCol(),2,0), &aMark, DelCellCmd::Rows, true);
// Make sure C1:C4 belong to the same group.
pFC = m_pDoc->GetFormulaCell(ScAddress(2,0,0));
@@ -923,7 +923,7 @@ void TestSharedFormula::testSharedFormulasRefUpdateExternal()
ScDocFunc& rDocFunc = m_xDocShell->GetDocFunc();
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
- rDocFunc.DeleteCells(ScRange(0,0,0,MAXCOL,1,0), &aMark, DelCellCmd::CellsUp, true);
+ rDocFunc.DeleteCells(ScRange(0,0,0,m_pDoc->MaxCol(),1,0), &aMark, DelCellCmd::CellsUp, true);
// Check the shifted formula cells now in A5:A8.
ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,4,0), "'file:///extdata.fake'#$Data.A1", "Wrong formula!");
@@ -1037,7 +1037,7 @@ void TestSharedFormula::testSharedFormulasInsertRow()
ScDocFunc& rFunc = m_xDocShell->GetDocFunc();
ScMarkData aMark(m_pDoc->GetSheetLimits());
aMark.SelectOneTable(0);
- rFunc.InsertCells(ScRange(0,2,0,MAXCOL,2,0), &aMark, INS_INSROWS_BEFORE, true, true);
+ rFunc.InsertCells(ScRange(0,2,0,m_pDoc->MaxCol(),2,0), &aMark, INS_INSROWS_BEFORE, true, true);
bool bResult = aCheck.checkContent(m_pDoc);
CPPUNIT_ASSERT_MESSAGE("Failed on the initial content check.", bResult);
@@ -1106,7 +1106,7 @@ void TestSharedFormula::testSharedFormulasDeleteRows()
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(10), pFC->GetSharedLength());
// Delete rows 9:12
- m_pDoc->DeleteRow(ScRange(0,8,0,MAXCOL,11,0));
+ m_pDoc->DeleteRow(ScRange(0,8,0,m_pDoc->MaxCol(),11,0));
// B1:B8 should be shared.
pFC = m_pDoc->GetFormulaCell(ScAddress(1,0,0));
@@ -1122,7 +1122,7 @@ void TestSharedFormula::testSharedFormulasDeleteRows()
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedLength());
// Delete row 3
- m_pDoc->DeleteRow(ScRange(0,2,0,MAXCOL,2,0));
+ m_pDoc->DeleteRow(ScRange(0,2,0,m_pDoc->MaxCol(),2,0));
// B1:B7 should be shared.
pFC = m_pDoc->GetFormulaCell(ScAddress(1,0,0));
@@ -1138,7 +1138,7 @@ void TestSharedFormula::testSharedFormulasDeleteRows()
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(8), pFC->GetSharedLength());
// Delete row 5
- m_pDoc->DeleteRow(ScRange(0,4,0,MAXCOL,4,0));
+ m_pDoc->DeleteRow(ScRange(0,4,0,m_pDoc->MaxCol(),4,0));
// B1:B6 should be shared.
pFC = m_pDoc->GetFormulaCell(ScAddress(1,0,0));
@@ -1173,7 +1173,7 @@ void TestSharedFormula::testSharedFormulasDeleteColumns()
CPPUNIT_ASSERT_EQUAL(11.0, m_pDoc->GetValue(ScAddress(2,0,0)));
// Delete column B.
- rFunc.DeleteCells(ScRange(1,0,0,1,MAXROW,0), &aMark, DelCellCmd::CellsLeft, true);
+ rFunc.DeleteCells(ScRange(1,0,0,1,m_pDoc->MaxRow(),0), &aMark, DelCellCmd::CellsLeft, true);
CPPUNIT_ASSERT_EQUAL(OUString("#REF!"), m_pDoc->GetString(ScAddress(1,0,0)));
// The reference should still point to row 1 but the column status should be set to 'deleted'.
@@ -1203,7 +1203,7 @@ void TestSharedFormula::testSharedFormulasDeleteColumns()
CPPUNIT_ASSERT_EQUAL(OUString("=B1"), pFC->GetFormula(aCFCxt));
// Clear row 1 and move over to a formula group case.
- clearRange(m_pDoc, ScRange(0,0,0,MAXCOL,0,0));
+ clearRange(m_pDoc, ScRange(0,0,0,m_pDoc->MaxCol(),0,0));
// Fill A1:B2 with numbers, and C1:C2 with formula that reference those numbers.
for (SCROW i = 0; i <= 1; ++i)
@@ -1217,7 +1217,7 @@ void TestSharedFormula::testSharedFormulasDeleteColumns()
}
// Delete column B.
- rFunc.DeleteCells(ScRange(1,0,0,1,MAXROW,0), &aMark, DelCellCmd::CellsLeft, true);
+ rFunc.DeleteCells(ScRange(1,0,0,1,m_pDoc->MaxRow(),0), &aMark, DelCellCmd::CellsLeft, true);
for (SCROW i = 0; i <= 1; ++i)
{
@@ -1498,7 +1498,7 @@ void TestSharedFormula::testSharedFormulaInsertColumn()
m_pDoc->SetString(ScAddress(7,2,0), "=G4*B4");
// Insert a single column at Column F. This used to crash before fdo#74041.
- m_pDoc->InsertCol(ScRange(5,0,0,5,MAXROW,0));
+ m_pDoc->InsertCol(ScRange(5,0,0,5,m_pDoc->MaxRow(),0));
ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(8,1,0), "H3*B3", "Wrong formula!");
ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(8,2,0), "H4*B4", "Wrong formula!");
@@ -1566,7 +1566,7 @@ void TestSharedFormula::testSharedFormulaMoveBlock()
CPPUNIT_ASSERT_EQUAL(3.0, m_pDoc->GetValue(ScAddress(1,2,0)));
// Clear the range and start over.
- clearRange(m_pDoc, ScRange(0,0,0,MAXCOL,MAXROW,0));
+ clearRange(m_pDoc, ScRange(0,0,0,m_pDoc->MaxCol(),m_pDoc->MaxRow(),0));
// Set values 1,2,3,4,5 to A1:A5.
for (SCROW i = 0; i <= 4; ++i)
diff --git a/sc/qa/unit/ucalc_sort.cxx b/sc/qa/unit/ucalc_sort.cxx
index ccff4d77b50d..777a8edcf441 100644
--- a/sc/qa/unit/ucalc_sort.cxx
+++ b/sc/qa/unit/ucalc_sort.cxx
@@ -295,7 +295,7 @@ void TestSort::testSortHorizontalWholeColumn()
CPPUNIT_ASSERT_EQUAL(9.0, m_pDoc->GetValue(ScAddress(6,0,0)));
// Extend the sort range to whole column.
- aSortRange.aEnd.SetRow(MAXROW);
+ aSortRange.aEnd.SetRow(m_pDoc->MaxRow());
SCCOL nCol1 = aSortRange.aStart.Col();
SCCOL nCol2 = aSortRange.aEnd.Col();
@@ -1246,7 +1246,7 @@ void TestSort::testSortRefUpdate4_Impl()
{
ScSortParam aSortData;
aSortData.nCol1 = 0;
- aSortData.nCol2 = MAXCOL;
+ aSortData.nCol2 = m_pDoc->MaxCol();
aSortData.nRow1 = aSortRange.aStart.Row()+1;
aSortData.nRow2 = aSortRange.aEnd.Row();
aSortData.bHasHeader = false;
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index e998ad9c841d..ee8bf407ba0e 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -458,7 +458,7 @@ std::vector<double>& ScColorFormat::getValues() const
SCCOL nColEnd = rRange.aEnd.Col();
SCROW nRowEnd = rRange.aEnd.Row();
- if(nRowEnd == MAXROW)
+ if(nRowEnd == mpDoc->MaxRow())
{
bool bShrunk = false;
mpDoc->ShrinkToUsedDataArea(bShrunk, nTab, nColStart, nRowStart,
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index e67b7c56b3c3..841238883dcb 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -776,7 +776,7 @@ void ScConditionEntry::FillCache() const
// temporary fix to workaround slow duplicate entry
// conditions, prevent to use a whole row
- if(nRow == MAXROW)
+ if(nRow == mpDoc->MaxRow())
{
bool bShrunk = false;
mpDoc->ShrinkToUsedDataArea(bShrunk, nTab, nColStart, nRowStart,
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 1160b45c1d7c..e625868b5466 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1358,7 +1358,7 @@ bool ScDrawLayer::GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) co
rRange.aStart.SetCol( 0 );
if (nWidth <= nStartX)
{
- for (SCCOL nCol : pDoc->GetColumnsRange(nTab, 0, MAXCOL))
+ for (SCCOL nCol : pDoc->GetColumnsRange(nTab, 0, pDoc->MaxCol()))
{
nWidth += pDoc->GetColWidth(nCol,nTab);
if (nWidth > nStartX)
@@ -1373,7 +1373,7 @@ bool ScDrawLayer::GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) co
rRange.aEnd.SetCol( 0 );
if (nWidth <= nEndX)
{
- for (SCCOL nCol : pDoc->GetColumnsRange(nTab, 0, MAXCOL)) //TODO: start at Start
+ for (SCCOL nCol : pDoc->GetColumnsRange(nTab, 0, pDoc->MaxCol())) //TODO: start at Start
{
nWidth += pDoc->GetColWidth(nCol,nTab);
if (nWidth > nEndX)
@@ -1392,7 +1392,7 @@ bool ScDrawLayer::GetPrintArea( ScRange& rRange, bool bSetHor, bool bSetVer ) co
SCROW nRow = pDoc->GetRowForHeight( nTab, nStartY);
rRange.aStart.SetRow( nRow>0 ? (nRow-1) : 0);
nRow = pDoc->GetRowForHeight( nTab, nEndY);
- rRange.aEnd.SetRow( nRow == MAXROW ? MAXROW :
+ rRange.aEnd.SetRow( nRow == pDoc->MaxRow() ? pDoc->MaxRow() :
(nRow>0 ? (nRow-1) : 0));
}
}
@@ -1503,7 +1503,7 @@ bool ScDrawLayer::HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow )
aTestRect.AdjustTop(pDoc->GetRowHeight( 0, nStartRow-1, nTab) );
- if (nEndRow==MAXROW)
+ if (nEndRow==pDoc->MaxRow())
aTestRect.SetBottom( MAXMM );
else
{
@@ -2470,7 +2470,7 @@ ScDrawLayer::GetObjectsAnchoredToRows(SCTAB nTab, SCROW nStartRow, SCROW nEndRow
std::vector<SdrObject*> aObjects;
SdrObjListIter aIter( pPage, SdrIterMode::Flat );
SdrObject* pObject = aIter.Next();
- ScRange aRange( 0, nStartRow, nTab, MAXCOL, nEndRow, nTab);
+ ScRange aRange( 0, nStartRow, nTab, pDoc->MaxCol(), nEndRow, nTab);
while (pObject)
{
if (!dynamic_cast<SdrCaptionObj*>(pObject)) // Caption objects are handled differently
@@ -2542,7 +2542,7 @@ std::vector<SdrObject*> ScDrawLayer::GetObjectsAnchoredToCols(SCTAB nTab, SCCOL
std::vector<SdrObject*> aObjects;
SdrObjListIter aIter(pPage, SdrIterMode::Flat);
SdrObject* pObject = aIter.Next();
- ScRange aRange(nStartCol, 0, nTab, nEndCol, MAXROW, nTab);
+ ScRange aRange(nStartCol, 0, nTab, nEndCol, pDoc->MaxRow(), nTab);
while (pObject)
{
if (!dynamic_cast<SdrCaptionObj*>(pObject)) // Caption objects are handled differently
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 945dc0cb2490..f3c0c1ed305b 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -5235,11 +5235,11 @@ void startListeningArea(
{ // automagically
if ( rRef1.IsColRel() )
{ // ColName
- aCell2.SetRow(MAXROW);
+ aCell2.SetRow(rDoc.MaxRow());
}
else
{ // RowName
- aCell2.SetCol(MAXCOL);
+ aCell2.SetCol(rDoc.MaxCol());
}
}
rDoc.StartListeningArea(ScRange(aCell1, aCell2), false, pCell);
@@ -5347,11 +5347,11 @@ void endListeningArea(
{ // automagically
if ( rRef1.IsColRel() )
{ // ColName
- aCell2.SetRow(MAXROW);
+ aCell2.SetRow(rDoc.MaxRow());
}
else
{ // RowName
- aCell2.SetCol(MAXCOL);
+ aCell2.SetCol(rDoc.MaxCol());
}
}
diff --git a/sc/source/core/data/stlsheet.cxx b/sc/source/core/data/stlsheet.cxx
index 5712bf883c78..e485b5f7fc99 100644
--- a/sc/source/core/data/stlsheet.cxx
+++ b/sc/source/core/data/stlsheet.cxx
@@ -113,7 +113,7 @@ bool ScStyleSheet::SetParent( const OUString& rParentName )
// RepaintRange checks the document's IsVisible flag and locked repaints.
ScDocument* pDoc = static_cast<ScStyleSheetPool*>(GetPool())->GetDocument();
if (pDoc)
- pDoc->RepaintRange( ScRange( 0,0,0, MAXCOL,MAXROW,MAXTAB ) );
+ pDoc->RepaintRange( ScRange( 0,0,0, pDoc->MaxCol(),pDoc->MaxRow(),MAXTAB ) );
}
}
diff --git a/sc/source/core/data/table6.cxx b/sc/source/core/data/table6.cxx
index c126424a26ec..4245e8c548da 100644
--- a/sc/source/core/data/table6.cxx
+++ b/sc/source/core/data/table6.cxx
@@ -799,7 +799,7 @@ bool ScTable::SearchAndReplace(
bool bFound = false;
if ( ValidColRow(rCol, rRow) ||
((nCommand == SvxSearchCmd::FIND || nCommand == SvxSearchCmd::REPLACE) &&
- (((rCol == MAXCOLCOUNT || rCol == -1) && ValidRow(rRow)) ||
+ (((rCol == GetDoc().GetSheetLimits().GetMaxColCount() || rCol == -1) && ValidRow(rRow)) ||
((rRow == GetDoc().GetSheetLimits().GetMaxRowCount() || rRow == -1) && ValidCol(rCol))
)
)
diff --git a/sc/source/core/data/table7.cxx b/sc/source/core/data/table7.cxx
index b66b9d88eb3a..f5c27323090c 100644
--- a/sc/source/core/data/table7.cxx
+++ b/sc/source/core/data/table7.cxx
@@ -520,19 +520,19 @@ OString ScTable::dumpColumnRowSizes(bool bColumns)
// If the data-structures are not available, just report that all
// rows/cols have the default sizes.
static const OString aDefaultForCols
- = OString::number(STD_COL_WIDTH) + ":" + OString::number(MAXCOL) + " ";
+ = OString::number(STD_COL_WIDTH) + ":" + OString::number(GetDoc().MaxCol()) + " ";
static const OString aDefaultForRows
- = OString::number(ScGlobal::nStdRowHeight) + ":" + OString::number(MAXROW) + " ";
+ = OString::number(ScGlobal::nStdRowHeight) + ":" + OString::number(GetDoc().MaxRow()) + " ";
// ScCompressedArray is a template class and we don't want to impose
// the restriction that its value type should be string serializable,
// instead just operate on the specialized object.
typedef ScCompressedArray<SCCOL, sal_uInt16> ColWidthsType;
- auto dumpColWidths = [](const ColWidthsType& rWidths) -> OString {
+ auto dumpColWidths = [this](const ColWidthsType& rWidths) -> OString {
OString aOutput;
OString aSegment;
SCCOL nStartCol = 0;
- const SCCOL nMaxCol = std::min(rWidths.GetLastPos(), MAXCOL);
+ const SCCOL nMaxCol = std::min(rWidths.GetLastPos(), GetDoc().MaxCol());
size_t nDummy = 0;
while (nStartCol <= nMaxCol)
{
@@ -558,8 +558,8 @@ OString ScTable::dumpColumnRowSizes(bool bColumns)
OString ScTable::dumpHiddenFiltered(bool bColumns, bool bHidden)
{
// defaults to no hidden/filtered row/cols.
- static const OString aDefaultForCols = "0:" + OString::number(MAXCOL) + " ";
- static const OString aDefaultForRows = "0:" + OString::number(MAXROW) + " ";
+ static const OString aDefaultForCols = "0:" + OString::number(GetDoc().MaxCol()) + " ";
+ static const OString aDefaultForRows = "0:" + OString::number(GetDoc().MaxRow()) + " ";
if (bHidden)
{
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index c5e97a2ffdf5..4db0e20ce5a4 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1791,14 +1791,14 @@ void ScGridWindow::DrawHiddenIndicator( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW n
aLineInfo.SetLineCap(css::drawing::LineCap_ROUND);
aLineInfo.SetDotLen(1);
for (int i=nX1; i<nX2; i++) {
- if (rDoc.ColHidden(i,nTab) && (i<MAXCOL ? !rDoc.ColHidden(i+1,nTab) : true)) {
+ if (rDoc.ColHidden(i,nTab) && (i<rDoc.MaxCol() ? !rDoc.ColHidden(i+1,nTab) : true)) {
Point aStart = mrViewData.GetScrPos(i, nY1, eWhich, true );
Point aEnd = mrViewData.GetScrPos(i, nY2, eWhich, true );
rRenderContext.DrawLine(aStart,aEnd,aLineInfo);
}
}
for (int i=nY1; i<nY2; i++) {
- if (rDoc.RowHidden(i,nTab) && (i<MAXROW ? !rDoc.RowHidden(i+1,nTab) : true)) {
+ if (rDoc.RowHidden(i,nTab) && (i<rDoc.MaxRow() ? !rDoc.RowHidden(i+1,nTab) : true)) {
Point aStart = mrViewData.GetScrPos(nX1, i, eWhich, true );
Point aEnd = mrViewData.GetScrPos(nX2, i, eWhich, true );
rRenderContext.DrawLine(aStart,aEnd,aLineInfo);