summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2021-02-02 10:39:21 +0200
committerTor Lillqvist <tml@collabora.com>2021-02-02 12:01:56 +0100
commite763e13873adfe3c6abfa4c2dfd3ac3847e2d494 (patch)
treee60a1085c9d09033c1e87a86dfdf4f00dcbdeaf0 /sc/source
parentdf5b9500c079ec1d3fd9485dbf55aeea338ae2fd (diff)
Don't bother shrinking row height when changing just one row interactively
This reverts dca0374fb1edbd9bdeeaadda3f1866ce66b3a778 and instead tries to achieve the same without using a flag in ScGlobal. How reliable that is I don't know. See https://gerrit.libreoffice.org/c/core/+/110245 for discussion. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110245 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Change-Id: I2a7aa5bf3d29e5fd071e2f1cab628b923b5b6754 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110285 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/core/data/dociter.cxx4
-rw-r--r--sc/source/core/data/document.cxx6
-rw-r--r--sc/source/core/data/table1.cxx23
-rw-r--r--sc/source/core/data/table2.cxx14
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx2
-rw-r--r--sc/source/ui/docshell/docfunc.cxx50
-rw-r--r--sc/source/ui/docshell/docsh5.cxx2
-rw-r--r--sc/source/ui/inc/docfunc.hxx2
-rw-r--r--sc/source/ui/inc/viewfunc.hxx2
-rw-r--r--sc/source/ui/undo/undobase.cxx2
-rw-r--r--sc/source/ui/undo/undoblk.cxx6
-rw-r--r--sc/source/ui/undo/undoblk3.cxx6
-rw-r--r--sc/source/ui/view/gridwin.cxx5
-rw-r--r--sc/source/ui/view/viewfun2.cxx6
-rw-r--r--sc/source/ui/view/viewfun3.cxx2
-rw-r--r--sc/source/ui/view/viewfun4.cxx2
-rw-r--r--sc/source/ui/view/viewfunc.cxx10
17 files changed, 70 insertions, 74 deletions
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index 9597fcedbbfd..ebf49a63038c 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -2730,7 +2730,7 @@ void ScDocRowHeightUpdater::update()
continue;
mrDoc.maTabs[nTab]->SetOptimalHeight(
- aCxt, aData.mnRow1, aData.mnRow2, &aProgress, nProgressStart);
+ aCxt, aData.mnRow1, aData.mnRow2, true, &aProgress, nProgressStart);
nProgressStart += mrDoc.maTabs[nTab]->GetWeightedCount(aData.mnRow1, aData.mnRow2);
}
@@ -2758,7 +2758,7 @@ void ScDocRowHeightUpdater::updateAll()
if (!ValidTab(nTab) || !mrDoc.maTabs[nTab])
continue;
- mrDoc.maTabs[nTab]->SetOptimalHeight(aCxt, 0, mrDoc.MaxRow(), &aProgress, nProgressStart);
+ mrDoc.maTabs[nTab]->SetOptimalHeight(aCxt, 0, mrDoc.MaxRow(), true, &aProgress, nProgressStart);
nProgressStart += mrDoc.maTabs[nTab]->GetWeightedCount();
}
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 5bbdd06266ee..be588062c5df 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4100,7 +4100,7 @@ void ScDocument::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, SCTAB nTab,
{
if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
maTabs[nTab]->SetRowHeightRange
- ( nStartRow, nEndRow, nNewHeight, 1.0 );
+ ( nStartRow, nEndRow, nNewHeight, 1.0, true );
}
void ScDocument::SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt16 nNewHeight )
@@ -4261,13 +4261,13 @@ tools::Long ScDocument::GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab,
return 0;
}
-bool ScDocument::SetOptimalHeight( sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab )
+bool ScDocument::SetOptimalHeight( sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bApi )
{
ScTable* pTab = FetchTable(nTab);
if (!pTab)
return false;
- return pTab->SetOptimalHeight(rCxt, nStartRow, nEndRow);
+ return pTab->SetOptimalHeight(rCxt, nStartRow, nEndRow, bApi);
}
void ScDocument::UpdateAllRowHeights( sc::RowHeightContext& rCxt, const ScMarkData* pTabMark )
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 19ddf61770de..0e35edf44d05 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -124,7 +124,7 @@ void GetOptimalHeightsInColumn(
struct OptimalHeightsFuncObjBase
{
virtual ~OptimalHeightsFuncObjBase() {}
- virtual bool operator() (SCROW nStartRow, SCROW nEndRow, sal_uInt16 nHeight) = 0;
+ virtual bool operator() (SCROW nStartRow, SCROW nEndRow, sal_uInt16 nHeight, bool bApi) = 0;
};
struct SetRowHeightOnlyFunc : public OptimalHeightsFuncObjBase
@@ -134,7 +134,7 @@ struct SetRowHeightOnlyFunc : public OptimalHeightsFuncObjBase
mpTab(pTab)
{}
- virtual bool operator() (SCROW nStartRow, SCROW nEndRow, sal_uInt16 nHeight) override
+ virtual bool operator() (SCROW nStartRow, SCROW nEndRow, sal_uInt16 nHeight, bool /* bApi */) override
{
mpTab->SetRowHeightOnly(nStartRow, nEndRow, nHeight);
return false;
@@ -151,16 +151,17 @@ struct SetRowHeightRangeFunc : public OptimalHeightsFuncObjBase
mnPPTY(nPPTY)
{}
- virtual bool operator() (SCROW nStartRow, SCROW nEndRow, sal_uInt16 nHeight) override
+ virtual bool operator() (SCROW nStartRow, SCROW nEndRow, sal_uInt16 nHeight, bool bApi) override
{
- return mpTab->SetRowHeightRange(nStartRow, nEndRow, nHeight, mnPPTY);
+ return mpTab->SetRowHeightRange(nStartRow, nEndRow, nHeight, mnPPTY, bApi);
}
};
bool SetOptimalHeightsToRows(
sc::RowHeightContext& rCxt,
OptimalHeightsFuncObjBase& rFuncObj,
- ScBitMaskCompressedArray<SCROW, CRFlags>* pRowFlags, SCROW nStartRow, SCROW nEndRow )
+ ScBitMaskCompressedArray<SCROW, CRFlags>* pRowFlags, SCROW nStartRow, SCROW nEndRow,
+ bool bApi )
{
bool bChanged = false;
SCROW nRngStart = 0;
@@ -201,7 +202,7 @@ bool SetOptimalHeightsToRows(
}
else
{
- bChanged |= rFuncObj(nRngStart, nRngEnd, nLast);
+ bChanged |= rFuncObj(nRngStart, nRngEnd, nLast, bApi);
nLast = 0;
}
}
@@ -216,13 +217,13 @@ bool SetOptimalHeightsToRows(
else
{
if (nLast)
- bChanged |= rFuncObj(nRngStart, nRngEnd, nLast);
+ bChanged |= rFuncObj(nRngStart, nRngEnd, nLast, bApi);
nLast = 0;
}
i += nMoreRows; // already handled - skip
}
if (nLast)
- bChanged |= rFuncObj(nRngStart, nRngEnd, nLast);
+ bChanged |= rFuncObj(nRngStart, nRngEnd, nLast, bApi);
return bChanged;
}
@@ -448,7 +449,7 @@ tools::Long ScTable::GetNeededSize( SCCOL nCol, SCROW nRow,
}
bool ScTable::SetOptimalHeight(
- sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow,
+ sc::RowHeightContext& rCxt, SCROW nStartRow, SCROW nEndRow, bool bApi,
ScProgress* pOuterProgress, sal_uLong nProgressStart )
{
assert(nStartRow <= nEndRow);
@@ -470,7 +471,7 @@ bool ScTable::SetOptimalHeight(
GetOptimalHeightsInColumn(rCxt, aCol, nStartRow, nEndRow, pProgress, nProgressStart);
SetRowHeightRangeFunc aFunc(this, rCxt.getPPTY());
- bool bChanged = SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow);
+ bool bChanged = SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow, bApi);
if ( pProgress != pOuterProgress )
delete pProgress;
@@ -498,7 +499,7 @@ void ScTable::SetOptimalHeightOnly(
SetRowHeightOnlyFunc aFunc(this);
- SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow);
+ SetOptimalHeightsToRows(rCxt, aFunc, pRowFlags.get(), nStartRow, nEndRow, true);
if ( pProgress != pOuterProgress )
delete pProgress;
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index b21c29f11ba8..0ba9421d8265 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2873,7 +2873,7 @@ void ScTable::StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, bool bRem
SCROW nEndRow = aData.mnRow2;
if (aData.mbValue)
- SetOptimalHeight(aCxt, nRow, nEndRow);
+ SetOptimalHeight(aCxt, nRow, nEndRow, true);
nRow = nEndRow + 1;
}
@@ -3011,7 +3011,7 @@ namespace {
*/
bool lcl_pixelSizeChanged(
ScFlatUInt16RowSegments& rRowHeights, SCROW nStartRow, SCROW nEndRow,
- sal_uInt16 nNewHeight, double nPPTY)
+ sal_uInt16 nNewHeight, double nPPTY, bool bApi)
{
tools::Long nNewPix = static_cast<tools::Long>(nNewHeight * nPPTY);
@@ -3028,7 +3028,7 @@ bool lcl_pixelSizeChanged(
// Heuristic: Don't bother when handling interactive input, if changing just one row and
// the height will shrink.
- bool bChanged = (nNewPix != nOldPix) && (!ScGlobal::bKeyInputInProgress || nEndRow - nStartRow > 0 || nNewPix > nOldPix);
+ bool bChanged = (nNewPix != nOldPix) && (bApi || nEndRow - nStartRow > 0 || nNewPix > nOldPix);
if (bChanged)
return true;
}
@@ -3042,7 +3042,7 @@ bool lcl_pixelSizeChanged(
}
bool ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight,
- double nPPTY )
+ double nPPTY, bool bApi )
{
bool bChanged = false;
if (ValidRow(nStartRow) && ValidRow(nEndRow) && mpRowHeights)
@@ -3072,7 +3072,7 @@ bool ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNew
// No idea why 20 is used here
if (!bSingle || nEndRow - nStartRow < 20)
{
- bChanged = lcl_pixelSizeChanged(*mpRowHeights, nStartRow, nEndRow, nNewHeight, nPPTY);
+ bChanged = lcl_pixelSizeChanged(*mpRowHeights, nStartRow, nEndRow, nNewHeight, nPPTY, bApi);
if (bChanged)
mpRowHeights->setValue(nStartRow, nEndRow, nNewHeight);
}
@@ -3080,9 +3080,9 @@ bool ScTable::SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNew
{
SCROW nMid = (nStartRow + nEndRow) / 2;
// No idea why nPPTY is ignored in these recursive calls and instead 1.0 is used
- if (SetRowHeightRange(nStartRow, nMid, nNewHeight, 1.0))
+ if (SetRowHeightRange(nStartRow, nMid, nNewHeight, 1.0, bApi))
bChanged = true;
- if (SetRowHeightRange(nMid + 1, nEndRow, nNewHeight, 1.0))
+ if (SetRowHeightRange(nMid + 1, nEndRow, nNewHeight, 1.0, bApi))
bChanged = true;
}
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 220c733a4da7..be0ecc4dd829 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -448,7 +448,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
ScopedVclPtrInstance< VirtualDevice > pVirtDev;
sc::RowHeightContext aCxt(mpDoc->MaxRow(), nPPTX, nPPTY, aZoom, aZoom, pVirtDev);
aCxt.setExtraHeight(ScGlobal::nLastRowHeightExtra);
- mpDoc->SetOptimalHeight(aCxt, 0, nEndRow, 0);
+ mpDoc->SetOptimalHeight(aCxt, 0, nEndRow, 0, true);
if ( !maRowHeights.empty() )
{
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 0c7b35ff000f..42ac96e8eea3 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -135,7 +135,7 @@ static void lcl_PaintAbove( ScDocShell& rDocShell, const ScRange& rRange )
}
}
-bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
+bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint, bool bApi )
{
ScDocument& rDoc = rDocShell.GetDocument();
SfxViewShell* pSomeViewForThisDoc = rDocShell.GetBestViewShell(false);
@@ -157,7 +157,7 @@ bool ScDocFunc::AdjustRowHeight( const ScRange& rRange, bool bPaint )
Fraction aOne(1,1);
sc::RowHeightContext aCxt(rDoc.MaxRow(), aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
- bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
+ bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab, bApi);
// tdf#76183: recalculate objects' positions
if (bChanged)
{
@@ -649,7 +649,7 @@ bool ScDocFunc::DeleteContents(
std::move(pUndoDoc), nFlags, pDataSpans, bMulti, bDrawUndo);
}
- if (!AdjustRowHeight( aExtendedRange ))
+ if (!AdjustRowHeight( aExtendedRange, true, bApi ))
rDocShell.PostPaint( aExtendedRange, PaintPartFlags::Grid, nExtFlags );
else if (nExtFlags & SC_PF_LINES)
lcl_PaintAbove( rDocShell, aExtendedRange ); // for lines above the range
@@ -716,7 +716,7 @@ bool ScDocFunc::DeleteCell(
nFlags, pDataSpans, false, bDrawUndo);
}
- if (!AdjustRowHeight(rPos))
+ if (!AdjustRowHeight(rPos, true, true))
rDocShell.PostPaint(
rPos.Col(), rPos.Row(), rPos.Tab(), rPos.Col(), rPos.Row(), rPos.Tab(),
PaintPartFlags::Grid, nExtFlags);
@@ -777,7 +777,7 @@ bool ScDocFunc::TransliterateText( const ScMarkData& rMark, TransliterationFlags
rDoc.TransliterateText( aMultiMark, nType );
- if (!AdjustRowHeight( aMarkRange ))
+ if (!AdjustRowHeight( aMarkRange, true, true ))
rDocShell.PostPaint( aMarkRange, PaintPartFlags::Grid );
aModificator.SetDocumentModified();
@@ -833,7 +833,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con
}
if ( bEditDeleted || rDoc.HasAttrib( ScRange(rPos), HasAttrFlags::NeedHeight ) )
- AdjustRowHeight( ScRange(rPos) );
+ AdjustRowHeight( ScRange(rPos), true, bApi );
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -877,7 +877,7 @@ bool ScDocFunc::SetValueCell( const ScAddress& rPos, double fVal, bool bInteract
}
if (bHeight)
- AdjustRowHeight(rPos);
+ AdjustRowHeight(rPos, true, !bInteraction);
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -948,7 +948,7 @@ bool ScDocFunc::SetStringCell( const ScAddress& rPos, const OUString& rStr, bool
}
if (bHeight)
- AdjustRowHeight(rPos);
+ AdjustRowHeight(rPos, true, !bInteraction);
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -983,7 +983,7 @@ bool ScDocFunc::SetEditCell( const ScAddress& rPos, const EditTextObject& rStr,
}
if (bHeight)
- AdjustRowHeight(rPos);
+ AdjustRowHeight(rPos, true, !bInteraction);
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -1047,7 +1047,7 @@ bool ScDocFunc::SetFormulaCell( const ScAddress& rPos, ScFormulaCell* pCell, boo
}
if (bHeight)
- AdjustRowHeight(rPos);
+ AdjustRowHeight(rPos, true, !bInteraction);
rDocShell.PostPaintCell( rPos );
aModificator.SetDocumentModified();
@@ -1473,7 +1473,7 @@ bool ScDocFunc::ApplyAttributes( const ScMarkData& rMark, const ScPatternAttr& r
if ( !bImportingXML )
rDocShell.UpdatePaintExt( nExtFlags, aMultiRange ); // content after the change
- if (!AdjustRowHeight( aMultiRange ))
+ if (!AdjustRowHeight( aMultiRange, true, bApi ))
rDocShell.PostPaint( aMultiRange, PaintPartFlags::Grid, nExtFlags );
else if (nExtFlags & SC_PF_LINES)
lcl_PaintAbove( rDocShell, aMultiRange ); // because of lines above the range
@@ -1546,7 +1546,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
rDoc.ApplySelectionStyle( *pStyleSheet, rMark );
- if (!AdjustRowHeight( aMultiRange ))
+ if (!AdjustRowHeight( aMultiRange, true, bApi ))
rDocShell.PostPaint( aMultiRange, PaintPartFlags::Grid );
aModificator.SetDocumentModified();
@@ -2195,8 +2195,8 @@ bool ScDocFunc::InsertCells( const ScRange& rRange, const ScMarkData* pTabMark,
nScenarioCount ++;
bool bAdjusted = ( eCmd == INS_INSROWS_BEFORE || eCmd == INS_INSROWS_AFTER ) ?
- AdjustRowHeight(ScRange(0, nStartRow, i, rDoc.MaxCol(), nEndRow, i+nScenarioCount )) :
- AdjustRowHeight(ScRange(0, nPaintStartRow, i, rDoc.MaxCol(), nPaintEndRow, i+nScenarioCount ));
+ AdjustRowHeight(ScRange(0, nStartRow, i, rDoc.MaxCol(), nEndRow, i+nScenarioCount ), true, bApi) :
+ AdjustRowHeight(ScRange(0, nPaintStartRow, i, rDoc.MaxCol(), nPaintEndRow, i+nScenarioCount ), true, bApi);
if (bAdjusted)
{
// paint only what is not done by AdjustRowHeight
@@ -2807,7 +2807,7 @@ bool ScDocFunc::DeleteCells( const ScRange& rRange, const ScMarkData* pTabMark,
nScenarioCount ++;
// delete entire rows: do not adjust
- if ( eCmd == DelCellCmd::Rows || !AdjustRowHeight(ScRange( 0, nPaintStartRow, rTab, rDoc.MaxCol(), nPaintEndRow, rTab+nScenarioCount )) )
+ if ( eCmd == DelCellCmd::Rows || !AdjustRowHeight(ScRange( 0, nPaintStartRow, rTab, rDoc.MaxCol(), nPaintEndRow, rTab+nScenarioCount ), true, bApi) )
rDocShell.PostPaint( nPaintStartCol, nPaintStartRow, rTab, nPaintEndCol, nPaintEndRow, rTab+nScenarioCount, nPaintFlags, nExtFlags );
else
{
@@ -3033,7 +3033,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
return false;
}
- bSourceHeight = AdjustRowHeight( rSource, false );
+ bSourceHeight = AdjustRowHeight( rSource, false, bApi );
}
ScRange aPasteDest( nDestCol, nDestRow, nDestTab, nDestEndCol, nDestEndRow, nDestEndTab );
@@ -3058,7 +3058,7 @@ bool ScDocFunc::MoveBlock( const ScRange& rSource, const ScAddress& rDestPos,
bool bDestHeight = AdjustRowHeight(
ScRange( 0,nDestRow,nDestTab, rDoc.MaxCol(),nDestEndRow,nDestEndTab ),
- false );
+ false, bApi );
/* Paste drawing objects after adjusting formula references
and row heights. There are no cell notes or drawing objects, if the
@@ -3723,7 +3723,7 @@ bool ScDocFunc::SetWidthOrHeight(
Fraction aOne(1,1);
sc::RowHeightContext aCxt(rDoc.MaxRow(), aProv.GetPPTX(), aProv.GetPPTY(), aOne, aOne, aProv.GetDevice());
aCxt.setForceAutoSize(bAll);
- rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);
+ rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab, bApi);
if (bAll)
rDoc.ShowRows( nStartNo, nEndNo, nTab, true );
@@ -4279,7 +4279,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark,
break;
bool bAdj = AdjustRowHeight( ScRange(nStartCol, nStartRow, rTab,
- nEndCol, nEndRow, rTab), false );
+ nEndCol, nEndRow, rTab), false, bApi );
if (bAdj)
rDocShell.PostPaint( 0,nStartRow,rTab, rDoc.MaxCol(),rDoc.MaxRow(),rTab,
PaintPartFlags::Grid | PaintPartFlags::Left );
@@ -4625,7 +4625,7 @@ bool ScDocFunc::FillSimple( const ScRange& rRange, const ScMarkData* pTabMark,
rDoc.Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, FILL_SIMPLE );
- AdjustRowHeight(aRange);
+ AdjustRowHeight(aRange, true, bApi);
if ( bRecord ) // only now is Draw-Undo available
{
@@ -4756,7 +4756,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark,
rDoc.Fill( aSourceArea.aStart.Col(), aSourceArea.aStart.Row(),
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax );
- AdjustRowHeight(rRange);
+ AdjustRowHeight(rRange, true, bApi);
rDocShell.PostPaintGridAll();
aModificator.SetDocumentModified();
@@ -4903,7 +4903,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e
aSourceArea.aEnd.Col(), aSourceArea.aEnd.Row(), &aProgress,
aMark, nCount, eDir, eCmd, eDateCmd, fStep, fMax );
- AdjustRowHeight(aDestArea);
+ AdjustRowHeight(aDestArea, true, bApi);
if ( bRecord ) // only now is Draw-Undo available
{
@@ -5004,7 +5004,7 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo
rDoc.ApplyAttr( nStartCol, nStartRow, nTab, SvxVerJustifyItem( SvxCellVerJustify::Center, ATTR_VER_JUSTIFY ) );
}
- if ( !AdjustRowHeight( ScRange( 0,nStartRow,nTab, rDoc.MaxCol(),nEndRow,nTab ) ) )
+ if ( !AdjustRowHeight( ScRange( 0,nStartRow,nTab, rDoc.MaxCol(),nEndRow,nTab ), true, bApi ) )
rDocShell.PostPaint( nStartCol, nStartRow, nTab,
nEndCol, nEndRow, nTab, PaintPartFlags::Grid );
if (bNeedContents || rOption.mbCenter)
@@ -5100,7 +5100,7 @@ bool ScDocFunc::UnmergeCells( const ScCellMergeOption& rOption, bool bRecord, Sc
rDoc.ExtendMerge( aRefresh, true );
- if ( !AdjustRowHeight( aExtended ) )
+ if ( !AdjustRowHeight( aExtended, true, true ) )
rDocShell.PostPaint( aExtended, PaintPartFlags::Grid );
bool bDone = ScDetectiveFunc(rDoc, nTab).DeleteAll( ScDetectiveDelete::Circles );
@@ -5451,7 +5451,7 @@ bool ScDocFunc::InsertNameList( const ScAddress& rStartPos, bool bApi )
std::move(pUndoDoc), std::move(pRedoDoc) ) );
}
- if (!AdjustRowHeight(ScRange(0,nStartRow,nTab,rDoc.MaxCol(),nEndRow,nTab)))
+ if (!AdjustRowHeight(ScRange(0,nStartRow,nTab,rDoc.MaxCol(),nEndRow,nTab), true, true))
rDocShell.PostPaint( nStartCol,nStartRow,nTab, nEndCol,nEndRow,nTab, PaintPartFlags::Grid );
aModificator.SetDocumentModified();
diff --git a/sc/source/ui/docshell/docsh5.cxx b/sc/source/ui/docshell/docsh5.cxx
index 464173db7876..fad7e64c1698 100644
--- a/sc/source/ui/docshell/docsh5.cxx
+++ b/sc/source/ui/docshell/docsh5.cxx
@@ -406,7 +406,7 @@ bool ScDocShell::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab )
ScSizeDeviceProvider aProv(this);
Fraction aZoom(1,1);
sc::RowHeightContext aCxt(m_aDocument.MaxRow(), aProv.GetPPTX(), aProv.GetPPTY(), aZoom, aZoom, aProv.GetDevice());
- bool bChange = m_aDocument.SetOptimalHeight(aCxt, nStartRow,nEndRow, nTab);
+ bool bChange = m_aDocument.SetOptimalHeight(aCxt, nStartRow,nEndRow, nTab, true);
if (bChange)
{
diff --git a/sc/source/ui/inc/docfunc.hxx b/sc/source/ui/inc/docfunc.hxx
index 1cf8c394437a..51dcf25ccd1c 100644
--- a/sc/source/ui/inc/docfunc.hxx
+++ b/sc/source/ui/inc/docfunc.hxx
@@ -60,7 +60,7 @@ class ScDocFunc
protected:
ScDocShell& rDocShell;
- bool AdjustRowHeight( const ScRange& rRange, bool bPaint = true );
+ bool AdjustRowHeight( const ScRange& rRange, bool bPaint, bool bApi );
void CreateOneName( ScRangeName& rList,
SCCOL nPosX, SCROW nPosY, SCTAB nTab,
SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index 457f599a5666..e5e6157e91d3 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -214,7 +214,7 @@ public:
void SetMarkedWidthOrHeight( bool bWidth, ScSizeMode eMode, sal_uInt16 nSizeTwips );
bool AdjustBlockHeight( bool bPaint = true, ScMarkData* pMarkData = nullptr );
- bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow );
+ bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bApi );
void ModifyCellSize( ScDirection eDir, bool bOptimal );
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index 21e91998904a..8ce8bc9e82f0 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -305,7 +305,7 @@ bool ScBlockUndo::AdjustHeight()
sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev);
bool bRet = rDoc.SetOptimalHeight(
- aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab());
+ aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab(), true);
if (bRet)
{
diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 2acc26313b9a..919d2b467582 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1263,7 +1263,7 @@ void ScUndoDragDrop::PaintArea( ScRange aRange, sal_uInt16 nExtFlags ) const
rDoc.MaxRow(), rViewData.GetPPTX(), rViewData.GetPPTY(), rViewData.GetZoomX(), rViewData.GetZoomY(),
pVirtDev);
- if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab()))
+ if (rDoc.SetOptimalHeight(aCxt, aRange.aStart.Row(), aRange.aEnd.Row(), aRange.aStart.Tab(), true))
{
// tdf#76183: recalculate objects' positions
rDoc.SetDrawPageSize(aRange.aStart.Tab());
@@ -2265,7 +2265,7 @@ void ScUndoRemoveMerge::Undo()
if ( pViewShell )
{
pViewShell->SetTabNo(rTab);
- bDidPaint = pViewShell->AdjustRowHeight(rOption.mnStartRow, rOption.mnEndRow);
+ bDidPaint = pViewShell->AdjustRowHeight(rOption.mnStartRow, rOption.mnEndRow, true);
}
if (!bDidPaint)
ScUndoUtil::PaintMore(pDocShell, aRange);
@@ -2311,7 +2311,7 @@ void ScUndoRemoveMerge::Redo()
if ( pViewShell )
{
pViewShell->SetTabNo(nTab);
- bDidPaint = pViewShell->AdjustRowHeight(rOption.mnStartRow, rOption.mnEndRow);
+ bDidPaint = pViewShell->AdjustRowHeight(rOption.mnStartRow, rOption.mnEndRow, true);
}
if (!bDidPaint)
ScUndoUtil::PaintMore(pDocShell, aRange);
diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx
index 2080f6e8d4bf..917fc67e3511 100644
--- a/sc/source/ui/undo/undoblk3.cxx
+++ b/sc/source/ui/undo/undoblk3.cxx
@@ -161,7 +161,7 @@ void ScUndoDeleteContents::DoChange( const bool bUndo )
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if ( !( pViewShell && pViewShell->AdjustRowHeight(
- aRange.aStart.Row(), aRange.aEnd.Row() ) ) )
+ aRange.aStart.Row(), aRange.aEnd.Row(), true ) ) )
/*A*/ pDocShell->PostPaint( aRange, PaintPartFlags::Grid | PaintPartFlags::Extras, nExtFlags );
if (pViewShell)
@@ -720,7 +720,7 @@ void ScUndoMerge::DoChange( bool bUndo ) const
if ( pViewShell )
{
pViewShell->SetTabNo(nTab);
- bDidPaint = pViewShell->AdjustRowHeight(maOption.mnStartRow, maOption.mnEndRow);
+ bDidPaint = pViewShell->AdjustRowHeight(maOption.mnStartRow, maOption.mnEndRow, true);
}
if (!bDidPaint)
@@ -873,7 +873,7 @@ void ScUndoAutoFormat::Redo()
rDoc.SetRowFlags( nRow, nTab, nOld & ~CRFlags::ManualSize );
}
- bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartY, nEndY, nTab);
+ bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartY, nEndY, nTab, true);
for (SCCOL nCol=nStartX; nCol<=nEndX; nCol++)
if (!rDoc.ColHidden(nCol, nTab))
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 56f02c91ce3b..37bc1ea211e6 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -44,7 +44,6 @@
#include <vcl/settings.hxx>
#include <sot/formats.hxx>
#include <comphelper/classids.hxx>
-#include <comphelper/flagguard.hxx>
#include <svx/svdview.hxx>
#include <editeng/outliner.hxx>
@@ -3192,12 +3191,8 @@ void ScGridWindow::SelectForContextMenu( const Point& rPosPixel, SCCOL nCellX, S
}
}
-bool ScGlobal::bKeyInputInProgress = false;
-
void ScGridWindow::KeyInput(const KeyEvent& rKEvt)
{
- comphelper::FlagGuard aResetFlag(ScGlobal::bKeyInputInProgress);
-
// Cursor control for ref input dialog
const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index b416928ca30b..112226405232 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -156,7 +156,7 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
SCROW nEndNo = rRow.mnEnd;
ScAddress aTopLeft(0, nStartNo, nTab);
rDoc.UpdateScriptTypes(aTopLeft, rDoc.GetSheetLimits().GetMaxColCount(), nEndNo-nStartNo+1);
- if (rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab))
+ if (rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab, true))
{
if (!bChanged)
nPaintY = nStartNo;
@@ -188,7 +188,7 @@ bool ScViewFunc::AdjustBlockHeight( bool bPaint, ScMarkData* pMarkData )
return bAnyChanged;
}
-bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
+bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, bool bApi )
{
if (comphelper::LibreOfficeKit::isActive())
{
@@ -214,7 +214,7 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow )
aZoomX = aZoomY = Fraction( 1, 1 );
}
sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
- bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab);
+ bool bChanged = rDoc.SetOptimalHeight(aCxt, nStartRow, nEndRow, nTab, bApi);
// tdf#76183: recalculate objects' positions
if (bChanged)
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index e8389d40aa04..f8c8e5770d57 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -140,7 +140,7 @@ void ScViewFunc::CutToClip(ScDocument* pClipDoc)
rDoc.DeleteObjectsInSelection( rMark );
rMark.MarkToSimple();
- if ( !AdjustRowHeight( aRange.aStart.Row(), aRange.aEnd.Row() ) )
+ if ( !AdjustRowHeight( aRange.aStart.Row(), aRange.aEnd.Row(), true ) )
pDocSh->PostPaint( aRange, PaintPartFlags::Grid, nExtFlags );
if ( bRecord ) // Draw-Undo now available
diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx
index 5697b0ba2291..7586d0346154 100644
--- a/sc/source/ui/view/viewfun4.cxx
+++ b/sc/source/ui/view/viewfun4.cxx
@@ -170,7 +170,7 @@ void ScViewFunc::PasteRTF( SCCOL nStartCol, SCROW nStartRow,
else if ( aDataHelper.GetString( SotClipboardFormatId::RICHTEXT, aStr ) )
aImpEx.ImportString( aStr, SotClipboardFormatId::RICHTEXT );
- AdjustRowHeight( nStartRow, aImpEx.GetRange().aEnd.Row() );
+ AdjustRowHeight( nStartRow, aImpEx.GetRange().aEnd.Row(), true );
pDocSh->UpdateOle(GetViewData());
ShowAllCursors();
}
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 164327616a6a..a8c5a1add0c9 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -704,7 +704,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
if (bSimple)
{
if (bCommon)
- AdjustRowHeight(nRow,nRow);
+ AdjustRowHeight(nRow,nRow,true);
EnterData(nCol,nRow,nTab,aString);
}
@@ -724,7 +724,7 @@ void ScViewFunc::EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab,
HideAllCursors();
- AdjustRowHeight(nRow,nRow);
+ AdjustRowHeight(nRow,nRow,true);
for (const auto& rTab : rMark)
pDocSh->PostPaintCell( nCol, nRow, rTab );
@@ -1899,7 +1899,7 @@ void ScViewFunc::DeleteMulti( bool bRows )
pDocSh, bRows, bNeedRefresh, nTab, aSpans, std::move(pUndoDoc), std::move(pUndoData)));
}
- if (!AdjustRowHeight(0, rDoc.MaxRow()))
+ if (!AdjustRowHeight(0, rDoc.MaxRow(), true))
{
if (bRows)
{
@@ -2170,7 +2170,7 @@ void ScViewFunc::SetWidthOrHeight(
sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
aCxt.setForceAutoSize(bAll);
aCxt.setExtraHeight(nSizeTwips);
- rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab);
+ rDoc.SetOptimalHeight(aCxt, nStartNo, nEndNo, nTab, true);
if (bAll)
rDoc.ShowRows( nStartNo, nEndNo, nTab, true );
@@ -2449,7 +2449,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal )
pPattern->GetItem( ATTR_LINEBREAK ).GetValue() ||
pPattern->GetItem( ATTR_HOR_JUSTIFY ).GetValue() == SvxCellHorJustify::Block;
if (bNeedHeight)
- AdjustRowHeight( nRow, nRow );
+ AdjustRowHeight( nRow, nRow, true );
}
}
else