[Libreoffice-commits] core.git: sfx2/source

Caolán McNamara caolanm at redhat.com
Fri Jul 29 16:21:44 UTC 2016


 sfx2/source/dialog/backingwindow.cxx |   18 +++++++++++++++++-
 sfx2/source/dialog/backingwindow.hxx |    1 +
 2 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit 1203bf57dea230cd6de7bb5fe359d8fcd3e033dc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jul 29 16:29:03 2016 +0100

    Related: tdf#99324 get backingwindow to honour auto mnemonic on mod key change
    
    Change-Id: I533232729db4a6ad5812d18bb63c36f7401066c0

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index 24f3bf0..6059ca1 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 abb68e9..2a12b84 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();
 


More information about the Libreoffice-commits mailing list