summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPranam Lashkari <lpranam@collabora.com>2024-05-10 02:02:18 +0300
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-05-10 11:09:13 +0200
commit726b133fd8c823c7f05a30c1995de26db372174d (patch)
treea2d0fd7fe39765da2b9e686ea4bc96bd601ae2b2
parenta578321434ada456be3fc7a91b3da9321ce01c5a (diff)
sc: undo: unify height adjust logic in undo with regular logic
in ScBlockUndo::AdjustHeight now we use device like ScViewFunc::SetWidthOrHeight This provides unified behavior with user adjusting height or triggered it by undo problem: in online sometimes undoing would cause wrong selection due to incorrect height set steps to reproduce(happened in certain files only): 1. autofill down a couple of cells 2. undo it 3. try to select the same cell again cell selection will act like auto filled cells are merged cells Change-Id: I81b798c4150284792ac3953caf822fefab0ccee2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167424 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--sc/source/ui/undo/undobase.cxx23
1 files changed, 16 insertions, 7 deletions
diff --git a/sc/source/ui/undo/undobase.cxx b/sc/source/ui/undo/undobase.cxx
index c9a233604281..9c7f5571dd71 100644
--- a/sc/source/ui/undo/undobase.cxx
+++ b/sc/source/ui/undo/undobase.cxx
@@ -37,6 +37,7 @@
#include <sortparam.hxx>
#include <columnspanset.hxx>
#include <undomanager.hxx>
+#include <sizedev.hxx>
ScSimpleUndo::ScSimpleUndo( ScDocShell* pDocSh ) :
@@ -286,18 +287,26 @@ bool ScBlockUndo::AdjustHeight()
{
ScDocument& rDoc = pDocShell->GetDocument();
- ScopedVclPtrInstance< VirtualDevice > pVirtDev;
+ ScSizeDeviceProvider aProv(pDocShell);
Fraction aZoomX( 1, 1 );
Fraction aZoomY = aZoomX;
double nPPTX, nPPTY;
ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
if (pViewShell)
{
- ScViewData& rData = pViewShell->GetViewData();
- nPPTX = rData.GetPPTX();
- nPPTY = rData.GetPPTY();
- aZoomX = rData.GetZoomX();
- aZoomY = rData.GetZoomY();
+ if (aProv.IsPrinter())
+ {
+ nPPTX = aProv.GetPPTX();
+ nPPTY = aProv.GetPPTY();
+ }
+ else
+ {
+ ScViewData& rData = pViewShell->GetViewData();
+ nPPTX = rData.GetPPTX();
+ nPPTY = rData.GetPPTY();
+ aZoomX = rData.GetZoomX();
+ aZoomY = rData.GetZoomY();
+ }
}
else
{
@@ -306,7 +315,7 @@ bool ScBlockUndo::AdjustHeight()
nPPTY = ScGlobal::nScreenPPTY;
}
- sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev);
+ sc::RowHeightContext aCxt(rDoc.MaxRow(), nPPTX, nPPTY, aZoomX, aZoomY, aProv.GetDevice());
bool bRet = rDoc.SetOptimalHeight(
aCxt, aBlockRange.aStart.Row(), aBlockRange.aEnd.Row(), aBlockRange.aStart.Tab(), true);