diff options
author | Christophe JAILLET <christophe.jaillet@wanadoo.fr> | 2019-07-10 22:31:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-11 09:30:13 +0200 |
commit | fc4245e6d69829fb5acd335a01005f666c9dd21f (patch) | |
tree | b3880e5ca50aeab50c934162c9eacff40e7c830a /sfx2/source | |
parent | f1e36c1581d1198c566872c29a0ff12c94a2a18f (diff) |
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@collabora.co.uk>
Diffstat (limited to 'sfx2/source')
-rw-r--r-- | sfx2/source/control/thumbnailview.cxx | 15 |
1 files changed, 4 insertions, 11 deletions
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); |