summaryrefslogtreecommitdiff
path: root/sc/source/ui/cctrl
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@suse.com>2011-11-18 16:56:10 -0500
committerKohei Yoshida <kohei.yoshida@suse.com>2011-11-18 16:59:43 -0500
commit898c527481059017c8f75ba51bfc80b297f0480d (patch)
treee42cb7b792c9832e1848d963a512cb9f52e47a4d /sc/source/ui/cctrl
parentb352f5357c95cf37ffa1debb1ffe62b84c223509 (diff)
Disable the OK button when no items are selected.
When filtering by equality, we need to have at least one value to compare to, or else bad things may happen. The pivot table OTOH can handle empty set. So over there, it's okay to allow no items to be selected.
Diffstat (limited to 'sc/source/ui/cctrl')
-rw-r--r--sc/source/ui/cctrl/checklistmenu.cxx20
1 files changed, 19 insertions, 1 deletions
diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx
index 3835ab96cebd..e96e6d410b2b 100644
--- a/sc/source/ui/cctrl/checklistmenu.cxx
+++ b/sc/source/ui/cctrl/checklistmenu.cxx
@@ -747,6 +747,11 @@ void ScMenuFloatingWindow::terminateAllPopupMenus()
// ============================================================================
+ScCheckListMenuWindow::Config::Config() :
+ mbAllowEmptySet(true)
+{
+}
+
ScCheckListMenuWindow::Member::Member() :
mbVisible(true)
{
@@ -958,7 +963,11 @@ void ScCheckListMenuWindow::setAllMemberState(bool bSet)
{
size_t n = maMembers.size();
for (size_t i = 0; i < n; ++i)
- maChecks.CheckEntryPos(static_cast< sal_uInt16 >( i ), bSet);
+ maChecks.CheckEntryPos(static_cast<sal_uInt16>(i), bSet);
+
+ if (!maConfig.mbAllowEmptySet)
+ // We need to have at least one member selected.
+ maBtnOk.Enable(maChecks.GetCheckedEntryCount() != 0);
}
void ScCheckListMenuWindow::selectCurrentMemberOnly(bool bSet)
@@ -1047,6 +1056,10 @@ IMPL_LINK( ScCheckListMenuWindow, CheckHdl, SvTreeListBox*, pChecks )
else
maChkToggleAll.SetState(STATE_DONTKNOW);
+ if (!maConfig.mbAllowEmptySet)
+ // We need to have at least one member selected.
+ maBtnOk.Enable(nNumChecked != 0);
+
mePrevToggleAllState = maChkToggleAll.GetState();
return 0;
}
@@ -1177,6 +1190,11 @@ void ScCheckListMenuWindow::initMembers()
}
}
+void ScCheckListMenuWindow::setConfig(const Config& rConfig)
+{
+ maConfig = rConfig;
+}
+
const Size& ScCheckListMenuWindow::getWindowSize() const
{
return maWndSize;