diff options
Diffstat (limited to 'sfx2/source/sidebar/Deck.cxx')
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 91929f8a1fa0..ad3751ca9910 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -260,6 +260,39 @@ void Deck::RequestLayout (void) +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() != NULL && 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)); + + } +} + + + + const char* GetWindowClassification (const Window* pWindow) { const String& rsName (pWindow->GetText()); |