Kaydet (Commit) e2c14a6c authored tarafından Arnaud Versini's avatar Arnaud Versini Kaydeden (comit) Noel Grandin

accessibility: remove useless calls to getAccessibleActionCount.

This also removes a lot of useless recursive locks.

Change-Id: Ie7f337683146bb5738f11b8f9194e73437312f03
Reviewed-on: https://gerrit.libreoffice.org/40325Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 42b894f8
......@@ -92,7 +92,7 @@ public:
virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) override;
// XAccessibleAction
virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) override;
virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) final override;
virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) override;
virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) override;
virtual css::uno::Reference< css::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) override;
......
......@@ -187,7 +187,7 @@ sal_Bool VCLXAccessibleButton::doAccessibleAction ( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
VclPtr< PushButton > pButton = GetAs< PushButton >();
......@@ -202,7 +202,7 @@ OUString VCLXAccessibleButton::getAccessibleActionDescription ( sal_Int32 nIndex
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
return OUString(RID_STR_ACC_ACTION_CLICK);
......@@ -213,7 +213,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
......
......@@ -184,7 +184,7 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >();
......@@ -214,7 +214,7 @@ OUString VCLXAccessibleCheckBox::getAccessibleActionDescription ( sal_Int32 nInd
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
if(IsChecked())
......@@ -228,7 +228,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
......
......@@ -231,7 +231,7 @@ OUString VCLXAccessibleMenu::getAccessibleActionDescription ( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex < 0 || nIndex >= GetChildCount() )
throw IndexOutOfBoundsException();
return OUString( );
......
......@@ -405,7 +405,7 @@ sal_Bool VCLXAccessibleMenuItem::doAccessibleAction ( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
Click();
......@@ -418,7 +418,7 @@ OUString VCLXAccessibleMenuItem::getAccessibleActionDescription ( sal_Int32 nInd
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
return OUString(RID_STR_ACC_ACTION_SELECT);
......@@ -429,7 +429,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKe
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
......
......@@ -162,7 +162,7 @@ sal_Bool VCLXAccessibleRadioButton::doAccessibleAction ( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() );
......@@ -176,7 +176,7 @@ OUString VCLXAccessibleRadioButton::getAccessibleActionDescription ( sal_Int32 n
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
return OUString(RID_STR_ACC_ACTION_SELECT);
......@@ -186,7 +186,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
......
......@@ -117,12 +117,13 @@ Sequence< OUString > VCLXAccessibleScrollBar::getSupportedServiceNames()
// XAccessibleAction
static constexpr sal_Int32 ACCESSIBLE_ACTION_COUNT=4;
sal_Int32 VCLXAccessibleScrollBar::getAccessibleActionCount( )
{
OExternalLockGuard aGuard( this );
return 4;
return ACCESSIBLE_ACTION_COUNT;
}
......@@ -130,7 +131,7 @@ sal_Bool VCLXAccessibleScrollBar::doAccessibleAction ( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex < 0 || nIndex >= ACCESSIBLE_ACTION_COUNT )
throw IndexOutOfBoundsException();
bool bReturn = false;
......@@ -158,7 +159,7 @@ OUString VCLXAccessibleScrollBar::getAccessibleActionDescription ( sal_Int32 nIn
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex < 0 || nIndex >= ACCESSIBLE_ACTION_COUNT )
throw IndexOutOfBoundsException();
OUString sDescription;
......@@ -180,7 +181,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleScrollBar::getAccessibleActionK
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex < 0 || nIndex >= ACCESSIBLE_ACTION_COUNT )
throw IndexOutOfBoundsException();
return Reference< XAccessibleKeyBinding >();
......
......@@ -621,7 +621,7 @@ sal_Bool VCLXAccessibleToolBoxItem::doAccessibleAction ( sal_Int32 nIndex )
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
if ( m_pToolBox )
......@@ -634,7 +634,7 @@ OUString VCLXAccessibleToolBoxItem::getAccessibleActionDescription ( sal_Int32 n
{
OExternalLockGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
return OUString(RID_STR_ACC_ACTION_CLICK);
......@@ -644,7 +644,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleToolBoxItem::getAccessibleActio
{
OContextEntryGuard aGuard( this );
if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
if ( nIndex != 0 )
throw IndexOutOfBoundsException();
return Reference< XAccessibleKeyBinding >();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment