sw/inc/view.hxx | 2 +- sw/source/uibase/docvw/edtwin.cxx | 2 +- sw/source/uibase/uiview/viewling.cxx | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-)
New commits: commit 793853fbd1665e90ab91e9b45826174707617275 Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Wed Feb 12 21:43:25 2025 -0500 Commit: Justin Luth <justin.l...@collabora.com> CommitDate: Fri Feb 14 20:28:38 2025 +0100 tdf#164703 tdf#111969 sw Get*Correction: only mouse passes PixelPos This fixes my 24.8 commit 5bc7d0186d1a70990377a2f4c630fe11e2dfd166. All my focus was on mouse clicks, so I didn't realize that keyboard shortcuts were badly affected. Avoid all of that cursor -> pixel -> cursor madness and just don't provide a pixel position at all when it is a keyboard request for a context menu. I don't see how to create a unit test for this. (See earlier patchsets) Change-Id: Id1fe7d1c15ce590ea4f882be49cfe539971c8c69 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181522 Reviewed-by: Justin Luth <jl...@mail.com> Tested-by: Jenkins diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx index a958e08bb3c9..ccfeb48b1a4e 100644 --- a/sw/inc/view.hxx +++ b/sw/inc/view.hxx @@ -456,7 +456,7 @@ public: tools::Long SetHScrollMax(tools::Long lMax); void SpellError(LanguageType eLang); - bool ExecSpellPopup( const Point& rPt ); + bool ExecSpellPopup(const Point& rPt, bool bIsMouseEvent); void ExecSmartTagPopup( const Point& rPt ); DECL_DLLPRIVATE_LINK( OnlineSpellCallback, SpellCallbackInfo&, void ); diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index efaf125578e9..047ebd3f5555 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -5789,7 +5789,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) aROPopup.Execute(this, aPixPos); } } - else if ( !m_rView.ExecSpellPopup( aDocPos ) ) + else if (!m_rView.ExecSpellPopup(aDocPos, rCEvt.IsMouseEvent())) SfxDispatcher::ExecutePopup(this, &aPixPos); } else if (m_pApplyTempl->nUndo < rSh.GetDoc()->GetIDocumentUndoRedo().GetUndoActionCount()) diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index ef7c2dfbc77c..ed62ec6fc742 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -620,7 +620,7 @@ IMPL_STATIC_LINK( AsyncExecute, ExecuteHdl_Impl, void*, p, void ) } //!! End of extra code for context menu modifying extensions -bool SwView::ExecSpellPopup(const Point& rPt) +bool SwView::ExecSpellPopup(const Point& rPt, bool bIsMouseEvent) { bool bRet = false; const SwViewOption* pVOpt = m_pWrtShell->GetViewOptions(); @@ -666,7 +666,8 @@ bool SwView::ExecSpellPopup(const Point& rPt) // if neither spell checking nor grammar checking provides suggestions use the // default context menu. bool bUseGrammarContext = false; - Reference< XSpellAlternatives > xAlt( m_pWrtShell->GetCorrection(&rPt, aToFill) ); + Reference<XSpellAlternatives> xAlt( + m_pWrtShell->GetCorrection(bIsMouseEvent ? &rPt : nullptr, aToFill)); ProofreadingResult aGrammarCheckRes; sal_Int32 nErrorInResult = -1; uno::Sequence< OUString > aSuggestions; @@ -674,7 +675,9 @@ bool SwView::ExecSpellPopup(const Point& rPt) if (!xAlt.is() || !xAlt->getAlternatives().hasElements()) { sal_Int32 nErrorPosInText = -1; - bCorrectionRes = m_pWrtShell->GetGrammarCorrection( aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, &rPt, aToFill ); + bCorrectionRes = m_pWrtShell->GetGrammarCorrection( + aGrammarCheckRes, nErrorPosInText, nErrorInResult, aSuggestions, + bIsMouseEvent ? &rPt : nullptr, aToFill); OUString aMessageText; if (nErrorInResult >= 0) aMessageText = aGrammarCheckRes.aErrors[ nErrorInResult ].aShortComment;