diff options
author | Caolán McNamara <caolanm@redhat.com> | 2021-08-03 19:50:46 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2021-08-03 22:07:49 +0200 |
commit | 58f0eb6ddba26705535d07b07a17f5cf141cf3da (patch) | |
tree | 9a85889aac7d79f4d6d9f137c31bc41ead5e878f /sw/source/uibase/utlui | |
parent | fcc0e6983f2e736022ecf22726cc34e50bd53f24 (diff) |
Related: tdf#143499 lookup id just once
instead of twice
for gen takes time from ~400ms to ~310ms
Change-Id: Ic5e11e889c10fa90b23165aabdca751436ecf55c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119943
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/uibase/utlui')
-rw-r--r-- | sw/source/uibase/utlui/content.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 0c4a23f98d0e..4d900a6bb42e 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -143,6 +143,13 @@ namespace return reinterpret_cast<const SwTypeNumber*>(rTreeView.get_id(rEntry).toInt64())->GetTypeId() == CTYPE_CTT; } + bool lcl_IsEqGtrOutlineContent(const weld::TreeIter& rEntry, const weld::TreeView& rTreeView, sal_uInt8 nLevel) + { + sal_Int64 nId = rTreeView.get_id(rEntry).toInt64(); + return reinterpret_cast<const SwTypeNumber*>(nId)->GetTypeId() == CTYPE_CNT && + reinterpret_cast<const SwOutlineContent*>(nId)->GetOutlineLevel() >= nLevel; + } + bool lcl_FindShell(SwWrtShell const * pShell) { bool bFound = false; @@ -1838,10 +1845,7 @@ bool SwContentTree::RequestingChildren(const weld::TreeIter& rParent) { bChild = m_xTreeView->iter_previous(*xChild); assert(!bChild || lcl_IsContentType(*xChild, *m_xTreeView) || dynamic_cast<SwOutlineContent*>(reinterpret_cast<SwTypeNumber*>(m_xTreeView->get_id(*xChild).toInt64()))); - while (bChild && - lcl_IsContent(*xChild, *m_xTreeView) && - (reinterpret_cast<SwOutlineContent*>(m_xTreeView->get_id(*xChild).toInt64())->GetOutlineLevel() >= nLevel) - ) + while (bChild && lcl_IsEqGtrOutlineContent(*xChild, *m_xTreeView, nLevel)) { bChild = m_xTreeView->iter_previous(*xChild); } |