diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-07-29 16:29:03 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-07-29 17:19:20 +0100 |
commit | 1203bf57dea230cd6de7bb5fe359d8fcd3e033dc (patch) | |
tree | f208c36d52f6ade2a01c0c01ded2ca77d3dfef10 | |
parent | f305b882868a03295f1b3108976d14354fa1553c (diff) |
Related: tdf#99324 get backingwindow to honour auto mnemonic on mod key change
Change-Id: I533232729db4a6ad5812d18bb63c36f7401066c0
-rw-r--r-- | sfx2/source/dialog/backingwindow.cxx | 18 | ||||
-rw-r--r-- | sfx2/source/dialog/backingwindow.hxx | 1 |
2 files changed, 18 insertions, 1 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index 24f3bf0bdf93..6059ca158307 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -163,8 +163,19 @@ BackingWindow::BackingWindow( vcl::Window* i_pParent ) : // init background SetBackground(); + + GetParent()->AddEventListener(LINK(this, BackingWindow, WindowEventListener)); } +IMPL_LINK_TYPED(BackingWindow, WindowEventListener, VclWindowEvent&, rEvent, void) +{ + if (rEvent.GetId() != VCLEVENT_WINDOW_COMMAND) + return; + CommandEvent* pCmdEvt = static_cast<CommandEvent*>(rEvent.GetData()); + if (pCmdEvt->GetCommand() != CommandEventId::ModKeyChange) + return; + Accelerator::ToggleMnemonicsOnHierarchy(*pCmdEvt, this); +} BackingWindow::~BackingWindow() { @@ -173,6 +184,7 @@ BackingWindow::~BackingWindow() void BackingWindow::dispose() { + GetParent()->RemoveEventListener(LINK(this, BackingWindow, WindowEventListener)); // deregister drag&drop helper if (mxDropTargetListener.is()) { @@ -405,7 +417,7 @@ void BackingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) *pVDev.get()); } -bool BackingWindow::PreNotify( NotifyEvent& rNEvt ) +bool BackingWindow::PreNotify(NotifyEvent& rNEvt) { if( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) { @@ -462,6 +474,10 @@ bool BackingWindow::PreNotify( NotifyEvent& rNEvt ) if ((aCommand != "vnd.sun.star.findbar:FocusToFindbar") && pEvt && mpAccExec->execute(rKeyCode)) return true; } + else if (rNEvt.GetType() == MouseNotifyEvent::COMMAND) + { + Accelerator::ToggleMnemonicsOnHierarchy(*rNEvt.GetCommandEvent(), this); + } return Window::PreNotify( rNEvt ); } diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx index abb68e9c765b..2a12b845fc78 100644 --- a/sfx2/source/dialog/backingwindow.hxx +++ b/sfx2/source/dialog/backingwindow.hxx @@ -106,6 +106,7 @@ class BackingWindow : public vcl::Window, public VclBuilderContainer DECL_LINK_TYPED(CreateContextMenuHdl, ThumbnailViewItem*, void); DECL_LINK_TYPED(OpenTemplateHdl, ThumbnailViewItem*, void); DECL_LINK_TYPED(EditTemplateHdl, ThumbnailViewItem*, void); + DECL_LINK_TYPED(WindowEventListener, VclWindowEvent&, void); void initControls(); |