diff options
author | László Németh <nemeth@numbertext.org> | 2023-10-10 15:49:38 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2023-10-11 09:00:37 +0200 |
commit | a822df6379606ab9f62d6ebb2318d0294d9c959c (patch) | |
tree | 069a030aedf29701953ecc5518312ab5878aaa9e | |
parent | d8b9f57c0fb984ce3c5771d832157fcad9af9082 (diff) |
tdf#157442 sw: fix spell checking of words next to digits
If the preceding or subsequent word was a number or a word with
numbers, misspelled words were accepted as correct.
Note: it occurred with disabled "Check words with numbers"
(default setting in Options – Language Settings – Writing Aids).
Regression from commit 5619fc438273cd15e78539e78b8af751bca24b1a
"tdf#154499 sw spell checking: add 2-word phrase checking".
Change-Id: I4478c89d04ebf971925d4bdd56aaebc7ce8fb77e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157799
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 1e9082201f7a..71ee1fd93a24 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -29,6 +29,7 @@ #include <editeng/fontitem.hxx> #include <editeng/hangulhanja.hxx> #include <i18nutil/transliteration.hxx> +#include <linguistic/misc.hxx> #include <SwSmartTagMgr.hxx> #include <o3tl/safeint.hxx> #include <osl/diagnose.h> @@ -1077,9 +1078,11 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs) const OUString& rActualWord = aScanner.GetPrevWord(); bCalledNextWord = true; // check space separated word pairs in the dictionary, e.g. "vice versa" - if ( !((bNextWord && pArgs->xSpeller->isValid( rActualWord + " " + aScanner.GetWord(), + if ( !((bNextWord && !linguistic::HasDigits(aScanner.GetWord()) && + pArgs->xSpeller->isValid( rActualWord + " " + aScanner.GetWord(), static_cast<sal_uInt16>(eActLang), Sequence< PropertyValue >() )) || - ( !sPrevWord.isEmpty() && pArgs->xSpeller->isValid( sPrevWord + " " + rActualWord, + ( !sPrevWord.isEmpty() && !linguistic::HasDigits(sPrevWord) && + pArgs->xSpeller->isValid( sPrevWord + " " + rActualWord, static_cast<sal_uInt16>(eActLang), Sequence< PropertyValue >() ))) ) { // make sure the selection build later from the data @@ -1395,9 +1398,11 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos) bNextWord = aScanner.NextWord(); bCalledNextWord = true; // check space separated word pairs in the dictionary, e.g. "vice versa" - if ( !((bNextWord && xSpell->isValid( aScanner.GetPrevWord() + " " + aScanner.GetWord(), + if ( !((bNextWord && !linguistic::HasDigits(aScanner.GetWord()) && + xSpell->isValid( aScanner.GetPrevWord() + " " + aScanner.GetWord(), static_cast<sal_uInt16>(eActLang), Sequence< PropertyValue >() )) || - (!sPrevWord.isEmpty() && xSpell->isValid( sPrevWord + " " + aScanner.GetPrevWord(), + (!sPrevWord.isEmpty() && !linguistic::HasDigits(sPrevWord) && + xSpell->isValid( sPrevWord + " " + aScanner.GetPrevWord(), static_cast<sal_uInt16>(eActLang), Sequence< PropertyValue >() ))) ) { sal_Int32 nSmartTagStt = nBegin; |