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

New commits:
commit fcef464fe83aef0183d6c7f849725649de2da70d
Author: Serge Krot <serge.k...@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 <c...@libreoffice.org>
    Reviewed-by: Katarina Behrens <katarina.behr...@cib.de>
    
    Conflicts:
            sc/source/ui/view/gridwin.cxx
    
    Change-Id: I5cbd515753ad606f55cedaa7023ffe88671f4702
    Reviewed-on: https://gerrit.libreoffice.org/55720
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Tested-by: Thorsten Behrens <thorsten.behr...@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:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to