[Libreoffice-commits] core.git: sc/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 15 18:20:49 UTC 2018


 sc/source/ui/condformat/condformatmgr.cxx |   12 ++++++++++++
 sc/source/ui/inc/condformatmgr.hxx        |    1 +
 2 files changed, 13 insertions(+)

New commits:
commit 401d1691468fb11281b4eaa290193b4e8ff871c3
Author:     Abhyudaya Sharma <sharmaabhyudaya at gmail.com>
AuthorDate: Sat Oct 6 21:27:48 2018 +0530
Commit:     Eike Rathke <erack at redhat.com>
CommitDate: Mon Oct 15 20:20:25 2018 +0200

    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 at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

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);


More information about the Libreoffice-commits mailing list