[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sc/source

Serge Krot Serge.Krot at cib.de
Wed Jun 13 07:45:59 UTC 2018


 sc/source/ui/view/gridwin.cxx |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

New commits:
commit fcef464fe83aef0183d6c7f849725649de2da70d
Author: Serge Krot <Serge.Krot at cib.de>
Date:   Thu Jun 7 18:02:50 2018 +0200

    tdf#117276 filter reset: check complete data range selected
    
    Reviewed-on: https://gerrit.libreoffice.org/55436
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>
    
    Conflicts:
            sc/source/ui/view/gridwin.cxx
    
    Change-Id: I5cbd515753ad606f55cedaa7023ffe88671f4702
    Reviewed-on: https://gerrit.libreoffice.org/55720
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
old mode 100644
new mode 100755
index 52dd3383eff5..a33b36464848
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -840,12 +840,9 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode)
     ScQueryParam aParam;
     pDBData->GetQueryParam(aParam);
 
-    if (eMode == Normal && mpAutoFilterPopup->isAllSelected())
-    {
-        // Remove this entry.
-        aParam.RemoveEntryByField(rPos.Col());
-    }
-    else
+    // Remove old entries.
+    aParam.RemoveEntryByField(rPos.Col());
+
     {
         // Try to use the existing entry for the column (if one exists).
         ScQueryEntry* pEntry = aParam.FindEntryByField(rPos.Col(), true);
@@ -877,6 +874,19 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode)
                 ScQueryEntry::QueryItemsType& rItems = pEntry->GetQueryItems();
                 rItems.clear();
                 std::for_each(aSelected.begin(), aSelected.end(), AddItemToEntry(rItems, rPool));
+
+                if (mpAutoFilterPopup->isAllSelected())
+                {
+                    // get all strings from the column
+                    std::vector<ScTypedStrData> aAllStrings; // case sensitive
+                    pDoc->GetDataEntries(rPos.Col(), rPos.Row(), rPos.Tab(), aAllStrings, true);
+
+                    if (rItems.size() == aAllStrings.size() || aAllStrings.empty())
+                    {
+                        // all selected => Remove filter entries
+                        aParam.RemoveEntryByField(rPos.Col());
+                    }
+                }
             }
             break;
             case Top10:


More information about the Libreoffice-commits mailing list