summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx14
-rw-r--r--sw/source/core/txtnode/txtedt.cxx8
2 files changed, 14 insertions, 8 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4812b4d32c9f..1f1045666b36 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3109,10 +3109,16 @@ OUString SwTxtNode::GetExpandTxt( const sal_Int32 nIdx,
const bool bWithFtn ) const
{
- OUStringBuffer aTxt(
- (nLen == -1) ? GetTxt().copy(nIdx) : GetTxt().copy(nIdx, nLen));
- sal_Int32 nTxtStt = nIdx;
- Replace0xFF(*this, aTxt, nTxtStt, aTxt.getLength(), true, bWithFtn );
+ sal_uInt16 eMode = EXPANDFIELDS;
+ if (bWithFtn)
+ eMode |= EXPANDFOOTNOTE;
+
+ ModelToViewHelper aConversionMap(*this, eMode);
+ OUString aExpandText = aConversionMap.getViewText();
+ const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nIdx );
+ sal_Int32 nEnd = nLen == -1 ? GetTxt().getLength() : nIdx + nLen;
+ const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd );
+ OUStringBuffer aTxt(aExpandText.copy(nExpandBegin, nExpandEnd-nExpandBegin));
// remove dummy characters of Input Fields
comphelper::string::remove(aTxt, CH_TXT_ATR_INPUTFIELDSTART);
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 733899596ded..8cb04356a4ff 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1983,15 +1983,15 @@ bool SwTxtNode::CountWords( SwDocStat& rStat,
const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEREDLINED);
OUString aExpandText = aConversionMap.getViewText();
- // map start and end points onto the ConversionMap
- const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nStt );
- const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd );
-
if (aExpandText.isEmpty() && !bCountNumbering)
{
return false;
}
+ // map start and end points onto the ConversionMap
+ const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nStt );
+ const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd );
+
//do the count
// all counts exclude hidden paras and hidden+redlined within para
// definition of space/white chars in SwScanner (and BreakIter!)