summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-09-08 13:41:52 +0200
committerEike Rathke <erack@redhat.com>2017-09-08 13:42:24 +0200
commit9c34c9c2409a8f09c3373d314ef7872d7c2aee92 (patch)
tree60bbf5f67782a399e3a95bb293fe640f708d7f3a /sc/source
parentecc64b73cf554a772a3e2eb987b83b6e8245266f (diff)
Inspecting children is only necessary if parent is selected
Change-Id: I9980bef27442504f59f5a85e655a761c5d35a012
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx25
1 files changed, 14 insertions, 11 deletions
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();
}
}