summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSzymon Kłos <szymon.klos@collabora.com>2017-05-27 19:16:58 +0200
committerAron Budea <aron.budea@collabora.com>2017-08-15 14:17:42 +0200
commitc3d02e94bc315c9736f862b3783d17ca6fc2caab (patch)
treebe588fb1260bbbfbc72020e803825322c82b4c53 /sc
parentbbe5291ace311b9f0f311dbda7c19b82708ee227 (diff)
tdf#107797 select all entries in the dropdown
Change-Id: I3ee33040744eab35f841d3622cb8981b49d04333 Reviewed-on: https://gerrit.libreoffice.org/38091 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Szymon Kłos <szymon.klos@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/41034 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Aron Budea <aron.budea@collabora.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/queryparam.hxx1
-rw-r--r--sc/source/core/tool/queryparam.cxx17
-rw-r--r--sc/source/ui/view/gridwin.cxx6
3 files changed, 21 insertions, 3 deletions
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));