[Libreoffice-commits] core.git: sc/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Tue Dec 22 09:44:41 UTC 2020
sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx | 3 +-
sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx | 2 -
sc/source/ui/dataprovider/datatransformation.cxx | 8 ++---
sc/source/ui/dbgui/tpsort.cxx | 4 +-
sc/source/ui/dbgui/tpsubt.cxx | 14 +++++-----
sc/source/ui/docshell/externalrefmgr.cxx | 6 ++--
sc/source/ui/inc/tpsort.hxx | 3 +-
sc/source/ui/inc/tpsubt.hxx | 6 +---
sc/source/ui/pagedlg/areasdlg.cxx | 3 +-
sc/source/ui/unoobj/chart2uno.cxx | 7 ++---
sc/source/ui/view/tabview.cxx | 6 ++--
sc/source/ui/view/viewfun2.cxx | 2 -
12 files changed, 34 insertions(+), 30 deletions(-)
New commits:
commit 12fd3cf163bd922e1fc2b4e2c31c7f77c2313676
Author: Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Mon Dec 21 20:20:54 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Dec 22 10:44:00 2020 +0100
more jumbo sheet work
Change-Id: I67884a0c0b897d8d60f2cfaba644e01f90f7d164
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108123
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx b/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx
index 88e7fef5d1d8..9688e17ac68f 100644
--- a/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx
+++ b/sc/source/ui/StatisticsDialogs/FourierAnalysisDialog.cxx
@@ -14,6 +14,7 @@
#include <FourierAnalysisDialog.hxx>
#include <scresid.hxx>
#include <strings.hrc>
+#include <o3tl/safeint.hxx>
ScFourierAnalysisDialog::ScFourierAnalysisDialog(SfxBindings* pSfxBindings,
SfxChildWindow* pChildWindow,
@@ -142,7 +143,7 @@ bool ScFourierAnalysisDialog::InputRangesValid()
if (mbWithLabels)
--nLastOutputRow;
- if (nLastOutputRow > MAXROW)
+ if (nLastOutputRow > o3tl::make_unsigned(mDocument.MaxRow()))
{
mxErrorMessage->set_label(ScResId(STR_MESSAGE_OUTPUT_TOO_LONG));
return false;
diff --git a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
index 3047ba34f46a..46f58599e131 100644
--- a/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
+++ b/sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools.cxx
@@ -169,7 +169,7 @@ void AddressWalkerWriter::writeFormulas(const std::vector<OUString>& rFormulas)
if (!nLength)
return;
- const size_t nMaxLen = MAXROW - mCurrentAddress.Row() + 1;
+ const size_t nMaxLen = mpDocShell->GetDocument().MaxRow() - mCurrentAddress.Row() + 1;
// If not done already, trim the length to fit.
if (nLength > nMaxLen)
nLength = nMaxLen;
diff --git a/sc/source/ui/dataprovider/datatransformation.cxx b/sc/source/ui/dataprovider/datatransformation.cxx
index 5a7be1c023cb..7a03f7ed3871 100644
--- a/sc/source/ui/dataprovider/datatransformation.cxx
+++ b/sc/source/ui/dataprovider/datatransformation.cxx
@@ -32,7 +32,7 @@ DataTransformation::~DataTransformation()
SCROW DataTransformation::getLastRow(const ScDocument& rDoc, SCCOL nCol)
{
- SCROW nEndRow = MAXROW;
+ SCROW nEndRow = rDoc.MaxRow();
return rDoc.GetLastDataRow(0, nCol, nCol, nEndRow);
}
@@ -50,7 +50,7 @@ void ColumnRemoveTransformation::Transform(ScDocument& rDoc) const
{
for (auto& rCol : maColumns)
{
- rDoc.DeleteCol(0, 0, MAXROW, 0, rCol, 1);
+ rDoc.DeleteCol(0, 0, rDoc.MaxRow(), 0, rCol, 1);
}
}
@@ -72,7 +72,7 @@ SplitColumnTransformation::SplitColumnTransformation(SCCOL nCol, sal_Unicode cSe
void SplitColumnTransformation::Transform(ScDocument& rDoc) const
{
- rDoc.InsertCol(0, 0, MAXROW, 0, mnCol + 1, 1);
+ rDoc.InsertCol(0, 0, rDoc.MaxRow(), 0, mnCol + 1, 1);
SCROW nEndRow = getLastRow(rDoc, mnCol);
for (SCROW nRow = 0; nRow <= nEndRow; ++nRow)
@@ -146,7 +146,7 @@ void MergeColumnTransformation::Transform(ScDocument& rDoc) const
if (itr == nTargetCol)
continue;
- rDoc.DeleteCol(0, 0, MAXROW, 0, itr, 1);
+ rDoc.DeleteCol(0, 0, rDoc.MaxRow(), 0, itr, 1);
}
}
diff --git a/sc/source/ui/dbgui/tpsort.cxx b/sc/source/ui/dbgui/tpsort.cxx
index f8c2a996bd22..4b37477b5c30 100644
--- a/sc/source/ui/dbgui/tpsort.cxx
+++ b/sc/source/ui/dbgui/tpsort.cxx
@@ -339,7 +339,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
SCCOL nMaxCol = rDoc.ClampToAllocatedColumns(nTab, aSortData.nCol2);
SCCOL col;
- for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
+ for ( col=nFirstSortCol; col<=nMaxCol && i<SC_MAXFIELDS(rDoc.GetSheetLimits()); col++ )
{
aFieldName = rDoc.GetString(col, nFirstSortRow, nTab);
if ( !bHasHeader || aFieldName.isEmpty() )
@@ -360,7 +360,7 @@ void ScTabPageSortFields::FillFieldLists( sal_uInt16 nStartField )
SCROW nMaxRow = aSortData.nRow2;
SCROW row;
- for ( row=nFirstSortRow; row<=nMaxRow && i<SC_MAXFIELDS; row++ )
+ for ( row=nFirstSortRow; row<=nMaxRow && i<SC_MAXFIELDS(rDoc.GetSheetLimits()); row++ )
{
aFieldName = rDoc.GetString(nFirstSortCol, row, nTab);
if ( !bHasHeader || aFieldName.isEmpty() )
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 4a8d8d85ddab..e99e56bf8d33 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -31,6 +31,7 @@
#include <subtotals.hrc>
#include <tpsubt.hxx>
+#include <tpsort.hxx>
#include <memory>
#include <osl/diagnose.h>
@@ -83,7 +84,8 @@ void ScTpSubTotalGroup::Init()
mxLbFunctions->connect_changed( LINK( this, ScTpSubTotalGroup, SelectTreeListBoxHdl) );
mxLbSelectAllColumns->connect_clicked( LINK( this, ScTpSubTotalGroup, CheckBoxHdl ) );
- nFieldArr[0] = 0;
+ mnFieldArr.resize(SC_MAXFIELDS(pDoc->GetSheetLimits()));
+ mnFieldArr[0] = 0;
FillListBoxes();
}
@@ -206,7 +208,7 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo,
theSubTotalData.nRow2 = rSubTotalData.nRow2;
theSubTotalData.bGroupActive[nGroupIdx] = (nGroup != 0);
theSubTotalData.nField[nGroupIdx] = (nGroup != 0)
- ? nFieldArr[nGroup-1]
+ ? mnFieldArr[nGroup-1]
: static_cast<SCCOL>(0);
if ( nEntryCount>0 && nCheckCount>0 && nGroup!=0 )
@@ -223,7 +225,7 @@ bool ScTpSubTotalGroup::DoFillItemSet( sal_uInt16 nGroupNo,
OSL_ENSURE( nCheck <= nCheckCount,
"Range error :-(" );
nFunction = mxLbColumns->get_id(i).toUInt32();
- pSubTotals[nCheck] = nFieldArr[i];
+ pSubTotals[nCheck] = mnFieldArr[i];
pFunctions[nCheck] = LbPosToFunc( nFunction );
nCheck++;
}
@@ -259,14 +261,14 @@ void ScTpSubTotalGroup::FillListBoxes()
mxLbGroup->insert_text(0, aStrNone );
sal_uInt16 i=0;
- for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS; col++ )
+ for ( col=nFirstCol; col<=nMaxCol && i<SC_MAXFIELDS(pDoc->GetSheetLimits()); col++ )
{
aFieldName = pDoc->GetString(col, nFirstRow, nTab);
if ( aFieldName.isEmpty() )
{
aFieldName = ScGlobal::ReplaceOrAppend( aStrColumn, u"%1", ScColToAlpha( col ));
}
- nFieldArr[i] = col;
+ mnFieldArr[i] = col;
mxLbGroup->insert_text(i+1, aFieldName);
mxLbColumns->insert(i);
mxLbColumns->set_toggle(i, TRISTATE_FALSE);
@@ -285,7 +287,7 @@ sal_uInt16 ScTpSubTotalGroup::GetFieldSelPos( SCCOL nField )
for ( sal_uInt16 n=0; n<nFieldCount && !bFound; n++ )
{
- if ( nFieldArr[n] == nField )
+ if ( mnFieldArr[n] == nField )
{
nFieldPos = n;
bFound = true;
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index c505e1501370..176e65836b25 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -1575,7 +1575,7 @@ static std::unique_ptr<ScTokenArray> convertToTokenArray(
{
rSrcDoc.FillMatrix(*xMat, nTab, nCol1, nRow1, nCol2, nRow2, &rHostDoc.GetSharedStringPool());
}
- else if ((nCol1 == 0 && nCol2 == MAXCOL) || (nRow1 == 0 && nRow2 == MAXROW))
+ else if ((nCol1 == 0 && nCol2 == rSrcDoc.MaxCol()) || (nRow1 == 0 && nRow2 == rSrcDoc.MaxRow()))
{
if ((o3tl::make_unsigned(nDataCol2-nDataCol1+1) < nMatrixColumns) ||
(o3tl::make_unsigned(nDataRow2-nDataRow1+1) < nMatrixRows))
@@ -1947,8 +1947,8 @@ ScExternalRefCache::TokenRef ScExternalRefManager::getSingleRefToken(
if (pTab)
*pTab = nTab;
- SCCOL nDataCol1 = 0, nDataCol2 = MAXCOL;
- SCROW nDataRow1 = 0, nDataRow2 = MAXROW;
+ SCCOL nDataCol1 = 0, nDataCol2 = pSrcDoc->MaxCol();
+ SCROW nDataRow1 = 0, nDataRow2 = pSrcDoc->MaxRow();
bool bData = pSrcDoc->ShrinkToDataArea(nTab, nDataCol1, nDataRow1, nDataCol2, nDataRow2);
if (!bData || rCell.Col() < nDataCol1 || nDataCol2 < rCell.Col() || rCell.Row() < nDataRow1 || nDataRow2 < rCell.Row())
{
diff --git a/sc/source/ui/inc/tpsort.hxx b/sc/source/ui/inc/tpsort.hxx
index 1c59ef1a2f1a..ba87a01231a8 100644
--- a/sc/source/ui/inc/tpsort.hxx
+++ b/sc/source/ui/inc/tpsort.hxx
@@ -31,10 +31,11 @@
#include "sortkeydlg.hxx"
#include <address.hxx>
+#include <sheetlimits.hxx>
#include <sortparam.hxx>
// +1 because one field is reserved for the "- undefined -" entry
-#define SC_MAXFIELDS MAXCOLCOUNT+1
+inline SCCOL SC_MAXFIELDS(const ScSheetLimits& rLimits) { return rLimits.GetMaxColCount() + 1; }
class ScViewData;
diff --git a/sc/source/ui/inc/tpsubt.hxx b/sc/source/ui/inc/tpsubt.hxx
index 93652127d026..c4b8fea42322 100644
--- a/sc/source/ui/inc/tpsubt.hxx
+++ b/sc/source/ui/inc/tpsubt.hxx
@@ -22,9 +22,7 @@
#include <sfx2/tabdlg.hxx>
#include <global.hxx>
-
-// +1 because one field is reserved for the "- none -" entry
-#define SC_MAXFIELDS MAXCOLCOUNT+1
+#include <sheetlimits.hxx>
class ScViewData;
class ScDocument;
@@ -51,7 +49,7 @@ protected:
const sal_uInt16 nWhichSubTotals;
const ScSubTotalParam& rSubTotalData;
- SCCOL nFieldArr[SC_MAXFIELDS];
+ std::vector<SCCOL> mnFieldArr;
sal_uInt16 nFieldCount;
std::unique_ptr<weld::ComboBox> mxLbGroup;
diff --git a/sc/source/ui/pagedlg/areasdlg.cxx b/sc/source/ui/pagedlg/areasdlg.cxx
index 1a3a34cfc9f9..d2639b085a77 100644
--- a/sc/source/ui/pagedlg/areasdlg.cxx
+++ b/sc/source/ui/pagedlg/areasdlg.cxx
@@ -653,7 +653,8 @@ static bool lcl_CheckOne_XL_R1C1( const ScDocument& rDoc, const OUString& rStr,
if (nNum <= 0)
return false;
- if ((bIsRow && nNum > rDoc.GetSheetLimits().GetMaxRowCount()) || (!bIsRow && nNum > MAXCOLCOUNT))
+ if ((bIsRow && nNum > rDoc.GetSheetLimits().GetMaxRowCount()) ||
+ (!bIsRow && nNum > rDoc.GetSheetLimits().GetMaxColCount()))
return false;
rVal = static_cast<SCCOLROW>(nNum-1);
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index 004729176c2e..7f1bf63bd548 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1061,7 +1061,7 @@ bool lcl_addUpperLeftCornerIfMissing(const ScDocument* pDoc, vector<ScTokenRef>&
if (rRefTokens.empty())
return false;
- SCCOL nMinCol = MAXCOLCOUNT;
+ SCCOL nMinCol = pDoc->GetSheetLimits().GetMaxColCount();
SCROW nMinRow = pDoc->GetSheetLimits().GetMaxRowCount();
SCCOL nMaxCol = 0;
SCROW nMaxRow = 0;
@@ -1207,9 +1207,10 @@ bool lcl_addUpperLeftCornerIfMissing(const ScDocument* pDoc, vector<ScTokenRef>&
}
}
+ const auto & rSheetLimits = pDoc->GetSheetLimits();
if (nMinRow >= nMaxRow || nMinCol >= nMaxCol ||
- nMinRow >= pDoc->GetSheetLimits().GetMaxRowCount() || nMinCol >= MAXCOLCOUNT ||
- nMaxRow >= pDoc->GetSheetLimits().GetMaxRowCount() || nMaxCol >= MAXCOLCOUNT)
+ nMinRow >= rSheetLimits.GetMaxRowCount() || nMinCol >= rSheetLimits.GetMaxColCount() ||
+ nMaxRow >= rSheetLimits.GetMaxRowCount() || nMaxCol >= rSheetLimits.GetMaxColCount())
{
// Invalid range. Bail out.
return false;
diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx
index 4374eae1d34c..1769bf007e6e 100644
--- a/sc/source/ui/view/tabview.cxx
+++ b/sc/source/ui/view/tabview.cxx
@@ -2832,9 +2832,11 @@ void ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle, tools::J
OString ScTabView::getSheetGeometryData(bool bColumns, bool bRows, bool bSizes, bool bHidden,
bool bFiltered, bool bGroups)
{
+ ScDocument& rDoc = aViewData.GetDocument();
+
boost::property_tree::ptree aTree;
aTree.put("commandName", ".uno:SheetGeometryData");
- aTree.put("maxtiledcolumn", MAXCOL);
+ aTree.put("maxtiledcolumn", rDoc.MaxCol());
aTree.put("maxtiledrow", MAXTILEDROW);
auto getJSONString = [](const boost::property_tree::ptree& rTree) {
@@ -2843,8 +2845,6 @@ OString ScTabView::getSheetGeometryData(bool bColumns, bool bRows, bool bSizes,
return aStream.str();
};
- ScDocument& rDoc = aViewData.GetDocument();
-
if ((!bSizes && !bHidden && !bFiltered && !bGroups) ||
(!bColumns && !bRows))
{
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 92452d24f71d..b416928ca30b 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -155,7 +155,7 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
SCROW nStartNo = rRow.mnStart;
SCROW nEndNo = rRow.mnEnd;
ScAddress aTopLeft(0, nStartNo, nTab);
- rDoc.UpdateScriptTypes(aTopLeft, MAXCOLCOUNT, nEndNo-nStartNo+1);
+ rDoc.UpdateScriptTypes(aTopLeft, rDoc.GetSheetLimits().GetMaxColCount(), nEndNo-nStartNo+1);
if (rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab))
{
if (!bChanged)
More information about the Libreoffice-commits
mailing list