diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-01-15 13:20:13 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-01-15 15:40:36 +0100 |
commit | c977473546e450ec122f5d3dbc4578d8994962ef (patch) | |
tree | 88fdd4cf96115a8f3995f23d4fe15e50570c2048 /svx | |
parent | 2d3d55e57b916e19c2c75228f7abeecda52716d6 (diff) |
tdf#38328: allow Find&Replace key combinations in FindTextFieldControl
... using svt::AcceleratorExecute to detect user-configurable key
combinations.
Change-Id: Iad4f6d3e0becfb896d4b4342c819c98e04789a1c
Reviewed-on: https://gerrit.libreoffice.org/66377
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/tbxctrls/tbunosearchcontrollers.cxx | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 323712913699..a3617a8362cf 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -49,6 +49,7 @@ #include <svl/ctloptions.hxx> #include <svl/srchitem.hxx> +#include <svtools/acceleratorexecute.hxx> #include <svtools/toolboxcontroller.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/toolbox.hxx> @@ -159,6 +160,7 @@ private: css::uno::Reference< css::frame::XFrame > m_xFrame; css::uno::Reference< css::uno::XComponentContext > m_xContext; + std::unique_ptr<svt::AcceleratorExecute> m_pAcc; }; FindTextFieldControl::FindTextFieldControl( vcl::Window* pParent, WinBits nStyle, @@ -166,10 +168,12 @@ FindTextFieldControl::FindTextFieldControl( vcl::Window* pParent, WinBits nStyle const css::uno::Reference< css::uno::XComponentContext >& xContext) : ComboBox( pParent, nStyle ), m_xFrame(xFrame), - m_xContext(xContext) + m_xContext(xContext), + m_pAcc(svt::AcceleratorExecute::createAcceleratorHelper()) { SetPlaceholderText(SvxResId(RID_SVXSTR_FINDBAR_FIND)); EnableAutocomplete(true, true); + m_pAcc->init(m_xContext, m_xFrame); } void FindTextFieldControl::Remember_Impl(const OUString& rStr) @@ -262,11 +266,11 @@ bool FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) } } // Select text in the search box when Ctrl-F pressed - if ( bMod1 && nCode == KEY_F ) + else if ( bMod1 && nCode == KEY_F ) SetSelection( Selection( SELECTION_MIN, SELECTION_MAX ) ); // Execute the search when Return, Ctrl-G or F3 pressed - if ( KEY_RETURN == nCode || (bMod1 && (KEY_G == nCode)) || (KEY_F3 == nCode) ) + else if ( KEY_RETURN == nCode || (bMod1 && (KEY_G == nCode)) || (KEY_F3 == nCode) ) { Remember_Impl(GetText()); @@ -276,6 +280,13 @@ bool FindTextFieldControl::PreNotify( NotifyEvent& rNEvt ) impl_executeSearch( m_xContext, m_xFrame, pToolBox, bShift); bRet = true; } + else + { + auto awtKey = svt::AcceleratorExecute::st_VCLKey2AWTKey(pKeyEvent->GetKeyCode()); + const OUString aCommand(m_pAcc->findCommand(awtKey)); + if (aCommand == ".uno:SearchDialog") + bRet = m_pAcc->execute(awtKey); + } break; } |