summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-03-27 20:22:24 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-03-28 08:57:48 +0000
commit4e0118aba0d41008c1a31b1cdc7ce7596b894ae2 (patch)
treec7384f5182a09d832e5c940f4758b82ba4be3b0d
parent88005f6f2541e12325c3e00aa438317ed8ab06bd (diff)
Related: fdo#73936 use ModelToViewHelper to expand SwTxtNodes
ModelToViewHelper knows about formfield dropdown lists so their content gets expanded, which means that in the spelling dialog the dropdowns get shown and are detected as fields Change-Id: If23d44c6189a73d04205816a32e863161f7f38ef
-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!)