tdf#157846 - UI: Part 9 - Unify lockdown behavior of Options dialog

for Accessibility Page.

Change-Id: I4705904200715c1e41849a47a3dd684ddfa219c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158425
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
diff --git a/cui/source/options/optaccessibility.cxx b/cui/source/options/optaccessibility.cxx
index f81c893..008a4a2 100644
--- a/cui/source/options/optaccessibility.cxx
+++ b/cui/source/options/optaccessibility.cxx
@@ -27,11 +27,18 @@ SvxAccessibilityOptionsTabPage::SvxAccessibilityOptionsTabPage(weld::Container* 
    : SfxTabPage(pPage, pController, "cui/ui/optaccessibilitypage.ui", "OptAccessibilityPage", &rSet)
    , m_xAccessibilityTool(m_xBuilder->weld_check_button("acctool"))
    , m_xTextSelectionInReadonly(m_xBuilder->weld_check_button("textselinreadonly"))
    , m_xTextSelectionInReadonlyImg(m_xBuilder->weld_widget("locktextselinreadonly"))
    , m_xAnimatedGraphics(m_xBuilder->weld_check_button("animatedgraphics"))
    , m_xAnimatedGraphicsImg(m_xBuilder->weld_widget("lockanimatedgraphics"))
    , m_xAnimatedTexts(m_xBuilder->weld_check_button("animatedtext"))
    , m_xAnimatedTextsImg(m_xBuilder->weld_widget("lockanimatedtext"))
    , m_xHighContrast(m_xBuilder->weld_combo_box("highcontrast"))
    , m_xHighContrastImg(m_xBuilder->weld_widget("lockhighcontrast"))
    , m_xHighContrastLabel(m_xBuilder->weld_label("label13"))
    , m_xAutomaticFontColor(m_xBuilder->weld_check_button("autofontcolor"))
    , m_xAutomaticFontColorImg(m_xBuilder->weld_widget("lockautofontcolor"))
    , m_xPagePreviews(m_xBuilder->weld_check_button("systempagepreviewcolor"))
    , m_xPagePreviewsImg(m_xBuilder->weld_widget("locksystempagepreviewcolor"))
{
#ifdef UNX
    // UNIX: read the gconf2 setting instead to use the checkbox
@@ -103,28 +110,47 @@ bool SvxAccessibilityOptionsTabPage::FillItemSet( SfxItemSet* )
void SvxAccessibilityOptionsTabPage::Reset( const SfxItemSet* )
{
    m_xPagePreviews->set_active( officecfg::Office::Common::Accessibility::IsForPagePreviews::get() );
    if( officecfg::Office::Common::Accessibility::IsForPagePreviews::isReadOnly() )
    if (officecfg::Office::Common::Accessibility::IsForPagePreviews::isReadOnly())
    {
        m_xPagePreviews->set_sensitive(false);
        m_xPagePreviewsImg->set_visible(true);
    }

    m_xAnimatedGraphics->set_active( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::get() );
    if( officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::isReadOnly() )
    if (officecfg::Office::Common::Accessibility::IsAllowAnimatedGraphics::isReadOnly())
    {
        m_xAnimatedGraphics->set_sensitive(false);
        m_xAnimatedGraphicsImg->set_visible(true);
    }

    m_xAnimatedTexts->set_active( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::get() );
    if( officecfg::Office::Common::Accessibility::IsAllowAnimatedText::isReadOnly() )
    if (officecfg::Office::Common::Accessibility::IsAllowAnimatedText::isReadOnly())
    {
        m_xAnimatedTexts->set_sensitive(false);
        m_xAnimatedTextsImg->set_visible(true);
    }

    m_xAutomaticFontColor->set_active( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::get() );
    if( officecfg::Office::Common::Accessibility::IsAutomaticFontColor::isReadOnly() )
    if (officecfg::Office::Common::Accessibility::IsAutomaticFontColor::isReadOnly())
    {
        m_xAutomaticFontColor->set_sensitive(false);
        m_xAutomaticFontColorImg->set_visible(true);
    }

    m_xTextSelectionInReadonly->set_active( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::get() );
    if( officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly() )
    if (officecfg::Office::Common::Accessibility::IsSelectionInReadonly::isReadOnly())
    {
        m_xTextSelectionInReadonly->set_sensitive(false);
        m_xTextSelectionInReadonlyImg->set_visible(true);
    }

    m_xHighContrast->set_active( officecfg::Office::Common::Accessibility::HighContrast::get() );
    if( officecfg::Office::Common::Accessibility::HighContrast::isReadOnly() )
    if (officecfg::Office::Common::Accessibility::HighContrast::isReadOnly())
    {
        m_xHighContrast->set_sensitive(false);
        m_xHighContrastLabel->set_sensitive(false);
        m_xHighContrastImg->set_visible(true);
    }

    AllSettings aAllSettings = Application::GetSettings();
    const MiscSettings& aMiscSettings = aAllSettings.GetMiscSettings();
diff --git a/cui/source/options/optaccessibility.hxx b/cui/source/options/optaccessibility.hxx
index 4481dd8..73fe167 100644
--- a/cui/source/options/optaccessibility.hxx
+++ b/cui/source/options/optaccessibility.hxx
@@ -24,11 +24,18 @@ class SvxAccessibilityOptionsTabPage : public SfxTabPage
{
    std::unique_ptr<weld::CheckButton> m_xAccessibilityTool;
    std::unique_ptr<weld::CheckButton> m_xTextSelectionInReadonly;
    std::unique_ptr<weld::Widget> m_xTextSelectionInReadonlyImg;
    std::unique_ptr<weld::CheckButton> m_xAnimatedGraphics;
    std::unique_ptr<weld::Widget> m_xAnimatedGraphicsImg;
    std::unique_ptr<weld::CheckButton> m_xAnimatedTexts;
    std::unique_ptr<weld::Widget> m_xAnimatedTextsImg;
    std::unique_ptr<weld::ComboBox> m_xHighContrast;
    std::unique_ptr<weld::Widget> m_xHighContrastImg;
    std::unique_ptr<weld::Label> m_xHighContrastLabel;
    std::unique_ptr<weld::CheckButton> m_xAutomaticFontColor;
    std::unique_ptr<weld::Widget> m_xAutomaticFontColorImg;
    std::unique_ptr<weld::CheckButton> m_xPagePreviews;
    std::unique_ptr<weld::Widget> m_xPagePreviewsImg;

public:
    SvxAccessibilityOptionsTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
diff --git a/cui/uiconfig/ui/optaccessibilitypage.ui b/cui/uiconfig/ui/optaccessibilitypage.ui
index 2148ee3..2cae4b5 100644
--- a/cui/uiconfig/ui/optaccessibilitypage.ui
+++ b/cui/uiconfig/ui/optaccessibilitypage.ui
@@ -15,13 +15,14 @@
        <property name="label-xalign">0</property>
        <property name="shadow-type">none</property>
        <child>
          <object class="GtkBox" id="box2">
          <!-- n-columns=2 n-rows=4 -->
          <object class="GtkGrid" id="grid1">
            <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="orientation">vertical</property>
            <property name="spacing">6</property>
            <property name="row-spacing">6</property>
            <child>
              <object class="GtkCheckButton" id="acctool">
                <property name="label" translatable="yes" context="optaccessibilitypage|acctool">Support _assistive technology tools (program restart required)</property>
@@ -37,9 +38,8 @@
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">0</property>
                <property name="left-attach">1</property>
                <property name="top-attach">0</property>
              </packing>
            </child>
            <child>
@@ -57,9 +57,8 @@
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">1</property>
                <property name="left-attach">1</property>
                <property name="top-attach">1</property>
              </packing>
            </child>
            <child>
@@ -77,9 +76,8 @@
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">2</property>
                <property name="left-attach">1</property>
                <property name="top-attach">2</property>
              </packing>
            </child>
            <child>
@@ -97,11 +95,52 @@
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">3</property>
                <property name="left-attach">1</property>
                <property name="top-attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkImage" id="locktextselinreadonly">
                <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="lockanimatedgraphics">
                <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="lockanimatedtext">
                <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>
            </child>
            <child>
              <placeholder/>
            </child>
          </object>
        </child>
        <child type="label">
@@ -136,7 +175,7 @@
            <property name="orientation">vertical</property>
            <property name="spacing">6</property>
            <child>
              <!-- n-columns=2 n-rows=1 -->
              <!-- n-columns=3 n-rows=1 -->
              <object class="GtkGrid" id="highcontrastbox">
                <property name="visible">True</property>
                <property name="can-focus">False</property>
@@ -152,7 +191,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>
@@ -174,7 +213,20 @@
                    </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="lockhighcontrast">
                    <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>
@@ -186,17 +238,75 @@
              </packing>
            </child>
            <child>
              <object class="GtkCheckButton" id="autofontcolor">
                <property name="label" translatable="yes" context="optaccessibilitypage|autofontcolor">Use automatic font _color for screen display</property>
              <!-- n-columns=2 n-rows=2 -->
              <object class="GtkGrid" id="grid3">
                <property name="visible">True</property>
                <property name="can-focus">True</property>
                <property name="receives-default">False</property>
                <property name="use-underline">True</property>
                <property name="draw-indicator">True</property>
                <child internal-child="accessible">
                  <object class="AtkObject" id="autofontcolor-atkobject">
                    <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|autofontcolor">Displays fonts in the office suite using the system color settings. This option only affects the screen display.</property>
                <property name="can-focus">False</property>
                <property name="hexpand">True</property>
                <property name="row-spacing">6</property>
                <child>
                  <object class="GtkCheckButton" id="autofontcolor">
                    <property name="label" translatable="yes" context="optaccessibilitypage|autofontcolor">Use automatic font _color for screen display</property>
                    <property name="visible">True</property>
                    <property name="can-focus">True</property>
                    <property name="receives-default">False</property>
                    <property name="use-underline">True</property>
                    <property name="draw-indicator">True</property>
                    <child internal-child="accessible">
                      <object class="AtkObject" id="autofontcolor-atkobject">
                        <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|autofontcolor">Displays fonts in the office suite using the system color settings. This option only affects the screen display.</property>
                      </object>
                    </child>
                  </object>
                  <packing>
                    <property name="left-attach">1</property>
                    <property name="top-attach">0</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkCheckButton" id="systempagepreviewcolor">
                    <property name="label" translatable="yes" context="optaccessibilitypage|systempagepreviewcolor">_Use system colors for page previews</property>
                    <property name="visible">True</property>
                    <property name="can-focus">True</property>
                    <property name="receives-default">False</property>
                    <property name="use-underline">True</property>
                    <property name="draw-indicator">True</property>
                    <child internal-child="accessible">
                      <object class="AtkObject" id="systempagepreviewcolor-atkobject">
                        <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|systempagepreviewcolor">Applies the high contrast settings of the operating system to page previews.</property>
                      </object>
                    </child>
                  </object>
                  <packing>
                    <property name="left-attach">1</property>
                    <property name="top-attach">1</property>
                  </packing>
                </child>
                <child>
                  <object class="GtkImage" id="lockautofontcolor">
                    <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="locksystempagepreviewcolor">
                    <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>
              <packing>
@@ -205,26 +315,6 @@
                <property name="position">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkCheckButton" id="systempagepreviewcolor">
                <property name="label" translatable="yes" context="optaccessibilitypage|systempagepreviewcolor">_Use system colors for page previews</property>
                <property name="visible">True</property>
                <property name="can-focus">True</property>
                <property name="receives-default">False</property>
                <property name="use-underline">True</property>
                <property name="draw-indicator">True</property>
                <child internal-child="accessible">
                  <object class="AtkObject" id="systempagepreviewcolor-atkobject">
                    <property name="AtkObject::accessible-description" translatable="yes" context="extended_tip|systempagepreviewcolor">Applies the high contrast settings of the operating system to page previews.</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="expand">False</property>
                <property name="fill">True</property>
                <property name="position">2</property>
              </packing>
            </child>
          </object>
        </child>
        <child type="label">