cui/source/dialogs/SpellDialog.cxx | 2 +- include/svx/SpellDialogChildWindow.hxx | 4 ++-- sc/source/ui/inc/spelldialog.hxx | 2 +- sc/source/ui/view/spelldialog.cxx | 4 ++-- sd/source/ui/dlg/SpellDialogChildWindow.cxx | 5 ++++- sd/source/ui/inc/SpellDialogChildWindow.hxx | 2 +- sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 11 ++++------- sw/source/uibase/inc/SwSpellDialogChildWindow.hxx | 2 +- 8 files changed, 16 insertions(+), 16 deletions(-)
New commits: commit 331e6fa45f12bb47e24354256329f4d04acba708 Author: Justin Luth <[email protected]> AuthorDate: Fri Sep 26 12:46:35 2025 -0400 Commit: Justin Luth <[email protected]> CommitDate: Mon Sep 29 13:56:24 2025 +0200 tdf#126814 SpellDialogChildWindow: force resume if CorrectAll modified Two separately running spell checks should NOT be able to affect each other. The ChangeAll dictionary is a single instance thing, so if one document's spell check adds a ChangeAll entry, the other document's spell check (when it regains the focus) must purge it and start all over again. [I took the easy approach here. A (more flexible) alternative would be to processDictionaryEvent(const DictionaryEvent& rDicEvt) at each SpellDialogChildWindow.] Change-Id: I6a2d4fc7bf75bfd6208bb95d78e8fa4bf5704224 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191554 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 1e915376aff1..1d45601f91c9 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -988,7 +988,7 @@ void SpellDialog::ToplevelFocusChanged() if (m_xDialog->has_toplevel_focus()) { //notify the child window of the focus change - rParent.GetFocus(); + rParent.GetFocus(/*ForceResume=*/m_bResumeClearsChangeAllDict); } else { diff --git a/include/svx/SpellDialogChildWindow.hxx b/include/svx/SpellDialogChildWindow.hxx index 9b50e5c8fc71..d1bc0b5f6ec4 100644 --- a/include/svx/SpellDialogChildWindow.hxx +++ b/include/svx/SpellDialogChildWindow.hxx @@ -99,10 +99,10 @@ protected: a "Resume" button that initiates a reinitialization. */ void InvalidateSpellDialog(); - /** Notifies the ChildWindow about the get focus event. The ChildWindow should no check if + /** Notifies the ChildWindow about the get focus event. The ChildWindow should now check if the spelling dialog should be set to the 'Resume' state by calling InvalidateSpellDialog() */ - virtual void GetFocus() = 0; + virtual void GetFocus(bool bForceResume) = 0; /** Notifies the ChildWindow about the lose focus event. The ChildWindow should use it to save the current selection/state. */ diff --git a/sc/source/ui/inc/spelldialog.hxx b/sc/source/ui/inc/spelldialog.hxx index 2319866afbf5..4da4777036f6 100644 --- a/sc/source/ui/inc/spelldialog.hxx +++ b/sc/source/ui/inc/spelldialog.hxx @@ -60,7 +60,7 @@ protected: spelling dialog back into the document. */ virtual void ApplyChangedSentence( const svx::SpellPortions& rChanged, bool bRecheck ) override; - virtual void GetFocus() override; + void GetFocus(bool bForceResume) override; virtual void LoseFocus() override; private: diff --git a/sc/source/ui/view/spelldialog.cxx b/sc/source/ui/view/spelldialog.cxx index b03e45d26d5d..0980d3449579 100644 --- a/sc/source/ui/view/spelldialog.cxx +++ b/sc/source/ui/view/spelldialog.cxx @@ -101,11 +101,11 @@ void ScSpellDialogChildWindow::ApplyChangedSentence( const svx::SpellPortions& r } } -void ScSpellDialogChildWindow::GetFocus() +void ScSpellDialogChildWindow::GetFocus(bool bForceResume) { SolarMutexGuard aGuard; - if( IsSelectionChanged() ) + if (bForceResume || IsSelectionChanged()) { Reset(); InvalidateSpellDialog(); diff --git a/sd/source/ui/dlg/SpellDialogChildWindow.cxx b/sd/source/ui/dlg/SpellDialogChildWindow.cxx index 93cf10ba02f8..1679c1de55cb 100644 --- a/sd/source/ui/dlg/SpellDialogChildWindow.cxx +++ b/sd/source/ui/dlg/SpellDialogChildWindow.cxx @@ -83,8 +83,11 @@ void SpellDialogChildWindow::ApplyChangedSentence ( } } -void SpellDialogChildWindow::GetFocus() +void SpellDialogChildWindow::GetFocus(bool bForceResume) { + if (bForceResume) + InvalidateSpellDialog(); + // In order to detect a cursor movement we could compare the // currently selected text shape with the one that was selected // when LoseFocus() was called the last time. diff --git a/sd/source/ui/inc/SpellDialogChildWindow.hxx b/sd/source/ui/inc/SpellDialogChildWindow.hxx index 3d2163a7e018..961b1ddf0dbc 100644 --- a/sd/source/ui/inc/SpellDialogChildWindow.hxx +++ b/sd/source/ui/inc/SpellDialogChildWindow.hxx @@ -58,7 +58,7 @@ private: spelling dialog back into the document. */ virtual void ApplyChangedSentence(const svx::SpellPortions& rChanged, bool bRecheck) override; - virtual void GetFocus() override; + void GetFocus(bool bForceResume) override; virtual void LoseFocus() override; /** This outliner is used to do the main work of iterating over a diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 14b084f8552f..430cfd1103ac 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -542,13 +542,13 @@ void SwSpellDialogChildWindow::SetGrammarChecking(bool bOn) } } -void SwSpellDialogChildWindow::GetFocus() +void SwSpellDialogChildWindow::GetFocus(bool bForceResume) { if(m_pSpellState->m_bLockFocus) return; - bool bInvalidate = false; SwWrtShell* pWrtShell = GetWrtShell_Impl(); - if(pWrtShell && !m_pSpellState->m_bInitialCall) + bool bInvalidate = bForceResume || !pWrtShell || m_pSpellState->m_bInitialCall; + if (!bInvalidate) { ShellMode eSelMode = pWrtShell->GetView().GetShellMode(); if(eSelMode != m_pSpellState->m_eSelMode) @@ -593,10 +593,7 @@ void SwSpellDialogChildWindow::GetFocus() } } } - else - { - bInvalidate = true; - } + if(bInvalidate) InvalidateSpellDialog(); } diff --git a/sw/source/uibase/inc/SwSpellDialogChildWindow.hxx b/sw/source/uibase/inc/SwSpellDialogChildWindow.hxx index 8599256da21c..ef9599cecd45 100644 --- a/sw/source/uibase/inc/SwSpellDialogChildWindow.hxx +++ b/sw/source/uibase/inc/SwSpellDialogChildWindow.hxx @@ -44,7 +44,7 @@ class SwSpellDialogChildWindow final virtual bool HasGrammarChecking() override; virtual bool IsGrammarChecking() override; virtual void SetGrammarChecking(bool bOn) override; - virtual void GetFocus() override; + void GetFocus(bool bForceResume) override; virtual void LoseFocus() override; public:
