From 536a6d6ca67d01c8470c242c6f1fd0750496eed4 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 6 Feb 2019 10:09:28 +0200 Subject: loplugin:flatten in sfx2 Change-Id: If4e07d497ead58a2ff58b5fdedd282b8784be421 Reviewed-on: https://gerrit.libreoffice.org/67435 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sfx2/source/sidebar/Deck.cxx | 49 ++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'sfx2/source/sidebar/Deck.cxx') 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) -- cgit