diff options
author | Aron Budea <aron.budea@collabora.com> | 2019-10-20 03:14:42 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-10-21 13:57:48 +0200 |
commit | f900c896697386fcc82b51f3f9ab3c8a84fdbb67 (patch) | |
tree | b4ccf8c0e01b899712b3db0e0526d3eb21390c9e | |
parent | loplugin:virtualdead unused param in SfxObjectShell::FillClass (diff) | |
download | core-f900c896697386fcc82b51f3f9ab3c8a84fdbb67.tar.gz core-f900c896697386fcc82b51f3f9ab3c8a84fdbb67.zip |
sc: rowcol: tdf#50916 convert ui/undo
Change-Id: I93ad2bbcf95ab136b9ce4df58e2849980e97d5fd
Reviewed-on: https://gerrit.libreoffice.org/81146
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r-- | sc/source/ui/undo/undobase.cxx | 4 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk.cxx | 115 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk2.cxx | 12 | ||||
-rw-r--r-- | sc/source/ui/undo/undoblk3.cxx | 22 | ||||
-rw-r--r-- | sc/source/ui/undo/undodat.cxx | 117 | ||||
-rw-r--r-- | sc/source/ui/undo/undostyl.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/undo/undotab.cxx | 29 | ||||
-rw-r--r-- | sc/source/ui/undo/undoutil.cxx | 5 |
8 files changed, 158 insertions, 148 deletions
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx index e00147bf408d..7181b10d01ee 100644 --- a/sc/source/ui/undo/undobase.cxx +++ b/sc/source/ui/undo/undobase.cxx @@ -313,7 +313,7 @@ bool ScBlockUndo::AdjustHeight() rDoc.SetDrawPageSize(aBlockRange.aStart.Tab()); pDocShell->PostPaint( 0, aBlockRange.aStart.Row(), aBlockRange.aStart.Tab(), - MAXCOL, MAXROW, aBlockRange.aEnd.Tab(), + rDoc.MaxCol(), rDoc.MaxRow(), aBlockRange.aEnd.Tab(), PaintPartFlags::Grid | PaintPartFlags::Left ); } return bRet; @@ -426,7 +426,7 @@ ScMoveUndo::~ScMoveUndo() void ScMoveUndo::UndoRef() { ScDocument& rDoc = pDocShell->GetDocument(); - ScRange aRange(0,0,0, MAXCOL,MAXROW,pRefUndoDoc->GetTableCount()-1); + ScRange aRange(0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),pRefUndoDoc->GetTableCount()-1); pRefUndoDoc->CopyToDocument(aRange, InsertDeleteFlags::FORMULA, false, rDoc, nullptr, false); if (pRefUndoData) pRefUndoData->DoUndo( &rDoc, false ); diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 54d50c38ac8c..89816cfe9042 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -77,16 +77,17 @@ ScUndoInsertCells::ScUndoInsertCells( ScDocShell* pNewDocShell, eCmd( eNewCmd ), bPartOfPaste( bNewPartOfPaste ) { + ScDocument& rDoc = pDocShell->GetDocument(); if (eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER) // whole row? { aEffRange.aStart.SetCol(0); - aEffRange.aEnd.SetCol(MAXCOL); + aEffRange.aEnd.SetCol(rDoc.MaxCol()); } if (eCmd == INS_INSCOLS_BEFORE || eCmd == INS_INSCOLS_AFTER) // whole column? { aEffRange.aStart.SetRow(0); - aEffRange.aEnd.SetRow(MAXROW); + aEffRange.aEnd.SetRow(rDoc.MaxRow()); } SetChangeTrack(); @@ -204,7 +205,7 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) ScRange aWorkRange( aEffRange ); if ( eCmd == INS_CELLSRIGHT ) // only "shift right" requires refresh of the moved area - aWorkRange.aEnd.SetCol(MAXCOL); + aWorkRange.aEnd.SetCol(rDoc.MaxCol()); for( i=0; i<nCount; i++ ) { if ( rDoc.HasAttrib( aWorkRange.aStart.Col(), aWorkRange.aStart.Row(), pTabs[i], @@ -225,16 +226,16 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) case INS_INSROWS_BEFORE: case INS_INSROWS_AFTER: nPaint |= PaintPartFlags::Left; - aWorkRange.aEnd.SetRow(MAXROW); + aWorkRange.aEnd.SetRow(rDoc.MaxRow()); break; case INS_CELLSDOWN: for( i=0; i<nCount; i++ ) { - aWorkRange.aEnd.SetRow(MAXROW); + aWorkRange.aEnd.SetRow(rDoc.MaxRow()); if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] )) { aWorkRange.aStart.SetCol(0); - aWorkRange.aEnd.SetCol(MAXCOL); + aWorkRange.aEnd.SetCol(rDoc.MaxCol()); nPaint |= PaintPartFlags::Left; } } @@ -246,11 +247,11 @@ void ScUndoInsertCells::DoChange( const bool bUndo ) case INS_CELLSRIGHT: for( i=0; i<nCount; i++ ) { - aWorkRange.aEnd.SetCol(MAXCOL); // to the far right + aWorkRange.aEnd.SetCol(rDoc.MaxCol()); // to the far right if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i]) ) { // AdjustDraw does not paint PaintPartFlags::Top, aWorkRange.aStart.SetCol(0); // thus solved like this - aWorkRange.aEnd.SetRow(MAXROW); + aWorkRange.aEnd.SetRow(rDoc.MaxRow()); nPaint |= PaintPartFlags::Left; } } @@ -344,16 +345,17 @@ ScUndoDeleteCells::ScUndoDeleteCells( ScDocShell* pNewDocShell, pScenarios( std::move(pNewScenarios) ), eCmd( eNewCmd ) { + ScDocument& rDoc = pDocShell->GetDocument(); if (eCmd == DelCellCmd::Rows) // whole row? { aEffRange.aStart.SetCol(0); - aEffRange.aEnd.SetCol(MAXCOL); + aEffRange.aEnd.SetCol(rDoc.MaxCol()); } if (eCmd == DelCellCmd::Cols) // whole column? { aEffRange.aStart.SetRow(0); - aEffRange.aEnd.SetRow(MAXROW); + aEffRange.aEnd.SetRow(rDoc.MaxRow()); } SetChangeTrack(); @@ -447,7 +449,7 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) ScRange aWorkRange( aEffRange ); if ( eCmd == DelCellCmd::CellsLeft ) // only "shift left" requires refresh of the moved area - aWorkRange.aEnd.SetCol(MAXCOL); + aWorkRange.aEnd.SetCol(rDoc.MaxCol()); for( i=0; i<nCount; i++ ) { @@ -460,9 +462,9 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) if ( !bUndo ) { if ( eCmd==DelCellCmd::Cols || eCmd==DelCellCmd::CellsLeft ) - aWorkRange.aEnd.SetCol(MAXCOL); + aWorkRange.aEnd.SetCol(rDoc.MaxCol()); if ( eCmd==DelCellCmd::Rows || eCmd==DelCellCmd::CellsUp ) - aWorkRange.aEnd.SetRow(MAXROW); + aWorkRange.aEnd.SetRow(rDoc.MaxRow()); ScMarkData aMarkData; aMarkData.SelectOneTable( aWorkRange.aStart.Tab() ); ScPatternAttr aPattern( rDoc.GetPool() ); @@ -484,16 +486,16 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) { case DelCellCmd::Rows: nPaint |= PaintPartFlags::Left; - aWorkRange.aEnd.SetRow(MAXROW); + aWorkRange.aEnd.SetRow(rDoc.MaxRow()); break; case DelCellCmd::CellsUp: for( i=0; i<nCount; i++ ) { - aWorkRange.aEnd.SetRow(MAXROW); + aWorkRange.aEnd.SetRow(rDoc.MaxRow()); if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] )) { aWorkRange.aStart.SetCol(0); - aWorkRange.aEnd.SetCol(MAXCOL); + aWorkRange.aEnd.SetCol(rDoc.MaxCol()); nPaint |= PaintPartFlags::Left; } } @@ -504,11 +506,11 @@ void ScUndoDeleteCells::DoChange( const bool bUndo ) case DelCellCmd::CellsLeft: for( i=0; i<nCount; i++ ) { - aWorkRange.aEnd.SetCol(MAXCOL); // to the far right + aWorkRange.aEnd.SetCol(rDoc.MaxCol()); // to the far right if ( pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), pTabs[i] ) ) { aWorkRange.aStart.SetCol(0); - aWorkRange.aEnd.SetRow(MAXROW); + aWorkRange.aEnd.SetRow(rDoc.MaxRow()); nPaint |= PaintPartFlags::Left; } } @@ -557,7 +559,7 @@ void ScUndoDeleteCells::Undo() // pRefUndoDoc we can apply the AutoFilter buttons. // Add one row for cases undoing deletion right above a cut AutoFilter // range so the buttons are removed. - SCROW nRefreshEndRow = std::min<SCROW>( aEffRange.aEnd.Row() + 1, MAXROW); + SCROW nRefreshEndRow = std::min<SCROW>( aEffRange.aEnd.Row() + 1, rDoc.MaxRow()); for (SCTAB i=0; i < nCount; ++i) { rDoc.RefreshAutoFilter( aEffRange.aStart.Col(), aEffRange.aStart.Row(), @@ -645,6 +647,7 @@ void ScUndoDeleteMulti::DoChange() const SCCOL nStartCol; SCROW nStartRow; PaintPartFlags nPaint; + ScDocument& rDoc = pDocShell->GetDocument(); if (mbRows) { nStartCol = 0; @@ -660,14 +663,13 @@ void ScUndoDeleteMulti::DoChange() const if (mbRefresh) { - ScDocument& rDoc = pDocShell->GetDocument(); - SCCOL nEndCol = MAXCOL; - SCROW nEndRow = MAXROW; + SCCOL nEndCol = rDoc.MaxCol(); + SCROW nEndRow = rDoc.MaxRow(); rDoc.RemoveFlagsTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, ScMF::Hor | ScMF::Ver ); rDoc.ExtendMerge( nStartCol, nStartRow, nEndCol, nEndRow, nTab, true ); } - pDocShell->PostPaint( nStartCol, nStartRow, nTab, MAXCOL, MAXROW, nTab, nPaint ); + pDocShell->PostPaint( nStartCol, nStartRow, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab, nPaint ); pDocShell->PostDataChanged(); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) @@ -681,12 +683,13 @@ void ScUndoDeleteMulti::SetChangeTrack() ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack(); if ( pChangeTrack ) { + ScDocument& rDoc = pDocShell->GetDocument(); nStartChangeAction = pChangeTrack->GetActionMax() + 1; ScRange aRange( 0, 0, nTab, 0, 0, nTab ); if (mbRows) - aRange.aEnd.SetCol( MAXCOL ); + aRange.aEnd.SetCol( rDoc.MaxCol() ); else - aRange.aEnd.SetRow( MAXROW ); + aRange.aEnd.SetRow( rDoc.MaxRow() ); // delete in reverse std::vector<sc::ColRowSpan>::const_reverse_iterator ri = maSpans.rbegin(), riEnd = maSpans.rend(); for (; ri != riEnd; ++ri) @@ -725,9 +728,9 @@ void ScUndoDeleteMulti::Undo() SCCOLROW nStart = rSpan.mnStart; SCCOLROW nEnd = rSpan.mnEnd; if (mbRows) - rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) ); + rDoc.InsertRow( 0,nTab, rDoc.MaxCol(),nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) ); else - rDoc.InsertCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) ); + rDoc.InsertCol( 0,nTab, rDoc.MaxRow(),nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) ); } for (const auto& rSpan : maSpans) @@ -735,10 +738,10 @@ void ScUndoDeleteMulti::Undo() SCCOLROW nStart = rSpan.mnStart; SCCOLROW nEnd = rSpan.mnEnd; if (mbRows) - pRefUndoDoc->CopyToDocument(0, nStart, nTab, MAXCOL, nEnd, nTab, InsertDeleteFlags::ALL, false, rDoc); + pRefUndoDoc->CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::ALL, false, rDoc); else pRefUndoDoc->CopyToDocument(static_cast<SCCOL>(nStart),0,nTab, - static_cast<SCCOL>(nEnd), MAXROW, nTab, InsertDeleteFlags::ALL, false, rDoc); + static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::ALL, false, rDoc); } ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack(); @@ -768,9 +771,9 @@ void ScUndoDeleteMulti::Redo() SCCOLROW nEnd = ri->mnEnd; SCCOLROW nStart = ri->mnStart; if (mbRows) - rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) ); + rDoc.DeleteRow( 0,nTab, rDoc.MaxCol(),nTab, nStart,static_cast<SCSIZE>(nEnd-nStart+1) ); else - rDoc.DeleteCol( 0,nTab, MAXROW,nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) ); + rDoc.DeleteCol( 0,nTab, rDoc.MaxRow(),nTab, static_cast<SCCOL>(nStart), static_cast<SCSIZE>(nEnd-nStart+1) ); } SetChangeTrack(); @@ -980,8 +983,8 @@ void ScUndoPaste::DoChange(bool bUndo) for (size_t i = 0, n = maBlockRanges.size(); i < n; ++i) { const ScRange& r = maBlockRanges[i]; - bColInfo &= (r.aStart.Row() == 0 && r.aEnd.Row() == MAXROW); - bRowInfo &= (r.aStart.Col() == 0 && r.aEnd.Col() == MAXCOL); + bColInfo &= (r.aStart.Row() == 0 && r.aEnd.Row() == rDoc.MaxRow()); + bRowInfo &= (r.aStart.Col() == 0 && r.aEnd.Col() == rDoc.MaxCol()); if (!bColInfo && !bRowInfo) break; } @@ -1041,7 +1044,7 @@ void ScUndoPaste::DoChange(bool bUndo) { pWorkRefData->DoUndo( &rDoc, true ); // true = bSetChartRangeLists for SetChartListenerCollection if (!maBlockRanges.empty() && - rDoc.RefreshAutoFilter(0, 0, MAXCOL, MAXROW, maBlockRanges[0].aStart.Tab())) + rDoc.RefreshAutoFilter(0, 0, rDoc.MaxCol(), rDoc.MaxRow(), maBlockRanges[0].aStart.Tab())) bPaintAll = true; } @@ -1085,30 +1088,30 @@ void ScUndoPaste::DoChange(bool bUndo) { rDrawRange.aStart.SetCol(0); rDrawRange.aStart.SetRow(0); - rDrawRange.aEnd.SetCol(MAXCOL); - rDrawRange.aEnd.SetRow(MAXROW); + rDrawRange.aEnd.SetCol(rDoc.MaxCol()); + rDrawRange.aEnd.SetRow(rDoc.MaxRow()); nPaint |= PaintPartFlags::Top | PaintPartFlags::Left; if (pViewShell) pViewShell->AdjustBlockHeight(false, &aData); } else { - if (maBlockRanges[i].aStart.Row() == 0 && maBlockRanges[i].aEnd.Row() == MAXROW) // whole column + if (maBlockRanges[i].aStart.Row() == 0 && maBlockRanges[i].aEnd.Row() == rDoc.MaxRow()) // whole column { nPaint |= PaintPartFlags::Top; - rDrawRange.aEnd.SetCol(MAXCOL); + rDrawRange.aEnd.SetCol(rDoc.MaxCol()); } - if (maBlockRanges[i].aStart.Col() == 0 && maBlockRanges[i].aEnd.Col() == MAXCOL) // whole row + if (maBlockRanges[i].aStart.Col() == 0 && maBlockRanges[i].aEnd.Col() == rDoc.MaxCol()) // whole row { nPaint |= PaintPartFlags::Left; - rDrawRange.aEnd.SetRow(MAXROW); + rDrawRange.aEnd.SetRow(rDoc.MaxRow()); } if (pViewShell && pViewShell->AdjustBlockHeight(false, &aData)) { rDrawRange.aStart.SetCol(0); rDrawRange.aStart.SetRow(0); - rDrawRange.aEnd.SetCol(MAXCOL); - rDrawRange.aEnd.SetRow(MAXROW); + rDrawRange.aEnd.SetCol(rDoc.MaxCol()); + rDrawRange.aEnd.SetRow(rDoc.MaxRow()); nPaint |= PaintPartFlags::Left; } pDocShell->UpdatePaintExt(nExtFlags, rDrawRange); @@ -1249,8 +1252,8 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const // tdf#76183: recalculate objects' positions rDoc.SetDrawPageSize(aRange.aStart.Tab()); aRange.aStart.SetCol(0); - aRange.aEnd.SetCol(MAXCOL); - aRange.aEnd.SetRow(MAXROW); + aRange.aEnd.SetCol(rDoc.MaxCol()); + aRange.aEnd.SetRow(rDoc.MaxRow()); nPaint |= PaintPartFlags::Left; } } @@ -1260,20 +1263,20 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const // Copy scenario -> also paint scenario boarder aRange.aStart.SetCol(0); aRange.aStart.SetRow(0); - aRange.aEnd.SetCol(MAXCOL); - aRange.aEnd.SetRow(MAXROW); + aRange.aEnd.SetCol(rDoc.MaxCol()); + aRange.aEnd.SetRow(rDoc.MaxRow()); } // column/row info (width/height) included if whole columns/rows were copied - if ( aSrcRange.aStart.Col() == 0 && aSrcRange.aEnd.Col() == MAXCOL ) + if ( aSrcRange.aStart.Col() == 0 && aSrcRange.aEnd.Col() == rDoc.MaxCol() ) { nPaint |= PaintPartFlags::Left; - aRange.aEnd.SetRow(MAXROW); + aRange.aEnd.SetRow(rDoc.MaxRow()); } - if ( aSrcRange.aStart.Row() == 0 && aSrcRange.aEnd.Row() == MAXROW ) + if ( aSrcRange.aStart.Row() == 0 && aSrcRange.aEnd.Row() == rDoc.MaxRow() ) { nPaint |= PaintPartFlags::Top; - aRange.aEnd.SetCol(MAXCOL); + aRange.aEnd.SetCol(rDoc.MaxCol()); } pDocShell->PostPaint( aRange, nPaint, nExtFlags ); @@ -1696,8 +1699,8 @@ void ScUndoUseScenario::Undo() // For copy-back scenario also consider content if ( nScenFlags & ScScenarioFlags::TwoWay ) { - rDoc.DeleteAreaTab( 0,0, MAXCOL,MAXROW, i, InsertDeleteFlags::ALL ); - pUndoDoc->CopyToDocument(0,0,i, MAXCOL,MAXROW,i, InsertDeleteFlags::ALL,false, rDoc); + rDoc.DeleteAreaTab( 0,0, rDoc.MaxCol(),rDoc.MaxRow(), i, InsertDeleteFlags::ALL ); + pUndoDoc->CopyToDocument(0,0,i, rDoc.MaxCol(),rDoc.MaxRow(),i, InsertDeleteFlags::ALL,false, rDoc); } if ( nScenFlags & ScScenarioFlags::ShowFrame ) bFrame = true; @@ -1705,7 +1708,7 @@ void ScUndoUseScenario::Undo() // if visible borders, then paint all if (bFrame) - pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid | PaintPartFlags::Extras ); + pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid | PaintPartFlags::Extras ); else pDocShell->PostPaint( aRange, PaintPartFlags::Grid | PaintPartFlags::Extras ); pDocShell->PostDataChanged(); @@ -2148,10 +2151,10 @@ void ScUndoRemoveBreaks::Undo() ScDocument& rDoc = pDocShell->GetDocument(); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); - pUndoDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, InsertDeleteFlags::NONE, false, rDoc); + pUndoDoc->CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::NONE, false, rDoc); if (pViewShell) pViewShell->UpdatePageBreakData( true ); - pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid ); + pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid ); EndUndo(); } @@ -2167,7 +2170,7 @@ void ScUndoRemoveBreaks::Redo() rDoc.UpdatePageBreaks(nTab); if (pViewShell) pViewShell->UpdatePageBreakData( true ); - pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid ); + pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid ); EndRedo(); } diff --git a/sc/source/ui/undo/undoblk2.cxx b/sc/source/ui/undo/undoblk2.cxx index 5f835fcc1324..9b4de7f89f62 100644 --- a/sc/source/ui/undo/undoblk2.cxx +++ b/sc/source/ui/undo/undoblk2.cxx @@ -107,17 +107,17 @@ void ScUndoWidthOrHeight::Undo() if (bWidth) // Width { pUndoDoc->CopyToDocument(static_cast<SCCOL>(nStart), 0, rTab, - static_cast<SCCOL>(nEnd), MAXROW, rTab, InsertDeleteFlags::NONE, + static_cast<SCCOL>(nEnd), rDoc.MaxRow(), rTab, InsertDeleteFlags::NONE, false, rDoc); rDoc.UpdatePageBreaks( rTab ); pDocShell->PostPaint( static_cast<SCCOL>(nPaintStart), 0, rTab, - MAXCOL, MAXROW, rTab, PaintPartFlags::Grid | PaintPartFlags::Top ); + rDoc.MaxCol(), rDoc.MaxRow(), rTab, PaintPartFlags::Grid | PaintPartFlags::Top ); } else // Height { - pUndoDoc->CopyToDocument(0, nStart, rTab, MAXCOL, nEnd, rTab, InsertDeleteFlags::NONE, false, rDoc); + pUndoDoc->CopyToDocument(0, nStart, rTab, rDoc.MaxCol(), nEnd, rTab, InsertDeleteFlags::NONE, false, rDoc); rDoc.UpdatePageBreaks( rTab ); - pDocShell->PostPaint( 0, nPaintStart, rTab, MAXCOL, MAXROW, rTab, PaintPartFlags::Grid | PaintPartFlags::Left ); + pDocShell->PostPaint( 0, nPaintStart, rTab, rDoc.MaxCol(), rDoc.MaxRow(), rTab, PaintPartFlags::Grid | PaintPartFlags::Left ); } } @@ -139,6 +139,8 @@ void ScUndoWidthOrHeight::Redo() { BeginRedo(); + ScDocument& rDoc = pDocShell->GetDocument(); + bool bPaintAll = false; if (eMode==SC_SIZE_OPTIMAL) { @@ -160,7 +162,7 @@ void ScUndoWidthOrHeight::Redo() // paint grid if selection was changed directly at the MarkData if (bPaintAll) - pDocShell->PostPaint( 0, 0, nStartTab, MAXCOL, MAXROW, nEndTab, PaintPartFlags::Grid ); + pDocShell->PostPaint( 0, 0, nStartTab, rDoc.MaxCol(), rDoc.MaxRow(), nEndTab, PaintPartFlags::Grid ); EndRedo(); } diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 5a7b79852980..215d7e20a3de 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -294,7 +294,7 @@ void ScUndoFillTable::DoChange( const bool bUndo ) SetChangeTrack(); } - pDocShell->PostPaint(0,0,0,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Extras); + pDocShell->PostPaint(0,0,0,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Extras); pDocShell->PostDataChanged(); // CellContentChanged comes with the selection @@ -806,11 +806,11 @@ void ScUndoAutoFormat::Undo() SCROW nEndY = aBlockRange.aEnd.Row(); SCTAB nEndZ = aBlockRange.aEnd.Tab(); - pUndoDoc->CopyToDocument( nStartX, 0, 0, nEndX, MAXROW, nTabCount-1, + pUndoDoc->CopyToDocument( nStartX, 0, 0, nEndX, rDoc.MaxRow(), nTabCount-1, InsertDeleteFlags::NONE, false, rDoc, &aMarkData ); - pUndoDoc->CopyToDocument( 0, nStartY, 0, MAXCOL, nEndY, nTabCount-1, + pUndoDoc->CopyToDocument( 0, nStartY, 0, rDoc.MaxCol(), nEndY, nTabCount-1, InsertDeleteFlags::NONE, false, rDoc, &aMarkData ); - pDocShell->PostPaint( 0, 0, nStartZ, MAXCOL, MAXROW, nEndZ, + pDocShell->PostPaint( 0, 0, nStartZ, rDoc.MaxCol(), rDoc.MaxRow(), nEndZ, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top, SC_PF_LINES ); } else @@ -891,7 +891,7 @@ void ScUndoAutoFormat::Redo() } pDocShell->PostPaint( 0, 0, nStartZ, - MAXCOL, MAXROW, nEndZ, + rDoc.MaxCol(), rDoc.MaxRow(), nEndZ, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Top, SC_PF_LINES); } else @@ -989,7 +989,7 @@ void ScUndoReplace::Undo() InsertDeleteFlags nUndoFlags = (pSearchItem->GetPattern()) ? InsertDeleteFlags::ATTRIB : InsertDeleteFlags::CONTENTS; pUndoDoc->CopyToDocument( 0, 0, 0, - MAXCOL, MAXROW, MAXTAB, + rDoc.MaxCol(), rDoc.MaxRow(), MAXTAB, nUndoFlags, false, rDoc, nullptr, false ); // without row flags pDocShell->PostPaintGridAll(); } @@ -1232,7 +1232,7 @@ void ScUndoConversion::DoChange( ScDocument* pRefDoc, const ScAddress& rCursorPo bool bMulti = aMarkData.IsMultiMarked(); pRefDoc->CopyToDocument( 0, 0, 0, - MAXCOL, MAXROW, nTabCount-1, + rDoc.MaxCol(), rDoc.MaxRow(), nTabCount-1, InsertDeleteFlags::CONTENTS, bMulti, rDoc, &aMarkData ); pDocShell->PostPaintGridAll(); } @@ -1382,7 +1382,7 @@ void ScUndoRefreshLink::Undo() for (SCTAB nTab=0; nTab<nCount; nTab++) if (xUndoDoc->HasTable(nTab)) { - ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab); + ScRange aRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab); if (bMakeRedo) { if (bFirst) @@ -1427,7 +1427,7 @@ void ScUndoRefreshLink::Redo() for (SCTAB nTab=0; nTab<nCount; nTab++) if (xRedoDoc->HasTable(nTab)) { - ScRange aRange(0,0,nTab,MAXCOL,MAXROW,nTab); + ScRange aRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab); rDoc.DeleteAreaTab( aRange, InsertDeleteFlags::ALL ); xRedoDoc->CopyToDocument(aRange, InsertDeleteFlags::ALL, false, rDoc); @@ -1676,9 +1676,9 @@ void ScUndoUpdateAreaLink::DoChange( const bool bUndo ) const // Paint if ( aNewRange.aEnd.Col() != aOldRange.aEnd.Col() ) - aWorkRange.aEnd.SetCol(MAXCOL); + aWorkRange.aEnd.SetCol(rDoc.MaxCol()); if ( aNewRange.aEnd.Row() != aOldRange.aEnd.Row() ) - aWorkRange.aEnd.SetRow(MAXROW); + aWorkRange.aEnd.SetRow(rDoc.MaxRow()); if ( !pDocShell->AdjustRowHeight( aWorkRange.aStart.Row(), aWorkRange.aEnd.Row(), aWorkRange.aStart.Tab() ) ) pDocShell->PostPaint( aWorkRange, PaintPartFlags::Grid ); diff --git a/sc/source/ui/undo/undodat.cxx b/sc/source/ui/undo/undodat.cxx index 16698857144d..34d9ffb32f52 100644 --- a/sc/source/ui/undo/undodat.cxx +++ b/sc/source/ui/undo/undodat.cxx @@ -96,13 +96,13 @@ void ScUndoDoOutline::Undo() // Original column/row status if (bColumns) pUndoDoc->CopyToDocument(static_cast<SCCOL>(nStart), 0, nTab, - static_cast<SCCOL>(nEnd), MAXROW, nTab, InsertDeleteFlags::NONE, false, rDoc); + static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, rDoc); else - pUndoDoc->CopyToDocument(0, nStart, nTab, MAXCOL, nEnd, nTab, InsertDeleteFlags::NONE, false, rDoc); + pUndoDoc->CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, rDoc); pViewShell->UpdateScrollBars(); - pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top); + pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top); EndUndo(); } @@ -177,7 +177,7 @@ void ScUndoMakeOutline::Undo() if ( nVisTab != nTab ) pViewShell->SetTabNo( nTab ); - pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); + pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); ScTabViewShell::notifyAllViewsHeaderInvalidation( bColumns, nTab ); @@ -188,6 +188,7 @@ void ScUndoMakeOutline::Redo() { BeginRedo(); + ScDocument& rDoc = pDocShell->GetDocument(); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockStart, aBlockEnd ); @@ -197,7 +198,7 @@ void ScUndoMakeOutline::Redo() else pViewShell->RemoveOutline( bColumns, false ); - pDocShell->PostPaint(0,0,aBlockStart.Tab(),MAXCOL,MAXROW,aBlockEnd.Tab(),PaintPartFlags::Grid); + pDocShell->PostPaint(0,0,aBlockStart.Tab(),rDoc.MaxCol(),rDoc.MaxRow(),aBlockEnd.Tab(),PaintPartFlags::Grid); EndRedo(); } @@ -255,9 +256,9 @@ void ScUndoOutlineLevel::Undo() if (bColumns) xUndoDoc->CopyToDocument(static_cast<SCCOL>(nStart), 0, nTab, - static_cast<SCCOL>(nEnd), MAXROW, nTab, InsertDeleteFlags::NONE, false, rDoc); + static_cast<SCCOL>(nEnd), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, rDoc); else - xUndoDoc->CopyToDocument(0, nStart, nTab, MAXCOL, nEnd, nTab, InsertDeleteFlags::NONE, false, rDoc); + xUndoDoc->CopyToDocument(0, nStart, nTab, rDoc.MaxCol(), nEnd, nTab, InsertDeleteFlags::NONE, false, rDoc); rDoc.UpdatePageBreaks( nTab ); @@ -267,7 +268,7 @@ void ScUndoOutlineLevel::Undo() if ( nVisTab != nTab ) pViewShell->SetTabNo( nTab ); - pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top); + pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top); EndUndo(); } @@ -348,8 +349,8 @@ void ScUndoOutlineBlock::Undo() } xUndoDoc->CopyToDocument(static_cast<SCCOL>(nStartCol), 0, nTab, - static_cast<SCCOL>(nEndCol), MAXROW, nTab, InsertDeleteFlags::NONE, false, rDoc); - xUndoDoc->CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); + static_cast<SCCOL>(nEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, rDoc); + xUndoDoc->CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); rDoc.UpdatePageBreaks( nTab ); @@ -359,7 +360,7 @@ void ScUndoOutlineBlock::Undo() if ( nVisTab != nTab ) pViewShell->SetTabNo( nTab ); - pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top); + pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top); pViewShell->OnLOKShowHideColRow(/*columns: */ true, nStartCol - 1); @@ -435,8 +436,8 @@ void ScUndoRemoveAllOutlines::Undo() SCROW nStartRow = aBlockStart.Row(); SCROW nEndRow = aBlockEnd.Row(); - xUndoDoc->CopyToDocument(nStartCol, 0, nTab, nEndCol, MAXROW, nTab, InsertDeleteFlags::NONE, false, rDoc); - xUndoDoc->CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); + xUndoDoc->CopyToDocument(nStartCol, 0, nTab, nEndCol, rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, rDoc); + xUndoDoc->CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); rDoc.UpdatePageBreaks( nTab ); @@ -446,7 +447,7 @@ void ScUndoRemoveAllOutlines::Undo() if ( nVisTab != nTab ) pViewShell->SetTabNo( nTab ); - pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); + pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); ScTabViewShell::notifyAllViewsHeaderInvalidation(BOTH_HEADERS, nTab); @@ -521,9 +522,9 @@ void ScUndoAutoOutline::Undo() xUndoTable->GetRowArray().GetRange(nStartRow, nEndRow); xUndoDoc->CopyToDocument(static_cast<SCCOL>(nStartCol), 0, nTab, - static_cast<SCCOL>(nEndCol), MAXROW, nTab, InsertDeleteFlags::NONE, false, + static_cast<SCCOL>(nEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, rDoc); - xUndoDoc->CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); + xUndoDoc->CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); pViewShell->UpdateScrollBars(); } @@ -532,7 +533,7 @@ void ScUndoAutoOutline::Undo() if ( nVisTab != nTab ) pViewShell->SetTabNo( nTab ); - pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); + pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); EndUndo(); } @@ -609,11 +610,11 @@ void ScUndoSubTotals::Undo() if (nNewEndRow > aParam.nRow2) { - rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aParam.nRow2+1, static_cast<SCSIZE>(nNewEndRow-aParam.nRow2) ); + rDoc.DeleteRow( 0,nTab, rDoc.MaxCol(),nTab, aParam.nRow2+1, static_cast<SCSIZE>(nNewEndRow-aParam.nRow2) ); } else if (nNewEndRow < aParam.nRow2) { - rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(aParam.nRow2-nNewEndRow) ); + rDoc.InsertRow( 0,nTab, rDoc.MaxCol(),nTab, nNewEndRow+1, static_cast<SCSIZE>(aParam.nRow2-nNewEndRow) ); } // Original Outline table @@ -630,9 +631,9 @@ void ScUndoSubTotals::Undo() xUndoTable->GetRowArray().GetRange(nStartRow, nEndRow); xUndoDoc->CopyToDocument(static_cast<SCCOL>(nStartCol), 0, nTab, - static_cast<SCCOL>(nEndCol), MAXROW, nTab, InsertDeleteFlags::NONE, false, + static_cast<SCCOL>(nEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, rDoc); - xUndoDoc->CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); + xUndoDoc->CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); pViewShell->UpdateScrollBars(); } @@ -640,13 +641,13 @@ void ScUndoSubTotals::Undo() // Original data and references ScUndoUtil::MarkSimpleBlock( pDocShell, 0, aParam.nRow1+1, nTab, - MAXCOL, aParam.nRow2, nTab ); + rDoc.MaxCol(), aParam.nRow2, nTab ); - rDoc.DeleteAreaTab( 0,aParam.nRow1+1, MAXCOL,aParam.nRow2, nTab, InsertDeleteFlags::ALL ); + rDoc.DeleteAreaTab( 0,aParam.nRow1+1, rDoc.MaxCol(),aParam.nRow2, nTab, InsertDeleteFlags::ALL ); - xUndoDoc->CopyToDocument(0, aParam.nRow1+1, nTab, MAXCOL, aParam.nRow2, nTab, + xUndoDoc->CopyToDocument(0, aParam.nRow1+1, nTab, rDoc.MaxCol(), aParam.nRow2, nTab, InsertDeleteFlags::NONE, false, rDoc); // Flags - xUndoDoc->UndoToDocument(0, aParam.nRow1+1, nTab, MAXCOL, aParam.nRow2, nTab, + xUndoDoc->UndoToDocument(0, aParam.nRow1+1, nTab, rDoc.MaxCol(), aParam.nRow2, nTab, InsertDeleteFlags::ALL, false, rDoc); ScUndoUtil::MarkSimpleBlock( pDocShell, aParam.nCol1,aParam.nRow1,nTab, @@ -661,7 +662,7 @@ void ScUndoSubTotals::Undo() if ( nVisTab != nTab ) pViewShell->SetTabNo( nTab ); - pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); + pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); pDocShell->PostDataChanged(); EndUndo(); @@ -788,7 +789,7 @@ void ScUndoQuery::Undo() } } else - xUndoDoc->CopyToDocument(0, aQueryParam.nRow1, nTab, MAXCOL, aQueryParam.nRow2, nTab, + xUndoDoc->CopyToDocument(0, aQueryParam.nRow1, nTab, rDoc.MaxCol(), aQueryParam.nRow2, nTab, InsertDeleteFlags::NONE, false, rDoc); if (xUndoDB) @@ -801,7 +802,7 @@ void ScUndoQuery::Undo() } ScRange aDirtyRange( 0 , aQueryParam.nRow1, nTab, - MAXCOL, aQueryParam.nRow2, nTab ); + rDoc.MaxCol(), aQueryParam.nRow2, nTab ); rDoc.SetDirty( aDirtyRange, true ); DoSdrUndoAction( pDrawUndo.get(), &rDoc ); @@ -829,12 +830,12 @@ void ScUndoQuery::Undo() nEndY = aOldDest.aEnd.Row(); } if (bDoSize) - nEndY = MAXROW; + nEndY = rDoc.MaxRow(); pDocShell->PostPaint( aQueryParam.nDestCol, aQueryParam.nDestRow, aQueryParam.nDestTab, nEndX, nEndY, aQueryParam.nDestTab, PaintPartFlags::Grid ); } else - pDocShell->PostPaint( 0, aQueryParam.nRow1, nTab, MAXCOL, MAXROW, nTab, + pDocShell->PostPaint( 0, aQueryParam.nRow1, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab, PaintPartFlags::Grid | PaintPartFlags::Left ); pDocShell->PostDataChanged(); @@ -1112,7 +1113,7 @@ void ScUndoImportData::Undo() pViewShell->SetTabNo( nTab ); if (bMoveCells) - pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid ); + pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid ); else pDocShell->PostPaint( aImportParam.nCol1,aImportParam.nRow1,nTab, nEndCol,nEndRow,nTab, PaintPartFlags::Grid ); @@ -1181,7 +1182,7 @@ void ScUndoImportData::Redo() pViewShell->SetTabNo( nTab ); if (bMoveCells) - pDocShell->PostPaint( 0,0,nTab, MAXCOL,MAXROW,nTab, PaintPartFlags::Grid ); + pDocShell->PostPaint( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid ); else pDocShell->PostPaint( aImportParam.nCol1,aImportParam.nRow1,nTab, nEndCol,nEndRow,nTab, PaintPartFlags::Grid ); @@ -1262,7 +1263,7 @@ void ScUndoRepeatDB::Undo() SCCOL nFormulaCols = 0; SCCOL nCol = aOldQuery.aEnd.Col() + 1; SCROW nRow = aOldQuery.aStart.Row() + 1; // test the header - while ( nCol <= MAXCOL && + while ( nCol <= rDoc.MaxCol() && rDoc.GetCellType(ScAddress( nCol, nRow, nTab )) == CELLTYPE_FORMULA ) { ++nCol; @@ -1285,11 +1286,11 @@ void ScUndoRepeatDB::Undo() if (nNewEndRow > aBlockEnd.Row()) { - rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aBlockEnd.Row()+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) ); + rDoc.DeleteRow( 0,nTab, rDoc.MaxCol(),nTab, aBlockEnd.Row()+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) ); } else if (nNewEndRow < aBlockEnd.Row()) { - rDoc.InsertRow( 0,nTab, MAXCOL,nTab, nNewEndRow+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) ); + rDoc.InsertRow( 0,nTab, rDoc.MaxCol(),nTab, nNewEndRow+1, static_cast<SCSIZE>(nNewEndRow-aBlockEnd.Row()) ); } // Original Outline table @@ -1306,22 +1307,22 @@ void ScUndoRepeatDB::Undo() xUndoTable->GetRowArray().GetRange(nStartRow, nEndRow); xUndoDoc->CopyToDocument(static_cast<SCCOL>(nStartCol), 0, nTab, - static_cast<SCCOL>(nEndCol), MAXROW, nTab, InsertDeleteFlags::NONE, false, + static_cast<SCCOL>(nEndCol), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, rDoc); - xUndoDoc->CopyToDocument(0, nStartRow, nTab, MAXCOL, nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); + xUndoDoc->CopyToDocument(0, nStartRow, nTab, rDoc.MaxCol(), nEndRow, nTab, InsertDeleteFlags::NONE, false, rDoc); pViewShell->UpdateScrollBars(); } // Original data and references ScUndoUtil::MarkSimpleBlock( pDocShell, 0, aBlockStart.Row(), nTab, - MAXCOL, aBlockEnd.Row(), nTab ); + rDoc.MaxCol(), aBlockEnd.Row(), nTab ); rDoc.DeleteAreaTab( 0, aBlockStart.Row(), - MAXCOL, aBlockEnd.Row(), nTab, InsertDeleteFlags::ALL ); + rDoc.MaxCol(), aBlockEnd.Row(), nTab, InsertDeleteFlags::ALL ); - xUndoDoc->CopyToDocument(0, aBlockStart.Row(), nTab, MAXCOL, aBlockEnd.Row(), nTab, + xUndoDoc->CopyToDocument(0, aBlockStart.Row(), nTab, rDoc.MaxCol(), aBlockEnd.Row(), nTab, InsertDeleteFlags::NONE, false, rDoc); // Flags - xUndoDoc->UndoToDocument(0, aBlockStart.Row(), nTab, MAXCOL, aBlockEnd.Row(), nTab, + xUndoDoc->UndoToDocument(0, aBlockStart.Row(), nTab, rDoc.MaxCol(), aBlockEnd.Row(), nTab, InsertDeleteFlags::ALL, false, rDoc); ScUndoUtil::MarkSimpleBlock( pDocShell, aBlockStart.Col(),aBlockStart.Row(),nTab, @@ -1336,7 +1337,7 @@ void ScUndoRepeatDB::Undo() if ( nVisTab != nTab ) pViewShell->SetTabNo( nTab ); - pDocShell->PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); + pDocShell->PostPaint(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab,PaintPartFlags::Grid|PaintPartFlags::Left|PaintPartFlags::Top|PaintPartFlags::Size); pDocShell->PostDataChanged(); EndUndo(); @@ -1548,16 +1549,16 @@ void ScUndoConsolidate::Undo() if (bInsRef) { - rDoc.DeleteRow( 0,nTab, MAXCOL,nTab, aDestArea.nRowStart, nInsertCount ); + rDoc.DeleteRow( 0,nTab, rDoc.MaxCol(),nTab, aDestArea.nRowStart, nInsertCount ); rDoc.SetOutlineTable(nTab, xUndoTab.get()); // Row status - xUndoDoc->CopyToDocument(0, 0, nTab, MAXCOL, MAXROW, nTab, InsertDeleteFlags::NONE, false, rDoc); + xUndoDoc->CopyToDocument(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab, InsertDeleteFlags::NONE, false, rDoc); // Data and references - rDoc.DeleteAreaTab( 0,aDestArea.nRowStart, MAXCOL,aDestArea.nRowEnd, nTab, InsertDeleteFlags::ALL ); + rDoc.DeleteAreaTab( 0,aDestArea.nRowStart, rDoc.MaxCol(),aDestArea.nRowEnd, nTab, InsertDeleteFlags::ALL ); xUndoDoc->UndoToDocument(0, aDestArea.nRowStart, nTab, - MAXCOL, aDestArea.nRowEnd, nTab, + rDoc.MaxCol(), aDestArea.nRowEnd, nTab, InsertDeleteFlags::ALL, false, rDoc); // Original range @@ -1567,7 +1568,7 @@ void ScUndoConsolidate::Undo() xUndoDoc->CopyToDocument(aOldRange, InsertDeleteFlags::ALL, false, rDoc); } - pDocShell->PostPaint( 0,aDestArea.nRowStart,nTab, MAXCOL,MAXROW,nTab, + pDocShell->PostPaint( 0,aDestArea.nRowStart,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, PaintPartFlags::Grid | PaintPartFlags::Left | PaintPartFlags::Size ); } else @@ -1800,8 +1801,8 @@ void ScUndoDataForm::DoChange( const bool bUndo ) { if (!xRedoDoc) { - bool bColInfo = ( aBlockRange.aStart.Row()==0 && aBlockRange.aEnd.Row()==MAXROW ); - bool bRowInfo = ( aBlockRange.aStart.Col()==0 && aBlockRange.aEnd.Col()==MAXCOL ); + bool bColInfo = ( aBlockRange.aStart.Row()==0 && aBlockRange.aEnd.Row()==rDoc.MaxRow() ); + bool bRowInfo = ( aBlockRange.aStart.Col()==0 && aBlockRange.aEnd.Col()==rDoc.MaxCol() ); xRedoDoc.reset(new ScDocument(SCDOCMODE_UNDO)); xRedoDoc->InitUndoSelected(&rDoc, *mxMarkData, bColInfo, bRowInfo); @@ -1828,7 +1829,7 @@ void ScUndoDataForm::DoChange( const bool bUndo ) if (pWorkRefData) { pWorkRefData->DoUndo( &rDoc, true ); // TRUE = bSetChartRangeLists for SetChartListenerCollection - if ( rDoc.RefreshAutoFilter( 0,0, MAXCOL,MAXROW, aBlockRange.aStart.Tab() ) ) + if ( rDoc.RefreshAutoFilter( 0,0, rDoc.MaxCol(),rDoc.MaxRow(), aBlockRange.aStart.Tab() ) ) bPaintAll = true; } @@ -1849,30 +1850,30 @@ void ScUndoDataForm::DoChange( const bool bUndo ) { aDrawRange.aStart.SetCol(0); aDrawRange.aStart.SetRow(0); - aDrawRange.aEnd.SetCol(MAXCOL); - aDrawRange.aEnd.SetRow(MAXROW); + aDrawRange.aEnd.SetCol(rDoc.MaxCol()); + aDrawRange.aEnd.SetRow(rDoc.MaxRow()); nPaint |= PaintPartFlags::Top | PaintPartFlags::Left; /*A*/ if (pViewShell) pViewShell->AdjustBlockHeight(false); } else { - if ( aBlockRange.aStart.Row() == 0 && aBlockRange.aEnd.Row() == MAXROW ) // whole column + if ( aBlockRange.aStart.Row() == 0 && aBlockRange.aEnd.Row() == rDoc.MaxRow() ) // whole column { nPaint |= PaintPartFlags::Top; - aDrawRange.aEnd.SetCol(MAXCOL); + aDrawRange.aEnd.SetCol(rDoc.MaxCol()); } - if ( aBlockRange.aStart.Col() == 0 && aBlockRange.aEnd.Col() == MAXCOL ) // whole row + if ( aBlockRange.aStart.Col() == 0 && aBlockRange.aEnd.Col() == rDoc.MaxCol() ) // whole row { nPaint |= PaintPartFlags::Left; - aDrawRange.aEnd.SetRow(MAXROW); + aDrawRange.aEnd.SetRow(rDoc.MaxRow()); } /*A*/ if (pViewShell && pViewShell->AdjustBlockHeight(false)) { aDrawRange.aStart.SetCol(0); aDrawRange.aStart.SetRow(0); - aDrawRange.aEnd.SetCol(MAXCOL); - aDrawRange.aEnd.SetRow(MAXROW); + aDrawRange.aEnd.SetCol(rDoc.MaxCol()); + aDrawRange.aEnd.SetRow(rDoc.MaxRow()); nPaint |= PaintPartFlags::Left; } pDocShell->UpdatePaintExt( nExtFlags, aDrawRange ); diff --git a/sc/source/ui/undo/undostyl.cxx b/sc/source/ui/undo/undostyl.cxx index 86bfdd09835d..89aad6155455 100644 --- a/sc/source/ui/undo/undostyl.cxx +++ b/sc/source/ui/undo/undostyl.cxx @@ -181,7 +181,7 @@ void ScUndoModifyStyle::DoChange( ScDocShell* pDocSh, const OUString& rName, } } - pDocSh->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left ); + pDocSh->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid|PaintPartFlags::Left ); //! undo/redo document modifications for deleted styles //! undo/redo modifications of number formatter diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index b6613439c3ee..5463cd509b69 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -86,10 +86,11 @@ OUString ScUndoInsertTab::GetComment() const void ScUndoInsertTab::SetChangeTrack() { - ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack(); if ( pChangeTrack ) { - ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab ); + ScRange aRange( 0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab ); pChangeTrack->AppendInsert( aRange ); nEndChangeAction = pChangeTrack->GetActionMax(); } @@ -175,12 +176,13 @@ OUString ScUndoInsertTables::GetComment() const void ScUndoInsertTables::SetChangeTrack() { - ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack(); if ( pChangeTrack ) { nStartChangeAction = pChangeTrack->GetActionMax() + 1; nEndChangeAction = 0; - ScRange aRange( 0, 0, nTab, MAXCOL, MAXROW, nTab ); + ScRange aRange( 0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab ); for( size_t i = 0; i < aNameList.size(); i++ ) { aRange.aStart.SetTab( sal::static_int_cast<SCTAB>( nTab + i ) ); @@ -264,13 +266,14 @@ OUString ScUndoDeleteTab::GetComment() const void ScUndoDeleteTab::SetChangeTrack() { - ScChangeTrack* pChangeTrack = pDocShell->GetDocument().GetChangeTrack(); + ScDocument& rDoc = pDocShell->GetDocument(); + ScChangeTrack* pChangeTrack = rDoc.GetChangeTrack(); if ( pChangeTrack ) { sal_uLong nTmpChangeAction; nStartChangeAction = pChangeTrack->GetActionMax() + 1; nEndChangeAction = 0; - ScRange aRange( 0, 0, 0, MAXCOL, MAXROW, 0 ); + ScRange aRange( 0, 0, 0, rDoc.MaxCol(), rDoc.MaxRow(), 0 ); for ( size_t i = 0; i < theTabs.size(); ++i ) { aRange.aStart.SetTab( theTabs[i] ); @@ -308,7 +311,7 @@ void ScUndoDeleteTab::Undo() bDrawIsInUndo = false; if (bOk) { - pRefUndoDoc->CopyToDocument(0,0,nTab, MAXCOL,MAXROW,nTab, InsertDeleteFlags::ALL,false, rDoc); + pRefUndoDoc->CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::ALL,false, rDoc); OUString aOldName; pRefUndoDoc->GetName( nTab, aOldName ); @@ -362,7 +365,7 @@ void ScUndoDeleteTab::Undo() pSfxApp->Broadcast( SfxHint( SfxHintId::ScDbAreasChanged ) ); pSfxApp->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) ); - pDocShell->PostPaint(0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::All ); // incl. extras + pDocShell->PostPaint(0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::All ); // incl. extras // not ShowTable due to SetTabNo(..., sal_True): ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); @@ -803,7 +806,7 @@ void ScUndoMakeScenario::Undo() DoSdrUndoAction( pDrawUndo.get(), &rDoc ); - pDocShell->PostPaint(0,0,nDestTab,MAXCOL,MAXROW,MAXTAB, PaintPartFlags::All); + pDocShell->PostPaint(0,0,nDestTab,rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::All); pDocShell->PostDataChanged(); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); @@ -887,7 +890,7 @@ void ScUndoImportTab::DoChange() const } SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScTablesChanged ) ); // Navigator - pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, + pDocShell->PostPaint( 0,0,0, rDoc.MaxCol(),rDoc.MaxRow(),MAXTAB, PaintPartFlags::Grid | PaintPartFlags::Top | PaintPartFlags::Left | PaintPartFlags::Extras ); } @@ -908,7 +911,7 @@ void ScUndoImportTab::Undo() { SCTAB nTabPos=nTab+i; - rDoc.CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, InsertDeleteFlags::ALL,false, *xRedoDoc); + rDoc.CopyToDocument(0,0,nTabPos, rDoc.MaxCol(),rDoc.MaxRow(),nTabPos, InsertDeleteFlags::ALL,false, *xRedoDoc); rDoc.GetName( nTabPos, aOldName ); xRedoDoc->RenameTab(nTabPos, aOldName); xRedoDoc->SetTabBgColor(nTabPos, rDoc.GetTabBgColor(nTabPos)); @@ -965,7 +968,7 @@ void ScUndoImportTab::Redo() for (i=0; i<nCount; i++) // then copy into inserted sheets { SCTAB nTabPos=nTab+i; - xRedoDoc->CopyToDocument(0,0,nTabPos, MAXCOL,MAXROW,nTabPos, InsertDeleteFlags::ALL,false, rDoc); + xRedoDoc->CopyToDocument(0,0,nTabPos, rDoc.MaxCol(),rDoc.MaxRow(),nTabPos, InsertDeleteFlags::ALL,false, rDoc); rDoc.SetTabBgColor(nTabPos, xRedoDoc->GetTabBgColor(nTabPos)); if (xRedoDoc->IsScenario(nTabPos)) @@ -1312,7 +1315,7 @@ void ScUndoPrintRange::DoChange(bool bUndo) ScPrintFunc( pDocShell, pDocShell->GetPrinter(), nTab ).UpdatePages(); - pDocShell->PostPaint( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), PaintPartFlags::Grid ); + pDocShell->PostPaint( ScRange(0,0,nTab,rDoc.MaxCol(),rDoc.MaxRow(),nTab), PaintPartFlags::Grid ); } void ScUndoPrintRange::Undo() diff --git a/sc/source/ui/undo/undoutil.cxx b/sc/source/ui/undo/undoutil.cxx index 66e97af2cade..d89905cbd685 100644 --- a/sc/source/ui/undo/undoutil.cxx +++ b/sc/source/ui/undo/undoutil.cxx @@ -100,10 +100,11 @@ void ScUndoUtil::PaintMore( ScDocShell* pDocShell, SCROW nRow1 = rRange.aStart.Row(); SCCOL nCol2 = rRange.aEnd.Col(); SCROW nRow2 = rRange.aEnd.Row(); + ScDocument& rDoc = pDocShell->GetDocument(); if (nCol1 > 0) --nCol1; if (nRow1 > 0) --nRow1; - if (nCol2<MAXCOL) ++nCol2; - if (nRow2<MAXROW) ++nRow2; + if (nCol2<rDoc.MaxCol()) ++nCol2; + if (nRow2<rDoc.MaxRow()) ++nRow2; pDocShell->PostPaint( nCol1,nRow1,rRange.aStart.Tab(), nCol2,nRow2,rRange.aEnd.Tab(), PaintPartFlags::Grid ); |