sc/qa/unit/tiledrendering/tiledrendering.cxx |    4 ++--
 sc/source/ui/docshell/docsh3.cxx             |    5 ++++-
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit 40fdb741ae8c65356fb82a85f4c7bb431038834e
Author:     Szymon Kłos <[email protected]>
AuthorDate: Tue Jul 25 14:35:49 2023 +0200
Commit:     Caolán McNamara <[email protected]>
CommitDate: Wed Jul 26 10:10:30 2023 +0200

    lok: notify only affected tabs on cell resize
    
    When row has automatic height and we type something into
    one cell - it may be resized. That caused sending
    document size changed callback to all the views, also
    affecting all the parts/tabs.
    
    This patch calls that only for affected views which
    are looking at modified parts. It will not invalidate
    all the tabs when only one is modified.
    
    Change-Id: I93e574cf967d608696c1a95ad8b5a7614973c3f5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154891
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx 
b/sc/qa/unit/tiledrendering/tiledrendering.cxx
index 039cffe5ab0e..8b0b66ed34ef 100644
--- a/sc/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx
@@ -1206,7 +1206,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol()
     dispatchCommand(mxComponent, ".uno:InsertRows", aArgs);
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
-    CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size());
     CPPUNIT_ASSERT_EQUAL(tools::Rectangle(-75, 51240, 32212230, 63990), 
aView.m_aInvalidations[0]);
 
     // move on the right
@@ -1223,7 +1223,7 @@ void ScTiledRenderingTest::testInvalidateOnInserRowCol()
     dispatchCommand(mxComponent, ".uno:InsertColumns", aArgs);
     Scheduler::ProcessEventsToIdle();
     CPPUNIT_ASSERT(aView.m_bInvalidateTiles);
-    CPPUNIT_ASSERT_EQUAL(size_t(2), aView.m_aInvalidations.size());
+    CPPUNIT_ASSERT_EQUAL(size_t(1), aView.m_aInvalidations.size());
     CPPUNIT_ASSERT_EQUAL(tools::Rectangle(254925, -15, 32212230, 63990), 
aView.m_aInvalidations[0]);
 }
 
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 803ba61f8a7a..1cec4abeb3fd 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -109,6 +109,7 @@ void ScDocShell::PostPaint( SCCOL nStartCol, SCROW 
nStartRow, SCTAB nStartTab,
 void ScDocShell::PostPaint( const ScRangeList& rRanges, PaintPartFlags nPart, 
sal_uInt16 nExtFlags )
 {
     ScRangeList aPaintRanges;
+    std::set<SCTAB> aTabsInvalidated;
     for (size_t i = 0, n = rRanges.size(); i < n; ++i)
     {
         const ScRange& rRange = rRanges[i];
@@ -167,6 +168,7 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, 
PaintPartFlags nPart, sa
             }
         }
         aPaintRanges.push_back(ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, 
nTab2));
+        aTabsInvalidated.insert(nTab1);
     }
 
     Broadcast(ScPaintHint(aPaintRanges.Combine(), nPart));
@@ -176,7 +178,8 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, 
PaintPartFlags nPart, sa
     if ((nPart & (PaintPartFlags::Top | PaintPartFlags::Left)) && 
comphelper::LibreOfficeKit::isActive())
     {
         ScModelObj* pModel = 
comphelper::getFromUnoTunnel<ScModelObj>(this->GetModel());
-        SfxLokHelper::notifyDocumentSizeChangedAllViews(pModel);
+        for (auto nTab : aTabsInvalidated)
+            SfxLokHelper::notifyPartSizeChangedAllViews(pModel, nTab);
     }
 }
 

Reply via email to