Kaydet (Commit) e37cacc8 authored tarafından Michael Stahl's avatar Michael Stahl

sw_redlinehide_3: fix MergedAttrIterReverse

Was using the wrong node when iterating; also the tricky case of empty
or without-end hints at the start of an extent was wrong.

MergedAttrIter also shouldn't include wihout-end hints and non-empty
hints at the end of an extent.

Change-Id: Ia0776c1d3043cbd6d76fa04905b4937ebba53398
üst 6c8f09bb
......@@ -424,9 +424,9 @@ static void checkApplyParagraphMarkFormatToNumbering( SwFont* pNumFnt, SwTextFor
for (SwTextAttr const* pHint = iter.PrevAttr(&pNode); pHint;
pHint = iter.PrevAttr(&pNode))
{
TextFrameIndex const nHintStart(
rInf.GetTextFrame()->MapModelToView(pNode, pHint->GetStart()));
if (nHintStart < nTextLen)
TextFrameIndex const nHintEnd(
rInf.GetTextFrame()->MapModelToView(pNode, *pHint->GetAnyEnd()));
if (nHintEnd < nTextLen)
{
break; // only those at para end are interesting
}
......
......@@ -104,8 +104,12 @@ namespace sw {
{
while (m_CurrentHint < pHints->Count())
{
SwTextAttr const*const pHint(pHints->Get(m_CurrentHint));
if (rExtent.nEnd < pHint->GetStart())
SwTextAttr *const pHint(pHints->Get(m_CurrentHint));
if (rExtent.nEnd < pHint->GetStart()
// <= if it has no end or isn't empty
|| (rExtent.nEnd == pHint->GetStart()
&& (!pHint->GetEnd()
|| *pHint->GetEnd() != pHint->GetStart())))
{
break;
}
......@@ -238,13 +242,18 @@ namespace sw {
{
while (0 < m_CurrentHint)
{
SwTextAttr const*const pHint(pHints->Get(m_CurrentHint - 1));
if (pHint->GetStart() < rExtent.nStart)
SwTextAttr *const pHint(
pHints->GetSortedByEnd(m_CurrentHint - 1));
if (*pHint->GetAnyEnd() < rExtent.nStart
// <= if it has end and isn't empty
|| (pHint->GetEnd()
&& *pHint->GetEnd() != pHint->GetStart()
&& *pHint->GetEnd() == rExtent.nStart))
{
break;
}
--m_CurrentHint;
if (pHint->GetStart() <= rExtent.nEnd)
if (*pHint->GetAnyEnd() <= rExtent.nEnd)
{
if (ppNode)
{
......@@ -258,7 +267,8 @@ namespace sw {
if (0 < m_CurrentExtent &&
rExtent.pNode != m_pMerged->extents[m_CurrentExtent-1].pNode)
{
SwpHints const*const pHints(rExtent.pNode->GetpSwpHints());
SwpHints const*const pHints(
m_pMerged->extents[m_CurrentExtent-1].pNode->GetpSwpHints());
m_CurrentHint = pHints ? pHints->Count() : 0; // reset
}
}
......@@ -269,7 +279,7 @@ namespace sw {
SwpHints const*const pHints(m_pNode->GetpSwpHints());
if (pHints && 0 < m_CurrentHint)
{
SwTextAttr const*const pHint(pHints->Get(m_CurrentHint - 1));
SwTextAttr const*const pHint(pHints->GetSortedByEnd(m_CurrentHint - 1));
--m_CurrentHint;
if (ppNode)
{
......
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