diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-09-26 21:35:55 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-28 08:48:54 +0100 |
commit | 0c430547d8eaca42e0a4875c9a201c202f1d2aa6 (patch) | |
tree | c18a6736c0bf926101bd3f833e666294b05d8794 /vcl/source/window | |
parent | 03e4a93815b3ab60d767c9b8cdc3b816cde24706 (diff) |
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
Diffstat (limited to 'vcl/source/window')
-rw-r--r-- | vcl/source/window/dialog.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/dlgctrl.cxx | 18 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 26 |
3 files changed, 37 insertions, 11 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index 807f9d6e9964..da9482c7c69f 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1123,8 +1123,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 8a47e5992cee..a1b2f81da56a 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 2fa259ba9003..d20cede3101c 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: */ |