summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2023-09-30 07:02:08 -0400
committerXisco Fauli <xiscofauli@libreoffice.org>2023-10-03 11:52:55 +0200
commitd23b589a9c4fd38e714e23ff91e623a33909a739 (patch)
tree8ff0c9ef06ee3822d522b0510bcabacd96c70a9d
parentofz#62935 avoid negative numbers in olHanglJaso (diff)
downloadcore-d23b589a9c4fd38e714e23ff91e623a33909a739.tar.gz
core-d23b589a9c4fd38e714e23ff91e623a33909a739.zip
tdf#157038 sc: avoid spell-check dialog from outside selection
Fixes 7.4 regression from cf18038c66075f7a18d89e47f3a2ab1a5bf7c4fd To avoid the HIGHLY LIKELY risk of losing the selection because of the LOW POTENTIAL of the right click being over a misspelling (that overflowed from outside the selection), simply don't even attempt to spell-check in that case. The opposite was already true (and is even worse). If the misspelling originates in the selected cells, but has overflowed into an unselected area, right clicking on the misspelling is deliberately ignored by SelectForContextMenu(). Change-Id: I7dfc5b190036f1705d848cb621e527cbff37e425 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157430 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> (cherry picked from commit 4cf4516bac88fb8f58743e6ae68eab0393059d7f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157328 Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
-rw-r--r--sc/source/ui/view/gridwin.cxx15
1 files changed, 14 insertions, 1 deletions
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 78a8db5e3d25..5ba1cb71dab6 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -3246,9 +3246,22 @@ void ScGridWindow::Command( const CommandEvent& rCEvt )
if (aPos.Col() >= 0 && (aSpellCheckCell.getType() == CELLTYPE_STRING || aSpellCheckCell.getType() == CELLTYPE_EDIT))
nColSpellError = aPos.Col();
- // Is there a misspelled word somewhere in the cell?
+ // Is there possibly a misspelled word somewhere in the cell?
// A "yes" does not mean that the word under the mouse pointer is wrong though.
bSpellError = (mpSpellCheckCxt->isMisspelled(nColSpellError, nCellY));
+ // Avoid situations where selecting the cell-with-wrong-spelling would be bad
+ if (bSpellError)
+ {
+ // When the mouse is over an empty cell, text with spelling errors
+ // potentially could have overflowed underneath the mouse pointer
+ if (nColSpellError != nCellX)
+ {
+ // If the mouse is over a selected cell, only consider spell-checking
+ // if the cell with the misspelling is also selected. tdf#157038
+ if (mrViewData.GetMarkData().IsCellMarked(nCellX, nCellY))
+ bSpellError = mrViewData.GetMarkData().IsCellMarked(nColSpellError, nCellY);
+ }
+ }
}
// #i18735# First select the item under the mouse pointer.