sw/source/uibase/uiview/viewling.cxx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-)
New commits: commit 0a22f4fd6d7496678822731a7bdd37687f717adf Author: Ashod Nakashian <[email protected]> Date: Mon Jul 20 22:41:56 2015 -0400 Spell-check wrong-dirty text upon showing context menu. This makes for a better user experience when the idle jobs haven't yet ran on some text to check for spelling. This can happen when the user is on a device with insufficient compute power and/or other idle jobs with higher-priority take precedence. This change leap-frogs the spell-checking idle job when the user might already know they mistyped a word and look for a quick fix via the context menu. Change-Id: Id1f7b4555050ded329ebeb56502f893ee7b2bc35 Reviewed-on: https://gerrit.libreoffice.org/17252 Tested-by: Jenkins <[email protected]> Reviewed-by: Norbert Thiebaud <[email protected]> diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index f074cbf..1758a2f 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -54,6 +54,7 @@ #include <edtwin.hxx> #include <crsskip.hxx> #include <ndtxt.hxx> +#include <txtfrm.hxx> #include <vcl/lstbox.hxx> #include <cmdid.h> #include <globals.hrc> @@ -641,6 +642,29 @@ bool SwView::ExecSpellPopup(const Point& rPt) m_pWrtShell->Push(); SwRect aToFill; + SwCrsrShell *pCrsrShell = static_cast<SwCrsrShell*>(m_pWrtShell); + SwPaM *pCrsr = pCrsrShell->GetCrsr(); + SwPosition aPoint(*pCrsr->GetPoint()); + const SwTextNode *pNode = aPoint.nNode.GetNode().GetTextNode(); + + // Spell-check in case the idle jobs haven't had a chance to kick in. + // This makes it possible to suggest spelling corrections for + // wrong words independent of the spell-checking idle job. + if (pNode && pNode->IsWrongDirty() && + m_pWrtShell->ISA(SwCrsrShell) && !pCrsrShell->IsTableMode() && + !pCrsr->HasMark() && !pCrsr->IsMultiSelection()) + { + SwContentFrm *pFrm = pCrsr->GetContentNode()->getLayoutFrm( + pCrsrShell->GetLayout(), + &rPt, &aPoint, false); + if (pFrm) + { + SwRect aRepaint(static_cast<SwTextFrm*>(pFrm)->_AutoSpell(nullptr, 0)); + if (aRepaint.HasArea()) + m_pWrtShell->InvalidateWindows(aRepaint); + } + } + // decide which variant of the context menu to use... // if neither spell checking nor grammar checking provides suggestions use the // default context menu. @@ -669,9 +693,6 @@ bool SwView::ExecSpellPopup(const Point& rPt) { // get paragraph text OUString aParaText; - SwPosition aPoint( *m_pWrtShell->GetCrsr()->GetPoint() ); - const SwTextNode *pNode = dynamic_cast< const SwTextNode * >( - &aPoint.nNode.GetNode() ); if (pNode) aParaText = pNode->GetText(); // this may include hidden text but that should be Ok else _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
