diff options
-rw-r--r-- | include/sfx2/templatedlg.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/sfx2/templatedlg.hxx b/include/sfx2/templatedlg.hxx index ecf75d61f7ca..c1302571972e 100644 --- a/include/sfx2/templatedlg.hxx +++ b/include/sfx2/templatedlg.hxx @@ -49,6 +49,7 @@ public: virtual ~SfxTemplateManagerDlg() override; virtual void dispose() override; virtual short Execute() override; + virtual bool EventNotify( NotifyEvent& rNEvt ) override; void setDocumentModel (const css::uno::Reference<css::frame::XModel> &rModel); 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; |