[Libreoffice-commits] .: Branch 'feature/cmclayouttrans' - vcl/inc vcl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 25 12:39:17 PDT 2012


 vcl/inc/vcl/layout.hxx        |    5 ++++-
 vcl/source/control/button.cxx |    4 ++--
 vcl/source/window/dlgctrl.cxx |   13 +++++++++----
 vcl/source/window/layout.cxx  |   17 +++++++++++------
 vcl/source/window/window.cxx  |    3 ++-
 5 files changed, 28 insertions(+), 14 deletions(-)

New commits:
commit a05574b56b83cbee758606a9529a0b6c117e76cc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Sep 25 20:37:53 2012 +0100

    we need to have the outermost TabDialog as the recipient of tab keystrokes
    
    Change-Id: I1d230512d2145a9a3198c25c60dcd8954928120e

diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx
index 1b00715..34c5696 100644
--- a/vcl/inc/vcl/layout.hxx
+++ b/vcl/inc/vcl/layout.hxx
@@ -478,7 +478,10 @@ private:
 Size getLegacyBestSizeForChildren(const Window &rWindow);
 
 //Get first parent which is not a layout widget
-Window* getLegacyNonLayoutParent(Window *pParent);
+Window* getNonLayoutParent(Window *pParent);
+
+//Get first real parent which is not a layout widget
+Window* getNonLayoutRealParent(Window *pParent);
 
 //Get next window after pChild of a pTopLevel window as
 //if any intermediate layout widgets didn't exist
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 0b4fe60..9f62c46 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1813,7 +1813,7 @@ void OKButton::Click()
     // Ist kein Link gesetzt, dann schliesse Parent
     if ( !GetClickHdl() )
     {
-        Window* pParent = getLegacyNonLayoutParent(GetParent());
+        Window* pParent = getNonLayoutParent(this);
         if ( pParent->IsSystemWindow() )
         {
             if ( pParent->IsDialog() )
@@ -1890,7 +1890,7 @@ void CancelButton::Click()
     // Ist kein Link gesetzt, dann schliesse Parent
     if ( !GetClickHdl() )
     {
-        Window* pParent = getLegacyNonLayoutParent(GetParent());
+        Window* pParent = getNonLayoutParent(this);
         if ( pParent->IsSystemWindow() )
         {
             if ( pParent->IsDialog() )
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index f7941ff..7f419c4 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -52,8 +52,9 @@ static sal_Bool ImplHasIndirectTabParent( Window* pWindow )
     // The window has inderect tab parent if it is included in tab hierarchy
     // of the indirect parent window
 
-    return ( pWindow && pWindow->GetParent()
-          && ( pWindow->GetParent()->ImplGetWindow()->GetStyle() & WB_CHILDDLGCTRL ) );
+    Window* pNonLayoutParent = getNonLayoutParent(pWindow);
+    return ( pNonLayoutParent
+          && ( pNonLayoutParent->ImplGetWindow()->GetStyle() & WB_CHILDDLGCTRL ) );
 }
 
 // -----------------------------------------------------------------------
@@ -68,8 +69,12 @@ static Window* ImplGetTopParentOfTabHierarchy( Window* pParent )
 
     if ( pResult )
     {
-        while ( pResult->GetParent() && ( pResult->ImplGetWindow()->GetStyle() & WB_CHILDDLGCTRL ) )
-            pResult = pResult->GetParent();
+        Window* pNonLayoutParent = getNonLayoutParent(pResult);
+        while ( pNonLayoutParent && ( pResult->ImplGetWindow()->GetStyle() & WB_CHILDDLGCTRL ) )
+        {
+            pResult = pNonLayoutParent;
+            pNonLayoutParent = getNonLayoutParent(pResult);
+        }
     }
 
     return pResult;
diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx
index 9ab9579..8666ef5 100644
--- a/vcl/source/window/layout.cxx
+++ b/vcl/source/window/layout.cxx
@@ -1072,13 +1072,18 @@ Size getLegacyBestSizeForChildren(const Window &rWindow)
     return aRet;
 }
 
-Window* getLegacyNonLayoutParent(Window *pParent)
+Window* getNonLayoutParent(Window *pWindow)
 {
-    while (pParent && pParent->GetType() == WINDOW_CONTAINER)
-    {
-        pParent = pParent->GetParent();
-    }
-    return pParent;
+    while (pWindow && pWindow->GetType() == WINDOW_CONTAINER)
+        pWindow = pWindow->GetParent();
+    return pWindow;
+}
+
+Window* getNonLayoutRealParent(Window *pWindow)
+{
+    while (pWindow && pWindow->GetType() == WINDOW_CONTAINER)
+        pWindow = pWindow->ImplGetParent();
+    return pWindow;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 66eeee5..6901d79 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -35,6 +35,7 @@
 #include "unotools/fontcfg.hxx"
 #include "unotools/confignode.hxx"
 
+#include "vcl/layout.hxx"
 #include "vcl/unohelp.hxx"
 #include "vcl/salgtype.hxx"
 #include "vcl/event.hxx"
@@ -5218,7 +5219,7 @@ long Window::Notify( NotifyEvent& rNEvt )
         if ( (rNEvt.GetType() == EVENT_KEYINPUT) || (rNEvt.GetType() == EVENT_KEYUP) )
         {
             if ( ImplIsOverlapWindow() ||
-                 ((ImplGetParent()->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
+                 ((getNonLayoutRealParent(this)->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
             {
                 nRet = ImplDlgCtrl( *rNEvt.GetKeyEvent(), rNEvt.GetType() == EVENT_KEYINPUT );
             }


More information about the Libreoffice-commits mailing list