editeng/source/editeng/editview.cxx | 3 +++ editeng/source/outliner/outlvw.cxx | 4 ++-- include/editeng/outliner.hxx | 2 +- sd/source/ui/view/NotesPanelViewShell.cxx | 5 +++-- sd/source/ui/view/drviews4.cxx | 5 +++-- sd/source/ui/view/outlnvsh.cxx | 5 +++-- sw/source/uibase/docvw/SidebarTxtControl.cxx | 6 ++++-- sw/source/uibase/uiview/viewdraw.cxx | 3 +-- 8 files changed, 20 insertions(+), 13 deletions(-)
New commits: commit b1c0c4838d2e006ffa8e72516569ce8d13bdbe01 Author: Justin Luth <[email protected]> AuthorDate: Mon Sep 29 19:38:30 2025 -0400 Commit: Justin Luth <[email protected]> CommitDate: Tue Sep 30 16:40:17 2025 +0200 tdf#98902 editeng: no SpellPopup when IsSelectionAtPoint In Writer (already in OOo 3.3), when a misspelled word is selected, the contextMenu doesn't give SpellPopup but rather just the normal context menu (so that the user can copy/cut their selection...) This patch does the same thing for Impress/Draw as well as Writer Textboxes and comments. Change-Id: Idddd39c3526d14940ffafd4aba2d1016b0e03ae7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191644 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 0494d792fd33..7e0cfa2819c3 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -1064,6 +1064,9 @@ static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLa bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void> &rCallBack) { + if (IsSelectionAtPoint(rPosPixel)) + return false; + OutputDevice& rDevice = getImpl().GetOutputDevice(); Point aPos(rDevice.PixelToLogic(rPosPixel)); aPos = getImpl().GetDocPos( aPos ); diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx index 9de18a134723..29221978de2d 100644 --- a/editeng/source/outliner/outlvw.cxx +++ b/editeng/source/outliner/outlvw.cxx @@ -1440,9 +1440,9 @@ bool OutlinerView::IsWrongSpelledWordAtPos( const Point& rPosPixel ) return pEditView->IsWrongSpelledWordAtPos( rPosPixel, /*bMarkIfWrong*/false ); } -void OutlinerView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rStartDlg) +bool OutlinerView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rStartDlg) { - pEditView->ExecuteSpellPopup(rPosPixel, rStartDlg); + return pEditView->ExecuteSpellPopup(rPosPixel, rStartDlg); } void OutlinerView::Read( SvStream& rInput, EETextFormat eFormat, SvKeyValueIterator* pHTTPHeaderAttrs ) diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 34cf8d808fcf..2e796cd7e672 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -362,7 +362,7 @@ public: bool IsCursorAtWrongSpelledWord(); bool IsWrongSpelledWordAtPos( const Point& rPosPixel ); - void ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rCallBack); + bool ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void>& rCallBack); void SetInvalidateMore( sal_uInt16 nPixel ); sal_uInt16 GetInvalidateMore() const; diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx b/sd/source/ui/view/NotesPanelViewShell.cxx index f2fe59290ba5..b5937278deb9 100644 --- a/sd/source/ui/view/NotesPanelViewShell.cxx +++ b/sd/source/ui/view/NotesPanelViewShell.cxx @@ -1468,16 +1468,17 @@ void NotesPanelViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) OutlinerView* pOLV = mpNotesPanelView->GetOutlinerView(); Point aPos(rCEvt.GetMousePosPixel()); + bool bUsedSpellPopup = false; if (pOLV && pOLV->IsWrongSpelledWordAtPos(aPos)) { // Popup for Online-Spelling now handled by DrawDocShell Link<SpellCallbackInfo&, void> aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback); - pOLV->ExecuteSpellPopup(aPos, aLink); + bUsedSpellPopup = pOLV->ExecuteSpellPopup(aPos, aLink); pOLV->GetEditView().Invalidate(); } - else + if (!bUsedSpellPopup) { GetViewFrame()->GetDispatcher()->ExecutePopup(u"drawtext"_ustr); } diff --git a/sd/source/ui/view/drviews4.cxx b/sd/source/ui/view/drviews4.cxx index fdb630ab527c..13dd065a0fa4 100644 --- a/sd/source/ui/view/drviews4.cxx +++ b/sd/source/ui/view/drviews4.cxx @@ -659,6 +659,7 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) if ( pOutlinerView ) { + bool bUsedSpellPopup = false; if( ( rCEvt.IsMouseEvent() && pOutlinerView->IsWrongSpelledWordAtPos(aPos) ) || ( !rCEvt.IsMouseEvent() && pOutlinerView->IsCursorAtWrongSpelledWord() ) ) { @@ -677,11 +678,11 @@ void DrawViewShell::Command(const CommandEvent& rCEvt, ::sd::Window* pWin) // first release the mouse. GetActiveWindow()->ReleaseMouse(); LockInput(); - pOutlinerView->ExecuteSpellPopup(aPos, aLink); + bUsedSpellPopup = pOutlinerView->ExecuteSpellPopup(aPos, aLink); pOutlinerView->GetEditView().Invalidate(); UnlockInput(); } - else + if (!bUsedSpellPopup) { if( (pObj->GetObjInventor() == SdrInventor::Default) && (pObj->GetObjIdentifier() == SdrObjKind::Table) ) { diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx index 1c7ac45a61ef..46f2eaa225a3 100644 --- a/sd/source/ui/view/outlnvsh.cxx +++ b/sd/source/ui/view/outlnvsh.cxx @@ -1353,15 +1353,16 @@ void OutlineViewShell::Command( const CommandEvent& rCEvt, ::sd::Window* pWin ) OutlinerView* pOLV = pOlView->GetViewByWindow(GetActiveWindow()); Point aPos(rCEvt.GetMousePosPixel()); + bool bUsedSpellPopup = false; if (pOLV && pOLV->IsWrongSpelledWordAtPos(aPos)) { // Popup for Online-Spelling now handled by DrawDocShell Link<SpellCallbackInfo&,void> aLink = LINK(GetDocSh(), DrawDocShell, OnlineSpellCallback); - pOLV->ExecuteSpellPopup(aPos, aLink); + bUsedSpellPopup = pOLV->ExecuteSpellPopup(aPos, aLink); pOLV->GetEditView().Invalidate(); } - else + if (!bUsedSpellPopup) { GetViewFrame()->GetDispatcher()->ExecutePopup(u"outline"_ustr); } diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index 9be4bce31f9f..3357dfcfe1b5 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -462,14 +462,16 @@ bool SidebarTextControl::Command( const CommandEvent& rCEvt ) { if (IsMouseCaptured()) ReleaseMouse(); + + bool bUsedSpellPopup = false; if ( !mrSidebarWin.IsReadOnlyOrProtected() && pEditView && pEditView->IsWrongSpelledWordAtPos( rCEvt.GetMousePosPixel(), true )) { Link<SpellCallbackInfo&,void> aLink = LINK(this, SidebarTextControl, OnlineSpellCallback); - pEditView->ExecuteSpellPopup(rCEvt.GetMousePosPixel(), aLink); + bUsedSpellPopup = pEditView->ExecuteSpellPopup(rCEvt.GetMousePosPixel(), aLink); } - else + if (!bUsedSpellPopup) { Point aPos; if (rCEvt.IsMouseEvent()) diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index a74d397ce6bc..a697875e0a61 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -765,9 +765,8 @@ bool SwView::ExecDrwTextSpellPopup(const Point& rPt) if (pOLV->IsWrongSpelledWordAtPos( aPos )) { - bRet = true; Link<SpellCallbackInfo&,void> aLink = LINK(this, SwView, OnlineSpellCallback); - pOLV->ExecuteSpellPopup(aPos, aLink); + bRet = pOLV->ExecuteSpellPopup(aPos, aLink); } return bRet; }
