[Libreoffice-commits] core.git: accessibility/source

Arnaud Versini arnaud.versini at gmail.com
Sun Apr 29 20:12:07 UTC 2018


 accessibility/source/standard/vclxaccessibletoolbox.cxx |   28 +++++++++++-----
 1 file changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 9f3e8cb4af359c387d575d34b9a3d59db7dbe3b0
Author: Arnaud Versini <arnaud.versini at gmail.com>
Date:   Sun Apr 29 20:15:02 2018 +0200

    accessibility : remove useless guards and optimisze a litle
    
    Change-Id: I1162f364d948b73b943fb973222103772fffddc3
    Reviewed-on: https://gerrit.libreoffice.org/53629
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index 7f744038d505..c9258d402be8 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -839,14 +839,20 @@ sal_Int32 VCLXAccessibleToolBox::getSelectedAccessibleChildCount(  )
     OExternalLockGuard aGuard( this );
 
     sal_Int32 nRet = 0;
-    for ( sal_Int32 i = 0, nCount = implGetAccessibleChildCount(); i < nCount; i++ )
+    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
+    if (pToolBox)
     {
-        if ( isAccessibleChildSelected( i ) )
+        sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
+        for ( size_t i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ )
         {
-            nRet = 1;
-            break; // a toolbox can only have (n)one selected child
+            if ( nHighlightItemId == pToolBox->GetItemId( i ) )
+            {
+                nRet = 1;
+                break; // a toolbox can only have (n)one selected child
+            }
         }
     }
+
     return nRet;
 }
 
@@ -857,14 +863,20 @@ Reference< XAccessible > VCLXAccessibleToolBox::getSelectedAccessibleChild( sal_
         throw IndexOutOfBoundsException();
 
     Reference< XAccessible > xChild;
-    for ( sal_Int32 i = 0, nCount = implGetAccessibleChildCount(); i < nCount; i++ )
+    VclPtr< ToolBox > pToolBox = GetAs< ToolBox >();
+    if (pToolBox)
     {
-        if ( isAccessibleChildSelected( i ) )
+        sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
+        for ( sal_Int32 i = 0, nCount = pToolBox->GetItemCount(); i < nCount; i++ )
         {
-            xChild = getAccessibleChild( i );
-            break;
+            if ( nHighlightItemId == pToolBox->GetItemId( i ) )
+            {
+                xChild = getAccessibleChild( i );
+                break;
+            }
         }
     }
+
     if (!xChild)
         throw IndexOutOfBoundsException();
 


More information about the Libreoffice-commits mailing list