sc/source/ui/view/tabview3.cxx |   25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

New commits:
commit 7ba2c87354d97448fc2b6f5ca0eea6ce0eeefb8a
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Aug 28 21:11:53 2024 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Thu Aug 29 09:03:57 2024 +0200

    Resolves: tdf#162651 area under removed editview needs to be refreshed
    
    which has become a problem since:
    
    commit 6d71c21890c908225945f0fc3566255ed150f660
    CommitDate: Mon Jan 22 20:47:16 2024 +0100
    
        don't always invalidate the entire width of the calc window
    
    Change-Id: Ic0db4932091806c79fd9e773d7be35727560a1ab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172552
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 40bda51d7b58..dd4495653d5b 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -2297,9 +2297,10 @@ void ScTabView::KillEditView( bool bNoPaint )
 
             pGridWin[i]->SetMapMode(pGridWin[i]->GetDrawMapMode());
 
+            const tools::Rectangle& rInvRect = aRectangle[i];
+
             if (comphelper::LibreOfficeKit::isActive())
             {
-                const tools::Rectangle& rInvRect = aRectangle[i];
                 pGridWin[i]->LogicInvalidatePart(&rInvRect, nTab);
 
                 // invalidate other views
@@ -2316,10 +2317,26 @@ void ScTabView::KillEditView( bool bNoPaint )
                 SfxLokHelper::forEachOtherView(GetViewData().GetViewShell(), 
lInvalidateWindows);
             }
             // #i73567# the cell still has to be repainted
-            else if (bExtended || ( bAtCursor && !bNoPaint ))
+            else
             {
-                pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, 
ScUpdateMode::All );
-                pGridWin[i]->UpdateSelectionOverlay();
+                const bool bDoPaint = bExtended || (bAtCursor && !bNoPaint);
+                const bool bDoInvalidate = !bDoPaint && bAtCursor;
+                if (bDoPaint)
+                {
+                    pGridWin[i]->Draw( nCol1, nRow1, nCol2, nRow2, 
ScUpdateMode::All );
+                    pGridWin[i]->UpdateSelectionOverlay();
+                }
+                else if (bDoInvalidate)
+                {
+                    // tdf#162651 even if !bNoPaint is set, and there will be a
+                    // follow up Draw of the next content, the area blanked out
+                    // by the editview which is being removed still needs to be
+                    // invalidated. The follow-up Draw of the content may be
+                    // optimized to only redraw the area of cells where content
+                    // has changed and will be unaware of what bounds this
+                    // editview grew to during its editing cycle.
+                    pGridWin[i]->Invalidate(rInvRect);
+                }
             }
         }
     }

Reply via email to