Kaydet (Commit) 6c14d15d authored tarafından Muhammad Haggag's avatar Muhammad Haggag Kaydeden (comit) Caolán McNamara

fdo#46757 Word/character count incorrect with record changes enabled

We were ignoring redlined (deleted) text when counting characters, but not when counting
words or characters without spaces. We now mask all redlined/hidden content from the
expanded node text before operating on it.

Change-Id: If882a6dde883a2ba0ca99909ca7ac2b9abd4a1fb
üst 43103840
...@@ -1856,13 +1856,6 @@ void SwTxtNode::CountWords( SwDocStat& rStat, ...@@ -1856,13 +1856,6 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
return; return;
} }
// make a copy of the text
String rTextCopy = m_Text.Copy( );
// mask out the redlined and hidden text with ' '
const xub_Unicode cChar(' ');
const sal_uInt16 nNumOfMaskedChars = lcl_MaskRedlinesAndHiddenText( *this, rTextCopy, nStt, nEnd, cChar, false );
// expand text into pConversionMap for scanner // expand text into pConversionMap for scanner
rtl::OUString aExpandText; rtl::OUString aExpandText;
const ModelToViewHelper::ConversionMap* pConversionMap = BuildConversionMap( aExpandText ); const ModelToViewHelper::ConversionMap* pConversionMap = BuildConversionMap( aExpandText );
...@@ -1877,6 +1870,12 @@ void SwTxtNode::CountWords( SwDocStat& rStat, ...@@ -1877,6 +1870,12 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
return; return;
} }
// make a copy of the expanded text for masking redlined/hidden text with ' '
String textCopy = aExpandText;
const xub_Unicode cChar(' ');
const sal_uInt16 nNumOfMaskedChars = lcl_MaskRedlinesAndHiddenText( *this, textCopy, nExpandBegin, nExpandEnd, cChar, false );
aExpandText = textCopy;
//do the count //do the count
// all counts exclude hidden paras and hidden+redlined within para // all counts exclude hidden paras and hidden+redlined within para
// definition of space/white chars in SwScanner (and BreakIter!) // definition of space/white chars in SwScanner (and BreakIter!)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment