sw/source/core/txtnode/txtedt.cxx |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit f33078700d65f2763ea56f2d04f93142dc93c61c
Author:     László Németh <nem...@numbertext.org>
AuthorDate: Tue Dec 1 15:12:54 2020 +0100
Commit:     Gabor Kelemen <kelemen.gab...@nisz.hu>
CommitDate: Mon Mar 1 17:12:59 2021 +0100

    tdf#66043 sw: fix spell checking of word with deletion
    
    Correct words were underlined as spelling mistakes,
    if they contained tracked deletions, related to the
    unwanted CH_TXTATR_INWORD characters (result of
    removing tracked deletions) at calling spell checking
    API functions. Fix it by checking the "invalid"
    words without CH_TXTATR_INWORD characters, too.
    
    Change-Id: I6d8a8d619a571dfb613991cb8cf67faab57de4c0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106988
    Tested-by: László Németh <nem...@numbertext.org>
    Reviewed-by: László Németh <nem...@numbertext.org>
    (cherry picked from commit d08e41379d39a3b552c2c8a34fe1c4849bb80bc9)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111710
    Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu>

diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index cbc5f4f396d7..e707c8e8d423 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1025,7 +1025,12 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs)
                 }
                 if( pArgs->xSpellAlt.is() )
                 {
-                    if (IsSymbolAt(aScanner.GetBegin()))
+                    if ( IsSymbolAt(aScanner.GetBegin()) ||
+                        // redlines can leave "in word" character within word,
+                        // we must remove them before spell checking
+                        // to avoid false alarm
+                        ( bRestoreString && pArgs->xSpeller->isValid( 
rWord.replaceAll(OUStringChar(CH_TXTATR_INWORD), ""),
+                            static_cast<sal_uInt16>(eActLang), Sequence< 
PropertyValue >() ) ) )
                     {
                         pArgs->xSpellAlt = nullptr;
                     }
@@ -1327,8 +1332,12 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, 
sal_Int32 nActPos)
             {
                 // check for: bAlter => xHyphWord.is()
                 OSL_ENSURE(!bSpell || xSpell.is(), "NULL pointer");
-
-                if( !xSpell->isValid( rWord, 
static_cast<sal_uInt16>(eActLang), Sequence< PropertyValue >() ) )
+                if( !xSpell->isValid( rWord, 
static_cast<sal_uInt16>(eActLang), Sequence< PropertyValue >() ) &&
+                    // redlines can leave "in word" character within word,
+                    // we must remove them before spell checking
+                    // to avoid false alarm
+                    (!bRestoreString || !xSpell->isValid( 
rWord.replaceAll(OUStringChar(CH_TXTATR_INWORD), ""),
+                            static_cast<sal_uInt16>(eActLang), Sequence< 
PropertyValue >() ) ) )
                 {
                     sal_Int32 nSmartTagStt = nBegin;
                     sal_Int32 nDummy = 1;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to