diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-02-20 09:29:08 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-02-20 09:05:18 +0000 |
commit | 7967e5e51e5210b8c3d3dc63502bd7d875eb36b7 (patch) | |
tree | 00e571aab5c0e522e7f2a4f25a14f54694e1cd47 /sc | |
parent | 7381cef88cccd2b35a83cd4842c73e4e69a47547 (diff) |
use O(n) algorithm to change all autofilter entries
Change-Id: Iae80c0c23b15a9c2ba0cd4913d6e22dc4c3a1816
Reviewed-on: https://gerrit.libreoffice.org/22516
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index 553babd91e53..865fb7b00b0b 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1131,13 +1131,30 @@ void ScCheckListMenuWindow::packWindow() void ScCheckListMenuWindow::setAllMemberState(bool bSet) { size_t n = maMembers.size(); - OUString aLabel; + std::set<SvTreeListEntry*> maParents; for (size_t i = 0; i < n; ++i) { - aLabel = maMembers[i].maName; - if (aLabel.isEmpty()) - aLabel = ScGlobal::GetRscString(STR_EMPTYDATA); - maChecks->ShowCheckEntry( aLabel, maMembers[i].mpParent, true, bSet); + maParents.insert(maMembers[i].mpParent); + } + for (auto itr = maParents.begin(), itrEnd = maParents.end(); itr != itrEnd; ++itr) + { + if (!(*itr)) + { + sal_uInt16 nCount = maChecks->GetEntryCount(); + for( sal_uInt16 i = 0; i < nCount; ++i) + { + SvTreeListEntry* pEntry = maChecks->GetEntry(i); + maChecks->CheckEntry(pEntry, bSet); + } + } + else + { + SvTreeListEntries& rEntries = (*itr)->GetChildEntries(); + for (auto it = rEntries.begin(), itEnd = rEntries.end(); it != itEnd; ++ it) + { + maChecks->CheckEntry(*itr, bSet); + } + } } if (!maConfig.mbAllowEmptySet) |