diff options
Diffstat (limited to 'sfx2/source/sidebar/Deck.cxx')
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index ad3751ca9910..0a319e17bc85 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -215,6 +215,56 @@ void Deck::DataChanged (const DataChangedEvent& rEvent) +long Deck::Notify (NotifyEvent& rEvent) +{ + if (rEvent.GetType() != EVENT_COMMAND) + return sal_False; + + CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData()); + if (pCommandEvent == NULL) + return sal_False; + + switch (pCommandEvent->GetCommand()) + { + case COMMAND_WHEEL: + { + if ( ! mpVerticalScrollBar + || ! mpVerticalScrollBar->IsVisible()) + return sal_False; + + // Ignore all wheel commands from outside the vertical + // scroll bar. Otherwise after a scroll we might land on + // a spin field and subsequent wheel events would change + // the value of that control. + if (rEvent.GetWindow() != mpVerticalScrollBar.get()) + return sal_True; + + // Get the wheel data and check that it describes a valid + // vertical scroll. + const CommandWheelData* pData = pCommandEvent->GetWheelData(); + if (pData==NULL + || pData->GetModifier() + || pData->GetMode() != COMMAND_WHEEL_SCROLL + || pData->IsHorz()) + return sal_False; + + // Execute the actual scroll action. + long nDelta = pData->GetDelta(); + mpVerticalScrollBar->DoScroll( + mpVerticalScrollBar->GetThumbPos() - nDelta); + return sal_True; + } + + default: + break; + } + + return sal_False; +} + + + + void Deck::SetPanels (const SharedPanelContainer& rPanels) { maPanels = rPanels; @@ -271,7 +321,6 @@ void Deck::ShowPanel (const Panel& rPanel) 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. @@ -414,4 +463,5 @@ void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>& maSeparators = rSeparators; } + } } // end of namespace sfx2::sidebar |