summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-12-01 15:12:54 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-12-03 09:57:48 +0100
commitb4707a331d8f28c87e3e48709937da1260ace596 (patch)
tree08cb58f64c681e825fd4bbc32324d562545985d0 /sw/source
parentcbbed438b0229b168b90414af2e64489aae2d107 (diff)
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 <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit d08e41379d39a3b552c2c8a34fe1c4849bb80bc9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107097 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/txtnode/txtedt.cxx15
1 files changed, 12 insertions, 3 deletions
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index ba47a0021b73..cc66f68ed23e 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1022,7 +1022,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;
}
@@ -1324,8 +1329,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;