diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-07-17 14:03:28 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-07-17 14:11:05 +0100 |
commit | f8f05d43de8728db58c8224c8aebf31ff570b6fc (patch) | |
tree | 350661fcc9ac7ede6c97baa56d39fcca7e1b0721 /sw/source/core/txtnode | |
parent | d1561a0813e15c6694b136db116004b212a463f6 (diff) |
Resolves: fdo49629 GotoEndOfWord fails with footnote at word end
a) remove special handling of 0x0002 in our custom icu rules.
Which brings us a step closer to getting rid of at least
some of them in favour of the defaults
b) expand the 0x02 in SwTxtNode::BuildConversionMap like we
do for fields so
Good side effect is our word count and character count now take into account
the actual footnote indicator text, as does our cursor travelling. Both of
which are more word-alike.
Change-Id: I3b0024ac4b10934bee7a9e83b0fce08a18556c7b
Diffstat (limited to 'sw/source/core/txtnode')
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index dcacdb4f280e..1a710a814d47 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3106,22 +3106,45 @@ const ModelToViewHelper::ConversionMap* for ( sal_uInt16 i = 0; pSwpHints2 && i < pSwpHints2->Count(); ++i ) { const SwTxtAttr* pAttr = (*pSwpHints2)[i]; - if ( RES_TXTATR_FIELD == pAttr->Which() ) + bool bReplace = false; + xub_StrLen nFieldPos; + rtl::OUString aExpand; + switch (pAttr->Which()) + { + case RES_TXTATR_FIELD: + bReplace = true; + aExpand = + static_cast<SwTxtFld const*>(pAttr)->GetFld().GetFld() + ->ExpandField(true); + nFieldPos = *pAttr->GetStart(); + break; + case RES_TXTATR_FTN: + { + bReplace = true; + const SwFmtFtn& rFtn = static_cast<SwTxtFtn const*>(pAttr)->GetFtn(); + const SwDoc *pDoc = GetDoc(); + aExpand = rFtn.GetViewNumStr(*pDoc); + nFieldPos = *pAttr->GetStart(); + } + break; + default: + if (pAttr->HasDummyChar()) + { + bReplace = true; + nFieldPos = *pAttr->GetStart(); + } + break; + } + + if (bReplace) { - const XubString aExpand( - static_cast<SwTxtFld const*>(pAttr)->GetFld().GetFld() - ->ExpandField(true)); - if ( aExpand.Len() > 0 ) - { - const xub_StrLen nFieldPos = *pAttr->GetStart(); - rRetText = rRetText.replaceAt( nPos + nFieldPos, 1, aExpand ); - if ( !pConversionMap ) - pConversionMap = new ModelToViewHelper::ConversionMap; - pConversionMap->push_back( - ModelToViewHelper::ConversionMapEntry( - nFieldPos, nPos + nFieldPos ) ); - nPos += ( aExpand.Len() - 1 ); - } + rRetText = rRetText.replaceAt( nPos + nFieldPos, 1, aExpand ); + if ( !pConversionMap ) + pConversionMap = new ModelToViewHelper::ConversionMap; + pConversionMap->push_back( + ModelToViewHelper::ConversionMapEntry( + nFieldPos, nPos + nFieldPos ) ); + nPos += ( aExpand.getLength() - 1 ); } } |