summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorTibor Móger <hapcyhun@gmail.com>2016-12-07 15:41:57 +0100
committerTamás Zolnai <tamas.zolnai@collabora.com>2016-12-20 20:22:39 +0000
commit86519381cd6c7df26087461680f5467aacdc89fc (patch)
treef291fac8122eec31d6c1eb90d50e85f2d97d367f /sfx2
parent574524604cfd73c25f3a95d2d09205e8e665082a (diff)
tdf#94576 handle esc keypress on templatemanagerdialog
SfxTemplateManagerDlg now overrides behaviour of ModalDialog on EventNotify by checking if the pressed key was esc and the searchFilter is not empty and it was focused. In this case instead of letting ModalDialog close the modal it clears the searchFilter Change-Id: I90d91a3b152f68b6c8780963d1b95258d9ccf23a Reviewed-on: https://gerrit.libreoffice.org/31736 Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com> Tested-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/doc/templatedlg.cxx21
1 files changed, 21 insertions, 0 deletions
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 114c6a7120a0..63056eb7254a 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -299,6 +299,27 @@ short SfxTemplateManagerDlg::Execute()
return ModalDialog::Execute();
}
+bool SfxTemplateManagerDlg::EventNotify( NotifyEvent& rNEvt )
+{
+ if (mpSearchFilter != nullptr &&
+ mpSearchFilter->HasControlFocus() &&
+ !mpSearchFilter->GetText().isEmpty() &&
+ rNEvt.GetType() == MouseNotifyEvent::KEYINPUT)
+ {
+ const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
+ vcl::KeyCode aKeyCode = pKEvt->GetKeyCode();
+ sal_uInt16 nKeyCode = aKeyCode.GetCode();
+
+ if ( nKeyCode == KEY_ESCAPE )
+ {
+ mpSearchFilter->SetText("");
+ mpSearchFilter->UpdateData();
+ return true;
+ }
+ }
+ return ModalDialog::EventNotify(rNEvt);
+}
+
void SfxTemplateManagerDlg::setDocumentModel(const uno::Reference<frame::XModel> &rModel)
{
m_xModel = rModel;