diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-08-03 10:54:11 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-08-03 10:55:43 +0100 |
commit | 92236c0fc4c8704a72f20a3c2e6f22df3c5ae333 (patch) | |
tree | 08cbbe450445e56431a8d551fa63c979ded416b9 /sw/source/core/txtnode | |
parent | 27c2fe405ca55a2630176a657fb4895c5e31fcea (diff) |
Related: fdo#46757 unsafe to pass expanded text to masking
So, use improved ModelToViewHelper to remove the hidden text right from the
start, which drops the need to mask out the hidden text and we can remove the
nNumOfMaskedChars hack
Change-Id: I3bd90598e496d4e82cd9cef4c8f9e61c180cb945
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r-- | sw/source/core/txtnode/txtedt.cxx | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index daeda95e491f..66650bab0d4c 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1860,8 +1860,8 @@ void SwTxtNode::CountWords( SwDocStat& rStat, return; } - // expand text into aConversionMap for scanner - const ModelToViewHelper aConversionMap(*this); + // ConversionMap to expand fields, remove invisible and redline deleted text for scanner + const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | HIDEINVISIBLE | HIDEREDLINED); rtl::OUString aExpandText = aConversionMap.getViewText(); // map start and end points onto the ConversionMap @@ -1874,12 +1874,6 @@ 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!) @@ -1914,7 +1908,6 @@ void SwTxtNode::CountWords( SwDocStat& rStat, } nTmpChars = pBreakIt->getGraphemeCount(aExpandText, nExpandBegin, nExpandEnd); - nTmpChars -= nNumOfMaskedChars; // no nTmpCharsExcludingSpaces adjust needed neither for blanked out MaskedChars // nor for mid-word selection - set scanner bClip = true at creation |