From 88179e3de8865ea07d5017ca0723afd10ad44ba7 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Mon, 7 Aug 2017 00:42:57 +0200 Subject: Revert "accessibility: remove useless calls to getAccessibleActionCount." This reverts commit e2c14a6caabbb6413ae7b1e631a0a89f7b2ba4c7. Change-Id: I6dc99c8ad9c6f15d6b1273338d96bc7909253ad9 Reviewed-on: https://gerrit.libreoffice.org/40815 Reviewed-by: Markus Mohrhard Tested-by: Jenkins --- accessibility/inc/standard/vclxaccessiblemenuitem.hxx | 2 +- accessibility/source/standard/vclxaccessiblebutton.cxx | 6 +++--- accessibility/source/standard/vclxaccessiblecheckbox.cxx | 6 +++--- accessibility/source/standard/vclxaccessiblemenu.cxx | 2 +- accessibility/source/standard/vclxaccessiblemenuitem.cxx | 6 +++--- accessibility/source/standard/vclxaccessibleradiobutton.cxx | 6 +++--- accessibility/source/standard/vclxaccessiblescrollbar.cxx | 9 ++++----- accessibility/source/standard/vclxaccessibletoolboxitem.cxx | 6 +++--- 8 files changed, 21 insertions(+), 22 deletions(-) diff --git a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx b/accessibility/inc/standard/vclxaccessiblemenuitem.hxx index 5e54ecb595e3..ee0ccd5589e8 100644 --- a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx +++ b/accessibility/inc/standard/vclxaccessiblemenuitem.hxx @@ -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( ) final override; + virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) 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; diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx index df67584bdccc..c95004327f86 100644 --- a/accessibility/source/standard/vclxaccessiblebutton.cxx +++ b/accessibility/source/standard/vclxaccessiblebutton.cxx @@ -187,7 +187,7 @@ sal_Bool VCLXAccessibleButton::doAccessibleAction ( sal_Int32 nIndex ) { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); VclPtr< PushButton > pButton = GetAs< PushButton >(); @@ -202,7 +202,7 @@ OUString VCLXAccessibleButton::getAccessibleActionDescription ( sal_Int32 nIndex { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); return OUString(RID_STR_ACC_ACTION_CLICK); @@ -213,7 +213,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx index d411c8ca54a2..f8243bfc7254 100644 --- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx @@ -184,7 +184,7 @@ sal_Bool VCLXAccessibleCheckBox::doAccessibleAction ( sal_Int32 nIndex ) { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); VclPtr< CheckBox > pCheckBox = GetAs< CheckBox >(); @@ -214,7 +214,7 @@ OUString VCLXAccessibleCheckBox::getAccessibleActionDescription ( sal_Int32 nInd { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); if(IsChecked()) @@ -228,7 +228,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/accessibility/source/standard/vclxaccessiblemenu.cxx index def909c40758..fd709766618c 100644 --- a/accessibility/source/standard/vclxaccessiblemenu.cxx +++ b/accessibility/source/standard/vclxaccessiblemenu.cxx @@ -231,7 +231,7 @@ OUString VCLXAccessibleMenu::getAccessibleActionDescription ( sal_Int32 nIndex ) { OExternalLockGuard aGuard( this ); - if ( nIndex < 0 || nIndex >= GetChildCount() ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); return OUString( ); diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx index 259501bfe4dd..60de73778696 100644 --- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx +++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx @@ -405,7 +405,7 @@ sal_Bool VCLXAccessibleMenuItem::doAccessibleAction ( sal_Int32 nIndex ) { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); Click(); @@ -418,7 +418,7 @@ OUString VCLXAccessibleMenuItem::getAccessibleActionDescription ( sal_Int32 nInd { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); return OUString(RID_STR_ACC_ACTION_SELECT); @@ -429,7 +429,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKe { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx index bff33c10647c..9606092e92f4 100644 --- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx +++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx @@ -162,7 +162,7 @@ sal_Bool VCLXAccessibleRadioButton::doAccessibleAction ( sal_Int32 nIndex ) { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); VCLXRadioButton* pVCLXRadioButton = static_cast< VCLXRadioButton* >( GetVCLXWindow() ); @@ -176,7 +176,7 @@ OUString VCLXAccessibleRadioButton::getAccessibleActionDescription ( sal_Int32 n { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); return OUString(RID_STR_ACC_ACTION_SELECT); @@ -186,7 +186,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper(); diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx index 242f09f69a27..bb83d7ac832d 100644 --- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx +++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx @@ -117,13 +117,12 @@ Sequence< OUString > VCLXAccessibleScrollBar::getSupportedServiceNames() // XAccessibleAction -static constexpr sal_Int32 ACCESSIBLE_ACTION_COUNT=4; sal_Int32 VCLXAccessibleScrollBar::getAccessibleActionCount( ) { OExternalLockGuard aGuard( this ); - return ACCESSIBLE_ACTION_COUNT; + return 4; } @@ -131,7 +130,7 @@ sal_Bool VCLXAccessibleScrollBar::doAccessibleAction ( sal_Int32 nIndex ) { OExternalLockGuard aGuard( this ); - if ( nIndex < 0 || nIndex >= ACCESSIBLE_ACTION_COUNT ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); bool bReturn = false; @@ -159,7 +158,7 @@ OUString VCLXAccessibleScrollBar::getAccessibleActionDescription ( sal_Int32 nIn { OExternalLockGuard aGuard( this ); - if ( nIndex < 0 || nIndex >= ACCESSIBLE_ACTION_COUNT ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); OUString sDescription; @@ -181,7 +180,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleScrollBar::getAccessibleActionK { OExternalLockGuard aGuard( this ); - if ( nIndex < 0 || nIndex >= ACCESSIBLE_ACTION_COUNT ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); return Reference< XAccessibleKeyBinding >(); diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx index 79dba98565ff..5dbc3b4d1050 100644 --- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx +++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx @@ -621,7 +621,7 @@ sal_Bool VCLXAccessibleToolBoxItem::doAccessibleAction ( sal_Int32 nIndex ) { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); if ( m_pToolBox ) @@ -634,7 +634,7 @@ OUString VCLXAccessibleToolBoxItem::getAccessibleActionDescription ( sal_Int32 n { OExternalLockGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); return OUString(RID_STR_ACC_ACTION_CLICK); @@ -644,7 +644,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleToolBoxItem::getAccessibleActio { OContextEntryGuard aGuard( this ); - if ( nIndex != 0 ) + if ( nIndex < 0 || nIndex >= getAccessibleActionCount() ) throw IndexOutOfBoundsException(); return Reference< XAccessibleKeyBinding >(); -- cgit