summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorAbhyudaya Sharma <sharmaabhyudaya@gmail.com>2018-10-06 21:27:48 +0530
committerEike Rathke <erack@redhat.com>2018-10-15 20:20:25 +0200
commit401d1691468fb11281b4eaa290193b4e8ff871c3 (patch)
tree7e6d81f60b6cdc8b63ef9687ae410cfbe2ec89d1 /sc/source
parentc85186441be27df0c843629c934a71f5935ba40c (diff)
tdf#120087 Disable unuseable items in Manage Dialog
Fix behaviour for 'Remove' and 'Edit' buttons for the Manage Conditional Formatting dialog in Calc Change-Id: Id8fc37262464232ab8fbb76c5a9609af5982e222 Reviewed-on: https://gerrit.libreoffice.org/61475 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/condformat/condformatmgr.cxx12
-rw-r--r--sc/source/ui/inc/condformatmgr.hxx1
2 files changed, 13 insertions, 0 deletions
diff --git a/sc/source/ui/condformat/condformatmgr.cxx b/sc/source/ui/condformat/condformatmgr.cxx
index 45d169b0e22e..1ee0eb440fa7 100644
--- a/sc/source/ui/condformat/condformatmgr.cxx
+++ b/sc/source/ui/condformat/condformatmgr.cxx
@@ -119,6 +119,8 @@ ScCondFormatManagerDlg::ScCondFormatManagerDlg(vcl::Window* pParent, ScDocument*
m_pBtnEdit->SetClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnClickHdl));
m_pBtnAdd->SetClickHdl(LINK(this, ScCondFormatManagerDlg, AddBtnHdl));
m_pCtrlManager->SetDoubleClickHdl(LINK(this, ScCondFormatManagerDlg, EditBtnHdl));
+
+ UpdateButtonSensitivity();
}
ScCondFormatManagerDlg::~ScCondFormatManagerDlg()
@@ -142,6 +144,13 @@ std::unique_ptr<ScConditionalFormatList> ScCondFormatManagerDlg::GetConditionalF
return std::move(mpFormatList);
}
+void ScCondFormatManagerDlg::UpdateButtonSensitivity()
+{
+ OUString aNewSensitivity = mpFormatList->size() ? OUString("true") : OUString("false");
+ m_pBtnRemove->set_property("sensitive", aNewSensitivity);
+ m_pBtnEdit->set_property("sensitive", aNewSensitivity);
+}
+
// Get the current conditional format selected.
//
ScConditionalFormat* ScCondFormatManagerDlg::GetCondFormatSelected()
@@ -153,12 +162,14 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, RemoveBtnHdl, Button*, void)
{
m_pCtrlManager->DeleteSelection();
mbModified = true;
+ UpdateButtonSensitivity();
}
IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnClickHdl, Button*, void)
{
mbModified = true;
EditBtnHdl(nullptr);
+ UpdateButtonSensitivity();
}
IMPL_LINK_NOARG(ScCondFormatManagerDlg, EditBtnHdl, SvTreeListBox*, bool)
{
@@ -182,6 +193,7 @@ IMPL_LINK_NOARG(ScCondFormatManagerDlg, AddBtnHdl, Button*, void)
void ScCondFormatManagerDlg::SetModified()
{
mbModified = true;
+ UpdateButtonSensitivity();
}
bool ScCondFormatManagerDlg::CondFormatsChanged() const
diff --git a/sc/source/ui/inc/condformatmgr.hxx b/sc/source/ui/inc/condformatmgr.hxx
index fec437fd6fa1..58b8b605228c 100644
--- a/sc/source/ui/inc/condformatmgr.hxx
+++ b/sc/source/ui/inc/condformatmgr.hxx
@@ -64,6 +64,7 @@ private:
VclPtr<PushButton> m_pBtnEdit;
std::unique_ptr<ScConditionalFormatList> mpFormatList;
VclPtr<ScCondFormatManagerWindow> m_pCtrlManager;
+ void UpdateButtonSensitivity();
DECL_LINK(RemoveBtnHdl, Button*, void);
DECL_LINK(EditBtnClickHdl, Button*, void);