sc/source/ui/cctrl/checklistmenu.cxx | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-)
New commits: commit 9c34c9c2409a8f09c3373d314ef7872d7c2aee92 Author: Eike Rathke <er...@redhat.com> Date: Fri Sep 8 13:41:52 2017 +0200 Inspecting children is only necessary if parent is selected Change-Id: I9980bef27442504f59f5a85e655a761c5d35a012 diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 74c5f6df301a..d2c16a98ebc5 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1649,20 +1649,23 @@ void ScCheckListBox::GetRecursiveChecked( SvTreeListEntry* pEntry, std::unordere rLabel = GetEntryText(pEntry); else rLabel = GetEntryText(pEntry) + ";" + rLabel; - } - if (pEntry->HasChildren()) - { - const SvTreeListEntries& rChildren = pEntry->GetChildEntries(); - for (auto& rChild : rChildren) + // Prerequisite: the selection mechanism guarantees that if a child is + // selected then also the parent is selected, so we only have to + // inspect the children in case the parent is selected. + if (pEntry->HasChildren()) { - OUString aLabel = rLabel; - GetRecursiveChecked( rChild.get(), vOut, aLabel); - if (!aLabel.isEmpty() && aLabel != rLabel) - vOut.insert( aLabel); + const SvTreeListEntries& rChildren = pEntry->GetChildEntries(); + for (auto& rChild : rChildren) + { + OUString aLabel = rLabel; + GetRecursiveChecked( rChild.get(), vOut, aLabel); + if (!aLabel.isEmpty() && aLabel != rLabel) + vOut.insert( aLabel); + } + // Let the caller not add the parent alone. + rLabel.clear(); } - // Let the caller not add the parent alone. - rLabel.clear(); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits