From 7352c717a307c46f0f1825375597fbe44b816ba5 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 13 Dec 2011 22:01:36 -0500 Subject: fdo#35981: Handle empty members correctly during field popup. Or else filtering of field members will not work correctly when the field contains an empty name. --- sc/source/ui/view/gridwin2.cxx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx index f2b10cf57ed8..7f2ce839e6e8 100644 --- a/sc/source/ui/view/gridwin2.cxx +++ b/sc/source/ui/view/gridwin2.cxx @@ -480,7 +480,12 @@ void ScGridWindow::DPLaunchFieldPopupMenu( for (size_t i = 0; i < n; ++i) { const ScDPLabelData::Member& rMem = rLabelData.maMembers[i]; - mpDPFieldPopup->addMember(rMem.getDisplayName(), rMem.mbVisible); + rtl::OUString aName = rMem.getDisplayName(); + if (aName.isEmpty()) + // Use special string for an empty name. + mpDPFieldPopup->addMember(ScGlobal::GetRscString(STR_EMPTYDATA), rMem.mbVisible); + else + mpDPFieldPopup->addMember(rMem.getDisplayName(), rMem.mbVisible); } mpDPFieldPopup->initMembers(); } @@ -581,9 +586,14 @@ void ScGridWindow::UpdateDPFromFieldPopupMenu() if (itrNameMap == aMemNameMap.end()) { // This is an original member name. Use it as-is. + rtl::OUString aName = itr->first; + if (aName.equals(ScGlobal::GetRscString(STR_EMPTYDATA))) + // Translate the special empty name into an empty string. + aName = rtl::OUString(); + aResult.insert( ScCheckListMenuWindow::ResultType::value_type( - itr->first, itr->second)); + aName, itr->second)); } else { -- cgit