diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-23 12:22:21 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-23 16:36:07 +0200 |
commit | dbf02b8b6c34313affda860fc6c5bbc64839b2d9 (patch) | |
tree | 5c69ab9e7b2d62c7940d316459d1544c18d3aa8e | |
parent | 6055814a98a764117cd95adf2bbab91fa34456c2 (diff) |
sc: rowcol: tdf#50916 convert docshell
Change-Id: I52c641bfba397134ad5ed2a9e8005f8959092303
Reviewed-on: https://gerrit.libreoffice.org/81381
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/source/ui/docshell/arealink.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/datastream.cxx | 7 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocfun.cxx | 36 | ||||
-rw-r--r-- | sc/source/ui/docshell/dbdocimp.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh3.cxx | 26 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh4.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh5.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh6.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/docsh8.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/docshell/impex.cxx | 40 | ||||
-rw-r--r-- | sc/source/ui/docshell/olinefun.cxx | 50 | ||||
-rw-r--r-- | sc/source/ui/docshell/tablink.cxx | 8 |
13 files changed, 118 insertions, 117 deletions
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index b04b0ba0cf9d..fab53d07bd8c 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -342,7 +342,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, if ( nNewEndX != nOldEndX || nNewEndY != nOldEndY ) // range changed? { pUndoDoc->InitUndo( &rDoc, 0, rDoc.GetTableCount()-1 ); - rDoc.CopyToDocument(0, 0, 0, MAXCOL, MAXROW, MAXTAB, + rDoc.CopyToDocument(0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, InsertDeleteFlags::FORMULA, false, *pUndoDoc); // all formulas } else @@ -381,7 +381,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, ScClipParam aClipParam(rTokenRange, false); rSrcDoc.CopyToClip(aClipParam, &aClipDoc, &aSourceMark, false, false); - if ( aClipDoc.HasAttrib( 0,0,nSrcTab, MAXCOL,MAXROW,nSrcTab, + if ( aClipDoc.HasAttrib( 0,0,nSrcTab, rDoc.MaxCol(),rDoc.MaxRow(),nSrcTab, HasAttrFlags::Merged | HasAttrFlags::Overlapped ) ) { //! ResetAttrib at document !!! @@ -389,7 +389,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, ScPatternAttr aPattern( rSrcDoc.GetPool() ); aPattern.GetItemSet().Put( ScMergeAttr() ); // Defaults aPattern.GetItemSet().Put( ScMergeFlagAttr() ); - aClipDoc.ApplyPatternAreaTab( 0,0, MAXCOL,MAXROW, nSrcTab, aPattern ); + aClipDoc.ApplyPatternAreaTab( 0,0, rDoc.MaxCol(),rDoc.MaxRow(), nSrcTab, aPattern ); } aNewTokenRange.aEnd.SetCol( aNewTokenRange.aStart.Col() + (rTokenRange.aEnd.Col() - rTokenRange.aStart.Col()) ); @@ -445,9 +445,9 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, SCROW nPaintEndY = std::max( aOldRange.aEnd.Row(), aNewRange.aEnd.Row() ); if ( aOldRange.aEnd.Col() != aNewRange.aEnd.Col() ) - nPaintEndX = MAXCOL; + nPaintEndX = rDoc.MaxCol(); if ( aOldRange.aEnd.Row() != aNewRange.aEnd.Row() ) - nPaintEndY = MAXROW; + nPaintEndY = rDoc.MaxRow(); if ( !m_pDocSh->AdjustRowHeight( aDestPos.Row(), nPaintEndY, nDestTab ) ) m_pDocSh->PostPaint( diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx index fab62d89af2d..3e3c46b86140 100644 --- a/sc/source/ui/docshell/datastream.cxx +++ b/sc/source/ui/docshell/datastream.cxx @@ -356,17 +356,18 @@ void DataStream::Decode(const OUString& rURL, const ScRange& rRange, maStartRange = aRange; maEndRange = aRange; + const auto & rDoc = mpDocShell->GetDocument(); if (nLimit == 0) { // Unlimited - maEndRange.aStart.SetRow(MAXROW); + maEndRange.aStart.SetRow(rDoc.MaxRow()); } else if (nLimit > 0) { // Limited. maEndRange.aStart.IncRow(nLimit-1); - if (maEndRange.aStart.Row() > MAXROW) - maEndRange.aStart.SetRow(MAXROW); + if (maEndRange.aStart.Row() > rDoc.MaxRow()) + maEndRange.aStart.SetRow(rDoc.MaxRow()); } maEndRange.aEnd.SetRow(maEndRange.aStart.Row()); diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index e6a68ade8ead..77c8b507277a 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -268,7 +268,7 @@ void ScDBDocFunc::ModifyAllDBData( const ScDBCollection& rNewColl, const std::ve rDoc.SetDBCollection( std::unique_ptr<ScDBCollection>(new ScDBCollection( rNewColl )) ); rDoc.CompileHybridFormula(); pOldColl = nullptr; - rDocShell.PostPaint(ScRange(0, 0, 0, MAXCOL, MAXROW, MAXTAB), PaintPartFlags::Grid); + rDocShell.PostPaint(ScRange(0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB), PaintPartFlags::Grid); aModificator.SetDocumentModified(); SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScDbAreasChanged ) ); @@ -362,20 +362,20 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bApi, bool bIsUnnamed, pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); rDoc.CopyToDocument(static_cast<SCCOL>(nOutStartCol), 0, - nTab, static_cast<SCCOL>(nOutEndCol), MAXROW, nTab, + nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); rDoc.CopyToDocument(0, static_cast<SCROW>(nOutStartRow), - nTab, MAXCOL, static_cast<SCROW>(nOutEndRow), nTab, + nTab, rDoc.MaxCol(), static_cast<SCROW>(nOutEndRow), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } else pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true ); // secure data range - incl. filtering result - rDoc.CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::ALL, false, *pUndoDoc); + rDoc.CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::ALL, false, *pUndoDoc); // all formulas because of references - rDoc.CopyToDocument(0, 0, 0, MAXCOL, MAXROW, nTabCount-1, InsertDeleteFlags::FORMULA, false, *pUndoDoc); + rDoc.CopyToDocument(0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), nTabCount-1, InsertDeleteFlags::FORMULA, false, *pUndoDoc); // ranges of DB and other ScRangeName* pDocRange = rDoc.GetRangeName(); @@ -452,7 +452,7 @@ bool ScDBDocFunc::RepeatDB( const OUString& rDBName, bool bApi, bool bIsUnnamed, pOld, pNew ) ); } - rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), + rDocShell.PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size); bDone = true; } @@ -609,7 +609,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, { nPaint |= PaintPartFlags::Left; nStartX = 0; - nEndX = MAXCOL; + nEndX = rDoc.MaxCol(); } rDocShell.PostPaint(ScRange(nStartX, nStartY, nTab, nEndX, nEndY, nTab), nPaint); } @@ -714,7 +714,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, SCCOL nTestCol = aOldDest.aEnd.Col() + 1; // next to the range SCROW nTestRow = rQueryParam.nDestRow + ( aLocalParam.bHasHeader ? 1 : 0 ); - while ( nTestCol <= MAXCOL && + while ( nTestCol <= rDoc.MaxCol() && rDoc.GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA ) { ++nTestCol; @@ -770,7 +770,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, else { pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true ); - rDoc.CopyToDocument(0, rQueryParam.nRow1, nTab, MAXCOL, rQueryParam.nRow2, nTab, + rDoc.CopyToDocument(0, rQueryParam.nRow1, nTab, rDoc.MaxCol(), rQueryParam.nRow2, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } @@ -931,7 +931,7 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, } // #i23299# Subtotal functions depend on cell's filtered states. - ScRange aDirtyRange(0 , aLocalParam.nRow1, nDestTab, MAXCOL, aLocalParam.nRow2, nDestTab); + ScRange aDirtyRange(0 , aLocalParam.nRow1, nDestTab, rDoc.MaxCol(), aLocalParam.nRow2, nDestTab); rDoc.SetSubTotalCellsDirty(aDirtyRange); if ( bRecord ) @@ -964,14 +964,14 @@ bool ScDBDocFunc::Query( SCTAB nTab, const ScQueryParam& rQueryParam, nEndY = aOldDest.aEnd.Row(); } if (bDoSize) - nEndY = MAXROW; + nEndY = rDoc.MaxRow(); rDocShell.PostPaint( ScRange(aLocalParam.nCol1, aLocalParam.nRow1, nDestTab, nEndX, nEndY, nDestTab), PaintPartFlags::Grid); } else rDocShell.PostPaint( - ScRange(0, rQueryParam.nRow1, nTab, MAXCOL, MAXROW, nTab), + ScRange(0, rQueryParam.nRow1, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid | PaintPartFlags::Left); aModificator.SetDocumentModified(); @@ -999,7 +999,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, return; } - ScEditableTester aTester( &rDoc, nTab, 0,rParam.nRow1+1, MAXCOL,MAXROW ); + ScEditableTester aTester( &rDoc, nTab, 0,rParam.nRow1+1, rDoc.MaxCol(),rDoc.MaxRow() ); if (!aTester.IsEditable()) { if (!bApi) @@ -1057,18 +1057,18 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, pTable->GetRowArray().GetRange( nOutStartRow, nOutEndRow ); pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); - rDoc.CopyToDocument(static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), MAXROW, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); - rDoc.CopyToDocument(0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(static_cast<SCCOL>(nOutStartCol), 0, nTab, static_cast<SCCOL>(nOutEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(0, nOutStartRow, nTab, rDoc.MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } else pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, bOldFilter ); // secure data range - incl. filtering result - rDoc.CopyToDocument(0, rParam.nRow1+1,nTab, MAXCOL,rParam.nRow2,nTab, + rDoc.CopyToDocument(0, rParam.nRow1+1,nTab, rDoc.MaxCol(),rParam.nRow2,nTab, InsertDeleteFlags::ALL, false, *pUndoDoc); // all formulas because of references - rDoc.CopyToDocument(0, 0, 0, MAXCOL,MAXROW,nTabCount-1, + rDoc.CopyToDocument(0, 0, 0, rDoc.MaxCol(),rDoc.MaxRow(),nTabCount-1, InsertDeleteFlags::FORMULA, false, *pUndoDoc); // ranges of DB and other @@ -1133,7 +1133,7 @@ void ScDBDocFunc::DoSubTotals( SCTAB nTab, const ScSubTotalParam& rParam, pDBData->SetArea( nTab, aNewParam.nCol1,aNewParam.nRow1, aNewParam.nCol2,aNewParam.nRow2 ); rDoc.CompileDBFormula(); - rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL,MAXROW,nTab), + rDocShell.PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab), PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size); aModificator.SetDocumentModified(); } diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 5c698c6b9176..5bba7356a653 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -241,7 +241,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, if ( xMeta.is() ) nColCount = xMeta->getColumnCount(); // this is the number of real columns - if ( rParam.nCol1 + nColCount - 1 > MAXCOL ) + if ( rParam.nCol1 + nColCount - 1 > rDoc.MaxCol() ) { nColCount = 0; //! error message @@ -381,7 +381,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, SCCOL nTestCol = rParam.nCol2 + 1; // right of the data SCROW nTestRow = rParam.nRow1 + 1; // below the title row - while ( nTestCol <= MAXCOL && + while ( nTestCol <= rDoc.MaxCol() && rDoc.GetCellType(ScAddress( nTestCol, nTestRow, nTab )) == CELLTYPE_FORMULA ) { ++nTestCol; @@ -429,7 +429,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, SCCOL nMinEndCol = std::min( rParam.nCol2, nEndCol ); // not too much nMinEndCol = sal::static_int_cast<SCCOL>( nMinEndCol + nFormulaCols ); // only if column count unchanged - pImportDoc->DeleteAreaTab( 0,0, MAXCOL,MAXROW, nTab, InsertDeleteFlags::ATTRIB ); + pImportDoc->DeleteAreaTab( 0,0, rDoc.MaxCol(),rDoc.MaxRow(), nTab, InsertDeleteFlags::ATTRIB ); rDoc.CopyToDocument(rParam.nCol1, rParam.nRow1, nTab, nMinEndCol, rParam.nRow1, nTab, InsertDeleteFlags::ATTRIB, false, *pImportDoc); @@ -453,7 +453,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, { ScPatternAttr aPattern(pImportDoc->GetPool()); aPattern.GetItemSet().Put( ScProtectionAttr( false,false,false,false ) ); - pImportDoc->ApplyPatternAreaTab( 0,0,MAXCOL,MAXROW, nTab, aPattern ); + pImportDoc->ApplyPatternAreaTab( 0,0,rDoc.MaxCol(),rDoc.MaxRow(), nTab, aPattern ); } // copy old data for undo @@ -588,7 +588,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, sc::SetFormulaDirtyContext aCxt; rDoc.SetAllFormulasDirty(aCxt); - rDocShell.PostPaint(ScRange(0, 0, nTab, MAXCOL, MAXROW, nTab), PaintPartFlags::Grid); + rDocShell.PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid); aModificator.SetDocumentModified(); ScDBRangeRefreshedHint aHint( rParam ); diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index d0f246e73d12..556d4645f50b 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -405,7 +405,7 @@ void processDataStream( ScDocShell& rShell, const sc::ImportPostProcessData& rDa ScRange aTopRange = r.maRange; aTopRange.aEnd.SetRow(aTopRange.aStart.Row()); sal_Int32 nLimit = r.maRange.aEnd.Row() - r.maRange.aStart.Row() + 1; - if (r.maRange.aEnd.Row() == MAXROW) + if (r.maRange.aEnd.Row() == rShell.GetDocument().MaxRow()) // Unlimited range. nLimit = 0; diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index cf0fecf46fd6..44b36a9ce435 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -113,10 +113,10 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row(); SCTAB nTab1 = rRange.aStart.Tab(), nTab2 = rRange.aEnd.Tab(); - if (!ValidCol(nCol1)) nCol1 = MAXCOL; - if (!ValidRow(nRow1)) nRow1 = MAXROW; - if (!ValidCol(nCol2)) nCol2 = MAXCOL; - if (!ValidRow(nRow2)) nRow2 = MAXROW; + if (!ValidCol(nCol1)) nCol1 = m_aDocument.MaxCol(); + if (!ValidRow(nRow1)) nRow1 = m_aDocument.MaxRow(); + if (!ValidCol(nCol2)) nCol2 = m_aDocument.MaxCol(); + if (!ValidRow(nRow2)) nRow2 = m_aDocument.MaxRow(); if ( m_pPaintLockData ) { @@ -139,16 +139,16 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa { //! check for hidden columns/rows! if (nCol1>0) --nCol1; - if (nCol2<MAXCOL) ++nCol2; + if (nCol2<m_aDocument.MaxCol()) ++nCol2; if (nRow1>0) --nRow1; - if (nRow2<MAXROW) ++nRow2; + if (nRow2<m_aDocument.MaxRow()) ++nRow2; } // expand for the merged ones if (nExtFlags & SC_PF_TESTMERGE) m_aDocument.ExtendMerge( nCol1, nRow1, nCol2, nRow2, nTab1 ); - if ( nCol1 != 0 || nCol2 != MAXCOL ) + if ( nCol1 != 0 || nCol2 != m_aDocument.MaxCol() ) { // Extend to whole rows if SC_PF_WHOLEROWS is set, or rotated or non-left // aligned cells are contained (see UpdatePaintExt). @@ -157,10 +157,10 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa if ( ( nExtFlags & SC_PF_WHOLEROWS ) || m_aDocument.HasAttrib( nCol1,nRow1,nTab1, - MAXCOL,nRow2,nTab2, HasAttrFlags::Rotate | HasAttrFlags::RightOrCenter ) ) + m_aDocument.MaxCol(),nRow2,nTab2, HasAttrFlags::Rotate | HasAttrFlags::RightOrCenter ) ) { nCol1 = 0; - nCol2 = MAXCOL; + nCol2 = m_aDocument.MaxCol(); } } aPaintRanges.push_back(ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2)); @@ -179,7 +179,7 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, sa void ScDocShell::PostPaintGridAll() { - PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid ); + PostPaint( 0,0,0, m_aDocument.MaxCol(),m_aDocument.MaxRow(),MAXTAB, PaintPartFlags::Grid ); } void ScDocShell::PostPaintCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) @@ -194,7 +194,7 @@ void ScDocShell::PostPaintCell( const ScAddress& rPos ) void ScDocShell::PostPaintExtras() { - PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Extras ); + PostPaint( 0,0,0, m_aDocument.MaxCol(),m_aDocument.MaxRow(),MAXTAB, PaintPartFlags::Extras ); } void ScDocShell::UpdatePaintExt( sal_uInt16& rExtFlags, const ScRange& rRange ) @@ -209,7 +209,7 @@ void ScDocShell::UpdatePaintExt( sal_uInt16& rExtFlags, const ScRange& rRange ) } if ( ( rExtFlags & SC_PF_WHOLEROWS ) == 0 && - ( rRange.aStart.Col() != 0 || rRange.aEnd.Col() != MAXCOL ) && + ( rRange.aStart.Col() != 0 || rRange.aEnd.Col() != m_aDocument.MaxCol() ) && m_aDocument.HasAttrib( rRange, HasAttrFlags::Rotate | HasAttrFlags::RightOrCenter ) ) { // If the range contains (logically) right- or center-aligned cells, @@ -558,7 +558,7 @@ sal_uInt16 ScDocShell::SetPrinter( VclPtr<SfxPrinter> const & pNewPrinter, SfxPr } } - PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB,PaintPartFlags::All); + PostPaint(0,0,0,m_aDocument.MaxCol(),m_aDocument.MaxRow(),MAXTAB,PaintPartFlags::All); return 0; } diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 54acb863a18d..e1c9332b0c4e 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -2130,7 +2130,7 @@ long SnapHorizontal( const ScDocument& rDoc, SCTAB nTab, long nVal, SCCOL& rStar SCCOL nCol = 0; long nTwips = static_cast<long>(nVal / HMM_PER_TWIPS); long nSnap = 0; - while ( nCol<MAXCOL ) + while ( nCol<rDoc.MaxCol() ) { long nAdd = rDoc.GetColWidth(nCol, nTab); if ( nSnap + nAdd/2 < nTwips || nCol < rStartCol ) @@ -2154,7 +2154,7 @@ long SnapVertical( const ScDocument& rDoc, SCTAB nTab, long nVal, SCROW& rStartR long nSnap = 0; bool bFound = false; - for (SCROW i = nRow; i <= MAXROW; ++i) + for (SCROW i = nRow; i <= rDoc.MaxRow(); ++i) { SCROW nLastRow; if (rDoc.RowHidden(i, nTab, nullptr, &nLastRow)) @@ -2177,7 +2177,7 @@ long SnapVertical( const ScDocument& rDoc, SCTAB nTab, long nVal, SCROW& rStartR } } if (!bFound) - nRow = MAXROW; // all hidden down to the bottom + nRow = rDoc.MaxRow(); // all hidden down to the bottom nVal = static_cast<long>( nSnap * HMM_PER_TWIPS ); rStartRow = nRow; diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx index a1604c3d4861..efeff05e94e7 100644 --- a/sc/source/ui/docshell/docsh5.cxx +++ b/sc/source/ui/docshell/docsh5.cxx @@ -415,7 +415,7 @@ bool ScDocShell::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) // tdf#76183: recalculate objects' positions m_aDocument.SetDrawPageSize(nTab); - PostPaint( 0,nStartRow,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid|PaintPartFlags::Left ); + PostPaint( 0,nStartRow,nTab, m_aDocument.MaxCol(),m_aDocument.MaxRow(),nTab, PaintPartFlags::Grid|PaintPartFlags::Left ); } return bChange; @@ -462,7 +462,7 @@ void ScDocShell::UpdatePendingRowHeights( SCTAB nUpdateTab, bool bBefore ) { if ( m_aDocument.IsPendingRowHeights( nUpdateTab ) ) { - AdjustRowHeight( 0, MAXROW, nUpdateTab ); + AdjustRowHeight( 0, m_aDocument.MaxRow(), nUpdateTab ); m_aDocument.UpdatePageBreaks( nUpdateTab ); m_aDocument.SetPendingRowHeights( nUpdateTab, false ); } @@ -581,16 +581,16 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord ) pUndoDoc->InitUndo( &m_aDocument, 0, nTabCount-1, false, true ); // row state - m_aDocument.CopyToDocument(0, 0, nDestTab, MAXCOL, MAXROW, nDestTab, + m_aDocument.CopyToDocument(0, 0, nDestTab, m_aDocument.MaxCol(), m_aDocument.MaxRow(), nDestTab, InsertDeleteFlags::NONE, false, *pUndoDoc); // all formulas - m_aDocument.CopyToDocument(0, 0, 0, MAXCOL, MAXROW, nTabCount-1, + m_aDocument.CopyToDocument(0, 0, 0, m_aDocument.MaxCol(), m_aDocument.MaxRow(), nTabCount-1, InsertDeleteFlags::FORMULA, false, *pUndoDoc); // complete output rows m_aDocument.CopyToDocument(0, aDestArea.nRowStart, nDestTab, - MAXCOL,aDestArea.nRowEnd, nDestTab, + m_aDocument.MaxCol(),aDestArea.nRowEnd, nDestTab, InsertDeleteFlags::ALL, false, *pUndoDoc); // old output range @@ -642,8 +642,8 @@ void ScDocShell::DoConsolidate( const ScConsolidateParam& rParam, bool bRecord ) if (rParam.bReferenceData) { nPaintStartCol = 0; - nPaintEndCol = MAXCOL; - nPaintEndRow = MAXROW; + nPaintEndCol = m_aDocument.MaxCol(); + nPaintEndRow = m_aDocument.MaxRow(); nPaintFlags |= PaintPartFlags::Left | PaintPartFlags::Size; } if (pDestData) @@ -711,7 +711,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord ) pUndoDoc->SetActiveScenario( i, bActive ); // At copy-back scenarios also contents if ( nScenFlags & ScScenarioFlags::TwoWay ) - m_aDocument.CopyToDocument(0, 0, i, MAXCOL, MAXROW, i, + m_aDocument.CopyToDocument(0, 0, i, m_aDocument.MaxCol(), m_aDocument.MaxRow(), i, InsertDeleteFlags::ALL, false, *pUndoDoc ); } @@ -728,7 +728,7 @@ void ScDocShell::UseScenario( SCTAB nTab, const OUString& rName, bool bRecord ) // paint all, because the active scenario may be modified in other ranges; //! only if there are visible frames? - PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid ); + PostPaint( 0,0,nTab, m_aDocument.MaxCol(),m_aDocument.MaxRow(),nTab, PaintPartFlags::Grid ); aModificator.SetDocumentModified(); } else @@ -824,7 +824,7 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin ScPatternAttr aProtPattern( m_aDocument.GetPool() ); aProtPattern.GetItemSet().Put( ScProtectionAttr( true ) ); - m_aDocument.ApplyPatternAreaTab( 0,0, MAXCOL,MAXROW, nNewTab, aProtPattern ); + m_aDocument.ApplyPatternAreaTab( 0,0, m_aDocument.MaxCol(),m_aDocument.MaxRow(), nNewTab, aProtPattern ); ScPatternAttr aPattern( m_aDocument.GetPool() ); aPattern.GetItemSet().Put( ScMergeFlagAttr( ScMF::Scenario ) ); @@ -838,7 +838,7 @@ SCTAB ScDocShell::MakeScenario( SCTAB nTab, const OUString& rName, const OUStrin m_aDocument.CopyScenario( nNewTab, nTab, true ); // sal_True - don't copy anything from scenario if (nFlags & ScScenarioFlags::ShowFrame) - PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid ); // paint frames + PostPaint( 0,0,nTab, m_aDocument.MaxCol(),m_aDocument.MaxRow(),nTab, PaintPartFlags::Grid ); // paint frames PostPaintExtras(); // table tab aModificator.SetDocumentModified(); @@ -861,7 +861,7 @@ sal_uLong ScDocShell::TransferTab( ScDocShell& rSrcDocShell, SCTAB nSrcPos, // set the transferred area to the copyparam to make adjusting formulas possible ScClipParam aParam; - ScRange aRange(0, 0, nSrcPos, MAXCOL, MAXROW, nSrcPos); + ScRange aRange(0, 0, nSrcPos, m_aDocument.MaxCol(), m_aDocument.MaxRow(), nSrcPos); aParam.maRanges.push_back(aRange); rSrcDoc.SetClipParam(aParam); diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index ff846af27c18..ad0e5b380d47 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -137,7 +137,7 @@ void ScDocShell::SetVisAreaOrSize( const tools::Rectangle& rVisArea ) ScRange aNew; m_aDocument.GetEmbedded( aNew); if (aOld != aNew) - PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB,PaintPartFlags::Grid); + PostPaint(0,0,0,m_aDocument.MaxCol(),m_aDocument.MaxRow(),MAXTAB,PaintPartFlags::Grid); //TODO/LATER: currently not implemented //ViewChanged( ASPECT_CONTENT ); // show in the container as well @@ -243,7 +243,7 @@ void ScDocShell::LoadStyles( SfxObjectShell &rSource ) // Paint - PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid | PaintPartFlags::Left ); + PostPaint( 0,0,0, m_aDocument.MaxCol(),m_aDocument.MaxRow(),MAXTAB, PaintPartFlags::Grid | PaintPartFlags::Left ); } void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellStyles, bool bPageStyles ) @@ -307,7 +307,7 @@ void ScDocShell::LoadStylesArgs( ScDocShell& rSource, bool bReplace, bool bCellS lcl_AdjustPool( GetStyleSheetPool() ); // adjust SetItems UpdateAllRowHeights(); - PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid | PaintPartFlags::Left ); // Paint + PostPaint( 0,0,0, m_aDocument.MaxCol(),m_aDocument.MaxRow(),MAXTAB, PaintPartFlags::Grid | PaintPartFlags::Left ); // Paint } void ScDocShell::ReconnectDdeLink(SfxObjectShell& rServer) @@ -413,7 +413,7 @@ void ScDocShell::ReloadTabLinks() if ( bAny ) { // Paint only once - PostPaint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB), + PostPaint( ScRange(0,0,0,m_aDocument.MaxCol(),m_aDocument.MaxRow(),MAXTAB), PaintPartFlags::Grid | PaintPartFlags::Top | PaintPartFlags::Left ); SetDocumentModified(); diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 736cdd86c63b..dae548543955 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -264,7 +264,7 @@ static void lcl_setScalesToColumns(ScDocument& rDoc, const vector<long>& rScales ScPatternAttr aNewAttrs( rDoc.GetPool() ); SfxItemSet& rSet = aNewAttrs.GetItemSet(); rSet.Put( SfxUInt32Item(ATTR_VALUE_FORMAT, nNewFormat) ); - rDoc.ApplyPatternAreaTab(i, 0, i, MAXROW, 0, aNewAttrs); + rDoc.ApplyPatternAreaTab(i, 0, i, rDoc.MaxRow(), 0, aNewAttrs); } } @@ -322,9 +322,9 @@ ErrCode ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncoding if ( xMeta.is() ) nColCount = xMeta->getColumnCount(); // this is the number of real columns - if ( nColCount > MAXCOL+1 ) + if ( nColCount > m_aDocument.MaxCol()+1 ) { - nColCount = MAXCOL+1; + nColCount = m_aDocument.MaxCol()+1; nErr = SCWARN_IMPORT_COLUMN_OVERFLOW; // warning } @@ -386,7 +386,7 @@ ErrCode ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncoding bool bEnd = false; while ( !bEnd && xRowSet->next() ) { - if ( nRow <= MAXROW ) + if ( nRow <= m_aDocument.MaxRow() ) { bool bSimpleRow = true; SCCOL nCol = 0; diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 5f463d043de9..0619425319be 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -96,7 +96,7 @@ enum class SylkVersion // Whole document without Undo ScImportExport::ScImportExport( ScDocument* p ) : pDocSh( dynamic_cast< ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ), - nSizeLimit( 0 ), nMaxImportRow(!utl::ConfigManager::IsFuzzing() ? MAXROW : SCROWS32K), + nSizeLimit( 0 ), nMaxImportRow(!utl::ConfigManager::IsFuzzing() ? pDoc->MaxRow() : SCROWS32K), cSep( '\t' ), cStr( '"' ), bFormulas( false ), bIncludeFiltered( true ), bAll( true ), bSingle( true ), bUndo( false ), @@ -112,7 +112,7 @@ ScImportExport::ScImportExport( ScDocument* p ) ScImportExport::ScImportExport( ScDocument* p, const ScAddress& rPt ) : pDocSh( dynamic_cast< ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ), aRange( rPt ), - nSizeLimit( 0 ), nMaxImportRow(!utl::ConfigManager::IsFuzzing() ? MAXROW : SCROWS32K), + nSizeLimit( 0 ), nMaxImportRow(!utl::ConfigManager::IsFuzzing() ? pDoc->MaxRow() : SCROWS32K), cSep( '\t' ), cStr( '"' ), bFormulas( false ), bIncludeFiltered( true ), bAll( false ), bSingle( true ), bUndo( pDocSh != nullptr ), @@ -129,7 +129,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScAddress& rPt ) ScImportExport::ScImportExport( ScDocument* p, const ScRange& r ) : pDocSh( dynamic_cast<ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ), aRange( r ), - nSizeLimit( 0 ), nMaxImportRow(!utl::ConfigManager::IsFuzzing() ? MAXROW : SCROWS32K), + nSizeLimit( 0 ), nMaxImportRow(!utl::ConfigManager::IsFuzzing() ? pDoc->MaxRow() : SCROWS32K), cSep( '\t' ), cStr( '"' ), bFormulas( false ), bIncludeFiltered( true ), bAll( false ), bSingle( false ), bUndo( pDocSh != nullptr ), @@ -147,7 +147,7 @@ ScImportExport::ScImportExport( ScDocument* p, const ScRange& r ) // If a View exists, the TabNo of the view will be used. ScImportExport::ScImportExport( ScDocument* p, const OUString& rPos ) : pDocSh( dynamic_cast< ScDocShell* >(p->GetDocumentShell()) ), pDoc( p ), - nSizeLimit( 0 ), nMaxImportRow(!utl::ConfigManager::IsFuzzing() ? MAXROW : SCROWS32K), + nSizeLimit( 0 ), nMaxImportRow(!utl::ConfigManager::IsFuzzing() ? pDoc->MaxRow() : SCROWS32K), cSep( '\t' ), cStr( '"' ), bFormulas( false ), bIncludeFiltered( true ), bAll( false ), bSingle( true ), bUndo( pDocSh != nullptr ), @@ -1372,7 +1372,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) assert(pSeps == aSeps.getStr()); - if ( nRow > MAXROW ) + if ( nRow > pDoc->MaxRow() ) { bOverflowRow = true; // display warning on import break; // for @@ -1385,16 +1385,16 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) bool bMultiLine = false; if ( bFixed ) // Fixed line length { - // Yes, the check is nCol<=MAXCOL+1, +1 because it is only an + // Yes, the check is nCol<=rDoc.MaxCol()+1, +1 because it is only an // overflow if there is really data following to be put behind // the last column, which doesn't happen if info is // SC_COL_SKIP. - for ( i=0; i<nInfoCount && nCol <= MAXCOL+1; i++ ) + for ( i=0; i<nInfoCount && nCol <= pDoc->MaxCol()+1; i++ ) { sal_uInt8 nFmt = pColFormat[i]; if (nFmt != SC_COL_SKIP) // otherwise don't increment nCol either { - if (nCol > MAXCOL) + if (nCol > pDoc->MaxCol()) bOverflowCol = true; // display warning on import else if (!bDetermineRange) { @@ -1419,11 +1419,11 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) SCCOL nSourceCol = 0; sal_uInt16 nInfoStart = 0; const sal_Unicode* p = aLine.getStr(); - // Yes, the check is nCol<=MAXCOL+1, +1 because it is only an + // Yes, the check is nCol<=rDoc.MaxCol()+1, +1 because it is only an // overflow if there is really data following to be put behind // the last column, which doesn't happen if info is // SC_COL_SKIP. - while (*p && nCol <= MAXCOL+1) + while (*p && nCol <= pDoc->MaxCol()+1) { bool bIsQuoted = false; p = ScImportExport::ScanNextFieldFromString( p, aCell, @@ -1441,7 +1441,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) } if ( nFmt != SC_COL_SKIP ) { - if (nCol > MAXCOL) + if (nCol > pDoc->MaxCol()) bOverflowCol = true; // display warning on import else if (!bDetermineRange) { @@ -1460,7 +1460,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) } } if (nEndCol < nCol) - nEndCol = nCol; //! points to the next free or even MAXCOL+2 + nEndCol = nCol; //! points to the next free or even rDoc.MaxCol()+2 if (!bDetermineRange) { @@ -1474,7 +1474,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm ) if (nRow > nStartRow) --nRow; if (nEndCol > nStartCol) - nEndCol = ::std::min( static_cast<SCCOL>(nEndCol - 1), MAXCOL); + nEndCol = ::std::min( static_cast<SCCOL>(nEndCol - 1), pDoc->MaxCol()); if (bDetermineRange) { @@ -1809,10 +1809,10 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) { bInvalidCol = false; bool bFail = o3tl::checked_add<SCCOL>(OUString(p).toInt32(), nStartCol - 1, nCol); - if (bFail || nCol < 0 || MAXCOL < nCol) + if (bFail || nCol < 0 || pDoc->MaxCol() < nCol) { SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;X invalid nCol=" << nCol); - nCol = std::max<SCCOL>(0, std::min<SCCOL>(nCol, MAXCOL)); + nCol = std::max<SCCOL>(0, std::min<SCCOL>(nCol, pDoc->MaxCol())); bInvalidCol = bOverflowCol = true; } break; @@ -1833,10 +1833,10 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) { bInvalidRefCol = false; bool bFail = o3tl::checked_add<SCCOL>(OUString(p).toInt32(), nStartCol - 1, nRefCol); - if (bFail || nRefCol < 0 || MAXCOL < nRefCol) + if (bFail || nRefCol < 0 || pDoc->MaxCol() < nRefCol) { SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;C invalid nRefCol=" << nRefCol); - nRefCol = std::max<SCCOL>(0, std::min<SCCOL>(nRefCol, MAXCOL)); + nRefCol = std::max<SCCOL>(0, std::min<SCCOL>(nRefCol, pDoc->MaxCol())); bInvalidRefCol = bOverflowCol = true; } break; @@ -1858,7 +1858,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) if( !bSingle && ( nCol < nStartCol || nCol > nEndCol || nRow < nStartRow || nRow > nEndRow - || nCol > MAXCOL || nRow > nMaxImportRow + || nCol > pDoc->MaxCol() || nRow > nMaxImportRow || bInvalidCol || bInvalidRow ) ) break; if( !bData ) @@ -1970,10 +1970,10 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) { bInvalidCol = false; bool bFail = o3tl::checked_add<SCCOL>(OUString(p).toInt32(), nStartCol - 1, nCol); - if (bFail || nCol < 0 || MAXCOL < nCol) + if (bFail || nCol < 0 || pDoc->MaxCol() < nCol) { SAL_WARN("sc.ui","ScImportExport::Sylk2Doc - ;X invalid nCol=" << nCol); - nCol = std::max<SCCOL>(0, std::min<SCCOL>(nCol, MAXCOL)); + nCol = std::max<SCCOL>(0, std::min<SCCOL>(nCol, pDoc->MaxCol())); bInvalidCol = bOverflowCol = true; } break; diff --git a/sc/source/ui/docshell/olinefun.cxx b/sc/source/ui/docshell/olinefun.cxx index 574165aea714..c3da9c9fcf5d 100644 --- a/sc/source/ui/docshell/olinefun.cxx +++ b/sc/source/ui/docshell/olinefun.cxx @@ -54,8 +54,8 @@ static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab, PaintPartFlags nParts = PaintPartFlags::Grid; SCCOL nStartCol = 0; SCROW nStartRow = 0; - SCCOL nEndCol = MAXCOL; // for testing if merged - SCROW nEndRow = MAXROW; + SCCOL nEndCol = rDoc.MaxCol(); // for testing if merged + SCROW nEndRow = rDoc.MaxRow(); if ( bColumns ) { nParts |= PaintPartFlags::Top; @@ -74,7 +74,7 @@ static void lcl_PaintWidthHeight( ScDocShell& rDocShell, SCTAB nTab, nStartCol = 0; nStartRow = 0; } - rDocShell.PostPaint( nStartCol,nStartRow,nTab, MAXCOL,MAXROW,nTab, nParts ); + rDocShell.PostPaint( nStartCol,nStartRow,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, nParts ); } void ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool bRecord, bool bApi ) @@ -124,7 +124,7 @@ void ScOutlineDocFunc::MakeOutline( const ScRange& rRange, bool bColumns, bool b if ( bSize ) nParts |= PaintPartFlags::Size; - rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, nParts ); + rDocShell.PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, nParts ); rDocShell.SetDocumentModified(); lcl_InvalidateOutliner( rDocShell.GetViewBindings() ); } @@ -185,7 +185,7 @@ void ScOutlineDocFunc::RemoveOutline( const ScRange& rRange, bool bColumns, bool if ( bSize ) nParts |= PaintPartFlags::Size; - rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, nParts ); + rDocShell.PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, nParts ); rDocShell.SetDocumentModified(); bDone = true; lcl_InvalidateOutliner( rDocShell.GetViewBindings() ); @@ -220,8 +220,8 @@ bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord ) ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO )); pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); - rDoc.CopyToDocument(nStartCol, 0, nTab, nEndCol, MAXROW, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); - rDoc.CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(nStartCol, 0, nTab, nEndCol, rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); std::unique_ptr<ScOutlineTable> pUndoTab(new ScOutlineTable( *pTable )); @@ -240,7 +240,7 @@ bool ScOutlineDocFunc::RemoveAllOutlines( SCTAB nTab, bool bRecord ) rDoc.SetStreamValid(nTab, false); - rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, + rDocShell.PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size ); rDocShell.SetDocumentModified(); lcl_InvalidateOutliner( rDocShell.GetViewBindings() ); @@ -283,8 +283,8 @@ void ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord ) pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO )); pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); - rDoc.CopyToDocument(nOutStartCol, 0, nTab, nOutEndCol, MAXROW, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); - rDoc.CopyToDocument(0, nOutStartRow, nTab, MAXCOL, nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(nOutStartCol, 0, nTab, nOutEndCol, rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(0, nOutStartRow, nTab, rDoc.MaxCol(), nOutEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } // enable @@ -306,7 +306,7 @@ void ScOutlineDocFunc::AutoOutline( const ScRange& rRange, bool bRecord ) rDoc.SetStreamValid(nTab, false); - rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size ); + rDocShell.PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Left | PaintPartFlags::Top | PaintPartFlags::Size ); rDocShell.SetDocumentModified(); lcl_InvalidateOutliner( rDocShell.GetViewBindings() ); } @@ -336,13 +336,13 @@ bool ScOutlineDocFunc::SelectLevel( SCTAB nTab, bool bColumns, sal_uInt16 nLevel { pUndoDoc->InitUndo( &rDoc, nTab, nTab, true ); rDoc.CopyToDocument(static_cast<SCCOL>(nStart), 0, nTab, - static_cast<SCCOL>(nEnd), MAXROW, nTab, InsertDeleteFlags::NONE, false, + static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } else { pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true ); - rDoc.CopyToDocument(0, nStart, nTab, MAXCOL, nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } rDocShell.GetUndoManager()->AddUndoAction( @@ -455,8 +455,8 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord ) std::unique_ptr<ScOutlineTable> pUndoTab(new ScOutlineTable( *pTable )); ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO )); pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); - rDoc.CopyToDocument(nStartCol, 0, nTab, nEndCol, MAXROW, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); - rDoc.CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(nStartCol, 0, nTab, nEndCol, rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); rDocShell.GetUndoManager()->AddUndoAction( std::make_unique<ScUndoOutlineBlock>( &rDocShell, @@ -466,7 +466,7 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord ) // Columns - nMin=MAXCOL; + nMin=rDoc.MaxCol(); nMax=0; ScOutlineArray& rColArray = pTable->GetColArray(); ScSubOutlineIterator aColIter( &rColArray ); @@ -488,7 +488,7 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord ) // Rows - nMin=MAXROW; + nMin=rDoc.MaxRow(); nMax=0; ScOutlineArray& rRowArray = pTable->GetRowArray(); ScSubOutlineIterator aRowIter( &rRowArray ); @@ -527,7 +527,7 @@ bool ScOutlineDocFunc::ShowMarkedOutlines( const ScRange& rRange, bool bRecord ) pViewSh->OnLOKShowHideColRow(/*columns: */ false, nMinStartRow - 1); } - rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top ); + rDocShell.PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top ); rDocShell.SetDocumentModified(); bDone = true; @@ -582,9 +582,9 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord ) ScDocumentUniquePtr pUndoDoc(new ScDocument( SCDOCMODE_UNDO )); pUndoDoc->InitUndo( &rDoc, nTab, nTab, true, true ); rDoc.CopyToDocument(static_cast<SCCOL>(nEffStartCol), 0, nTab, - static_cast<SCCOL>(nEffEndCol), MAXROW, nTab, InsertDeleteFlags::NONE, + static_cast<SCCOL>(nEffEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); - rDoc.CopyToDocument(0, nEffStartRow, nTab, MAXCOL, nEffEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(0, nEffStartRow, nTab, rDoc.MaxCol(), nEffEndRow, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); rDocShell.GetUndoManager()->AddUndoAction( std::make_unique<ScUndoOutlineBlock>( &rDocShell, @@ -621,7 +621,7 @@ bool ScOutlineDocFunc::HideMarkedOutlines( const ScRange& rRange, bool bRecord ) rDoc.SetDrawPageSize(nTab); rDoc.UpdatePageBreaks( nTab ); - rDocShell.PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top ); + rDocShell.PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top ); rDocShell.SetDocumentModified(); bDone = true; @@ -654,13 +654,13 @@ void ScOutlineDocFunc::ShowOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel { pUndoDoc->InitUndo( &rDoc, nTab, nTab, true ); rDoc.CopyToDocument(static_cast<SCCOL>(nStart), 0, nTab, - static_cast<SCCOL>(nEnd), MAXROW, nTab, InsertDeleteFlags::NONE, false, + static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } else { pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true ); - rDoc.CopyToDocument(0, nStart, nTab, MAXCOL, nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } rDocShell.GetUndoManager()->AddUndoAction( @@ -746,13 +746,13 @@ bool ScOutlineDocFunc::HideOutline( SCTAB nTab, bool bColumns, sal_uInt16 nLevel { pUndoDoc->InitUndo( &rDoc, nTab, nTab, true ); rDoc.CopyToDocument(static_cast<SCCOL>(nStart), 0, nTab, - static_cast<SCCOL>(nEnd), MAXROW, nTab, InsertDeleteFlags::NONE, false, + static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } else { pUndoDoc->InitUndo( &rDoc, nTab, nTab, false, true ); - rDoc.CopyToDocument(0, nStart, nTab, MAXCOL, nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); + rDoc.CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, *pUndoDoc); } rDocShell.GetUndoManager()->AddUndoAction( diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 83a0e4f87c76..80eb7cca743a 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -240,7 +240,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, else pUndoDoc->AddUndoTab( nTab, nTab, true, true ); bFirst = false; - ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab); + ScRange aRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab); rDoc.CopyToDocument(aRange, InsertDeleteFlags::ALL, false, *pUndoDoc); pUndoDoc->TransferDrawPage( &rDoc, nTab, nTab ); pUndoDoc->SetLink( nTab, nMode, aFileName, aFilterName, @@ -284,7 +284,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, (nMode == ScLinkMode::VALUE) ); // only values? else { - rDoc.DeleteAreaTab( 0,0,MAXCOL,MAXROW, nTab, InsertDeleteFlags::ALL ); + rDoc.DeleteAreaTab( 0,0,rDoc.MaxCol(),rDoc.MaxRow(), nTab, InsertDeleteFlags::ALL ); bool bShowError = true; if ( nMode == ScLinkMode::VALUE ) @@ -294,7 +294,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, ScRangeList aErrorCells; // cells on the linked sheets that need error values - ScCellIterator aIter(&rDoc, ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB)); // all sheets + ScCellIterator aIter(&rDoc, ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB)); // all sheets for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if (aIter.getType() != CELLTYPE_FORMULA) @@ -386,7 +386,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, // Paint (may be several tables) - pImpl->m_pDocSh->PostPaint( ScRange(0,0,0,MAXCOL,MAXROW,MAXTAB), + pImpl->m_pDocSh->PostPaint( ScRange(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB), PaintPartFlags::Grid | PaintPartFlags::Top | PaintPartFlags::Left | PaintPartFlags::Extras ); aModificator.SetDocumentModified(); |