summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2016-01-05 15:53:48 +0300
committerJustin Luth <justin_luth@sil.org>2016-01-07 04:32:06 +0000
commit4038f5535658c0e0fb5e3711974f48ef4a96b30a (patch)
tree7711e307efe76936966a0c845b88cbee594d8d2b /svx
parentf5151af414f0ac0590d87040929cabe7f8db3106 (diff)
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@sil.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/source/table/accessibletableshape.cxx26
1 files changed, 12 insertions, 14 deletions
diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
index ce4396987f50..aa24c1bf10ca 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)