summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2020-10-26 20:18:28 +0000
committerMichael Meeks <michael.meeks@collabora.com>2020-10-27 13:55:29 +0100
commitc2eb3259894b56e0dc8fe4762c66e05f37d48e40 (patch)
treeb9ed8a855b199313e636c6bf2bc89ff7a66ef235
parent4834571bab5439f6f95c13c249899c3fe75c8c8e (diff)
calc: clear the spell-checking cache on tab switch.
Change-Id: I187b5ff65c951e088e403f1a7a833bee248229fc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104850 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
-rw-r--r--sc/inc/spellcheckcontext.hxx1
-rw-r--r--sc/source/ui/view/spellcheckcontext.cxx8
-rw-r--r--sc/source/ui/view/tabview3.cxx4
3 files changed, 13 insertions, 0 deletions
diff --git a/sc/inc/spellcheckcontext.hxx b/sc/inc/spellcheckcontext.hxx
index 07cab368443b..8e2392ef5ff1 100644
--- a/sc/inc/spellcheckcontext.hxx
+++ b/sc/inc/spellcheckcontext.hxx
@@ -52,6 +52,7 @@ public:
void reset();
void resetForContentChange();
+ void setTabNo(SCTAB nTab);
private:
void ensureResults(SCCOL nCol, SCROW nRow);
diff --git a/sc/source/ui/view/spellcheckcontext.cxx b/sc/source/ui/view/spellcheckcontext.cxx
index 4b90bdb0c099..8861e91a41e4 100644
--- a/sc/source/ui/view/spellcheckcontext.cxx
+++ b/sc/source/ui/view/spellcheckcontext.cxx
@@ -227,6 +227,14 @@ void SpellCheckContext::dispose()
pDoc = nullptr;
}
+void SpellCheckContext::setTabNo(SCTAB nTab)
+{
+ if (mnTab == nTab)
+ return;
+ mnTab = nTab;
+ reset();
+}
+
bool SpellCheckContext::isMisspelled(SCCOL nCol, SCROW nRow) const
{
const_cast<SpellCheckContext*>(this)->ensureResults(nCol, nRow);
diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 01c363903004..736d47ace777 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -58,6 +58,7 @@
#include <rangeutl.hxx>
#include <client.hxx>
#include <tabprotection.hxx>
+#include <spellcheckcontext.hxx>
#include <markdata.hxx>
#include <formula/FormulaCompiler.hxx>
#include <comphelper/lok.hxx>
@@ -1851,6 +1852,9 @@ void ScTabView::SetTabNo( SCTAB nTab, bool bNew, bool bExtendSelection, bool bSa
bool bFocus = pGridWin[eOldActive] && pGridWin[eOldActive]->HasFocus();
aViewData.SetTabNo( nTab );
+ if (mpSpellCheckCxt)
+ mpSpellCheckCxt->setTabNo( nTab );
+
// UpdateShow before SetCursor, so that UpdateAutoFillMark finds the correct
// window (is called from SetCursor)
UpdateShow();