[Libreoffice-commits] core.git: Branch 'feature/sidebar' - sfx2/source

Andre Fischer af at apache.org
Fri May 10 08:08:56 PDT 2013


 sfx2/source/sidebar/Deck.cxx |   52 ++++++++++++++++++++++++++++++++++++++++++-
 sfx2/source/sidebar/Deck.hxx |    1 
 2 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit 77c85da8b7cbad2e2904af81554d65afcd868a23
Author: Andre Fischer <af at apache.org>
Date:   Wed May 8 07:21:37 2013 +0000

    Resolves: #i122254# Process mouse wheel events over sidebar scroll bar
    
    (cherry picked from commit db9602cbf627e1a7af56f3a419ec7c7445dcfb85)
    
    Change-Id: I272763eb24e58443d8c8a980eca9b0f654a9e899

diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index ad3751c..0a319e1 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 e3c3b6f..171fff7 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);


More information about the Libreoffice-commits mailing list