sfx2/source/control/thumbnailview.cxx |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

New commits:
commit cd80b3cebca54f166c56501cd563397aee219ad1
Author:     Andreas Heinisch <andreas.heini...@yahoo.de>
AuthorDate: Tue Dec 10 10:42:47 2024 +0100
Commit:     Andreas Heinisch <andreas.heini...@yahoo.de>
CommitDate: Tue Dec 10 18:55:46 2024 +0100

    tdf#164102 - Start Center: adjust first item only if there are pinned items
    
    Change-Id: I7c80efde04f037234a54ba0d063acd6bf48a903c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178206
    Tested-by: Jenkins
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
    Reviewed-by: Andreas Heinisch <andreas.heini...@yahoo.de>

diff --git a/sfx2/source/control/thumbnailview.cxx 
b/sfx2/source/control/thumbnailview.cxx
index 261ee64d6ec3..7c60a398928c 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -482,10 +482,15 @@ void ThumbnailView::CalculateItemPositions(bool 
bScrollBarUsed)
         y += mnItemHeight + nVItemSpace;
     }
 
-    // tdf#162510 - adjust first item to take into account the new line after 
pinned items
-    auto nFirstItemAdjustment = mnCols - nItemCountPinned % mnCols;
-    if (nFirstItemAdjustment <= nFirstItem)
-        nFirstItem -= nFirstItemAdjustment;
+    // tdf#164102 - adjust first item only if there are any pinned items
+    if (const auto nRemainingPinnedSlots = nItemCountPinned % mnCols)
+    {
+        // tdf#162510 - adjust first item to take into account the new line 
after pinned items
+        const auto nFirstItemAdjustment = mnCols - nRemainingPinnedSlots;
+        if (nFirstItemAdjustment <= nFirstItem)
+            nFirstItem -= nFirstItemAdjustment;
+    }
+
 #endif
 
     // If want also draw parts of items in the last line,

Reply via email to