summaryrefslogtreecommitdiff
path: root/sw/source/core/txtnode/txtedt.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/core/txtnode/txtedt.cxx')
-rw-r--r--sw/source/core/txtnode/txtedt.cxx22
1 files changed, 20 insertions, 2 deletions
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 9c8ea97f932c..06ebf9d4aef1 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -376,7 +376,8 @@ void SwTxtNode::RstTxtAttr(
const sal_Int32 nLen,
const sal_uInt16 nWhich,
const SfxItemSet* pSet,
- const bool bInclRefToxMark )
+ const bool bInclRefToxMark,
+ const bool bExactRange )
{
if ( !GetpSwpHints() )
return;
@@ -421,7 +422,7 @@ void SwTxtNode::RstTxtAttr(
SwTxtAttr *pHt = NULL;
while ( (i < m_pSwpHints->Count())
&& ( ( ( nAttrStart = (*m_pSwpHints)[i]->GetStart()) < nEnd )
- || nLen==0 ) )
+ || nLen==0 ) && !bExactRange)
{
pHt = m_pSwpHints->GetTextHint(i);
@@ -599,6 +600,23 @@ void SwTxtNode::RstTxtAttr(
++i;
}
+ if (bExactRange)
+ {
+ // Only delete the hints which start at nStt and end at nEnd.
+ for (i = 0; i < m_pSwpHints->Count(); ++i)
+ {
+ SwTxtAttr* pHint = m_pSwpHints->GetTextHint(i);
+ if (pHint->GetStart() != nStt)
+ continue;
+
+ const sal_Int32* pHintEnd = pHint->GetEnd();
+ if (!pHintEnd || *pHintEnd != nEnd)
+ continue;
+
+ delAttributes.push_back(pHint);
+ }
+ }
+
if (bChanged && !delAttributes.empty())
{ // Delete() calls GetStartOf() - requires sorted hints!
m_pSwpHints->Resort();