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

Justin Luth justin_luth at sil.org
Wed Jan 6 20:32:27 PST 2016


 svx/source/table/accessibletableshape.cxx |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

New commits:
commit 4038f5535658c0e0fb5e3711974f48ef4a96b30a
Author: Justin Luth <justin_luth at sil.org>
Date:   Tue Jan 5 15:53:48 2016 +0300

    optimize performance - avoid GetActiveAccessibleCell call
    
    pActiveAccessibleCell is only needed when the "FOCUSED" state
    is being set. Many other states are also set with the SetState function.
    Avoid the GetActiveAccessibleCell function call when processing
    these states.
    
    Change-Id: Ib317f0f4b290cc8d33f7af7f450e35c8b1f7f924
    Reviewed-on: https://gerrit.libreoffice.org/21120
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
    Tested-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
index ce43969..aa24c1b 100644
--- a/svx/source/table/accessibletableshape.cxx
+++ b/svx/source/table/accessibletableshape.cxx
@@ -988,29 +988,27 @@ AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell()
 //If current active cell is in editing, the focus state should be set to internal text
 bool AccessibleTableShape::SetState (sal_Int16 aState)
 {
-    AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
-    bool bStateHasChanged = false;
-    if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != nullptr)
+    if( aState == AccessibleStateType::FOCUSED )
     {
-        return pActiveAccessibleCell->SetState(aState);
+        AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
+        if( pActiveAccessibleCell != nullptr )
+            return pActiveAccessibleCell->SetState(aState);
     }
-    else
-        bStateHasChanged = AccessibleShape::SetState (aState);
-    return bStateHasChanged;
+
+    return AccessibleShape::SetState (aState);
 }
 
 //If current active cell is in editing, the focus state should be reset to internal text
 bool AccessibleTableShape::ResetState (sal_Int16 aState)
 {
-    AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
-    bool bStateHasChanged = false;
-    if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != nullptr)
+    if( aState == AccessibleStateType::FOCUSED )
     {
-        return pActiveAccessibleCell->ResetState(aState);
+        AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
+        if( pActiveAccessibleCell != nullptr )
+            return pActiveAccessibleCell->ResetState(aState);
     }
-    else
-        bStateHasChanged = AccessibleShape::ResetState (aState);
-    return bStateHasChanged;
+
+    return AccessibleShape::ResetState (aState);
 }
 
 bool AccessibleTableShape::SetStateDirectly (sal_Int16 aState)


More information about the Libreoffice-commits mailing list