sc/source/ui/docshell/docsh3.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit c822a05625da33479527e11a80fe44d3d7b504c8
Author:     Aron Budea <aron.bu...@collabora.com>
AuthorDate: Sun Dec 3 19:22:17 2023 +1030
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Dec 4 21:28:46 2023 +0100

    lok: Notify all tabs in the range
    
    34d5abf464dfbf4bdc36f6b87e606c84a1f4d99d restricted this to the
    first tab, but PostPaint(...) is sometimes called with a
    0..9999 tab range, even if the change only affected somewhere
    in between.
    
    In addition, restrict range end to the last actual tab in the
    spreadsheet.
    
    Change-Id: I44a7bb351e17bf85b13fedfe2a9f3d76543c4372
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160253
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit 4d30910523bccb3b965f254401e6341af2ee8704)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160182
    Tested-by: Jenkins

diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 788aac9af86e..96546d11a5fe 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -110,12 +110,13 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, 
PaintPartFlags nPart, sa
 {
     ScRangeList aPaintRanges;
     std::set<SCTAB> aTabsInvalidated;
+    const SCTAB nMaxTab = m_pDocument->GetTableCount() - 1;
     for (size_t i = 0, n = rRanges.size(); i < n; ++i)
     {
         const ScRange& rRange = rRanges[i];
         SCCOL nCol1 = rRange.aStart.Col(), nCol2 = rRange.aEnd.Col();
         SCROW nRow1 = rRange.aStart.Row(), nRow2 = rRange.aEnd.Row();
-        SCTAB nTab1 = rRange.aStart.Tab(), nTab2 = rRange.aEnd.Tab();
+        SCTAB nTab1 = rRange.aStart.Tab(), nTab2 = std::min<SCTAB>(nMaxTab, 
rRange.aEnd.Tab());
 
         if (!m_pDocument->ValidCol(nCol1)) nCol1 = m_pDocument->MaxCol();
         if (!m_pDocument->ValidRow(nRow1)) nRow1 = m_pDocument->MaxRow();
@@ -168,7 +169,8 @@ void ScDocShell::PostPaint( const ScRangeList& rRanges, 
PaintPartFlags nPart, sa
             }
         }
         aPaintRanges.push_back(ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, 
nTab2));
-        aTabsInvalidated.insert(nTab1);
+        for (auto nTabNum = nTab1; nTabNum <= nTab2; ++nTabNum)
+            aTabsInvalidated.insert(nTabNum);
     }
 
     Broadcast(ScPaintHint(aPaintRanges.Combine(), nPart));

Reply via email to