diff options
author | Jim Raykowski <raykowj@gmail.com> | 2019-05-04 15:28:39 -0800 |
---|---|---|
committer | Jim Raykowski <raykowj@gmail.com> | 2019-05-21 00:06:50 +0200 |
commit | b26b6cab5d8147d35f76a21c333719c80840d08d (patch) | |
tree | 715656dcc5c161e1329eeeef0b89cd9aa341016b /svx/source | |
parent | 5c8de864f72c4e077b7be5871a2e51f02f69c0e9 (diff) |
tdf#119775 Make keyboard use work for TableWindow popup window
This patch restores the ability to use the keyboard for the TableWindow
popup window by not including the 'More Options...' button when
activated by keyboard from a toolbox. It also limits handling of key
input to SPACE, RETURN, and ESCAPE key input when mouse activated.
Change-Id: I306bcb844a829ca7067b8496f37cb68f35fa754d
Reviewed-on: https://gerrit.libreoffice.org/71813
Tested-by: Jenkins
Reviewed-by: Jim Raykowski <raykowj@gmail.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/tbxctrls/layctrl.cxx | 37 |
1 files changed, 31 insertions, 6 deletions
diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index 0858cd211e18..4b9903819588 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -84,6 +84,7 @@ public: virtual void MouseButtonUp( const MouseEvent& rMEvt ) override; virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& ) override; virtual void PopupModeEnd() override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; private: void Update( long nNewCol, long nNewLine ); @@ -137,13 +138,22 @@ TableWindow::TableWindow( sal_uInt16 nSlotId, vcl::Window* pParent, const OUStri SetText( rText ); - aTableButton->SetPosSizePixel( Point( nTablePosX, mnTableHeight + 5 ), - Size( mnTableWidth - nTablePosX, 24 ) ); - aTableButton->SetText( SvxResId( RID_SVXSTR_MORE ) ); - aTableButton->SetClickHdl( LINK( this, TableWindow, SelectHdl ) ); - aTableButton->Show(); + // if parent window is a toolbox only display table button when mouse activated + ToolBox* pToolBox = nullptr; + if (pParent->GetType() == WindowType::TOOLBOX) + pToolBox = dynamic_cast<ToolBox*>( pParent ); + if ( !pToolBox || !pToolBox->IsKeyEvent() ) + { + aTableButton->SetPosSizePixel( Point( nTablePosX, mnTableHeight + 5 ), + Size( mnTableWidth - nTablePosX, 24 ) ); + aTableButton->SetText( SvxResId( RID_SVXSTR_MORE ) ); + aTableButton->SetClickHdl( LINK( this, TableWindow, SelectHdl ) ); + aTableButton->Show(); - SetOutputSizePixel( Size( mnTableWidth + 3, mnTableHeight + 33 ) ); + SetOutputSizePixel( Size( mnTableWidth + 3, mnTableHeight + 33 ) ); + } + else + SetOutputSizePixel( Size( mnTableWidth + 3, mnTableHeight + 3 ) ); } @@ -375,6 +385,21 @@ void TableWindow::CloseAndShowTableDialog() TableDialog( Sequence< PropertyValue >() ); } +bool TableWindow::EventNotify( NotifyEvent& rNEvt ) +{ + // handle table button key input + if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + { + const vcl::KeyCode& rKey = rNEvt.GetKeyEvent()->GetKeyCode(); + const sal_uInt16 nCode = rKey.GetCode(); + if ( nCode != KEY_RETURN && nCode != KEY_SPACE && nCode != KEY_ESCAPE ) + { + return true; + } + } + return SfxPopupWindow::EventNotify( rNEvt ); +} + class ColumnsWindow : public SfxPopupWindow { private: |