Kaydet (Commit) 4e0118ab authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst 88005f6f
...@@ -3109,10 +3109,16 @@ OUString SwTxtNode::GetExpandTxt( const sal_Int32 nIdx, ...@@ -3109,10 +3109,16 @@ OUString SwTxtNode::GetExpandTxt( const sal_Int32 nIdx,
const bool bWithFtn ) const const bool bWithFtn ) const
{ {
OUStringBuffer aTxt( sal_uInt16 eMode = EXPANDFIELDS;
(nLen == -1) ? GetTxt().copy(nIdx) : GetTxt().copy(nIdx, nLen)); if (bWithFtn)
sal_Int32 nTxtStt = nIdx; eMode |= EXPANDFOOTNOTE;
Replace0xFF(*this, aTxt, nTxtStt, aTxt.getLength(), true, bWithFtn );
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 // remove dummy characters of Input Fields
comphelper::string::remove(aTxt, CH_TXT_ATR_INPUTFIELDSTART); comphelper::string::remove(aTxt, CH_TXT_ATR_INPUTFIELDSTART);
......
...@@ -1983,15 +1983,15 @@ bool SwTxtNode::CountWords( SwDocStat& rStat, ...@@ -1983,15 +1983,15 @@ bool SwTxtNode::CountWords( SwDocStat& rStat,
const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEREDLINED); const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEREDLINED);
OUString aExpandText = aConversionMap.getViewText(); 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) if (aExpandText.isEmpty() && !bCountNumbering)
{ {
return false; 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 //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