summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMuhammad Haggag <mhaggag@gmail.com>2012-06-13 16:45:06 +0200
committerAndras Timar <atimar@suse.com>2012-06-15 18:59:45 +0200
commit553f9ccfc8a6048528b9ffcd535adf7f1cd51fc7 (patch)
tree245f3ae6bc42a8cc3579f4ae767ceabbdc21b4c8 /sw
parent32ad77ac1449c53e3c8af7d0c93e16d1066f5ecd (diff)
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
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/txtedt.cxx13
1 files changed, 6 insertions, 7 deletions
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 3fbef67eba57..7f350c6f68d7 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1856,13 +1856,6 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
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
rtl::OUString aExpandText;
const ModelToViewHelper::ConversionMap* pConversionMap = BuildConversionMap( aExpandText );
@@ -1877,6 +1870,12 @@ void SwTxtNode::CountWords( SwDocStat& rStat,
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
// all counts exclude hidden paras and hidden+redlined within para
// definition of space/white chars in SwScanner (and BreakIter!)