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

Christophe JAILLET (via logerrit) logerrit at kemper.freedesktop.org
Thu Jul 11 07:31:06 UTC 2019


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

New commits:
commit fc4245e6d69829fb5acd335a01005f666c9dd21f
Author:     Christophe JAILLET <christophe.jaillet at wanadoo.fr>
AuthorDate: Wed Jul 10 22:31:46 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 11 09:30:13 2019 +0200

    Simplify ThumbnailView::CalculateItemPositions()
    
    There is no need to call 'setPosSizePixel()' twice, once at the beginning
    of the function just to set the width (in case of changed settings) and
    once at the end of the function to set the position and the size.
    The size obviously includes the width.
    
    Change-Id: Ie1806fe21eb28af12f1c77ac1494bb970575eff9
    Reviewed-on: https://gerrit.libreoffice.org/75382
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/control/thumbnailview.cxx b/sfx2/source/control/thumbnailview.cxx
index f9cbbae6027a..29245fc02dff 100644
--- a/sfx2/source/control/thumbnailview.cxx
+++ b/sfx2/source/control/thumbnailview.cxx
@@ -245,6 +245,7 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
     size_t      nItemCount = mFilteredItemList.size();
     WinBits     nStyle = GetStyle();
     VclPtr<ScrollBar>  pDelScrBar;
+    long        nScrBarWidth = 0;
 
     // consider the scrolling
     if ( nStyle & WB_VSCROLL )
@@ -254,12 +255,9 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
             mpScrBar = VclPtr<ScrollBar>::Create( this, WB_VSCROLL | WB_DRAG );
             mpScrBar->SetScrollHdl( LINK( this, ThumbnailView, ImplScrollHdl ) );
         }
-        else
-        {
-            // adapt the width because of the changed settings
-            long nScrBarWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
-            mpScrBar->setPosSizePixel( 0, 0, nScrBarWidth, 0, PosSizeFlags::Width );
-        }
+
+        // adapt the width because of the changed settings
+        nScrBarWidth = GetSettings().GetStyleSettings().GetScrollBarSize();
     }
     else
     {
@@ -279,11 +277,6 @@ void ThumbnailView::CalculateItemPositions (bool bScrollBarUsed)
     else
         nScrollRatio = 0;
 
-    // calculate ScrollBar width
-    long nScrBarWidth = 0;
-    if ( mpScrBar )
-        nScrBarWidth = mpScrBar->GetSizePixel().Width();
-
     // calculate maximum number of visible columns
     mnCols = static_cast<sal_uInt16>((aWinSize.Width()-nScrBarWidth) / mnItemWidth);
 


More information about the Libreoffice-commits mailing list