diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-15 10:46:42 +0000 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-01-23 22:11:31 +0100 |
commit | 7e774c56ef6e261e92e78db52ccf79b046ab2a98 (patch) | |
tree | e1f78404ab767f81a8fe64af035912a85151a75a /sc/source/ui/docshell/docfunc.cxx | |
parent | d8af51f9c521dca999c22a025e625f09002907b6 (diff) |
don't always invalidate the entire width of the calc window
If know the max width affected we can avoid redrawing much of
the row
LTR cell edits, deletes, single line paste
Change-Id: Ib7e3d8bfa3a5ce7df97f28bcf7858b3abcb752a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162408
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162483
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Diffstat (limited to 'sc/source/ui/docshell/docfunc.cxx')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 1a8d902bea19..21aee819174b 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -671,6 +671,26 @@ bool ScDocFunc::DeleteContents( return true; } +tools::Long ScDocShell::GetPixelWidthHint(const ScAddress& rPos) +{ + ScViewData* pViewData = GetViewData(); + if (!pViewData) + return -1; + + ScSizeDeviceProvider aProv(this); + OutputDevice* pDev = aProv.GetDevice(); // has pixel MapMode + double nPPTX = aProv.GetPPTX(); + double nPPTY = aProv.GetPPTY(); + + ScDocument& rDoc = GetDocument(); + Fraction aInvX(pViewData->GetZoomX().GetDenominator(), + pViewData->GetZoomX().GetNumerator()); + Fraction aInvY(pViewData->GetZoomY().GetDenominator(), + pViewData->GetZoomY().GetNumerator()); + return rDoc.GetNeededSize(rPos.Col(), rPos.Row(), rPos.Tab(), pDev, + nPPTX, nPPTY, aInvX, aInvY, true /*bWidth*/); +} + bool ScDocFunc::DeleteCell( const ScAddress& rPos, const ScMarkData& rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi ) { @@ -719,6 +739,7 @@ bool ScDocFunc::DeleteCell( pDataSpans = sc::DocFuncUtil::getNonEmptyCellSpans(rDoc, rMark, rPos); } + tools::Long nBefore(rDocShell.GetPixelWidthHint(rPos)); rDoc.DeleteArea(rPos.Col(), rPos.Row(), rPos.Col(), rPos.Row(), rMark, nFlags); if (bRecord) @@ -731,7 +752,7 @@ bool ScDocFunc::DeleteCell( if (!AdjustRowHeight(rPos, true, bApi)) rDocShell.PostPaint( rPos.Col(), rPos.Row(), rPos.Tab(), rPos.Col(), rPos.Row(), rPos.Tab(), - PaintPartFlags::Grid, nExtFlags); + PaintPartFlags::Grid, nExtFlags, nBefore); aModificator.SetDocumentModified(); @@ -833,7 +854,9 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con aOldValues.push_back(aOldValue); } + tools::Long nBefore(rDocShell.GetPixelWidthHint(rPos)); o_rbNumFmtSet = rDoc.SetString( rPos.Col(), rPos.Row(), rPos.Tab(), rText ); + tools::Long nAfter(rDocShell.GetPixelWidthHint(rPos)); if (bUndo) { @@ -845,7 +868,7 @@ bool ScDocFunc::SetNormalString( bool& o_rbNumFmtSet, const ScAddress& rPos, con if ( bEditDeleted || rDoc.HasAttrib( ScRange(rPos), HasAttrFlags::NeedHeight ) ) AdjustRowHeight( ScRange(rPos), true, bApi ); - rDocShell.PostPaintCell( rPos ); + rDocShell.PostPaintCell( rPos, std::max(nBefore, nAfter) ); aModificator.SetDocumentModified(); // notify input handler here the same way as in PutCell |