diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/vcl/layout.hxx | 6 | ||||
-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 |
4 files changed, 43 insertions, 11 deletions
diff --git a/vcl/inc/vcl/layout.hxx b/vcl/inc/vcl/layout.hxx index 34c5696a0747..47355283f68a 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 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: */ |