Kaydet (Commit) b170256f authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

tabbar: make ImplFormat more readable

Change-Id: Id9a188fc46d800212ff583a233f06553bf1b4596
Reviewed-on: https://gerrit.libreoffice.org/73591
Tested-by: Jenkins
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst c74d7ff0
...@@ -691,36 +691,39 @@ void TabBar::ImplFormat() ...@@ -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;
......
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