tabbar: make ImplFormat more readable
Change-Id: Id9a188fc46d800212ff583a233f06553bf1b4596 Reviewed-on: https://gerrit.libreoffice.org/73591 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
This commit is contained in:
committed by
Tomaž Vajngerl
parent
c74d7ff0b4
commit
b170256fb6
@@ -691,36 +691,39 @@ void TabBar::ImplFormat()
|
|||||||
if (!mbFormat)
|
if (!mbFormat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sal_uInt16 n = 0;
|
sal_uInt16 nItemIndex = 0;
|
||||||
long x = mnOffX;
|
long x = mnOffX;
|
||||||
for (auto& pItem : mpImpl->mpItemList)
|
for (auto & pItem : mpImpl->mpItemList)
|
||||||
{
|
{
|
||||||
// At all non-visible tabs an empty rectangle is set
|
// At all non-visible tabs an empty rectangle is set
|
||||||
if ((n + 1 < mnFirstPos) || (x > mnLastOffX))
|
if ((nItemIndex + 1 < mnFirstPos) || (x > mnLastOffX))
|
||||||
pItem->maRect.SetEmpty();
|
pItem->maRect.SetEmpty();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Slightly before the tab before the first visible page
|
// Slightly before the tab before the first visible page
|
||||||
// should also be visible
|
// should also be visible
|
||||||
if (n + 1 == mnFirstPos)
|
if (nItemIndex + 1 == mnFirstPos)
|
||||||
pItem->maRect.SetLeft( x-pItem->mnWidth );
|
{
|
||||||
|
pItem->maRect.SetLeft(x - pItem->mnWidth);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pItem->maRect.SetLeft( x );
|
pItem->maRect.SetLeft(x);
|
||||||
x += pItem->mnWidth;
|
x += pItem->mnWidth;
|
||||||
}
|
}
|
||||||
pItem->maRect.SetRight( x );
|
pItem->maRect.SetRight(x);
|
||||||
pItem->maRect.SetBottom( maWinSize.Height() - 1 );
|
pItem->maRect.SetBottom(maWinSize.Height() - 1);
|
||||||
|
|
||||||
if (mbMirrored)
|
if (mbMirrored)
|
||||||
{
|
{
|
||||||
long nTmp = mnOffX + mnLastOffX - pItem->maRect.Right();
|
long nNewLeft = mnOffX + mnLastOffX - pItem->maRect.Right();
|
||||||
pItem->maRect.SetRight( mnOffX + mnLastOffX - pItem->maRect.Left() );
|
long nNewRight = mnOffX + mnLastOffX - pItem->maRect.Left();
|
||||||
pItem->maRect.SetLeft( nTmp );
|
pItem->maRect.SetRight(nNewRight);
|
||||||
|
pItem->maRect.SetLeft(nNewLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
n++;
|
nItemIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
mbFormat = false;
|
mbFormat = false;
|
||||||
|
Reference in New Issue
Block a user