[Libreoffice-commits] core.git: sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Sat Feb 20 09:05:45 UTC 2016


 sc/source/ui/cctrl/checklistmenu.cxx |   27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

New commits:
commit 7967e5e51e5210b8c3d3dc63502bd7d875eb36b7
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Sat Feb 20 09:29:08 2016 +0100

    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 at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 553babd..865fb7b 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)


More information about the Libreoffice-commits mailing list