diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-06-05 00:41:03 +0500 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-06-05 11:26:45 +0200 |
commit | 8d4427d14148181c6125b49f7a23d33e91189160 (patch) | |
tree | 4a7fc96a5bdb6a912a93f380e4ae2345aee9eded /sw/inc | |
parent | a6c7a66d862dad2c78378b9da4febf184b052368 (diff) |
tdf#136294: trigger pending spellcheck in SwCursorShell::UpdateCursor
This allows to drop the partial fix created for tdf#124603 (except for unit
test). The problem solved in commit 4c91e94e892943ef5e031d65f6f42864233cb4cd
(tdf#92036: sw: fix idle spelling loop, 2015-09-09) is kept solved; when a
word is marked pending, this is signalled to the viewshell. SwCursorShell
stores that as a flag, which will then start an idle on cursor update, and
finally call SwViewShell::LayoutIdle, which does the spell checking. If the
cursor is still in the word that is pending the check, the cycle will repeat,
trying spell checks only at cursor update, not as a busy loop.
Change-Id: I5dc77baabffa723e261d553e40d40e5ace4266bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168413
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168430
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/crsrsh.hxx | 12 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 7 |
2 files changed, 19 insertions, 0 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 03afe5006ad6..97248572c762 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -23,6 +23,7 @@ #include <rtl/ustring.hxx> #include <tools/link.hxx> +#include <vcl/idle.hxx> #include <vcl/keycod.hxx> #include <o3tl/typed_flags_set.hxx> @@ -243,8 +244,14 @@ private: bool m_bMacroExecAllowed : 1; + // SwViewShell::LayoutIdle needs to be called on cursor update to repeat a spell check, + // because previous attempt marked a word as pending, because the word had cursor + bool m_bNeedLayoutOnCursorUpdate : 1 = false; + SwFrame* m_oldColFrame; + Idle m_aLayoutIdle; // An idle to schedule another SwViewShell::LayoutIdle call + SAL_DLLPRIVATE void MoveCursorToNum(); SAL_DLLPRIVATE void ParkPams( SwPaM* pDelRg, SwShellCursor** ppDelRing ); @@ -285,6 +292,9 @@ private: SAL_DLLPRIVATE const SwRangeRedline* GotoRedline_( SwRedlineTable::size_type nArrPos, bool bSelect ); SAL_DLLPRIVATE void sendLOKCursorUpdates(); + + DECL_LINK(DoLayoutIdle, Timer*, void); // calls SwViewShell::LayoutIdle + protected: inline SwMoveFnCollection const & MakeFindRange( SwDocPositions, SwDocPositions, SwPaM* ) const; @@ -308,6 +318,8 @@ protected: protected: virtual void SwClientNotify(const SwModify&, const SfxHint&) override; + virtual void OnSpellWrongStatePending() override { m_bNeedLayoutOnCursorUpdate = true; } + public: SwCursorShell( SwDoc& rDoc, vcl::Window *pWin, const SwViewOption *pOpt ); // disguised copy constructor diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 66eec0f5060e..ea5ed065dafa 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -598,6 +598,13 @@ public: void GetFirstLastVisPageNumbers(SwVisiblePageNumbers& rVisiblePageNumbers); virtual void dumpAsXml(xmlTextWriterPtr pWriter) const; + + // SwTextFrame::AutoSpell_ calls this, to notify the shell, that a word has a spelling error, + // but that couldn't be drawn, because the cursor was in that word (so that the user is not + // annoyed while typing). The shell's task is to re-run the spell check (i.e., call LayoutIdle, + // which internally does the spell check), when the cursor leaves that word (implemented in + // SwCursorShell). + virtual void OnSpellWrongStatePending() {} }; // manages global ShellPointer |