diff options
author | Efe Gürkan YALAMAN <efeyalaman@gmail.com> | 2013-12-17 01:45:13 +0200 |
---|---|---|
committer | Kohei Yoshida <libreoffice@kohei.us> | 2013-12-31 01:11:07 +0000 |
commit | d6f9ddb0aaa3fd9e3877f94a3147c68dd64bc77e (patch) | |
tree | 17aa3a601e122d0d393bbe6e6a1909e7ebce2f4c | |
parent | fed8a0b291eca0565071da27d6fb7c7c5f331dcd (diff) |
fdo#70465 SvTreeListBox::GetLevelChildCount refactored
Instead of iterating siblings returning count of parents child vector.
This slightly improves loading performance of "Expert Config" when accessibility enabled.
Change-Id: Ide1af3df19efaae9c0cc92086456bf3520ee5dd2
Reviewed-on: https://gerrit.libreoffice.org/7106
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Tested-by: Kohei Yoshida <libreoffice@kohei.us>
-rw-r--r-- | svtools/source/contnr/treelistbox.cxx | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 1602cd37d69a..d1ec6dca4f3b 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -937,15 +937,16 @@ sal_uLong SvTreeListBox::GetLevelChildCount( SvTreeListEntry* _pParent ) const { DBG_CHKTHIS(SvTreeListBox,0); - sal_uLong nCount = 0; + //if _pParent is 0, then pEntry is the first child of the root. SvTreeListEntry* pEntry = FirstChild( _pParent ); - while ( pEntry ) - { - ++nCount; - pEntry = NextSibling( pEntry ); - } - return nCount; + if( !pEntry )//there is only root, root don't have children + return 0; + + if( !_pParent )//root and children of root + return pEntry->pParent->maChildren.size(); + + return _pParent->maChildren.size(); } SvViewDataEntry* SvTreeListBox::GetViewDataEntry( SvTreeListEntry* pEntry ) const |