diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2008-04-15 12:04:22 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2008-04-15 12:04:22 +0000 |
commit | 3b22654409b85ba849f06bd7131df092fd488cfe (patch) | |
tree | cb32ebb43a4c559523cd090bca94d19ddf4b14fe /accessibility/source/standard/vclxaccessibletoolbox.cxx | |
parent | fc08d887e883f5cde7715275f6db671acb3bfd4e (diff) |
INTEGRATION: CWS aqua11y01 (1.2.26); FILE MERGED
2008/03/13 09:05:18 obr 1.2.26.2: WaE: explizitly cast sal_Int32 to USHORT
2008/03/11 14:48:40 fne 1.2.26.1: #i82877# make toolbox respond to focus changes through a11y
Diffstat (limited to 'accessibility/source/standard/vclxaccessibletoolbox.cxx')
-rw-r--r-- | accessibility/source/standard/vclxaccessibletoolbox.cxx | 82 |
1 files changed, 79 insertions, 3 deletions
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx index a522fe153bbd..ef68bbcb80d2 100644 --- a/accessibility/source/standard/vclxaccessibletoolbox.cxx +++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx @@ -7,7 +7,7 @@ * OpenOffice.org - a multi-platform office productivity suite * * $RCSfile: vclxaccessibletoolbox.cxx,v $ - * $Revision: 1.3 $ + * $Revision: 1.4 $ * * This file is part of OpenOffice.org. * @@ -779,5 +779,81 @@ Reference< XAccessible > VCLXAccessibleToolBox::GetChildAccessible( const VclWin return xReturn; } // ----------------------------------------------------------------------------- - - +// XAccessibleSelection +// ----------------------------------------------------------------------------- +void VCLXAccessibleToolBox::selectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + OExternalLockGuard aGuard( this ); + if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); + USHORT nPos = static_cast < USHORT > (nChildIndex); + pToolBox->ChangeHighlight( nPos ); +} +// ----------------------------------------------------------------------------- +sal_Bool VCLXAccessibleToolBox::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + OExternalLockGuard aGuard( this ); + if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); + USHORT nPos = static_cast < USHORT > (nChildIndex); + if ( pToolBox != NULL && pToolBox->GetHighlightItemId() == pToolBox->GetItemId( nPos ) ) + return sal_True; + else + return sal_False; +} +// ----------------------------------------------------------------------------- +void VCLXAccessibleToolBox::clearAccessibleSelection( ) throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + ToolBox * pToolBox = static_cast < ToolBox * > ( GetWindow() ); + pToolBox -> LoseFocus(); +} +// ----------------------------------------------------------------------------- +void VCLXAccessibleToolBox::selectAllAccessibleChildren( ) throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + // intentionally empty. makes no sense for a toolbox +} +// ----------------------------------------------------------------------------- +sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount( ) throw (RuntimeException) +{ + OExternalLockGuard aGuard( this ); + sal_Int32 nRet = 0; + for ( sal_Int32 i = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) + { + if ( isAccessibleChildSelected( i ) ) + { + nRet = 1; + break; // a toolbox can only have (n)one selected child + } + } + return nRet; +} +// ----------------------------------------------------------------------------- +Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + OExternalLockGuard aGuard( this ); + if ( nSelectedChildIndex < 0 || nSelectedChildIndex >= getSelectedAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + Reference< XAccessible > xChild; + for ( sal_Int32 i = 0, j = 0, nCount = getAccessibleChildCount(); i < nCount; i++ ) + { + if ( isAccessibleChildSelected( i ) && ( j++ == nSelectedChildIndex ) ) + { + xChild = getAccessibleChild( i ); + break; + } + } + return xChild; +} +// ----------------------------------------------------------------------------- +void VCLXAccessibleToolBox::deselectAccessibleChild( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException) +{ + OExternalLockGuard aGuard( this ); + if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount() ) + throw IndexOutOfBoundsException(); + clearAccessibleSelection(); // a toolbox can only have (n)one selected child +} +// ----------------------------------------------------------------------------- |