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

sw_redlinehide_2: force SwAttrIter::GetNextAttr to make progress

... and skip over the redline if the start position is at the beginning
of it.

Change-Id: Ib12b459b12d49e1443257ce398963ab3ec64f2a5
üst 457f4151
......@@ -442,7 +442,8 @@ static void InsertCharAttrs(SfxPoolItem const** pAttrs, SfxItemSet const& rItems
// if return false: portion ends at start of redline, indexes unchanged
// if return true: portion end not known (past end of redline), indexes point to first hint past end of redline
static bool CanSkipOverRedline(SwRangeRedline const& rRedline,
size_t & rStartIndex, size_t & rEndIndex)
size_t & rStartIndex, size_t & rEndIndex,
bool const isTheAnswerYes)
{
size_t nStartIndex(rStartIndex);
size_t nEndIndex(rEndIndex);
......@@ -499,7 +500,7 @@ static bool CanSkipOverRedline(SwRangeRedline const& rRedline,
case RES_TXTATR_CJK_RUBY:
case RES_TXTATR_INPUTFIELD:
{
return false; // always break
if (!isTheAnswerYes) return false; // always break
}
break;
// these are guaranteed not to overlap
......@@ -589,7 +590,7 @@ static bool CanSkipOverRedline(SwRangeRedline const& rRedline,
case RES_TXTATR_CJK_RUBY:
case RES_TXTATR_INPUTFIELD:
{
return false;
if (!isTheAnswerYes) return false;
}
break;
case RES_TXTATR_AUTOFMT:
......@@ -610,7 +611,7 @@ static bool CanSkipOverRedline(SwRangeRedline const& rRedline,
}
if (!isFound)
{
return false;
if (!isTheAnswerYes) return false;
}
}
SfxItemSet const& rSet((pAttr->Which() == RES_TXTATR_CHARFMT)
......@@ -646,7 +647,7 @@ static bool CanSkipOverRedline(SwRangeRedline const& rRedline,
// if we didn't find a matching start for any end, then it really ends inside
if (!activeCharFmts.empty())
{
return false;
if (!isTheAnswerYes) return false;
}
for (size_t i = 0; i < SAL_N_ELEMENTS(activeCharAttrsStart); ++i)
{
......@@ -654,7 +655,7 @@ static bool CanSkipOverRedline(SwRangeRedline const& rRedline,
// assert(!activeCharAttrsStart[i] || activeCharAttrsStart[i]->GetItemPool()->IsItemPoolable(*activeCharAttrsStart[i]));
if (activeCharAttrsStart[i] != activeCharAttrsEnd[i])
{
return false;
if (!isTheAnswerYes) return false;
}
}
rStartIndex = nStartIndex;
......@@ -738,8 +739,9 @@ TextFrameIndex SwAttrIter::GetNextAttr() const
if (redline.second.first)
{
assert(m_pMergedPara);
if (CanSkipOverRedline(*redline.second.first, nStartIndex, nEndIndex))
{
if (CanSkipOverRedline(*redline.second.first,
nStartIndex, nEndIndex, m_nPosition == redline.first))
{ // if current position is start of the redline, must skip!
nActRedline += redline.second.second;
if (&redline.second.first->End()->nNode.GetNode() != pTextNode)
{
......
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