svx/source/tbxctrls/layctrl.cxx | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-)
New commits: commit b26b6cab5d8147d35f76a21c333719c80840d08d Author: Jim Raykowski <rayk...@gmail.com> AuthorDate: Sat May 4 15:28:39 2019 -0800 Commit: Jim Raykowski <rayk...@gmail.com> CommitDate: Tue May 21 00:06:50 2019 +0200 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 <rayk...@gmail.com> 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: _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits