From 066076255277261898278102b49cf91fdd3d2881 Mon Sep 17 00:00:00 2001 From: Dennis Francis Date: Thu, 24 Mar 2022 10:21:11 +0530 Subject: lok: paste-undo: invalidate sheetgeometry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In case of copy/pasting of whole column(row) and its undo/redo may result in column(row) width(height) changes. Hence a corresponding sheet-geometry invalidation message needs to be sent to the lok client(s). Change-Id: I7aa471d9770fc21c567a3c6f5d5926df0fd5dacb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132015 Tested-by: Jenkins CollaboraOffice Reviewed-by: Szymon Kłos --- sc/source/ui/undo/undoblk.cxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index f4ea10273b1e..6391547f23ef 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1096,6 +1096,11 @@ void ScUndoPaste::DoChange(bool bUndo) ScRangeList aDrawRanges(maBlockRanges); PaintPartFlags nPaint = PaintPartFlags::Grid; + + // For sheet geometry invalidation. + bool bColsAffected = false; + bool bRowsAffected = false; + for (size_t i = 0, n = aDrawRanges.size(); i < n; ++i) { ScRange& rDrawRange = aDrawRanges[i]; @@ -1118,11 +1123,13 @@ void ScUndoPaste::DoChange(bool bUndo) { nPaint |= PaintPartFlags::Top; rDrawRange.aEnd.SetCol(rDoc.MaxCol()); + bColsAffected = true; } if (maBlockRanges[i].aStart.Col() == 0 && maBlockRanges[i].aEnd.Col() == rDoc.MaxCol()) // whole row { nPaint |= PaintPartFlags::Left; rDrawRange.aEnd.SetRow(rDoc.MaxRow()); + bRowsAffected = true; } if (pViewShell && pViewShell->AdjustBlockHeight(false, &aData)) { @@ -1144,6 +1151,13 @@ void ScUndoPaste::DoChange(bool bUndo) pDocShell->PostDataChanged(); if (pViewShell) pViewShell->CellContentChanged(); + + if (bColsAffected || bRowsAffected) + ScTabViewShell::notifyAllViewsSheetGeomInvalidation( + pViewShell, + bColsAffected, bRowsAffected, + true /* bSizes*/, true /* bHidden */, true /* bFiltered */, + true /* bGroups */, aDrawRanges[0].aStart.Tab()); } void ScUndoPaste::Undo() -- cgit