diff options
author | Andre Fischer <af@apache.org> | 2013-05-08 07:21:37 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-20 11:33:30 +0100 |
commit | 5e8a2c64799856ddc34ab5d468bd54d7302302f4 (patch) | |
tree | a9b950ce71010093c1cd2bd8c0bb8dd007a8f796 /sfx2 | |
parent | d35884ef7d57de649e524a10397bf0d912101c25 (diff) |
Resolves: #i122254# Process mouse wheel events over sidebar scroll bar
(cherry picked from commit db9602cbf627e1a7af56f3a419ec7c7445dcfb85)
Change-Id: I272763eb24e58443d8c8a980eca9b0f654a9e899
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/Deck.cxx | 52 | ||||
-rw-r--r-- | sfx2/source/sidebar/Deck.hxx | 1 |
2 files changed, 52 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 diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx index e3c3b6f83ea6..171fff774af7 100644 --- a/sfx2/source/sidebar/Deck.hxx +++ b/sfx2/source/sidebar/Deck.hxx @@ -69,6 +69,7 @@ public: virtual void Paint (const Rectangle& rUpdateArea); virtual void DataChanged (const DataChangedEvent& rEvent); + virtual long Notify (NotifyEvent& rEvent); void PrintWindowTree (void); void PrintWindowTree (const ::std::vector<Panel*>& rPanels); |