[Libreoffice-commits] core.git: sc/inc sc/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 25 10:57:07 UTC 2019


 sc/inc/dociter.hxx                       |    2 +-
 sc/inc/rowheightcontext.hxx              |    2 +-
 sc/inc/segmenttree.hxx                   |    6 +++---
 sc/source/core/data/dociter.cxx          |    8 ++++----
 sc/source/core/data/markdata.cxx         |   14 ++++++++++----
 sc/source/core/data/markmulti.cxx        |    2 +-
 sc/source/core/data/rowheightcontext.cxx |    4 ++--
 sc/source/core/data/segmenttree.cxx      |   12 ++++++------
 sc/source/core/data/table1.cxx           |   12 ++++++------
 sc/source/core/data/table2.cxx           |    4 ++--
 sc/source/filter/rtf/eeimpars.cxx        |    2 +-
 sc/source/filter/xml/xmlrowi.cxx         |    2 +-
 sc/source/ui/docshell/docfunc.cxx        |    4 ++--
 sc/source/ui/docshell/docsh.cxx          |    2 +-
 sc/source/ui/docshell/docsh5.cxx         |    4 ++--
 sc/source/ui/undo/undobase.cxx           |    2 +-
 sc/source/ui/undo/undoblk.cxx            |    2 +-
 sc/source/ui/undo/undoblk3.cxx           |    2 +-
 sc/source/ui/view/viewfun2.cxx           |    4 ++--
 sc/source/ui/view/viewfunc.cxx           |    2 +-
 20 files changed, 49 insertions(+), 43 deletions(-)

New commits:
commit 916746a5155a1a17225e85d2c30a1c2322aac589
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Nov 25 11:14:53 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Nov 25 11:56:27 2019 +0100

    sc: rowcol: tdf#50916 convert segmenttree
    
    Change-Id: Ia05d1bc60a76a8bbf65afe5b0459ce213be9bfbe
    Reviewed-on: https://gerrit.libreoffice.org/83646
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index c30a4840d466..7308d6d4b4a3 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -596,7 +596,7 @@ public:
         SCTAB mnTab;
         ScFlatBoolRowSegments maRanges;
 
-        TabRanges(SCTAB nTab);
+        TabRanges(SCTAB nTab, SCROW nMaxRow);
     };
 
     /**
diff --git a/sc/inc/rowheightcontext.hxx b/sc/inc/rowheightcontext.hxx
index 2bec0e05cbcb..07becd39fd88 100644
--- a/sc/inc/rowheightcontext.hxx
+++ b/sc/inc/rowheightcontext.hxx
@@ -35,7 +35,7 @@ class SC_DLLPUBLIC RowHeightContext
 
 public:
     RowHeightContext(
-        double fPPTX, double fPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
+        SCROW nMaxRow, double fPPTX, double fPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
         OutputDevice* pOutDev );
 
     ~RowHeightContext();
diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx
index 8414176d125d..9d772a0b4b46 100644
--- a/sc/inc/segmenttree.hxx
+++ b/sc/inc/segmenttree.hxx
@@ -63,7 +63,7 @@ public:
         ScFlatBoolRowSegments const & mrSegs;
     };
 
-    ScFlatBoolRowSegments();
+    ScFlatBoolRowSegments(SCROW nMaxRow);
     ScFlatBoolRowSegments(const ScFlatBoolRowSegments& r);
     ~ScFlatBoolRowSegments();
 
@@ -89,7 +89,7 @@ public:
         SCCOL   mnCol2;
         bool    mbValue;
     };
-    ScFlatBoolColSegments();
+    ScFlatBoolColSegments(SCCOL nMaxCol);
     ScFlatBoolColSegments(const ScFlatBoolColSegments& r);
     ~ScFlatBoolColSegments();
 
@@ -131,7 +131,7 @@ public:
         sal_uInt16  mnCurValue;
     };
 
-    ScFlatUInt16RowSegments(sal_uInt16 nDefault);
+    ScFlatUInt16RowSegments(SCROW nMaxRow, sal_uInt16 nDefault);
     ScFlatUInt16RowSegments(const ScFlatUInt16RowSegments& r);
     ~ScFlatUInt16RowSegments();
 
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 391940171a69..4616f5698b0f 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -2662,8 +2662,8 @@ const ScPatternAttr* ScDocAttrIterator::GetNext( SCCOL& rCol, SCROW& rRow1, SCRO
     return nullptr;  // Nothing anymore
 }
 
-ScDocRowHeightUpdater::TabRanges::TabRanges(SCTAB nTab) :
-    mnTab(nTab)
+ScDocRowHeightUpdater::TabRanges::TabRanges(SCTAB nTab, SCROW nMaxRow) :
+    mnTab(nTab), maRanges(nMaxRow)
 {
 }
 
@@ -2709,7 +2709,7 @@ void ScDocRowHeightUpdater::update()
         if (!ValidTab(nTab) || nTab >= mrDoc.GetTableCount() || !mrDoc.maTabs[nTab])
             continue;
 
-        sc::RowHeightContext aCxt(mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev);
+        sc::RowHeightContext aCxt(mrDoc.MaxRow(), mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev);
         ScFlatBoolRowSegments::RangeData aData;
         ScFlatBoolRowSegments::RangeIterator aRangeItr(rTabRanges.maRanges);
         for (bool bFound = aRangeItr.getFirst(aData); bFound; bFound = aRangeItr.getNext(aData))
@@ -2739,7 +2739,7 @@ void ScDocRowHeightUpdater::updateAll()
     ScProgress aProgress(mrDoc.GetDocumentShell(), ScResId(STR_PROGRESS_HEIGHTING), nCellCount, true);
 
     Fraction aZoom(1, 1);
-    sc::RowHeightContext aCxt(mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev);
+    sc::RowHeightContext aCxt(mrDoc.MaxRow(), mfPPTX, mfPPTY, aZoom, aZoom, mpOutDev);
     sal_uLong nProgressStart = 0;
     for (SCTAB nTab = 0; nTab < mrDoc.GetTableCount(); ++nTab)
     {
diff --git a/sc/source/core/data/markdata.cxx b/sc/source/core/data/markdata.cxx
index 9d976500d4f1..469e169a9c03 100644
--- a/sc/source/core/data/markdata.cxx
+++ b/sc/source/core/data/markdata.cxx
@@ -704,7 +704,7 @@ void ScMarkData::GetSelectionCover( ScRange& rRange )
         std::unique_ptr<ScFlatBoolRowSegments> pCurColMarkedRows;
         std::unordered_map<SCROW,ScFlatBoolColSegments> aRowToColSegmentsInTopEnvelope;
         std::unordered_map<SCROW,ScFlatBoolColSegments> aRowToColSegmentsInBottomEnvelope;
-        ScFlatBoolRowSegments aNoRowsMarked;
+        ScFlatBoolRowSegments aNoRowsMarked(mnMaxRow);
         aNoRowsMarked.setFalse( 0, mnMaxRow );
 
         bool bPrevColUnMarked = false;
@@ -715,7 +715,7 @@ void ScMarkData::GetSelectionCover( ScRange& rRange )
             bool bCurColUnMarked = !aMultiSel.HasMarks( nCol );
             if ( !bCurColUnMarked )
             {
-                pCurColMarkedRows.reset( new ScFlatBoolRowSegments() );
+                pCurColMarkedRows.reset( new ScFlatBoolRowSegments(mnMaxRow) );
                 pCurColMarkedRows->setFalse( 0, mnMaxRow );
                 ScMultiSelIter aMultiIter( aMultiSel, nCol );
                 ScFlatBoolRowSegments::ForwardIterator aPrevItr(
@@ -803,14 +803,20 @@ void ScMarkData::GetSelectionCover( ScRange& rRange )
                         ScRange aAddRange( nCol, nTop - 1, aMultiRange.aStart.Tab(),
                                            nCol, nTop - 1, aMultiRange.aStart.Tab());
                         lcl_AddRanges( rRange, aAddRange ); // Top envelope
-                        aRowToColSegmentsInTopEnvelope[nTop - 1].setTrue( nCol, nCol );
+                        auto it = aRowToColSegmentsInTopEnvelope.find(nTop - 1);
+                        if (it == aRowToColSegmentsInTopEnvelope.end())
+                            it = aRowToColSegmentsInTopEnvelope.emplace(nTop - 1, ScFlatBoolColSegments(mnMaxCol)).first;
+                        it->second.setTrue( nCol, nCol );
                     }
                     if( nBottom < mnMaxRow )
                     {
                         ScRange aAddRange(nCol, nBottom + 1, aMultiRange.aStart.Tab(),
                                           nCol, nBottom + 1, aMultiRange.aStart.Tab());
                         lcl_AddRanges( rRange, aAddRange ); // Bottom envelope
-                        aRowToColSegmentsInBottomEnvelope[nBottom + 1].setTrue( nCol, nCol );
+                        auto it = aRowToColSegmentsInBottomEnvelope.find(nBottom + 1);
+                        if (it == aRowToColSegmentsInBottomEnvelope.end())
+                            it = aRowToColSegmentsInBottomEnvelope.emplace(nBottom + 1, ScFlatBoolColSegments(mnMaxCol)).first;
+                        it->second.setTrue( nCol, nCol );
                     }
                 }
 
diff --git a/sc/source/core/data/markmulti.cxx b/sc/source/core/data/markmulti.cxx
index d990c49846fc..fa9262024339 100644
--- a/sc/source/core/data/markmulti.cxx
+++ b/sc/source/core/data/markmulti.cxx
@@ -421,7 +421,7 @@ ScMultiSelIter::ScMultiSelIter( const ScMultiSel& rMultiSel, SCCOL nCol ) :
 
     if (bHasMarks1 && bHasMarks2)
     {
-        pRowSegs.reset( new ScFlatBoolRowSegments);
+        pRowSegs.reset( new ScFlatBoolRowSegments(rMultiSel.mnMaxRow) );
         pRowSegs->setFalse( 0, rMultiSel.mnMaxRow );
         {
             ScMarkArrayIter aMarkIter( &rMultiSel.aRowSel );
diff --git a/sc/source/core/data/rowheightcontext.cxx b/sc/source/core/data/rowheightcontext.cxx
index 4cba0b9d9f17..86d2ab1da082 100644
--- a/sc/source/core/data/rowheightcontext.cxx
+++ b/sc/source/core/data/rowheightcontext.cxx
@@ -11,10 +11,10 @@
 
 namespace sc {
 
-RowHeightContext::RowHeightContext(
+RowHeightContext::RowHeightContext(SCROW nMaxRow,
     double fPPTX, double fPPTY, const Fraction& rZoomX, const Fraction& rZoomY,
     OutputDevice* pOutDev ) :
-    maHeights(0),
+    maHeights(nMaxRow, 0),
     mfPPTX(fPPTX), mfPPTY(fPPTY),
     maZoomX(rZoomX), maZoomY(rZoomY),
     mpOutDev(pOutDev),
diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx
index 3e7bfd9aca48..b4116168002f 100644
--- a/sc/source/core/data/segmenttree.cxx
+++ b/sc/source/core/data/segmenttree.cxx
@@ -351,8 +351,8 @@ bool ScFlatBoolRowSegments::RangeIterator::getNext(RangeData& rRange)
     return true;
 }
 
-ScFlatBoolRowSegments::ScFlatBoolRowSegments() :
-    mpImpl(new ScFlatBoolSegmentsImpl(static_cast<SCCOLROW>(MAXROW)))
+ScFlatBoolRowSegments::ScFlatBoolRowSegments(SCROW nMaxRow) :
+    mpImpl(new ScFlatBoolSegmentsImpl(nMaxRow))
 {
 }
 
@@ -414,8 +414,8 @@ SCROW ScFlatBoolRowSegments::findLastTrue() const
     return mpImpl->findLastTrue(false);
 }
 
-ScFlatBoolColSegments::ScFlatBoolColSegments() :
-    mpImpl(new ScFlatBoolSegmentsImpl(static_cast<SCCOLROW>(MAXCOL)))
+ScFlatBoolColSegments::ScFlatBoolColSegments(SCCOL nMaxCol) :
+    mpImpl(new ScFlatBoolSegmentsImpl(nMaxCol))
 {
 }
 
@@ -486,8 +486,8 @@ bool ScFlatUInt16RowSegments::ForwardIterator::getValue(SCROW nPos, sal_uInt16&
     return true;
 }
 
-ScFlatUInt16RowSegments::ScFlatUInt16RowSegments(sal_uInt16 nDefault) :
-    mpImpl(new ScFlatUInt16SegmentsImpl(static_cast<SCCOLROW>(MAXROW), nDefault))
+ScFlatUInt16RowSegments::ScFlatUInt16RowSegments(SCROW nMaxRow, sal_uInt16 nDefault) :
+    mpImpl(new ScFlatUInt16SegmentsImpl(nMaxRow, nDefault))
 {
 }
 
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7a2e740bb721..583982ed5f2c 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -241,10 +241,10 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
     nRepeatStartY( SCROW_REPEAT_NONE ),
     nRepeatEndY( SCROW_REPEAT_NONE ),
     mpRowHeights( static_cast<ScFlatUInt16RowSegments*>(nullptr) ),
-    mpHiddenCols(new ScFlatBoolColSegments),
-    mpHiddenRows(new ScFlatBoolRowSegments),
-    mpFilteredCols(new ScFlatBoolColSegments),
-    mpFilteredRows(new ScFlatBoolRowSegments),
+    mpHiddenCols(new ScFlatBoolColSegments(pDoc->MaxCol())),
+    mpHiddenRows(new ScFlatBoolRowSegments(pDoc->MaxRow())),
+    mpFilteredCols(new ScFlatBoolColSegments(pDoc->MaxCol())),
+    mpFilteredRows(new ScFlatBoolRowSegments(pDoc->MaxRow())),
     nTableAreaX( 0 ),
     nTableAreaY( 0 ),
     nTab( nNewTab ),
@@ -279,7 +279,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName,
 
     if (bRowInfo)
     {
-        mpRowHeights.reset(new ScFlatUInt16RowSegments(ScGlobal::nStdRowHeight));
+        mpRowHeights.reset(new ScFlatUInt16RowSegments(pDocument->MaxRow(), ScGlobal::nStdRowHeight));
         pRowFlags.reset(new ScBitMaskCompressedArray<SCROW, CRFlags>( pDocument->MaxRow(), CRFlags::NONE));
     }
 
@@ -1962,7 +1962,7 @@ void ScTable::ExtendPrintArea( OutputDevice* pDev,
 
     // First, mark those columns that we need to skip i.e. hidden and empty columns.
 
-    ScFlatBoolColSegments aSkipCols;
+    ScFlatBoolColSegments aSkipCols(pDocument->MaxCol());
     aSkipCols.setFalse(0, pDocument->MaxCol());
     for (SCCOL i = 0; i <= pDocument->MaxCol(); ++i)
     {
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 4069f163e163..2c532b733562 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2820,11 +2820,11 @@ void ScTable::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRem
                                 double nPPTX, double nPPTY,
                                 const Fraction& rZoomX, const Fraction& rZoomY )
 {
-    ScFlatBoolRowSegments aUsedRows;
+    ScFlatBoolRowSegments aUsedRows(pDocument->MaxRow());
     for (SCCOL i = 0; i < aCol.size(); ++i)
         aCol[i].FindStyleSheet(pStyleSheet, aUsedRows, bRemoved);
 
-    sc::RowHeightContext aCxt(nPPTX, nPPTY, rZoomX, rZoomY, pDev);
+    sc::RowHeightContext aCxt(pDocument->MaxRow(), nPPTX, nPPTY, rZoomX, rZoomY, pDev);
     SCROW nRow = 0;
     while (nRow <= pDocument->MaxRow())
     {
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 368c99fa3bd6..2e10e8d0a2fc 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -446,7 +446,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
         double nPPTX = ScGlobal::nScreenPPTX * static_cast<double>(aZoom) / nOutputFactor;
         double nPPTY = ScGlobal::nScreenPPTY * static_cast<double>(aZoom);
         ScopedVclPtrInstance< VirtualDevice > pVirtDev;
-        sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoom, aZoom, pVirtDev);
+        sc::RowHeightContext aCxt(mpDoc->MaxRow(), nPPTX, nPPTY, aZoom, aZoom, pVirtDev);
         aCxt.setExtraHeight(ScGlobal::nLastRowHeightExtra);
         mpDoc->SetOptimalHeight(aCxt, 0, nEndRow, 0);
 
diff --git a/sc/source/filter/xml/xmlrowi.cxx b/sc/source/filter/xml/xmlrowi.cxx
index 9f28b2bacad0..112e637c3051 100644
--- a/sc/source/filter/xml/xmlrowi.cxx
+++ b/sc/source/filter/xml/xmlrowi.cxx
@@ -209,7 +209,7 @@ void SAL_CALL ScXMLTableRowContext::endFastElement(sal_Int32 /*nElement*/)
                         std::vector<ScDocRowHeightUpdater::TabRanges>& rRecalcRanges = rXMLImport.GetRecalcRowRanges();
                         while (static_cast<SCTAB>(rRecalcRanges.size()) <= nSheet)
                         {
-                            rRecalcRanges.emplace_back(0);
+                            rRecalcRanges.emplace_back(0, pDoc->MaxRow());
                         }
                         rRecalcRanges.at(nSheet).mnTab = nSheet;
                         rRecalcRanges.at(nSheet).maRanges.setTrue(nFirstRow, nCurrentRow);
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 7b6794f2445d..3960e9daa596 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -153,7 +153,7 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
     ScSizeDeviceProvider aProv( &rDocShell );
     Fraction aOne(1,1);
 
-    sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
+    sc::RowHeightContext aCxt(rDoc.MaxRow(), aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
     bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
     // tdf#76183: recalculate objects' positions
     if (bChanged)
@@ -3671,7 +3671,7 @@ bool ScDocFunc::SetWidthOrHeight(
 
                 ScSizeDeviceProvider aProv( &rDocShell );
                 Fraction aOne(1,1);
-                sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
+                sc::RowHeightContext aCxt(rDoc.MaxRow(), aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
                 aCxt.setForceAutoSize(bAll);
                 rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);
 
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 0fd41c54d957..7ae0f73b2e2d 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -1362,7 +1362,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
                 sItStr = ScGlobal::GetCharsetString( RTL_TEXTENCODING_IBM_850 );
             }
 
-            ScDocRowHeightUpdater::TabRanges aRecalcRanges(0);
+            ScDocRowHeightUpdater::TabRanges aRecalcRanges(0, m_aDocument.MaxRow());
             ErrCode eError = DBaseImport( rMedium.GetPhysicalName(),
                     ScGlobal::GetCharsetValue(sItStr), aColWidthParam, aRecalcRanges.maRanges );
             aRecalcRowRangesArray.push_back(aRecalcRanges);
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index ea851d9b9d1b..aee5cef5d0a4 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -407,7 +407,7 @@ bool ScDocShell::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab )
 {
     ScSizeDeviceProvider aProv(this);
     Fraction aZoom(1,1);
-    sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, aProv.GetDevice());
+    sc::RowHeightContext aCxt(m_aDocument.MaxRow(), aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, aProv.GetDevice());
     bool bChange = m_aDocument.SetOptimalHeight(aCxt, nStartRow,nEndRow, nTab);
 
     if (bChange)
@@ -427,7 +427,7 @@ void ScDocShell::UpdateAllRowHeights( const ScMarkData* pTabMark )
 
     ScSizeDeviceProvider aProv(this);
     Fraction aZoom(1,1);
-    sc::RowHeightContext aCxt(aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, aProv.GetDevice());
+    sc::RowHeightContext aCxt(m_aDocument.MaxRow(), aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, aProv.GetDevice());
     m_aDocument.UpdateAllRowHeights(aCxt, pTabMark);
 }
 
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 7181b10d01ee..af8115f286ee 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -303,7 +303,7 @@ bool ScBlockUndo::AdjustHeight()
         nPPTY = ScGlobal::nScreenPPTY;
     }
 
-    sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev);
+    sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev);
     bool bRet = rDoc.SetOptimalHeight(
         aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab());
 
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 7c07be1f45be..af7440c58a9d 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1244,7 +1244,7 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
         ScopedVclPtrInstance< VirtualDevice > pVirtDev;
         ScViewData& rViewData = pViewShell->GetViewData();
         sc::RowHeightContext aCxt(
-            rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), rViewData.GetZoomY(),
+            rDoc.MaxRow(), rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), rViewData.GetZoomY(),
             pVirtDev);
 
         if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab()))
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 1459e4dd482d..9f7772ce07cf 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -856,7 +856,7 @@ void ScUndoAutoFormat::Redo()
             nPPTY = ScGlobal::nScreenPPTY;
         }
 
-        sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev);
+        sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev);
         for (SCTAB nTab=nStartZ; nTab<=nEndZ; nTab++)
         {
             ScMarkData aDestMark(rDoc.MaxRow(), rDoc.MaxCol());
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 1f6a66ab8db2..5c5302a99517 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -144,7 +144,7 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
         aZoomX = aZoomY = Fraction( 1, 1 );
     }
 
-    sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
+    sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
     bool bAnyChanged = false;
     for (const SCTAB& nTab : *pMarkData)
     {
@@ -205,7 +205,7 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
         nPPTY = aProv.GetPPTY();
         aZoomX = aZoomY = Fraction( 1, 1 );
     }
-    sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
+    sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
     bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
 
     // tdf#76183: recalculate objects' positions
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 21d10fcd1726..eb0f1935333b 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -2157,7 +2157,7 @@ void ScViewFunc::SetWidthOrHeight(
                         aZoomX = aZoomY = Fraction( 1, 1 );
                     }
 
-                    sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
+                    sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
                     aCxt.setForceAutoSize(bAll);
                     aCxt.setExtraHeight(nSizeTwips);
                     rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);


More information about the Libreoffice-commits mailing list