include/sfx2/lokhelper.hxx     |    3 +++
 sc/source/ui/inc/gridwin.hxx   |    1 +
 sc/source/ui/view/gridwin4.cxx |   10 ++++++++--
 sc/source/ui/view/tabview3.cxx |    7 ++++---
 sfx2/source/view/lokhelper.cxx |    9 ++++++++-
 5 files changed, 24 insertions(+), 6 deletions(-)

New commits:
commit 913af4a4c1fbb1d9fcb04a5e5752c361acc1a8b9
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Thu Aug 17 20:22:02 2023 +0100
Commit:     Michael Meeks <michael.me...@collabora.com>
CommitDate: Thu Aug 24 23:24:11 2023 +0200

    add a SfxLokHelper::notifyInvalidation which can take a 'part'
    
    no change in behaviour intended
    
    Change-Id: I6040eafb03bcf39724761d7708540e9b25edd8f9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155813
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 560b5112f6738f02a12adec7d5be04e2411c93b9)
    
    add a LogicInvalidatePart which can take a 'part'
    
    no change in behaviour intended
    
    Change-Id: Idee6615cc86cd01bea9aaf17fff2840eea6521a0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155814
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 28d41e60416ef10ae2a59d1c4ad34a2eb75dc408)
    
    for LibreOfficeKit::isActive we can skip to LogicInvalidate
    
    it should be the same effect
    
    Change-Id: I2faa0b728fdebe837855e1f23e066ae8b1a2bde6
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155815
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit a35311beef378c15ecbb3bb0560035c17f4657ca)
    
    on invalidating other views, specific what Tab is invalidated
    
    the other views might be viewing other tabs and it is only
    the tab ('part') this view is on which is invalidated
    
    Change-Id: I9f054ffa6158a6bc62e3eb7b7170450e26870b54
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155816
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 34d32740d89876c3d4fd2743a07d6e2578601683)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155877
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Michael Meeks <michael.me...@collabora.com>

diff --git a/include/sfx2/lokhelper.hxx b/include/sfx2/lokhelper.hxx
index 3e94854f6d46..1fd04550a7b3 100644
--- a/include/sfx2/lokhelper.hxx
+++ b/include/sfx2/lokhelper.hxx
@@ -138,6 +138,9 @@ public:
     /// Emits a LOK_CALLBACK_DOCUMENT_SIZE_CHANGED for all views of the same 
document with the same part
     static void notifyPartSizeChangedAllViews(vcl::ITiledRenderable* pDoc, int 
nPart);
     /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to 
setOptionalFeatures() if needed.
+    static void notifyInvalidation(SfxViewShell const* pThisView, int nPart, 
tools::Rectangle const *);
+    /// Emits a LOK_CALLBACK_INVALIDATE_TILES, but tweaks it according to 
setOptionalFeatures() if needed
+    /// uses the Part reported by pThisView
     static void notifyInvalidation(SfxViewShell const* pThisView, 
tools::Rectangle const *);
     /// Notifies all views with the given type and payload.
     static void notifyAllViews(int nType, const OString& rPayload);
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index f5e64372ee14..8334e5fd0d51 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -378,6 +378,7 @@ public:
 
     /// @see Window::LogicInvalidate().
     void LogicInvalidate(const tools::Rectangle* pRectangle) override;
+    void LogicInvalidatePart(const tools::Rectangle* pRectangle, int nPart);
 
     /// Update the cell selection according to what handles have been dragged.
     /// @see vcl::ITiledRenderable::setTextSelection() for the values of nType.
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 235fb8d3a38b..1f235fcd6aa4 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1724,7 +1724,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     }
 }
 
-void ScGridWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
+void ScGridWindow::LogicInvalidatePart(const tools::Rectangle* pRectangle, int 
nPart)
 {
     tools::Rectangle aRectangle;
     tools::Rectangle* pResultRectangle;
@@ -1756,7 +1756,13 @@ void ScGridWindow::LogicInvalidate(const 
tools::Rectangle* pRectangle)
     }
 
     ScTabViewShell* pViewShell = mrViewData.GetViewShell();
-    SfxLokHelper::notifyInvalidation(pViewShell, pResultRectangle);
+    SfxLokHelper::notifyInvalidation(pViewShell, nPart, pResultRectangle);
+}
+
+void ScGridWindow::LogicInvalidate(const tools::Rectangle* pRectangle)
+{
+    ScTabViewShell* pViewShell = mrViewData.GetViewShell();
+    LogicInvalidatePart(pRectangle, pViewShell->getPart());
 }
 
 void ScGridWindow::SetCellSelectionPixel(int nType, int nPixelX, int nPixelY)
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 38b528fa93de..545c42e12b4d 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2199,6 +2199,7 @@ void ScTabView::KillEditView( bool bNoPaint )
     SCROW nRow1 = aViewData.GetEditStartRow();
     SCCOL nCol2 = aViewData.GetEditEndCol();
     SCROW nRow2 = aViewData.GetEditEndRow();
+    SCTAB nTab = aViewData.GetTabNo();
     bool bPaint[4];
     bool bNotifyAcc = false;
     tools::Rectangle aRectangle[4];
@@ -2236,16 +2237,16 @@ void ScTabView::KillEditView( bool bNoPaint )
             if (comphelper::LibreOfficeKit::isActive())
             {
                 const tools::Rectangle& rInvRect = aRectangle[i];
-                pGridWin[i]->Invalidate(rInvRect);
+                pGridWin[i]->LogicInvalidatePart(&rInvRect, nTab);
 
                 // invalidate other views
                 auto lInvalidateWindows =
-                        [&rInvRect] (ScTabView* pTabView)
+                        [nTab, &rInvRect] (ScTabView* pTabView)
                         {
                             for (VclPtr<ScGridWindow> const & pWin: 
pTabView->pGridWin)
                             {
                                 if (pWin)
-                                    pWin->Invalidate(rInvRect);
+                                    pWin->LogicInvalidatePart(&rInvRect, nTab);
                             }
                         };
 
diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index b24cee1ecc55..a6939d0085ed 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -615,12 +615,19 @@ void SfxLokHelper::notifyWindow(const SfxViewShell* 
pThisView,
 }
 
 void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, 
tools::Rectangle const* pRect)
+{
+    // -1 means all parts
+    const int nPart = comphelper::LibreOfficeKit::isPartInInvalidation() ? 
pThisView->getPart() : INT_MIN;
+    SfxLokHelper::notifyInvalidation(pThisView, nPart, pRect);
+}
+
+void SfxLokHelper::notifyInvalidation(SfxViewShell const* pThisView, const int 
nInPart, tools::Rectangle const* pRect)
 {
     if (DisableCallbacks::disabled())
         return;
 
     // -1 means all parts
-    const int nPart = comphelper::LibreOfficeKit::isPartInInvalidation() ? 
pThisView->getPart() : INT_MIN;
+    const int nPart = comphelper::LibreOfficeKit::isPartInInvalidation() ? 
nInPart : INT_MIN;
     const int nMode = pThisView->getEditMode();
     pThisView->libreOfficeKitViewInvalidateTilesCallback(pRect, nPart, nMode);
 }

Reply via email to