diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-06 10:09:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-07 08:19:14 +0100 |
commit | 536a6d6ca67d01c8470c242c6f1fd0750496eed4 (patch) | |
tree | cc2aed75621456aaeb31d26e910cc61baf3bfdd7 /sfx2/source/sidebar/Deck.cxx | |
parent | 53a318196859140deb4b3c317db583a90cfd604c (diff) |
loplugin:flatten in sfx2
Change-Id: If4e07d497ead58a2ff58b5fdedd282b8784be421
Reviewed-on: https://gerrit.libreoffice.org/67435
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/sidebar/Deck.cxx')
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 7202d5a750cc..e0405c9c279c 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -240,31 +240,30 @@ Panel* Deck::GetPanel(const OUString & panelId) void Deck::ShowPanel(const Panel& rPanel) { - if (mpVerticalScrollBar && mpVerticalScrollBar->IsVisible()) - { - // Get vertical extent of the panel. - sal_Int32 nPanelTop (rPanel.GetPosPixel().Y()); - const sal_Int32 nPanelBottom (nPanelTop + rPanel.GetSizePixel().Height() - 1); - // Add the title bar into the extent. - if (rPanel.GetTitleBar() && rPanel.GetTitleBar()->IsVisible()) - nPanelTop = rPanel.GetTitleBar()->GetPosPixel().Y(); - - // Determine what the new thumb position should be like. - // When the whole panel does not fit then make its top visible - // and it off at the bottom. - sal_Int32 nNewThumbPos (mpVerticalScrollBar->GetThumbPos()); - if (nPanelBottom >= nNewThumbPos+mpVerticalScrollBar->GetVisibleSize()) - nNewThumbPos = nPanelBottom - mpVerticalScrollBar->GetVisibleSize(); - if (nPanelTop < nNewThumbPos) - nNewThumbPos = nPanelTop; - - mpVerticalScrollBar->SetThumbPos(nNewThumbPos); - mpScrollContainer->SetPosPixel( - Point( - mpScrollContainer->GetPosPixel().X(), - -nNewThumbPos)); - - } + if (!mpVerticalScrollBar || !mpVerticalScrollBar->IsVisible()) + return; + + // Get vertical extent of the panel. + sal_Int32 nPanelTop (rPanel.GetPosPixel().Y()); + const sal_Int32 nPanelBottom (nPanelTop + rPanel.GetSizePixel().Height() - 1); + // Add the title bar into the extent. + if (rPanel.GetTitleBar() && rPanel.GetTitleBar()->IsVisible()) + nPanelTop = rPanel.GetTitleBar()->GetPosPixel().Y(); + + // Determine what the new thumb position should be like. + // When the whole panel does not fit then make its top visible + // and it off at the bottom. + sal_Int32 nNewThumbPos (mpVerticalScrollBar->GetThumbPos()); + if (nPanelBottom >= nNewThumbPos+mpVerticalScrollBar->GetVisibleSize()) + nNewThumbPos = nPanelBottom - mpVerticalScrollBar->GetVisibleSize(); + if (nPanelTop < nNewThumbPos) + nNewThumbPos = nPanelTop; + + mpVerticalScrollBar->SetThumbPos(nNewThumbPos); + mpScrollContainer->SetPosPixel( + Point( + mpScrollContainer->GetPosPixel().X(), + -nNewThumbPos)); } static const OUString GetWindowClassification(const vcl::Window* pWindow) |