svtools/source/control/tabbar.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit be86c8f2432623fdb8ed4f22ca08c35121fd8bec
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Thu Jan 19 08:56:04 2023 +0100
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Tue Jan 24 08:04:02 2023 +0000

    tdf#100584 - Arrange sheets in the tab bar depending on the RTL settings
    
    Change-Id: Id10bfd18029651790be943b74745016f6ad637ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145765
    Tested-by: Jenkins
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/svtools/source/control/tabbar.cxx 
b/svtools/source/control/tabbar.cxx
index 7daba1791d3e..b09c748feb5e 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -704,10 +704,15 @@ void TabBar::ImplFormat()
     if (!mbFormat)
         return;
 
-    sal_uInt16 nItemIndex = 0;
     tools::Long x = mnOffX;
-    for (auto & rItem : mpImpl->maItemList)
+
+    const size_t nItemListSize = mpImpl->maItemList.size();
+    for (size_t nItemIndex = 0; nItemIndex < nItemListSize; nItemIndex++)
     {
+        // tdf#100584 - arrange sheets depending on the RTL settings
+        auto& rItem = mbMirrored ? mpImpl->maItemList[nItemListSize - 
nItemIndex - 1]
+                                 : mpImpl->maItemList[nItemIndex];
+
         // At all non-visible tabs an empty rectangle is set
         if ((nItemIndex + 1 < mnFirstPos) || (x > mnLastOffX))
             rItem.maRect.SetEmpty();
@@ -735,8 +740,6 @@ void TabBar::ImplFormat()
                 rItem.maRect.SetLeft(nNewLeft);
             }
         }
-
-        nItemIndex++;
     }
 
     mbFormat = false;

Reply via email to