[Libreoffice-commits] core.git: 2 commits - vcl/source

Caolán McNamara caolanm at redhat.com
Mon Oct 3 11:53:58 UTC 2016


 vcl/source/window/syswin.cxx |   65 +++++++++++++++++++++----------------------
 1 file changed, 33 insertions(+), 32 deletions(-)

New commits:
commit 348dcf1edb1a45027b52ba1e6f15bbf4d484a2c5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 3 12:49:30 2016 +0100

    Resolves: tdf#99324 accel underlines don't appear in extension option pages
    
    because they are not widget-layout tab pages, we have to dive down
    through the WB_DIALOGCONTROL widgets as well
    
    Change-Id: I13dbf88878efd89794158ce43137381008e18890

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index cb45ea4..7526fa9 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -128,46 +128,47 @@ void ImplHandleControlAccelerator( vcl::Window* pWindow, bool bShow )
     }
 }
 
-bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::Window *pWindow)
+namespace
 {
-    if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+    void processChildren(vcl::Window *pParent, bool bShowAccel)
     {
-        const CommandModKeyData *pCData = rCEvent.GetModKeyData();
-        const bool bShowAccel =  pCData && pCData->IsMod2();
-
-        vcl::Window *pGetChild = firstLogicalChildOfParent(pWindow);
-        while (pGetChild)
+        // go through its children
+        vcl::Window* pChild = firstLogicalChildOfParent(pParent);
+        while (pChild)
         {
-            if (pGetChild->GetType() == WINDOW_TABCONTROL)
+            if (pChild->GetType() == WINDOW_TABCONTROL)
             {
                 // find currently shown tab page
-                TabControl* pTabControl = static_cast<TabControl*>( pGetChild );
+                TabControl* pTabControl = static_cast<TabControl*>(pChild);
                 TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
-                vcl::Window* pTabPageChild = firstLogicalChildOfParent( pTabPage );
-
-                // and go through its children
-                while ( pTabPageChild )
-                {
-                    ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
-                    pTabPageChild = nextLogicalChildOfParent(pTabPage, pTabPageChild);
-                }
+                processChildren(pTabPage, bShowAccel);
             }
-            else if (pGetChild->GetType() == WINDOW_TABPAGE)
+            else if (pChild->GetType() == WINDOW_TABPAGE)
             {
                 // bare tabpage without tabcontrol parent (options dialog)
-                vcl::Window* pTabPageChild = firstLogicalChildOfParent( pGetChild );
-
-                // and go through its children
-                while ( pTabPageChild )
-                {
-                    ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
-                    pTabPageChild = nextLogicalChildOfParent(pGetChild, pTabPageChild);
-                }
+                processChildren(pChild, bShowAccel);
             }
-
-            ImplHandleControlAccelerator( pGetChild, bShowAccel );
-            pGetChild = nextLogicalChildOfParent(pWindow, pGetChild);
+            else if ((pChild->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) == WB_DIALOGCONTROL)
+            {
+                // special controls that manage their children outside of widget layout
+                processChildren(pChild, bShowAccel);
+            }
+            else
+            {
+                ImplHandleControlAccelerator(pChild, bShowAccel);
+            }
+            pChild = nextLogicalChildOfParent(pParent, pChild);
         }
+    }
+}
+
+bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::Window *pWindow)
+{
+    if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
+    {
+        const CommandModKeyData *pCData = rCEvent.GetModKeyData();
+        const bool bShowAccel = pCData && pCData->IsMod2();
+        processChildren(pWindow, bShowAccel);
         return true;
     }
     return false;
commit 1bceb4e6aeaea138fac5ea9b3dfb8710babb3d43
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Oct 3 10:55:04 2016 +0100

    fix indent
    
    Change-Id: Ia1bc9fe3c2c3833e36ec6fb9636856049acf03ec

diff --git a/vcl/source/window/syswin.cxx b/vcl/source/window/syswin.cxx
index c4d5017..cb45ea4 100644
--- a/vcl/source/window/syswin.cxx
+++ b/vcl/source/window/syswin.cxx
@@ -138,31 +138,31 @@ bool Accelerator::ToggleMnemonicsOnHierarchy(const CommandEvent& rCEvent, vcl::W
         vcl::Window *pGetChild = firstLogicalChildOfParent(pWindow);
         while (pGetChild)
         {
-            if ( pGetChild->GetType() == WINDOW_TABCONTROL )
+            if (pGetChild->GetType() == WINDOW_TABCONTROL)
             {
-                 // find currently shown tab page
-                 TabControl* pTabControl = static_cast<TabControl*>( pGetChild );
-                 TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
-                 vcl::Window* pTabPageChild = firstLogicalChildOfParent( pTabPage );
-
-                 // and go through its children
-                 while ( pTabPageChild )
-                 {
-                     ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
-                     pTabPageChild = nextLogicalChildOfParent(pTabPage, pTabPageChild);
-                 }
+                // find currently shown tab page
+                TabControl* pTabControl = static_cast<TabControl*>( pGetChild );
+                TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
+                vcl::Window* pTabPageChild = firstLogicalChildOfParent( pTabPage );
+
+                // and go through its children
+                while ( pTabPageChild )
+                {
+                    ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
+                    pTabPageChild = nextLogicalChildOfParent(pTabPage, pTabPageChild);
+                }
             }
-            else if ( pGetChild->GetType() == WINDOW_TABPAGE )
+            else if (pGetChild->GetType() == WINDOW_TABPAGE)
             {
-                 // bare tabpage without tabcontrol parent (options dialog)
-                 vcl::Window* pTabPageChild = firstLogicalChildOfParent( pGetChild );
-
-                 // and go through its children
-                 while ( pTabPageChild )
-                 {
-                     ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
-                     pTabPageChild = nextLogicalChildOfParent(pGetChild, pTabPageChild);
-                 }
+                // bare tabpage without tabcontrol parent (options dialog)
+                vcl::Window* pTabPageChild = firstLogicalChildOfParent( pGetChild );
+
+                // and go through its children
+                while ( pTabPageChild )
+                {
+                    ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
+                    pTabPageChild = nextLogicalChildOfParent(pGetChild, pTabPageChild);
+                }
             }
 
             ImplHandleControlAccelerator( pGetChild, bShowAccel );


More information about the Libreoffice-commits mailing list