diff options
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/ui/cctrl/checklistmenu.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/inc/checklistmenu.hxx | 13 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin.cxx | 24 | ||||
-rw-r--r-- | sc/source/ui/view/gridwin2.cxx | 14 |
4 files changed, 35 insertions, 26 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index ce637818191c..dba72366b4aa 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -1916,12 +1916,14 @@ void ScCheckListMenuWindow::getResult(ResultType& rResult) if (aLabel.isEmpty()) aLabel = ScGlobal::GetRscString(STR_EMPTYDATA); bool bState = maChecks->IsChecked( aLabel, maMembers[i].mpParent ); - OUString sName; + ResultEntry aResultEntry; + aResultEntry.bValid = bState; if ( maMembers[i].mbDate ) - sName = maMembers[i].maRealName; + aResultEntry.aName = maMembers[i].maRealName; else - sName = maMembers[i].maName; - aResult.insert(ResultType::value_type(sName, bState)); + aResultEntry.aName = maMembers[i].maName; + aResultEntry.bDate = maMembers[i].mbDate; + aResult.insert(aResultEntry); } } rResult.swap(aResult); diff --git a/sc/source/ui/inc/checklistmenu.hxx b/sc/source/ui/inc/checklistmenu.hxx index f2e208ad4f6b..1864415b6aaa 100644 --- a/sc/source/ui/inc/checklistmenu.hxx +++ b/sc/source/ui/inc/checklistmenu.hxx @@ -292,7 +292,18 @@ struct ScCheckListMember class ScCheckListMenuWindow : public ScMenuFloatingWindow { public: - typedef std::unordered_map<OUString, bool, OUStringHash> ResultType; + struct ResultEntry + { + OUString aName; + bool bValid; + bool bDate; + + bool operator<(const ResultEntry& rhs) const + { + return aName < rhs.aName; + } + }; + typedef std::set<ResultEntry> ResultType; /** * Extended data that the client code may need to store. Create a diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index bfbae1242a84..c590bc336b0d 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -590,13 +590,16 @@ class AddItemToEntry : public std::unary_function<OUString, void> public: AddItemToEntry(ScQueryEntry::QueryItemsType& rItems, svl::SharedStringPool& rPool) : mrItems(rItems), mrPool(rPool) {} - void operator() (const OUString& rSelected) + void operator() (const ScCheckListMenuWindow::ResultEntry& rEntry) { - ScQueryEntry::Item aNew; - aNew.maString = mrPool.intern(rSelected); - aNew.meType = ScQueryEntry::ByString; - aNew.mfVal = 0.0; - mrItems.push_back(aNew); + if (rEntry.bValid) + { + ScQueryEntry::Item aNew; + aNew.maString = mrPool.intern(rEntry.aName); + aNew.meType = rEntry.bDate ? ScQueryEntry::ByDate : ScQueryEntry::ByString; + aNew.mfVal = 0.0; + mrItems.push_back(aNew); + } } }; @@ -800,17 +803,10 @@ void ScGridWindow::UpdateAutoFilterFromMenu(AutoFilterMode eMode) ScCheckListMenuWindow::ResultType aResult; mpAutoFilterPopup->getResult(aResult); - std::vector<OUString> aSelected; - ScCheckListMenuWindow::ResultType::const_iterator itr = aResult.begin(), itrEnd = aResult.end(); - for (; itr != itrEnd; ++itr) - { - if (itr->second) - aSelected.push_back(itr->first); - } ScQueryEntry::QueryItemsType& rItems = pEntry->GetQueryItems(); rItems.clear(); - std::for_each(aSelected.begin(), aSelected.end(), AddItemToEntry(rItems, rPool)); + std::for_each(aResult.begin(), aResult.end(), AddItemToEntry(rItems, rPool)); } break; case Top10: diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index 1cdef6e1b205..59d70bdb2164 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -568,29 +568,29 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu() ScCheckListMenuWindow::ResultType aRawResult; mpDPFieldPopup->getResult(aRawResult); - ScCheckListMenuWindow::ResultType aResult; + std::unordered_map<OUString, bool, OUStringHash> aResult; ScCheckListMenuWindow::ResultType::const_iterator itr = aRawResult.begin(), itrEnd = aRawResult.end(); for (; itr != itrEnd; ++itr) { - MemNameMapType::const_iterator itrNameMap = aMemNameMap.find(itr->first); + MemNameMapType::const_iterator itrNameMap = aMemNameMap.find(itr->aName); if (itrNameMap == aMemNameMap.end()) { // This is an original member name. Use it as-is. - OUString aName = itr->first; + OUString aName = itr->aName; if (aName.equals(ScGlobal::GetRscString(STR_EMPTYDATA))) // Translate the special empty name into an empty string. aName.clear(); aResult.insert( - ScCheckListMenuWindow::ResultType::value_type( - aName, itr->second)); + std::unordered_map<OUString, bool, OUStringHash>::value_type( + aName, itr->bValid)); } else { // This is a layout name. Get the original member name and use it. aResult.insert( - ScCheckListMenuWindow::ResultType::value_type( - itrNameMap->second, itr->second)); + std::unordered_map<OUString, bool, OUStringHash>::value_type( + itrNameMap->second, itr->bValid)); } } pDim->UpdateMemberVisibility(aResult); |