tdf#158131 - UI: Part 27 - Unify lockdown behavior of Options dialog
for Writer - Table Page.
Change-Id: Ic2fbec7dd5520a48bb1b6bf85a2277268cf36611
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159405
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 6688ae7..7b37e90 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1259,19 +1259,31 @@ SwTableOptionsTabPage::SwTableOptionsTabPage(weld::Container* pPage, weld::Dialo
, m_pWrtShell(nullptr)
, m_bHTMLMode(false)
, m_xHeaderCB(m_xBuilder->weld_check_button("header"))
, m_xHeaderImg(m_xBuilder->weld_widget("lockheader"))
, m_xRepeatHeaderCB(m_xBuilder->weld_check_button("repeatheader"))
, m_xRepeatHeaderImg(m_xBuilder->weld_widget("lockrepeatheader"))
, m_xDontSplitCB(m_xBuilder->weld_check_button("dontsplit"))
, m_xDontSplitImg(m_xBuilder->weld_widget("lockdontsplit"))
, m_xBorderCB(m_xBuilder->weld_check_button("border"))
, m_xBorderImg(m_xBuilder->weld_widget("lockborder"))
, m_xNumFormattingCB(m_xBuilder->weld_check_button("numformatting"))
, m_xNumFormattingImg(m_xBuilder->weld_widget("locknumformatting"))
, m_xNumFormatFormattingCB(m_xBuilder->weld_check_button("numfmtformatting"))
, m_xNumFormatFormattingImg(m_xBuilder->weld_widget("locknumfmtformatting"))
, m_xNumAlignmentCB(m_xBuilder->weld_check_button("numalignment"))
, m_xNumAlignmentImg(m_xBuilder->weld_widget("locknumalignment"))
, m_xRowMoveMF(m_xBuilder->weld_metric_spin_button("rowmove", FieldUnit::CM))
, m_xRowMoveImg(m_xBuilder->weld_widget("lockrowmove"))
, m_xColMoveMF(m_xBuilder->weld_metric_spin_button("colmove", FieldUnit::CM))
, m_xColMoveImg(m_xBuilder->weld_widget("lockcolmove"))
, m_xRowInsertMF(m_xBuilder->weld_metric_spin_button("rowinsert", FieldUnit::CM))
, m_xRowInsertImg(m_xBuilder->weld_widget("lockrowinsert"))
, m_xColInsertMF(m_xBuilder->weld_metric_spin_button("colinsert", FieldUnit::CM))
, m_xColInsertImg(m_xBuilder->weld_widget("lockcolinsert"))
, m_xFixRB(m_xBuilder->weld_radio_button("fix"))
, m_xFixPropRB(m_xBuilder->weld_radio_button("fixprop"))
, m_xVarRB(m_xBuilder->weld_radio_button("var"))
, m_xBehaviorOfImg(m_xBuilder->weld_widget("lockbehaviorof"))
{
Link<weld::Toggleable&,void> aLnk(LINK(this, SwTableOptionsTabPage, CheckBoxHdl));
m_xNumFormattingCB->connect_toggled(aLnk);
@@ -1423,9 +1435,20 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* rSet)
}
m_xRowMoveMF->set_value(m_xRowMoveMF->normalize(pModOpt->GetTableHMove()), FieldUnit::TWIP);
m_xRowMoveMF->set_sensitive(!officecfg::Office::Writer::Table::Shift::Row::isReadOnly());
m_xRowMoveImg->set_visible(officecfg::Office::Writer::Table::Shift::Row::isReadOnly());
m_xColMoveMF->set_value(m_xColMoveMF->normalize(pModOpt->GetTableVMove()), FieldUnit::TWIP);
m_xColMoveMF->set_sensitive(!officecfg::Office::Writer::Table::Shift::Column::isReadOnly());
m_xColMoveImg->set_visible(officecfg::Office::Writer::Table::Shift::Column::isReadOnly());
m_xRowInsertMF->set_value(m_xRowInsertMF->normalize(pModOpt->GetTableHInsert()), FieldUnit::TWIP);
m_xRowInsertMF->set_sensitive(!officecfg::Office::Writer::Table::Insert::Row::isReadOnly());
m_xRowInsertImg->set_visible(officecfg::Office::Writer::Table::Insert::Row::isReadOnly());
m_xColInsertMF->set_value(m_xColInsertMF->normalize(pModOpt->GetTableVInsert()), FieldUnit::TWIP);
m_xColInsertMF->set_sensitive(!officecfg::Office::Writer::Table::Insert::Column::isReadOnly());
m_xColInsertImg->set_visible(officecfg::Office::Writer::Table::Insert::Column::isReadOnly());
switch(pModOpt->GetTableMode())
{
@@ -1445,17 +1468,44 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* rSet)
m_xDontSplitCB->hide();
}
if (officecfg::Office::Writer::Table::Change::Effect::isReadOnly())
{
m_xFixRB->set_sensitive(false);
m_xFixPropRB->set_sensitive(false);
m_xVarRB->set_sensitive(false);
m_xBehaviorOfImg->set_visible(true);
}
SwInsertTableOptions aInsOpts = pModOpt->GetInsTableFlags(m_bHTMLMode);
const SwInsertTableFlags nInsTableFlags = aInsOpts.mnInsMode;
m_xHeaderCB->set_active(bool(nInsTableFlags & SwInsertTableFlags::Headline));
m_xHeaderCB->set_sensitive(!officecfg::Office::Writer::Insert::Table::Header::isReadOnly());
m_xHeaderImg->set_visible(officecfg::Office::Writer::Insert::Table::Header::isReadOnly());
m_xRepeatHeaderCB->set_active((!m_bHTMLMode) && (aInsOpts.mnRowsToRepeat > 0));
m_xRepeatHeaderCB->set_sensitive(!officecfg::Office::Writer::Insert::Table::RepeatHeader::isReadOnly());
m_xRepeatHeaderImg->set_visible(officecfg::Office::Writer::Insert::Table::RepeatHeader::isReadOnly());
m_xDontSplitCB->set_active(!(nInsTableFlags & SwInsertTableFlags::SplitLayout));
m_xDontSplitCB->set_sensitive(!officecfg::Office::Writer::Insert::Table::Split::isReadOnly());
m_xDontSplitImg->set_visible(officecfg::Office::Writer::Insert::Table::Split::isReadOnly());
m_xBorderCB->set_active(bool(nInsTableFlags & SwInsertTableFlags::DefaultBorder));
m_xBorderCB->set_sensitive(!officecfg::Office::Writer::Insert::Table::Border::isReadOnly());
m_xBorderImg->set_visible(officecfg::Office::Writer::Insert::Table::Border::isReadOnly());
m_xNumFormattingCB->set_active(pModOpt->IsInsTableFormatNum(m_bHTMLMode));
m_xNumFormattingCB->set_sensitive(!officecfg::Office::Writer::Table::Input::NumberRecognition::isReadOnly());
m_xNumFormattingImg->set_visible(officecfg::Office::Writer::Table::Input::NumberRecognition::isReadOnly());
m_xNumFormatFormattingCB->set_active(pModOpt->IsInsTableChangeNumFormat(m_bHTMLMode));
m_xNumFormatFormattingCB->set_sensitive(!officecfg::Office::Writer::Table::Input::NumberFormatRecognition::isReadOnly());
m_xNumFormatFormattingImg->set_visible(officecfg::Office::Writer::Table::Input::NumberFormatRecognition::isReadOnly());
m_xNumAlignmentCB->set_active(pModOpt->IsInsTableAlignNum(m_bHTMLMode));
m_xNumAlignmentCB->set_sensitive(!officecfg::Office::Writer::Table::Input::Alignment::isReadOnly());
m_xNumAlignmentImg->set_visible(officecfg::Office::Writer::Table::Input::Alignment::isReadOnly());
m_xHeaderCB->save_state();
m_xRepeatHeaderCB->save_state();
@@ -1474,9 +1524,12 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* rSet)
IMPL_LINK_NOARG(SwTableOptionsTabPage, CheckBoxHdl, weld::Toggleable&, void)
{
m_xNumFormatFormattingCB->set_sensitive(m_xNumFormattingCB->get_active());
m_xNumAlignmentCB->set_sensitive(m_xNumFormattingCB->get_active());
m_xRepeatHeaderCB->set_sensitive(m_xHeaderCB->get_active());
m_xNumFormatFormattingCB->set_sensitive(m_xNumFormattingCB->get_active() &&
!officecfg::Office::Writer::Table::Input::NumberFormatRecognition::isReadOnly());
m_xNumAlignmentCB->set_sensitive(m_xNumFormattingCB->get_active() &&
!officecfg::Office::Writer::Table::Input::Alignment::isReadOnly());
m_xRepeatHeaderCB->set_sensitive(m_xHeaderCB->get_active() &&
!officecfg::Office::Writer::Insert::Table::RepeatHeader::isReadOnly());
}
void SwTableOptionsTabPage::PageCreated( const SfxAllItemSet& aSet)
diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx
index dd8bd93..6020b98 100644
--- a/sw/source/uibase/inc/optpage.hxx
+++ b/sw/source/uibase/inc/optpage.hxx
@@ -226,23 +226,35 @@ class SwTableOptionsTabPage final : public SfxTabPage
bool m_bHTMLMode;
std::unique_ptr<weld::CheckButton> m_xHeaderCB;
std::unique_ptr<weld::Widget> m_xHeaderImg;
std::unique_ptr<weld::CheckButton> m_xRepeatHeaderCB;
std::unique_ptr<weld::Widget> m_xRepeatHeaderImg;
std::unique_ptr<weld::CheckButton> m_xDontSplitCB;
std::unique_ptr<weld::Widget> m_xDontSplitImg;
std::unique_ptr<weld::CheckButton> m_xBorderCB;
std::unique_ptr<weld::Widget> m_xBorderImg;
std::unique_ptr<weld::CheckButton> m_xNumFormattingCB;
std::unique_ptr<weld::Widget> m_xNumFormattingImg;
std::unique_ptr<weld::CheckButton> m_xNumFormatFormattingCB;
std::unique_ptr<weld::Widget> m_xNumFormatFormattingImg;
std::unique_ptr<weld::CheckButton> m_xNumAlignmentCB;
std::unique_ptr<weld::Widget> m_xNumAlignmentImg;
std::unique_ptr<weld::MetricSpinButton> m_xRowMoveMF;
std::unique_ptr<weld::Widget> m_xRowMoveImg;
std::unique_ptr<weld::MetricSpinButton> m_xColMoveMF;
std::unique_ptr<weld::Widget> m_xColMoveImg;
std::unique_ptr<weld::MetricSpinButton> m_xRowInsertMF;
std::unique_ptr<weld::Widget> m_xRowInsertImg;
std::unique_ptr<weld::MetricSpinButton> m_xColInsertMF;
std::unique_ptr<weld::Widget> m_xColInsertImg;
std::unique_ptr<weld::RadioButton> m_xFixRB;
std::unique_ptr<weld::RadioButton> m_xFixPropRB;
std::unique_ptr<weld::RadioButton> m_xVarRB;
std::unique_ptr<weld::Widget> m_xBehaviorOfImg;
DECL_LINK(CheckBoxHdl, weld::Toggleable&, void);
diff --git a/sw/uiconfig/swriter/ui/opttablepage.ui b/sw/uiconfig/swriter/ui/opttablepage.ui
index b87c655..809f630 100644
--- a/sw/uiconfig/swriter/ui/opttablepage.ui
+++ b/sw/uiconfig/swriter/ui/opttablepage.ui
@@ -46,7 +46,7 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=4 -->
<!-- n-columns=2 n-rows=4 -->
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -70,7 +70,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -90,7 +90,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -109,7 +109,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
@@ -128,6 +128,58 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockheader">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockrepeatheader">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockdontsplit">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockborder">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">3</property>
</packing>
@@ -159,7 +211,7 @@
<property name="label-xalign">0</property>
<property name="shadow-type">none</property>
<child>
<!-- n-columns=1 n-rows=3 -->
<!-- n-columns=2 n-rows=3 -->
<object class="GtkGrid" id="grid2">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -183,7 +235,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
@@ -203,7 +255,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -223,6 +275,45 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="locknumformatting">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="locknumfmtformatting">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="locknumalignment">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
@@ -273,7 +364,7 @@
<property name="row-spacing">12</property>
<property name="column-spacing">12</property>
<child>
<!-- n-columns=2 n-rows=4 -->
<!-- n-columns=3 n-rows=4 -->
<object class="GtkGrid" id="grid5">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -287,7 +378,7 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="width">2</property>
</packing>
@@ -309,7 +400,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -330,7 +421,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
@@ -351,7 +442,7 @@
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">3</property>
</packing>
</child>
@@ -367,11 +458,11 @@
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
<attributes>
<attribute name="scale" value="0.9"/>
<attribute name="scale" value="0.90000000000000002"/>
</attributes>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -386,11 +477,11 @@
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
<attributes>
<attribute name="scale" value="0.9"/>
<attribute name="scale" value="0.90000000000000002"/>
</attributes>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
@@ -405,14 +496,36 @@
<property name="max-width-chars">50</property>
<property name="xalign">0</property>
<attributes>
<attribute name="scale" value="0.9"/>
<attribute name="scale" value="0.90000000000000002"/>
</attributes>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockbehaviorof">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left-attach">0</property>
@@ -427,7 +540,7 @@
<property name="spacing">12</property>
<property name="homogeneous">True</property>
<child>
<!-- n-columns=2 n-rows=3 -->
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="grid4">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -444,7 +557,7 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="width">2</property>
</packing>
@@ -464,7 +577,7 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -483,7 +596,7 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
@@ -498,7 +611,7 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -513,10 +626,39 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockrowmove">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockcolmove">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
@@ -525,7 +667,7 @@
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=3 -->
<!-- n-columns=3 n-rows=3 -->
<object class="GtkGrid" id="grid6">
<property name="visible">True</property>
<property name="can-focus">False</property>
@@ -549,7 +691,7 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -568,7 +710,7 @@
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
@@ -583,7 +725,7 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">1</property>
</packing>
</child>
@@ -598,7 +740,7 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
@@ -610,11 +752,40 @@
<property name="xalign">0</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockrowinsert">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkImage" id="lockcolinsert">
<property name="can-focus">False</property>
<property name="no-show-all">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="icon-name">res/lock.png</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>