summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toolkit/inc/controls/table/defaultinputhandler.hxx1
-rw-r--r--toolkit/inc/controls/table/tablecontrolinterface.hxx12
-rw-r--r--toolkit/source/controls/table/defaultinputhandler.cxx45
-rw-r--r--toolkit/source/controls/table/tablecontrol.cxx43
-rw-r--r--toolkit/source/controls/table/tablecontrol_impl.hxx14
5 files changed, 55 insertions, 60 deletions
diff --git a/toolkit/inc/controls/table/defaultinputhandler.hxx b/toolkit/inc/controls/table/defaultinputhandler.hxx
index 51610b4b5d2d..40acc4a7a809 100644
--- a/toolkit/inc/controls/table/defaultinputhandler.hxx
+++ b/toolkit/inc/controls/table/defaultinputhandler.hxx
@@ -44,7 +44,6 @@ namespace svt::table
bool MouseMove(ITableControl& _rControl, const MouseEvent& rMEvt);
bool MouseButtonDown(ITableControl& _rControl, const MouseEvent& rMEvt);
bool MouseButtonUp(ITableControl& _rControl, const MouseEvent& rMEvt);
- static bool KeyInput(ITableControl& _rControl, const KeyEvent& rKEvt);
private:
bool delegateMouseEvent( ITableControl& i_control, const MouseEvent& i_event,
diff --git a/toolkit/inc/controls/table/tablecontrolinterface.hxx b/toolkit/inc/controls/table/tablecontrolinterface.hxx
index ee9a52785471..e5ff0cd88303 100644
--- a/toolkit/inc/controls/table/tablecontrolinterface.hxx
+++ b/toolkit/inc/controls/table/tablecontrolinterface.hxx
@@ -163,18 +163,6 @@ namespace svt::table
*/
virtual void showCursor() = 0;
- /** dispatches an action to the table control
-
- @return
- <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
- failure conditions include some other instance vetoing the action, or impossibility
- to execute the action at all (for instance moving up one row when already positioned
- on the very first row).
-
- @see TableControlAction
- */
- virtual bool dispatchAction( TableControlAction _eAction ) = 0;
-
/** returns selection engine*/
virtual SelectionEngine* getSelEngine() = 0;
diff --git a/toolkit/source/controls/table/defaultinputhandler.cxx b/toolkit/source/controls/table/defaultinputhandler.cxx
index ef6e250547f8..ba00f0bb9384 100644
--- a/toolkit/source/controls/table/defaultinputhandler.cxx
+++ b/toolkit/source/controls/table/defaultinputhandler.cxx
@@ -114,51 +114,6 @@ namespace svt::table
return delegateMouseEvent( i_tableControl, i_event, &MouseFunction::handleMouseUp );
}
-
- bool DefaultInputHandler::KeyInput( ITableControl& _rControl, const KeyEvent& rKEvt )
- {
- bool bHandled = false;
-
- const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
- sal_uInt16 nKeyCode = rKeyCode.GetCode();
-
- struct ActionMapEntry
- {
- sal_uInt16 nKeyCode;
- sal_uInt16 nKeyModifier;
- TableControlAction eAction;
- }
- static const aKnownActions[] = {
- { KEY_DOWN, 0, TableControlAction::cursorDown },
- { KEY_UP, 0, TableControlAction::cursorUp },
- { KEY_LEFT, 0, TableControlAction::cursorLeft },
- { KEY_RIGHT, 0, TableControlAction::cursorRight },
- { KEY_HOME, 0, TableControlAction::cursorToLineStart },
- { KEY_END, 0, TableControlAction::cursorToLineEnd },
- { KEY_PAGEUP, 0, TableControlAction::cursorPageUp },
- { KEY_PAGEDOWN, 0, TableControlAction::cursorPageDown },
- { KEY_PAGEUP, KEY_MOD1, TableControlAction::cursorToFirstLine },
- { KEY_PAGEDOWN, KEY_MOD1, TableControlAction::cursorToLastLine },
- { KEY_HOME, KEY_MOD1, TableControlAction::cursorTopLeft },
- { KEY_END, KEY_MOD1, TableControlAction::cursorBottomRight },
- { KEY_SPACE, KEY_MOD1, TableControlAction::cursorSelectRow },
- { KEY_UP, KEY_SHIFT, TableControlAction::cursorSelectRowUp },
- { KEY_DOWN, KEY_SHIFT, TableControlAction::cursorSelectRowDown },
- { KEY_END, KEY_SHIFT, TableControlAction::cursorSelectRowAreaBottom },
- { KEY_HOME, KEY_SHIFT, TableControlAction::cursorSelectRowAreaTop }
- };
- for (const ActionMapEntry& rAction : aKnownActions)
- {
- if ( ( rAction.nKeyCode == nKeyCode ) && ( rAction.nKeyModifier == rKeyCode.GetModifier() ) )
- {
- bHandled = _rControl.dispatchAction( rAction.eAction );
- break;
- }
- }
-
- return bHandled;
- }
-
} // namespace svt::table
diff --git a/toolkit/source/controls/table/tablecontrol.cxx b/toolkit/source/controls/table/tablecontrol.cxx
index bde7d9788126..c5b5ef1c6b78 100644
--- a/toolkit/source/controls/table/tablecontrol.cxx
+++ b/toolkit/source/controls/table/tablecontrol.cxx
@@ -96,7 +96,48 @@ namespace svt::table
void TableControl::KeyInput( const KeyEvent& rKEvt )
{
- if (!m_pImpl || !DefaultInputHandler::KeyInput(*m_pImpl, rKEvt))
+ bool bHandled = false;
+ if (m_pImpl)
+ {
+ const vcl::KeyCode& rKeyCode = rKEvt.GetKeyCode();
+ sal_uInt16 nKeyCode = rKeyCode.GetCode();
+
+ struct ActionMapEntry
+ {
+ sal_uInt16 nKeyCode;
+ sal_uInt16 nKeyModifier;
+ TableControlAction eAction;
+ }
+ static const aKnownActions[] = {
+ { KEY_DOWN, 0, TableControlAction::cursorDown },
+ { KEY_UP, 0, TableControlAction::cursorUp },
+ { KEY_LEFT, 0, TableControlAction::cursorLeft },
+ { KEY_RIGHT, 0, TableControlAction::cursorRight },
+ { KEY_HOME, 0, TableControlAction::cursorToLineStart },
+ { KEY_END, 0, TableControlAction::cursorToLineEnd },
+ { KEY_PAGEUP, 0, TableControlAction::cursorPageUp },
+ { KEY_PAGEDOWN, 0, TableControlAction::cursorPageDown },
+ { KEY_PAGEUP, KEY_MOD1, TableControlAction::cursorToFirstLine },
+ { KEY_PAGEDOWN, KEY_MOD1, TableControlAction::cursorToLastLine },
+ { KEY_HOME, KEY_MOD1, TableControlAction::cursorTopLeft },
+ { KEY_END, KEY_MOD1, TableControlAction::cursorBottomRight },
+ { KEY_SPACE, KEY_MOD1, TableControlAction::cursorSelectRow },
+ { KEY_UP, KEY_SHIFT, TableControlAction::cursorSelectRowUp },
+ { KEY_DOWN, KEY_SHIFT, TableControlAction::cursorSelectRowDown },
+ { KEY_END, KEY_SHIFT, TableControlAction::cursorSelectRowAreaBottom },
+ { KEY_HOME, KEY_SHIFT, TableControlAction::cursorSelectRowAreaTop }
+ };
+ for (const ActionMapEntry& rAction : aKnownActions)
+ {
+ if ((rAction.nKeyCode == nKeyCode) && (rAction.nKeyModifier == rKeyCode.GetModifier()))
+ {
+ bHandled = m_pImpl->dispatchAction(rAction.eAction);
+ break;
+ }
+ }
+ }
+
+ if (!bHandled)
Control::KeyInput( rKEvt );
else
{
diff --git a/toolkit/source/controls/table/tablecontrol_impl.hxx b/toolkit/source/controls/table/tablecontrol_impl.hxx
index db17ef85fdfe..a2fc6ec873d7 100644
--- a/toolkit/source/controls/table/tablecontrol_impl.hxx
+++ b/toolkit/source/controls/table/tablecontrol_impl.hxx
@@ -244,7 +244,19 @@ namespace svt::table
// ITableControl
virtual void hideCursor() override;
virtual void showCursor() override;
- virtual bool dispatchAction( TableControlAction _eAction ) override;
+
+ /** dispatches an action to the table control
+
+ @return
+ <TRUE/> if the action could be dispatched successfully, <FALSE/> otherwise. Usual
+ failure conditions include some other instance vetoing the action, or impossibility
+ to execute the action at all (for instance moving up one row when already positioned
+ on the very first row).
+
+ @see TableControlAction
+ */
+ virtual bool dispatchAction(TableControlAction _eAction);
+
virtual SelectionEngine* getSelEngine() override;
virtual PTableModel getModel() const override;
virtual ColPos getCurrentColumn() const override;