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

New commits:
commit 71d29f8143430b0e01c4f4c97e3fdd091e59bcf1
Author:     Marco Cecchetti <[email protected]>
AuthorDate: Thu Feb 1 22:45:42 2024 +0100
Commit:     Marco Cecchetti <[email protected]>
CommitDate: Mon Feb 5 18:22:00 2024 +0100

    lok: calc: missing invalidation of position on undo a drag and drop
    
    When undo/redo a drag and drop of a block of cells cached position was
    not invalidated.
    
    Change-Id: I538815bba46f6759db3b09a583eca9481148cdbd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162915
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162991
    Reviewed-by: Marco Cecchetti <[email protected]>

diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index 987e89f58442..2b9ad48d92ab 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1352,6 +1352,13 @@ void ScUndoDragDrop::DoUndo( ScRange aRange )
     pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
     maPaintRanges.Join(aPaintRange);
 
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
+        pTabViewShell->OnLOKSetWidthOrHeight(aPaintRange.aStart.Col(), true);
+        pTabViewShell->OnLOKSetWidthOrHeight(aPaintRange.aStart.Row(), false);
+    }
+
     ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
         ScTabViewShell::GetActiveViewShell(),
         true /* bColumns */, true /* bRows */,
@@ -1507,6 +1514,18 @@ void ScUndoDragDrop::Redo()
 
     if (comphelper::LibreOfficeKit::isActive())
     {
+        SCCOL nStartCol = aDestRange.aStart.Col();
+        SCROW nStartRow = aDestRange.aStart.Row();
+        if (bCut)
+        {
+            nStartCol = std::min(nStartCol, aSrcRange.aStart.Col());
+            nStartRow = std::min(nStartRow, aSrcRange.aStart.Row());
+        }
+
+        ScTabViewShell* pTabViewShell = ScTabViewShell::GetActiveViewShell();
+        pTabViewShell->OnLOKSetWidthOrHeight(nStartCol, true);
+        pTabViewShell->OnLOKSetWidthOrHeight(nStartRow, false);
+
         SCTAB nStartTab = aDestRange.aStart.Tab();
         SCTAB nEndTab = aDestRange.aEnd.Tab();
         if (bCut)
commit 7607cb20e88b7fd647f96d3daa0bfb8ffad533de
Author:     Marco Cecchetti <[email protected]>
AuthorDate: Tue Jan 30 14:54:18 2024 +0100
Commit:     Marco Cecchetti <[email protected]>
CommitDate: Mon Feb 5 18:21:50 2024 +0100

    lok: calc: missing update of sheet geometry data on undo a drag and drop
    
    When undo/redo a drag and drop of a block of cells sheet geometry data
    was not invalidated.
    
    Change-Id: I0579de814ed61357c70a64d0e4ebf862525d3c79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162776
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Tomaž Vajngerl <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162990
    Reviewed-by: Marco Cecchetti <[email protected]>

diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx
index d352ba143ba8..987e89f58442 100644
--- a/sc/source/ui/undo/undoblk.cxx
+++ b/sc/source/ui/undo/undoblk.cxx
@@ -1351,6 +1351,12 @@ void ScUndoDragDrop::DoUndo( ScRange aRange )
 
     pDocShell->UpdatePaintExt(mnPaintExtFlags, aPaintRange);
     maPaintRanges.Join(aPaintRange);
+
+    ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+        ScTabViewShell::GetActiveViewShell(),
+        true /* bColumns */, true /* bRows */,
+        true /* bSizes */, true /* bHidden */, true /* bFiltered */,
+        true /* bGroups */, aPaintRange.aStart.Tab());
 }
 
 void ScUndoDragDrop::Undo()
@@ -1498,6 +1504,24 @@ void ScUndoDragDrop::Redo()
 
     EndRedo();
     SfxGetpApp()->Broadcast( SfxHint( SfxHintId::ScAreaLinksChanged ) );
+
+    if (comphelper::LibreOfficeKit::isActive())
+    {
+        SCTAB nStartTab = aDestRange.aStart.Tab();
+        SCTAB nEndTab = aDestRange.aEnd.Tab();
+        if (bCut)
+        {
+            nStartTab = std::min(nStartTab, aSrcRange.aStart.Tab());
+            nEndTab = std::max(nEndTab, aSrcRange.aEnd.Tab());
+        }
+        for (nTab = nStartTab; nTab <= nEndTab; ++nTab)
+        {
+            ScTabViewShell::notifyAllViewsSheetGeomInvalidation(
+                ScTabViewShell::GetActiveViewShell(), true /* bColumns */, 
true /* bRows */,
+                true /* bSizes */, true /* bHidden */, true /* bFiltered */, 
true /* bGroups */,
+                nTab);
+        }
+    }
 }
 
 void ScUndoDragDrop::Repeat(SfxRepeatTarget& /* rTarget */)

Reply via email to