diff options
Diffstat (limited to 'sfx2/source/sidebar/Deck.cxx')
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 86 |
1 files changed, 47 insertions, 39 deletions
diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx index 0a319e17bc85..6534ec77eff9 100644 --- a/sfx2/source/sidebar/Deck.cxx +++ b/sfx2/source/sidebar/Deck.cxx @@ -217,49 +217,57 @@ void Deck::DataChanged (const DataChangedEvent& rEvent) long Deck::Notify (NotifyEvent& rEvent) { - if (rEvent.GetType() != EVENT_COMMAND) - return sal_False; + if (rEvent.GetType() == EVENT_COMMAND) + { + CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData()); + if (pCommandEvent != NULL) + switch (pCommandEvent->GetCommand()) + { + case COMMAND_WHEEL: + return ProcessWheelEvent(pCommandEvent, rEvent) + ? sal_True + : sal_False; + + default: + break; + } + } - CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData()); - if (pCommandEvent == NULL) - return sal_False; + return Window::Notify(rEvent); +} - 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; + +bool Deck::ProcessWheelEvent ( + CommandEvent* pCommandEvent, + NotifyEvent& rEvent) +{ + if ( ! mpVerticalScrollBar) + return false; + if ( ! mpVerticalScrollBar->IsVisible()) + return 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 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 false; + + // Execute the actual scroll action. + long nDelta = pData->GetDelta(); + mpVerticalScrollBar->DoScroll( + mpVerticalScrollBar->GetThumbPos() - nDelta); + return true; } |