[Libreoffice-commits] .: Branch 'feature/calc-dp-unlimited-fields' - sc/source
Kohei Yoshida
kohei at kemper.freedesktop.org
Wed Dec 15 18:45:41 PST 2010
sc/source/ui/dbgui/fieldwnd.cxx | 24 ++++++++++++++++++++++++
sc/source/ui/inc/fieldwnd.hxx | 4 ++++
2 files changed, 28 insertions(+)
New commits:
commit 42497053fccc1a676a06fdae0f0a4db185d28355
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Wed Dec 15 21:45:06 2010 -0500
Handle mouse wheel input on the row field control.
Only for vertical scrolling at the moment.
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index 802b2d8..a96af6d 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -275,6 +275,20 @@ void ScDPFieldControlBase::DataChanged( const DataChangedEvent& rDCEvt )
Control::DataChanged( rDCEvt );
}
+void ScDPFieldControlBase::Command( const CommandEvent& rCEvt )
+{
+ if (rCEvt.GetCommand() == COMMAND_WHEEL)
+ {
+ const CommandWheelData* pData = rCEvt.GetWheelData();
+ if (pData->GetMode() == COMMAND_WHEEL_SCROLL && !pData->IsHorz())
+ {
+ // Handle vertical mouse wheel scrolls.
+ long nNotch = pData->GetNotchDelta(); // positive => up; negative => down
+ HandleWheelScroll(nNotch);
+ }
+ }
+}
+
void ScDPFieldControlBase::MouseButtonDown( const MouseEvent& rMEvt )
{
if( rMEvt.IsLeft() )
@@ -896,6 +910,11 @@ void ScDPHorFieldControl::ResetScrollBar()
}
}
+void ScDPHorFieldControl::HandleWheelScroll(long /*nNotch*/)
+{
+ // not handled for horizontal field controls.
+}
+
bool ScDPHorFieldControl::GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize)
{
if (nPos >= mnFieldBtnColCount*mnFieldBtnRowCount)
@@ -1159,6 +1178,11 @@ void ScDPRowFieldControl::ResetScrollBar()
}
}
+void ScDPRowFieldControl::HandleWheelScroll(long nNotch)
+{
+ maScroll.DoScroll(maScroll.GetThumbPos() - nNotch);
+}
+
bool ScDPRowFieldControl::GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize)
{
if (nPos >= mnColumnBtnCount)
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx
index f681021..a8128fc 100644
--- a/sc/source/ui/inc/fieldwnd.hxx
+++ b/sc/source/ui/inc/fieldwnd.hxx
@@ -88,6 +88,7 @@ public:
virtual void ScrollToShowSelection() = 0;
virtual void ScrollToEnd() = 0;
virtual void ResetScrollBar() = 0;
+ virtual void HandleWheelScroll(long nNotch) = 0;
/** Reads the FixedText's text with mnemonic and hides the FixedText. */
void UseMnemonic();
@@ -145,6 +146,7 @@ public:
virtual void Paint( const Rectangle& rRect );
virtual void DataChanged( const DataChangedEvent& rDCEvt );
+ virtual void Command( const CommandEvent& rCEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
virtual void MouseMove( const MouseEvent& rMEvt );
@@ -257,6 +259,7 @@ public:
virtual void ScrollToEnd();
virtual void ScrollToShowSelection();
virtual void ResetScrollBar();
+ virtual void HandleWheelScroll(long nNotch);
private:
bool GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize);
@@ -321,6 +324,7 @@ public:
virtual void ScrollToEnd();
virtual void ScrollToShowSelection();
virtual void ResetScrollBar();
+ virtual void HandleWheelScroll(long nNotch);
protected:
virtual size_t CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const;
More information about the Libreoffice-commits
mailing list