sw/source/core/txtnode/txtedt.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
New commits: commit f3c084853331a9552821c369349398f964c73ab6 Author: László Németh <nem...@numbertext.org> AuthorDate: Tue Oct 10 15:49:38 2023 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Oct 11 10:52:21 2023 +0200 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 <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 4df899de2ac51e684e83ab95dd25fc752ce2e92e) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157775 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> 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;