vcl/inc/vcl/layout.hxx | 6 ++++++ vcl/source/window/dialog.cxx | 4 ++-- vcl/source/window/dlgctrl.cxx | 18 +++++++++--------- vcl/source/window/layout.cxx | 26 ++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 11 deletions(-)
New commits: commit 8372d258ad499162a4ba9888c8792454ad4d8f8e Author: Caolán McNamara <caol...@redhat.com> Date: Wed Sep 26 21:35:55 2012 +0100 truly skip unshown widgets in tab traversal make tab traversal of dialog widgets hidden because their containers are hidden and/or disabled Change-Id: I1947584717030f3703c018cbf05235811df7835e diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx index 34c5696..4735528 100644 --- a/vcl/inc/vcl/layout.hxx +++ b/vcl/inc/vcl/layout.hxx @@ -483,6 +483,12 @@ Window* getNonLayoutParent(Window *pParent); //Get first real parent which is not a layout widget Window* getNonLayoutRealParent(Window *pParent); +//return true if this window and its stack of containers are all shown +bool isVisibleInLayout(const Window *pWindow); + +//return true if this window and its stack of containers are all enabled +bool isEnabledInLayout(const Window *pWindow); + //Get next window after pChild of a pTopLevel window as //if any intermediate layout widgets didn't exist //i.e. acts like pChild = pChild->GetWindow(WINDOW_NEXT); diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 64907b2..03624ee 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1134,8 +1134,8 @@ void Dialog::GrabFocusToFirstControl() // Control in der TabSteuerung den Focus geben if ( !pFocusControl || !(pFocusControl->GetStyle() & WB_TABSTOP) || - !pFocusControl->IsVisible() || - !pFocusControl->IsEnabled() || !pFocusControl->IsInputEnabled() ) + !isVisibleInLayout(pFocusControl) || + !isEnabledInLayout(pFocusControl) || !pFocusControl->IsInputEnabled() ) { sal_uInt16 n = 0; pFocusControl = ImplGetDlgWindow( n, DLGWINDOW_FIRST ); diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index 7f419c4..7598ea1 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -94,7 +94,7 @@ static Window* ImplGetSubChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& pWindow = pWindow->ImplGetWindow(); // Unsichtbare und disablte Fenster werden uebersprungen - if ( pTabPage || pWindow->IsVisible() ) + if ( pTabPage || isVisibleInLayout(pWindow) ) { // Wenn das letzte Control ein TabControl war, wird von // diesem die TabPage genommen @@ -167,7 +167,7 @@ static Window* ImplGetChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nI if ( bTestEnable ) { sal_uInt16 n2 = nIndex; - while ( pWindow && (!pWindow->IsEnabled() || !pWindow->IsInputEnabled()) ) + while ( pWindow && (!isEnabledInLayout(pWindow) || !pWindow->IsInputEnabled()) ) { n2 = nIndex+1; nIndex = 0; @@ -184,7 +184,7 @@ static Window* ImplGetChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nI nIndex = 0; pWindow = ImplGetSubChildWindow( pParent, n, nIndex ); } - while ( pWindow && n && (!pWindow->IsEnabled() || !pWindow->IsInputEnabled()) ); + while ( pWindow && n && (!isEnabledInLayout(pWindow) || !pWindow->IsInputEnabled()) ); } } return pWindow; @@ -278,7 +278,7 @@ Window* Window::ImplGetDlgWindow( sal_uInt16 nIndex, sal_uInt16 nType, while ( (i != nStartIndex) && (i != nStartIndex2) ); if ( (i == nStartIndex2) && - (!(pWindow->GetStyle() & WB_TABSTOP) || !pWindow->IsEnabled()) ) + (!(pWindow->GetStyle() & WB_TABSTOP) || !isEnabledInLayout(pWindow)) ) i = nStartIndex; } } @@ -816,7 +816,7 @@ sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput ) nStyle = pWindow->GetStyle(); - if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() ) + if ( isVisibleInLayout(pWindow) && isEnabledInLayout(pWindow) && pWindow->IsInputEnabled() ) { if ( pWindow != pSWindow ) pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); @@ -842,7 +842,7 @@ sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput ) if ( nStyle & WB_GROUP ) break; - if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() ) + if ( isVisibleInLayout(pWindow) && isEnabledInLayout(pWindow) && pWindow->IsInputEnabled() ) { pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); return sal_True; @@ -869,7 +869,7 @@ sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput ) } } - if ( pButtonWindow && pButtonWindow->IsVisible() && pButtonWindow->IsEnabled() && pButtonWindow->IsInputEnabled() ) + if ( pButtonWindow && isVisibleInLayout(pButtonWindow) && isEnabledInLayout(pButtonWindow) && pButtonWindow->IsInputEnabled() ) { if ( bKeyInput ) { @@ -1102,7 +1102,7 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window nIndex, nIndex, sal_False ); - if( pSWindow && pSWindow->IsVisible() && ! (pSWindow->GetStyle() & WB_NOLABEL) ) + if( pSWindow && isVisibleInLayout(pSWindow) && ! (pSWindow->GetStyle() & WB_NOLABEL) ) { WindowType nType = pSWindow->GetType(); if( nType != WINDOW_FIXEDTEXT && @@ -1192,7 +1192,7 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo nSearchIndex, nFoundIndex, sal_False ); - if( pSWindow && pSWindow->IsVisible() && !(pSWindow->GetStyle() & WB_NOLABEL) ) + if( pSWindow && isVisibleInLayout(pSWindow) && !(pSWindow->GetStyle() & WB_NOLABEL) ) { WindowType nType = pSWindow->GetType(); if ( ( nType == WINDOW_FIXEDTEXT || diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 2fa259b..d20cede 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1094,4 +1094,30 @@ Window* getNonLayoutRealParent(Window *pWindow) return pWindow; } +bool isVisibleInLayout(const Window *pWindow) +{ + bool bVisible = true; + while (bVisible) + { + bVisible = pWindow->IsVisible(); + pWindow = pWindow->GetParent(); + if (!pWindow || pWindow->GetType() != WINDOW_CONTAINER) + break; + } + return bVisible; +} + +bool isEnabledInLayout(const Window *pWindow) +{ + bool bEnabled = true; + while (bEnabled) + { + bEnabled = pWindow->IsEnabled(); + pWindow = pWindow->GetParent(); + if (!pWindow || pWindow->GetType() != WINDOW_CONTAINER) + break; + } + return bEnabled; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits