summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2023-12-03 19:22:17 +1030
committerCaolán McNamara <caolan.mcnamara@collabora.com>2023-12-04 20:09:29 +0100
commit4d30910523bccb3b965f254401e6341af2ee8704 (patch)
tree82a93adc53fb04af5087e4f12c186651ea589d1e
parenteccbe3bb4ed6f0bed4e7fbacfaf50762c93f9464 (diff)
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 <jenkinscollaboraoffice@gmail.com> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--sc/source/ui/docshell/docsh3.cxx6
1 files changed, 4 insertions, 2 deletions
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 8b24cf81d727..0e2efa7f09fc 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));