[Libreoffice-commits] core.git: sw/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 3 20:08:23 UTC 2021
sw/source/uibase/utlui/content.cxx | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 58f0eb6ddba26705535d07b07a17f5cf141cf3da
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Aug 3 19:50:46 2021 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 3 22:07:49 2021 +0200
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 at redhat.com>
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);
}
More information about the Libreoffice-commits
mailing list