diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-09-30 01:42:42 -0500 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2011-10-05 18:51:26 -0500 |
commit | 25161537b4291b15dc6752381374b612322a23b7 (patch) | |
tree | 8d9e8c4339e91f781e2caf4ec3a6b856903bc235 | |
parent | 8c6e559781123b6802148b4c1e3b0ba1459f3f2a (diff) |
re-add GetAccessibleRelationMemberOf() in vcl::Window::
-rw-r--r-- | vcl/inc/vcl/window.hxx | 1 | ||||
-rw-r--r-- | vcl/source/window/dlgctrl.cxx | 56 |
2 files changed, 57 insertions, 0 deletions
diff --git a/vcl/inc/vcl/window.hxx b/vcl/inc/vcl/window.hxx index ba52258f9103..0985c1d17db3 100644 --- a/vcl/inc/vcl/window.hxx +++ b/vcl/inc/vcl/window.hxx @@ -1018,6 +1018,7 @@ public: Window* GetAccessibleRelationLabelFor() const; void SetAccessibleRelationMemberOf( Window* pMemberOf ); + Window* GetAccessibleRelationMemberOf() const; // to avoid sending accessibility events in cases like closing dialogs // by default checks complete parent path diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index a0fc48b61dbe..bd13b21d69fb 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -1247,6 +1247,62 @@ Window* Window::GetAccessibleRelationLabeledBy() const return pWindow; } +Window* Window::GetAccessibleRelationMemberOf() const +{ + Window* pWindow = NULL; + Window* pFrameWindow = GetParent(); + if ( !pFrameWindow ) + { + pFrameWindow = ImplGetFrameWindow(); + } + if( !( GetType() == WINDOW_FIXEDLINE || + GetType() == WINDOW_GROUPBOX ) ) + { + // search for a control that makes member of this window + // it is considered the last fixed line or group box + // that comes before this control; with the exception of push buttons + // which are labeled only if the fixed line or group box + // is directly before the control + // get form start and form end and index of this control + sal_uInt16 nIndex, nFormStart, nFormEnd; + Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow, + const_cast<Window*>(this), + nIndex, + nFormStart, + nFormEnd ); + if( pSWindow && nIndex != nFormStart ) + { + if( GetType() == WINDOW_PUSHBUTTON || + GetType() == WINDOW_HELPBUTTON || + GetType() == WINDOW_OKBUTTON || + GetType() == WINDOW_CANCELBUTTON ) + { + nFormStart = nIndex-1; + } + for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- ) + { + sal_uInt16 nFoundIndex = 0; + pSWindow = ::ImplGetChildWindow( pFrameWindow, + nSearchIndex, + nFoundIndex, + sal_False ); + if( pSWindow && pSWindow->IsVisible() && + ( pSWindow->GetType() == WINDOW_FIXEDLINE || + pSWindow->GetType() == WINDOW_GROUPBOX ) ) + { + pWindow = pSWindow; + break; + } + if( nFoundIndex > nSearchIndex || nSearchIndex == 0 ) + { + break; + } + } + } + } + return pWindow; +} + // ----------------------------------------------------------------------- KeyEvent Window::GetActivationKey() const |