summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2022-02-19 20:22:23 +0200
committerEike Rathke <erack@redhat.com>2022-02-25 15:22:32 +0100
commitcf18038c66075f7a18d89e47f3a2ab1a5bf7c4fd (patch)
tree2032074d415fd06b060f1e4f41be3aa99d49c92a /editeng
parent6c49b4290955ef1b3a502b4e5e223a4fd5573683 (diff)
tdf#81894 sc spelling: eliminate separate(inaccurate) check
ExecuteSpellPopup is quite accurate at identifying whether the spelling at PosPixel is a spelling error or not. If it is not a misspelled word, then it just silently returns. If we make this a bDone flag, then it will just move on to the normal right-click dialog. There are a few additional scenarios that need to be handled (mainly in terms of showing the edit-mode menu instead of the full format menu, and also not always returning the correct row/col when in edit mode). I will do them in separate patches so that each edge case can be clearly seen and handled. They all rely on this patch being applied first. This is the base patch. Too many things simply don't work with the interim check, so I removed it. (Part of the problem is that EditView kicks on and off, and then a new CompleteOnlineSpelling needs to be run before IsWrongSpelledWordAtPos can return a meaningful answer.) This patch specifically fixes the problem of not opening SpellPopup on a misspelled word in a wrapped-cell. Steps to reproduce: 1.) Open LOv4304.ods from bug 81894 comment 6. 2.) Right-click on "spellng" in cell B12. Before the patch, a full format popup was displayed (not in edit mode) because IsSpellErrorAtPos returned false, when it should have been true. With this patch, spelling suggestions are provided. As an example of an edge case, also notice: 3.) double-click on cell B4 (to enter edit mode) 4.) right click on "spellng" which appears to be in D4 Before the patch, nothing happened at all, but with the patch at least the fall-back menu is displayed. (EditView never switches out of cell B, so SpellPopup is looking at wrong information.) Change-Id: I91d413debc58de832dc7413034618e9e2bae3dd5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130297 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editview.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index a422cb55c85e..17ecb94b9dd1 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -978,7 +978,7 @@ static void LOKSendSpellPopupMenu(const weld::Menu& rMenu, LanguageType nGuessLa
pViewShell->libreOfficeKitViewCallback(LOK_CALLBACK_CONTEXT_MENU, aStream.str().c_str());
}
-void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void> &rCallBack)
+bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbackInfo&,void> &rCallBack)
{
OutputDevice& rDevice = pImpEditView->GetOutputDevice();
Point aPos(rDevice.PixelToLogic(rPosPixel));
@@ -987,7 +987,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
Reference< linguistic2::XSpellChecker1 > xSpeller( pImpEditView->pEditEngine->pImpEditEngine->GetSpeller() );
ESelection aOldSel = GetSelection();
if ( !(xSpeller.is() && pImpEditView->IsWrongSpelledWord( aPaM, true )) )
- return;
+ return false;
// PaMtoEditCursor returns Logical units
tools::Rectangle aTempRect = pImpEditView->pEditEngine->pImpEditEngine->PaMtoEditCursor( aPaM, GetCursorFlags::TextOnly );
@@ -1167,7 +1167,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
xPopupMenu->remove("autocorrectdlg");
LOKSendSpellPopupMenu(*xPopupMenu, nGuessLangWord, nGuessLangPara, nWords);
- return;
+ return true;
}
OString sId = xPopupMenu->popup_at_rect(pPopupParent, aTempRect);
@@ -1267,6 +1267,7 @@ void EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link<SpellCallbac
{
SetSelection( aOldSel );
}
+ return true;
}
OUString EditView::SpellIgnoreWord()