sc/source/ui/undo/undoblk.cxx |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

New commits:
commit 066076255277261898278102b49cf91fdd3d2881
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Thu Mar 24 10:21:11 2022 +0530
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Tue Mar 29 09:51:28 2022 +0200

    lok: paste-undo: invalidate sheetgeometry
    
    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 <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

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()

Reply via email to