Data Validity: Disable controls depending on checkbox state

Change-Id: I48454f5ca0bc418c471768e672a6ad67027d68a4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195281
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Tested-by: Jenkins
This commit is contained in:
Heiko Tietze
2025-12-09 14:40:36 +01:00
committed by Heiko Tietze
parent bd84bd35e9
commit 5e022dcb5c
3 changed files with 126 additions and 129 deletions
+14
View File
@@ -780,6 +780,8 @@ ScTPValidationError::ScTPValidationError(weld::Container* pPage, weld::DialogCon
, m_xBtnSearch(m_xBuilder->weld_button(u"browseBtn"_ustr))
, m_xEdtTitle(m_xBuilder->weld_entry(u"erroralert_title"_ustr))
, m_xFtError(m_xBuilder->weld_label(u"errormsg_label"_ustr))
, m_xFtTitle(m_xBuilder->weld_label(u"title_label"_ustr))
, m_xFtAction(m_xBuilder->weld_label(u"action_label"_ustr))
, m_xEdError(m_xBuilder->weld_text_view(u"errorMsg"_ustr))
{
m_xEdError->set_size_request(m_xEdError->get_approximate_digit_width() * 40, m_xEdError->get_height_rows(12));
@@ -792,6 +794,7 @@ ScTPValidationError::~ScTPValidationError()
void ScTPValidationError::Init()
{
m_xTsbShow->connect_toggled(LINK(this, ScTPValidationError, ToggleErrorMessage));
m_xLbAction->connect_changed(LINK(this, ScTPValidationError, SelectActionHdl));
m_xBtnSearch->connect_clicked(LINK( this, ScTPValidationError, ClickSearchHdl));
@@ -841,6 +844,17 @@ bool ScTPValidationError::FillItemSet( SfxItemSet* rArgSet )
return true;
}
IMPL_LINK_NOARG(ScTPValidationError, ToggleErrorMessage, weld::Toggleable&, void)
{
bool const bEnable(m_xTsbShow->get_active());
m_xLbAction->set_sensitive(bEnable);
m_xEdtTitle->set_sensitive(bEnable);
m_xEdError->set_sensitive(bEnable);
m_xFtError->set_sensitive(bEnable);
m_xFtTitle->set_sensitive(bEnable);
m_xFtAction->set_sensitive(bEnable);
}
IMPL_LINK_NOARG(ScTPValidationError, SelectActionHdl, weld::ComboBox&, void)
{
ScValidErrorStyle eStyle = static_cast<ScValidErrorStyle>(m_xLbAction->get_active());
+3
View File
@@ -260,11 +260,14 @@ private:
std::unique_ptr<weld::Button> m_xBtnSearch;
std::unique_ptr<weld::Entry> m_xEdtTitle;
std::unique_ptr<weld::Label> m_xFtError;
std::unique_ptr<weld::Label> m_xFtTitle;
std::unique_ptr<weld::Label> m_xFtAction;
std::unique_ptr<weld::TextView> m_xEdError;
void Init();
// Handler ------------------------
DECL_LINK(ToggleErrorMessage, weld::Toggleable&, void);
DECL_LINK(SelectActionHdl, weld::ComboBox&, void);
DECL_LINK(ClickSearchHdl, weld::Button&, void);
+109 -129
View File
@@ -33,157 +33,137 @@
</packing>
</child>
<child>
<object class="GtkFrame" id="frame1">
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">24</property>
<property name="margin-top">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
<child>
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="grid1">
<object class="GtkLabel" id="action_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">12</property>
<property name="margin-top">6</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes" context="erroralerttabpage|action_label">_Action:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">actionCB</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="title_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="erroralerttabpage|title_label">_Title:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">erroralert_title</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="vexpand">True</property>
<property name="row-spacing">6</property>
<property name="column-spacing">12</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkLabel" id="action_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="erroralerttabpage|action_label">_Action:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">actionCB</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="title_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="erroralerttabpage|title_label">_Title:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">erroralert_title</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledwindow1">
<object class="GtkTextView" id="errorMsg">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="vexpand">True</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkTextView" id="errorMsg">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="vexpand">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="errorMsg-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="erroralerttabpage|extended_tip|errorMsg">Enter the message that you want to display when invalid data is entered in a cell.</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="erroralert_title">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activates-default">True</property>
<property name="truncate-multiline">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="errormsg_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="erroralerttabpage|errormsg_label">_Error message:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">errorMsg</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browseBtn">
<property name="label" translatable="yes" context="erroralerttabpage|browseBtn">_Browse...</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="browseBtn-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="erroralerttabpage|extended_tip|browseBtn">Opens the Macro dialog where you can select the macro that is executed when invalid data is entered in a cell. The macro is executed after the error message is displayed.</property>
<object class="AtkObject" id="errorMsg-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="erroralerttabpage|extended_tip|errorMsg">Enter the message that you want to display when invalid data is entered in a cell.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="actionCB">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<items>
<item translatable="yes" context="erroralerttabpage|actionCB">Stop</item>
<item translatable="yes" context="erroralerttabpage|actionCB">Warning</item>
<item translatable="yes" context="erroralerttabpage|actionCB">Information</item>
<item translatable="yes" context="erroralerttabpage|actionCB">Macro</item>
</items>
<child internal-child="accessible">
<object class="AtkObject" id="actionCB-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="erroralerttabpage|extended_tip|actionCB">Select the action that you want to occur when invalid data is entered in a cell.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child type="label">
<object class="GtkLabel" id="label1">
<child>
<object class="GtkEntry" id="erroralert_title">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activates-default">True</property>
<property name="truncate-multiline">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="errormsg_label">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes" context="erroralerttabpage|label1">Contents</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
<property name="label" translatable="yes" context="erroralerttabpage|errormsg_label">_Error message:</property>
<property name="use-underline">True</property>
<property name="mnemonic-widget">errorMsg</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="browseBtn">
<property name="label" translatable="yes" context="erroralerttabpage|browseBtn">_Browse...</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="use-underline">True</property>
<child internal-child="accessible">
<object class="AtkObject" id="browseBtn-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="erroralerttabpage|extended_tip|browseBtn">Opens the Macro dialog where you can select the macro that is executed when invalid data is entered in a cell. The macro is executed after the error message is displayed.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="actionCB">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="hexpand">True</property>
<items>
<item translatable="yes" context="erroralerttabpage|actionCB">Stop</item>
<item translatable="yes" context="erroralerttabpage|actionCB">Warning</item>
<item translatable="yes" context="erroralerttabpage|actionCB">Information</item>
<item translatable="yes" context="erroralerttabpage|actionCB">Macro</item>
</items>
<child internal-child="accessible">
<object class="AtkObject" id="actionCB-atkobject">
<property name="AtkObject::accessible-description" translatable="yes" context="erroralerttabpage|extended_tip|actionCB">Select the action that you want to occur when invalid data is entered in a cell.</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
</object>
<packing>