tdf#67919 access toolbar button dropdown menu from macOS VoiceOver
The fix was copied from the following NeoOffice source code files which are licensed under the Mozilla Public License, v. 2.0: https://github.com/neooffice/NeoOffice/blob/NeoOffice-2022_7/accessibility/source/standard/vclxaccessibletoolboxitem.cxx https://github.com/neooffice/NeoOffice/blob/NeoOffice-2022_7/include/vcl/toolbox.hxx https://github.com/neooffice/NeoOffice/blob/NeoOffice-2022_7/vcl/source/window/toolbox.cxx Change-Id: Ibd24c6df4ecd7fdac1c56763d1daec09936a9b31 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170426 Reviewed-by: Patrick Luby <guibomacdev@gmail.com> Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
parent
be1b9f955b
commit
3c30273d72
3 changed files with 50 additions and 12 deletions
|
@ -632,19 +632,27 @@ OUString SAL_CALL VCLXAccessibleToolBoxItem::getToolTipText( )
|
|||
|
||||
sal_Int32 VCLXAccessibleToolBoxItem::getAccessibleActionCount( )
|
||||
{
|
||||
// only one action -> "Click"
|
||||
return 1;
|
||||
// "Click" and maybe "Toggle Popup"
|
||||
return ( m_pToolBox && m_pToolBox->ItemHasDropdown( m_nItemId ) ? 2 : 1 );
|
||||
}
|
||||
|
||||
sal_Bool VCLXAccessibleToolBoxItem::doAccessibleAction ( sal_Int32 nIndex )
|
||||
{
|
||||
OExternalLockGuard aGuard( this );
|
||||
|
||||
if ( nIndex != 0 )
|
||||
throw IndexOutOfBoundsException();
|
||||
|
||||
if ( m_pToolBox )
|
||||
m_pToolBox->TriggerItem( m_nItemId );
|
||||
switch ( nIndex )
|
||||
{
|
||||
case 0:
|
||||
if ( m_pToolBox )
|
||||
m_pToolBox->TriggerItem( m_nItemId );
|
||||
break;
|
||||
case 1:
|
||||
if ( m_pToolBox && m_pToolBox->ItemHasDropdown( m_nItemId ) )
|
||||
m_pToolBox->TriggerItemDropdown( m_nItemId );
|
||||
break;
|
||||
default:
|
||||
throw IndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -653,17 +661,22 @@ OUString VCLXAccessibleToolBoxItem::getAccessibleActionDescription ( sal_Int32 n
|
|||
{
|
||||
OExternalLockGuard aGuard( this );
|
||||
|
||||
if ( nIndex != 0 )
|
||||
throw IndexOutOfBoundsException();
|
||||
|
||||
return RID_STR_ACC_ACTION_CLICK;
|
||||
switch ( nIndex )
|
||||
{
|
||||
case 0:
|
||||
return RID_STR_ACC_ACTION_CLICK;
|
||||
case 1:
|
||||
return RID_STR_ACC_ACTION_TOGGLEPOPUP;
|
||||
default:
|
||||
throw IndexOutOfBoundsException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference< XAccessibleKeyBinding > VCLXAccessibleToolBoxItem::getAccessibleActionKeyBinding( sal_Int32 nIndex )
|
||||
{
|
||||
OContextEntryGuard aGuard( this );
|
||||
|
||||
if ( nIndex != 0 )
|
||||
if (nIndex < 0 || nIndex >= getAccessibleActionCount())
|
||||
throw IndexOutOfBoundsException();
|
||||
|
||||
return Reference< XAccessibleKeyBinding >();
|
||||
|
|
|
@ -389,6 +389,9 @@ public:
|
|||
|
||||
void TriggerItem( ToolBoxItemId nItemId );
|
||||
|
||||
bool ItemHasDropdown( ToolBoxItemId nItemId );
|
||||
void TriggerItemDropdown( ToolBoxItemId nItemId );
|
||||
|
||||
/// Shows or hides items.
|
||||
void ShowItem(ToolBoxItemId nItemId, bool bVisible = true);
|
||||
|
||||
|
|
|
@ -4153,6 +4153,28 @@ void ToolBox::TriggerItem( ToolBoxItemId nItemId )
|
|||
ImplActivateItem( aKeyCode );
|
||||
}
|
||||
|
||||
bool ToolBox::ItemHasDropdown( ToolBoxItemId nItemId )
|
||||
{
|
||||
ImplToolItem* pItem = ImplGetItem( nItemId );
|
||||
return pItem && pItem->mnBits & ToolBoxItemBits::DROPDOWN;
|
||||
}
|
||||
|
||||
void ToolBox::TriggerItemDropdown( ToolBoxItemId nItemId )
|
||||
{
|
||||
if( mpFloatWin || !ItemHasDropdown( nItemId ) )
|
||||
return;
|
||||
|
||||
// Prevent highlighting of triggered item
|
||||
mnHighItemId = ToolBoxItemId(0);
|
||||
|
||||
mnDownItemId = mnCurItemId = nItemId;
|
||||
mnCurPos = GetItemPos( mnCurItemId );
|
||||
mnMouseModifier = 0;
|
||||
|
||||
mpData->mbDropDownByKeyboard = false;
|
||||
mpData->maDropdownClickHdl.Call( this );
|
||||
}
|
||||
|
||||
// calls the button's action handler
|
||||
// returns true if action was called
|
||||
bool ToolBox::ImplActivateItem( vcl::KeyCode aKeyCode )
|
||||
|
|
Loading…
Reference in a new issue