summaryrefslogtreecommitdiff
path: root/accessibility
diff options
context:
space:
mode:
authorArnaud Versini <Arnaud.Versini@libreoffice.org>2017-07-23 16:25:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-08-05 21:27:14 +0200
commite2c14a6caabbb6413ae7b1e631a0a89f7b2ba4c7 (patch)
treef6b8eb38495489cc91e03068f337087cf53473a7 /accessibility
parent42b894f80a6d0c39bb0f7092eb204a15c22c4f38 (diff)
accessibility: remove useless calls to getAccessibleActionCount.
This also removes a lot of useless recursive locks. Change-Id: Ie7f337683146bb5738f11b8f9194e73437312f03 Reviewed-on: https://gerrit.libreoffice.org/40325 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'accessibility')
-rw-r--r--accessibility/inc/standard/vclxaccessiblemenuitem.hxx2
-rw-r--r--accessibility/source/standard/vclxaccessiblebutton.cxx6
-rw-r--r--accessibility/source/standard/vclxaccessiblecheckbox.cxx6
-rw-r--r--accessibility/source/standard/vclxaccessiblemenu.cxx2
-rw-r--r--accessibility/source/standard/vclxaccessiblemenuitem.cxx6
-rw-r--r--accessibility/source/standard/vclxaccessibleradiobutton.cxx6
-rw-r--r--accessibility/source/standard/vclxaccessiblescrollbar.cxx9
-rw-r--r--accessibility/source/standard/vclxaccessibletoolboxitem.cxx6
8 files changed, 22 insertions, 21 deletions
diff --git a/accessibility/inc/standard/vclxaccessiblemenuitem.hxx b/accessibility/inc/standard/vclxaccessiblemenuitem.hxx
index ee0ccd5589e8..5e54ecb595e3 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( ) 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;
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index c95004327f86..df67584bdccc 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 || 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();
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index f8243bfc7254..d411c8ca54a2 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 || 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();
diff --git a/accessibility/source/standard/vclxaccessiblemenu.cxx b/accessibility/source/standard/vclxaccessiblemenu.cxx
index fd709766618c..def909c40758 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 >= getAccessibleActionCount() )
+ if ( nIndex < 0 || nIndex >= GetChildCount() )
throw IndexOutOfBoundsException();
return OUString( );
diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
index 60de73778696..259501bfe4dd 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 || 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();
diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
index 9606092e92f4..bff33c10647c 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 || 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();
diff --git a/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
index bb83d7ac832d..242f09f69a27 100644
--- a/accessibility/source/standard/vclxaccessiblescrollbar.cxx
+++ b/accessibility/source/standard/vclxaccessiblescrollbar.cxx
@@ -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 >();
diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
index 5dbc3b4d1050..79dba98565ff 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 || 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 >();