sc/inc/queryparam.hxx              |    1 +
 sc/source/core/tool/queryparam.cxx |   17 +++++++++++++++++
 sc/source/ui/view/gridwin.cxx      |    6 +++---
 3 files changed, 21 insertions(+), 3 deletions(-)

New commits:
commit c3d02e94bc315c9736f862b3783d17ca6fc2caab
Author: Szymon Kłos <szymon.k...@collabora.com>
Date:   Sat May 27 19:16:58 2017 +0200

    tdf#107797 select all entries in the dropdown
    
    Change-Id: I3ee33040744eab35f841d3622cb8981b49d04333
    Reviewed-on: https://gerrit.libreoffice.org/38091
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/41034
    Reviewed-by: Aron Budea <aron.bu...@collabora.com>
    Tested-by: Aron Budea <aron.bu...@collabora.com>

diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx
index 68ac18b6f84a..16b4573c9fa6 100644
--- a/sc/inc/queryparam.hxx
+++ b/sc/inc/queryparam.hxx
@@ -57,6 +57,7 @@ struct ScQueryParamBase
     SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n);
     SC_DLLPUBLIC ScQueryEntry& AppendEntry();
     ScQueryEntry* FindEntryByField(SCCOLROW nField, bool bNew);
+    std::vector<ScQueryEntry*> FindAllEntriesByField(SCCOLROW nField);
     SC_DLLPUBLIC void RemoveEntryByField(SCCOLROW nField);
     void Resize(size_t nNew);
     void FillInExcelSyntax( svl::SharedStringPool& rPool, const OUString& 
aCellStr, SCSIZE nIndex,
diff --git a/sc/source/core/tool/queryparam.cxx 
b/sc/source/core/tool/queryparam.cxx
index 5131a31f7e1f..f5630b66b565 100644
--- a/sc/source/core/tool/queryparam.cxx
+++ b/sc/source/core/tool/queryparam.cxx
@@ -143,6 +143,23 @@ ScQueryEntry* ScQueryParamBase::FindEntryByField(SCCOLROW 
nField, bool bNew)
     return &AppendEntry();
 }
 
+std::vector<ScQueryEntry*> ScQueryParamBase::FindAllEntriesByField(SCCOLROW 
nField)
+{
+    std::vector<ScQueryEntry*> aEntries;
+
+    EntriesType::iterator itr = std::find_if(
+        m_Entries.begin(), m_Entries.end(), FindByField(nField));
+
+    while (itr != m_Entries.end())
+    {
+        aEntries.push_back((*itr).get());
+        itr = std::find_if(
+            itr + 1, m_Entries.end(), FindByField(nField));
+    }
+
+    return aEntries;
+}
+
 void ScQueryParamBase::RemoveEntryByField(SCCOLROW nField)
 {
     EntriesType::iterator itr = std::find_if(
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 630400b94c5b..d2a1223e86ce 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -702,11 +702,11 @@ void ScGridWindow::LaunchAutoFilterMenu(SCCOL nCol, SCROW 
nRow)
 
     ScQueryParam aParam;
     pDBData->GetQueryParam(aParam);
-    ScQueryEntry* pEntry = aParam.FindEntryByField(nCol, false);
+    std::vector<ScQueryEntry*> aEntries = aParam.FindAllEntriesByField(nCol);
     std::unordered_set<OUString, OUStringHash> aSelected;
-    if (pEntry && pEntry->bDoQuery)
+    for (ScQueryEntry* pEntry : aEntries)
     {
-        if (pEntry->eOp == SC_EQUAL)
+        if (pEntry && pEntry->bDoQuery && pEntry->eOp == SC_EQUAL)
         {
             ScQueryEntry::QueryItemsType& rItems = pEntry->GetQueryItems();
             std::for_each(rItems.begin(), rItems.end(), 
AddSelectedItemString(aSelected));
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to