while ( nOtherPos < pRects->size() )
{
tools::Rectangle aOtherRect = (*pRects)[nOtherPos]; if ( aOtherRect.Top() > nBottom + 1 )
{ // rectangles are sorted, so we can stop searching break;
} if ( aOtherRect.Top() == nBottom + 1 &&
aOtherRect.Left() == aCompRect.Left() &&
aOtherRect.Right() == aCompRect.Right() )
{ // extend first rectangle
nBottom = aOtherRect.Bottom();
aCompRect.SetBottom( nBottom );
(*pRects)[nComparePos].SetBottom( nBottom );
// remove second rectangle
pRects->erase( pRects->begin() + nOtherPos );
// continue at unmodified nOtherPos
} else
++nOtherPos;
}
++nComparePos;
}
}
void ScInvertMerger::FlushTotal()
{ if( aTotalRect.IsEmpty() ) return; // nothing to do
if ( pRects )
pRects->push_back( aTotalRect );
aTotalRect.SetEmpty();
}
void ScInvertMerger::FlushLine()
{ if( aLineRect.IsEmpty() ) return; // nothing to do
if ( aTotalRect.IsEmpty() )
{
aTotalRect = aLineRect; // start new total rect
} else
{ if ( aLineRect.Left() == aTotalRect.Left() &&
aLineRect.Right() == aTotalRect.Right() &&
aLineRect.Top() == aTotalRect.Bottom() + 1 )
{ // extend total rect
aTotalRect.SetBottom( aLineRect.Bottom() );
} else
{
FlushTotal(); // draw old total rect
aTotalRect = aLineRect; // and start new one
}
}
if ( aLineRect.IsEmpty() )
{
aLineRect = aJustified; // start new line rect
} else
{ bool bDone = false; if ( aJustified.Top() == aLineRect.Top() &&
aJustified.Bottom() == aLineRect.Bottom() )
{ // try to extend line rect if ( aJustified.Left() == aLineRect.Right() + 1 )
{
aLineRect.SetRight( aJustified.Right() );
bDone = true;
} elseif ( aJustified.Right() + 1 == aLineRect.Left() ) // for RTL layout
{
aLineRect.SetLeft( aJustified.Left() );
bDone = true;
}
} if (!bDone)
{
FlushLine(); // use old line rect for total rect
aLineRect = aJustified; // and start new one
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.