tdf#158133 - UI: Part 28 - Unify lockdown behavior of Options dialog

for Writer - Changes Page.

Change-Id: I1cb26c6387c9483b6c99fa800a7d7c0529456cd4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159414
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 7b37e90..add7bed 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1972,23 +1972,31 @@ SwRedlineOptionsTabPage::SwRedlineOptionsTabPage(weld::Container* pPage, weld::D
                                                 const SfxItemSet& rSet)
    : SfxTabPage(pPage, pController, "modules/swriter/ui/optredlinepage.ui", "OptRedLinePage", &rSet)
    , m_xInsertLB(m_xBuilder->weld_combo_box("insert"))
    , m_xInsertImg(m_xBuilder->weld_widget("lockinsert"))
    , m_xInsertColorLB(new ColorListBox(m_xBuilder->weld_menu_button("insertcolor"),
                [this]{ return GetDialogController()->getDialog(); }))
    , m_xInsertColorImg(m_xBuilder->weld_widget("lockinsertcolor"))
    , m_xInsertedPreviewWN(new SvxFontPrevWindow)
    , m_xInsertedPreview(new weld::CustomWeld(*m_xBuilder, "insertedpreview", *m_xInsertedPreviewWN))
    , m_xDeletedLB(m_xBuilder->weld_combo_box("deleted"))
    , m_xDeletedImg(m_xBuilder->weld_widget("lockdeleted"))
    , m_xDeletedColorLB(new ColorListBox(m_xBuilder->weld_menu_button("deletedcolor"),
                [this]{ return GetDialogController()->getDialog(); }))
    , m_xDeletedColorImg(m_xBuilder->weld_widget("lockdeletedcolor"))
    , m_xDeletedPreviewWN(new SvxFontPrevWindow)
    , m_xDeletedPreview(new weld::CustomWeld(*m_xBuilder, "deletedpreview", *m_xDeletedPreviewWN))
    , m_xChangedLB(m_xBuilder->weld_combo_box("changed"))
    , m_xChangedImg(m_xBuilder->weld_widget("lockchanged"))
    , m_xChangedColorLB(new ColorListBox(m_xBuilder->weld_menu_button("changedcolor"),
                [this]{ return GetDialogController()->getDialog(); }))
    , m_xChangedColorImg(m_xBuilder->weld_widget("lockchangedcolor"))
    , m_xChangedPreviewWN(new SvxFontPrevWindow)
    , m_xChangedPreview(new weld::CustomWeld(*m_xBuilder, "changedpreview", *m_xChangedPreviewWN))
    , m_xMarkPosLB(m_xBuilder->weld_combo_box("markpos"))
    , m_xMarkPosImg(m_xBuilder->weld_widget("lockmarkpos"))
    , m_xMarkColorLB(new ColorListBox(m_xBuilder->weld_menu_button("markcolor"),
                [this]{ return GetDialogController()->getDialog(); }))
    , m_xMarkColorImg(m_xBuilder->weld_widget("lockmarkcolor"))
    , m_xMarkPreviewWN(new SwMarkPreview)
    , m_xMarkPreview(new weld::CustomWeld(*m_xBuilder, "markpreview", *m_xMarkPreviewWN))
{
@@ -2161,18 +2169,32 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet*  )

    Color nColor = rInsertAttr.m_nColor;
    m_xInsertColorLB->SelectEntry(nColor);
    m_xInsertColorLB->set_sensitive(!officecfg::Office::Writer::Revision::TextDisplay::Insert::Attribute::isReadOnly());
    m_xInsertColorImg->set_visible(officecfg::Office::Writer::Revision::TextDisplay::Insert::Attribute::isReadOnly());

    nColor = rDeletedAttr.m_nColor;
    m_xDeletedColorLB->SelectEntry(nColor);
    m_xDeletedColorLB->set_sensitive(!officecfg::Office::Writer::Revision::TextDisplay::Delete::Attribute::isReadOnly());
    m_xDeletedColorImg->set_visible(officecfg::Office::Writer::Revision::TextDisplay::Delete::Attribute::isReadOnly());

    nColor = rChangedAttr.m_nColor;
    m_xChangedColorLB->SelectEntry(nColor);
    m_xChangedColorLB->set_sensitive(!officecfg::Office::Writer::Revision::TextDisplay::ChangedAttribute::Attribute::isReadOnly());
    m_xChangedColorImg->set_visible(officecfg::Office::Writer::Revision::TextDisplay::ChangedAttribute::Attribute::isReadOnly());

    m_xMarkColorLB->SelectEntry(pOpt->GetMarkAlignColor());
    m_xMarkColorLB->set_sensitive(!officecfg::Office::Writer::Revision::LinesChanged::Color::isReadOnly());
    m_xMarkColorImg->set_visible(officecfg::Office::Writer::Revision::LinesChanged::Color::isReadOnly());

    m_xInsertLB->set_active(0);
    m_xInsertLB->set_sensitive(!officecfg::Office::Writer::Revision::TextDisplay::Insert::Color::isReadOnly());
    m_xInsertImg->set_visible(officecfg::Office::Writer::Revision::TextDisplay::Insert::Color::isReadOnly());
    m_xDeletedLB->set_active(0);
    m_xDeletedLB->set_sensitive(!officecfg::Office::Writer::Revision::TextDisplay::Delete::Color::isReadOnly());
    m_xDeletedImg->set_visible(officecfg::Office::Writer::Revision::TextDisplay::Delete::Color::isReadOnly());
    m_xChangedLB->set_active(0);
    m_xChangedLB->set_sensitive(!officecfg::Office::Writer::Revision::TextDisplay::ChangedAttribute::Color::isReadOnly());
    m_xChangedImg->set_visible(officecfg::Office::Writer::Revision::TextDisplay::ChangedAttribute::Color::isReadOnly());

    lcl_FillRedlineAttrListBox(*m_xInsertLB, rInsertAttr, aInsertAttrMap, SAL_N_ELEMENTS(aInsertAttrMap));
    lcl_FillRedlineAttrListBox(*m_xDeletedLB, rDeletedAttr, aDeletedAttrMap, SAL_N_ELEMENTS(aDeletedAttrMap));
@@ -2188,6 +2210,8 @@ void SwRedlineOptionsTabPage::Reset( const SfxItemSet*  )
        case text::HoriOrientation::INSIDE:   nPos = 4;   break;
    }
    m_xMarkPosLB->set_active(nPos);
    m_xMarkPosLB->set_sensitive(!officecfg::Office::Writer::Revision::LinesChanged::Mark::isReadOnly());
    m_xMarkPosImg->set_visible(officecfg::Office::Writer::Revision::LinesChanged::Mark::isReadOnly());

    // show settings in preview
    AttribHdl(*m_xInsertLB);
diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx
index 6020b98..9027c74 100644
--- a/sw/source/uibase/inc/optpage.hxx
+++ b/sw/source/uibase/inc/optpage.hxx
@@ -363,22 +363,30 @@ public:
class SwRedlineOptionsTabPage final : public SfxTabPage
{
    std::unique_ptr<weld::ComboBox> m_xInsertLB;
    std::unique_ptr<weld::Widget> m_xInsertImg;
    std::unique_ptr<ColorListBox> m_xInsertColorLB;
    std::unique_ptr<weld::Widget> m_xInsertColorImg;
    std::unique_ptr<SvxFontPrevWindow> m_xInsertedPreviewWN;
    std::unique_ptr<weld::CustomWeld> m_xInsertedPreview;

    std::unique_ptr<weld::ComboBox> m_xDeletedLB;
    std::unique_ptr<weld::Widget> m_xDeletedImg;
    std::unique_ptr<ColorListBox> m_xDeletedColorLB;
    std::unique_ptr<weld::Widget> m_xDeletedColorImg;
    std::unique_ptr<SvxFontPrevWindow> m_xDeletedPreviewWN;
    std::unique_ptr<weld::CustomWeld> m_xDeletedPreview;

    std::unique_ptr<weld::ComboBox> m_xChangedLB;
    std::unique_ptr<weld::Widget> m_xChangedImg;
    std::unique_ptr<ColorListBox> m_xChangedColorLB;
    std::unique_ptr<weld::Widget> m_xChangedColorImg;
    std::unique_ptr<SvxFontPrevWindow> m_xChangedPreviewWN;
    std::unique_ptr<weld::CustomWeld> m_xChangedPreview;

    std::unique_ptr<weld::ComboBox> m_xMarkPosLB;
    std::unique_ptr<weld::Widget> m_xMarkPosImg;
    std::unique_ptr<ColorListBox> m_xMarkColorLB;
    std::unique_ptr<weld::Widget> m_xMarkColorImg;
    std::unique_ptr<SwMarkPreview> m_xMarkPreviewWN;
    std::unique_ptr<weld::CustomWeld> m_xMarkPreview;

diff --git a/sw/uiconfig/swriter/ui/optredlinepage.ui b/sw/uiconfig/swriter/ui/optredlinepage.ui
index 255bf2d..f3dff70 100644
--- a/sw/uiconfig/swriter/ui/optredlinepage.ui
+++ b/sw/uiconfig/swriter/ui/optredlinepage.ui
@@ -18,7 +18,7 @@
        <property name="label-xalign">0</property>
        <property name="shadow-type">none</property>
        <child>
          <!-- n-columns=3 n-rows=2 -->
          <!-- n-columns=4 n-rows=2 -->
          <object class="GtkGrid" id="grid3">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
@@ -37,7 +37,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>
              </packing>
            </child>
@@ -51,7 +51,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>
@@ -80,7 +80,7 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="left-attach">2</property>
                <property name="top-attach">0</property>
              </packing>
            </child>
@@ -103,7 +103,7 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="left-attach">2</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
@@ -130,11 +130,37 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">2</property>
                <property name="left-attach">3</property>
                <property name="top-attach">0</property>
                <property name="height">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkImage" id="lockinsert">
                <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="lockinsertcolor">
                <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>
          </object>
        </child>
        <child type="label">
@@ -162,7 +188,7 @@
        <property name="label-xalign">0</property>
        <property name="shadow-type">none</property>
        <child>
          <!-- n-columns=3 n-rows=2 -->
          <!-- n-columns=4 n-rows=2 -->
          <object class="GtkGrid" id="grid4">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
@@ -181,7 +207,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>
              </packing>
            </child>
@@ -195,7 +221,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>
@@ -211,7 +237,7 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="left-attach">2</property>
                <property name="top-attach">0</property>
              </packing>
            </child>
@@ -234,7 +260,7 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="left-attach">2</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
@@ -261,11 +287,37 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">2</property>
                <property name="left-attach">3</property>
                <property name="top-attach">0</property>
                <property name="height">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkImage" id="lockdeleted">
                <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="lockdeletedcolor">
                <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>
          </object>
        </child>
        <child type="label">
@@ -293,7 +345,7 @@
        <property name="label-xalign">0</property>
        <property name="shadow-type">none</property>
        <child>
          <!-- n-columns=3 n-rows=2 -->
          <!-- n-columns=4 n-rows=2 -->
          <object class="GtkGrid" id="grid5">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
@@ -312,7 +364,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>
              </packing>
            </child>
@@ -326,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">1</property>
              </packing>
            </child>
@@ -342,7 +394,7 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="left-attach">2</property>
                <property name="top-attach">0</property>
              </packing>
            </child>
@@ -365,7 +417,7 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="left-attach">2</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
@@ -392,11 +444,37 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">2</property>
                <property name="left-attach">3</property>
                <property name="top-attach">0</property>
                <property name="height">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkImage" id="lockchanged">
                <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="lockchangedcolor">
                <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>
          </object>
        </child>
        <child type="label">
@@ -424,7 +502,7 @@
        <property name="label-xalign">0</property>
        <property name="shadow-type">none</property>
        <child>
          <!-- n-columns=3 n-rows=2 -->
          <!-- n-columns=4 n-rows=2 -->
          <object class="GtkGrid" id="grid2">
            <property name="visible">True</property>
            <property name="can-focus">False</property>
@@ -452,7 +530,7 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="left-attach">2</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
@@ -466,7 +544,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>
              </packing>
            </child>
@@ -480,7 +558,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>
@@ -507,7 +585,7 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">2</property>
                <property name="left-attach">3</property>
                <property name="top-attach">0</property>
                <property name="height">2</property>
              </packing>
@@ -531,10 +609,36 @@
                </child>
              </object>
              <packing>
                <property name="left-attach">1</property>
                <property name="left-attach">2</property>
                <property name="top-attach">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkImage" id="lockmarkpos">
                <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="lockmarkcolor">
                <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>
          </object>
        </child>
        <child type="label">