[Libreoffice-commits] core.git: svtools/source

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 7 01:12:34 UTC 2019


 svtools/source/control/tabbar.cxx |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

New commits:
commit b170256fb6ebaf774b02b89835b19d9f3a1afb89
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Tue Jun 4 15:29:11 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Fri Jun 7 03:11:55 2019 +0200

    tabbar: make ImplFormat more readable
    
    Change-Id: Id9a188fc46d800212ff583a233f06553bf1b4596
    Reviewed-on: https://gerrit.libreoffice.org/73591
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index f1dbc69bccb0..8ee61e42cb61 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -691,36 +691,39 @@ void TabBar::ImplFormat()
     if (!mbFormat)
         return;
 
-    sal_uInt16 n = 0;
+    sal_uInt16 nItemIndex = 0;
     long x = mnOffX;
-    for (auto& pItem : mpImpl->mpItemList)
+    for (auto & pItem : mpImpl->mpItemList)
     {
         // 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();
         else
         {
             // Slightly before the tab before the first visible page
             // should also be visible
-            if (n + 1 == mnFirstPos)
-                pItem->maRect.SetLeft( x-pItem->mnWidth );
+            if (nItemIndex + 1 == mnFirstPos)
+            {
+                pItem->maRect.SetLeft(x - pItem->mnWidth);
+            }
             else
             {
-                pItem->maRect.SetLeft( x );
+                pItem->maRect.SetLeft(x);
                 x += pItem->mnWidth;
             }
-            pItem->maRect.SetRight( x );
-            pItem->maRect.SetBottom( maWinSize.Height() - 1 );
+            pItem->maRect.SetRight(x);
+            pItem->maRect.SetBottom(maWinSize.Height() - 1);
 
             if (mbMirrored)
             {
-                long nTmp = mnOffX + mnLastOffX - pItem->maRect.Right();
-                pItem->maRect.SetRight( mnOffX + mnLastOffX - pItem->maRect.Left() );
-                pItem->maRect.SetLeft( nTmp );
+                long nNewLeft  = mnOffX + mnLastOffX - pItem->maRect.Right();
+                long nNewRight = mnOffX + mnLastOffX - pItem->maRect.Left();
+                pItem->maRect.SetRight(nNewRight);
+                pItem->maRect.SetLeft(nNewLeft);
             }
         }
 
-        n++;
+        nItemIndex++;
     }
 
     mbFormat = false;


More information about the Libreoffice-commits mailing list