tdf#158238 - UI: Part 40 - Unify lockdown behavior of Options dialog

for Impress - View Page.

Change-Id: Icc3c4fc9dd3800ef454cbddb06e569e03c08967a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159856
Tested-by: Jenkins
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index b177c8e..fabf762 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -110,9 +110,13 @@ std::unique_ptr<SfxTabPage> SdTpOptionsSnap::Create( weld::Container* pPage, wel
SdTpOptionsContents::SdTpOptionsContents(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs)
    : SfxTabPage(pPage, pController, "modules/simpress/ui/sdviewpage.ui", "SdViewPage", &rInAttrs)
    , m_xCbxRuler(m_xBuilder->weld_check_button("ruler"))
    , m_xCbxRulerImg(m_xBuilder->weld_widget("lockruler"))
    , m_xCbxDragStripes(m_xBuilder->weld_check_button("dragstripes"))
    , m_xCbxDragStripesImg(m_xBuilder->weld_widget("lockdragstripes"))
    , m_xCbxHandlesBezier(m_xBuilder->weld_check_button("handlesbezier"))
    , m_xCbxHandlesBezierImg(m_xBuilder->weld_widget("lockhandlesbezier"))
    , m_xCbxMoveOutline(m_xBuilder->weld_check_button("moveoutline"))
    , m_xCbxMoveOutlineImg(m_xBuilder->weld_widget("lockmoveoutline"))
{
}

@@ -173,6 +177,22 @@ void SdTpOptionsContents::Reset( const SfxItemSet* rAttrs )
    m_xCbxDragStripes->set_active( aLayoutItem.GetOptionsLayout().IsDragStripes() );
    m_xCbxHandlesBezier->set_active( aLayoutItem.GetOptionsLayout().IsHandlesBezier() );

    bool bReadOnly = officecfg::Office::Impress::Layout::Display::Ruler::isReadOnly();
    m_xCbxRuler->set_sensitive(!bReadOnly);
    m_xCbxRulerImg->set_visible(bReadOnly);

    bReadOnly = officecfg::Office::Impress::Layout::Display::Contour::isReadOnly();
    m_xCbxMoveOutline->set_sensitive(!bReadOnly);
    m_xCbxMoveOutlineImg->set_visible(bReadOnly);

    bReadOnly = officecfg::Office::Impress::Layout::Display::Guide::isReadOnly();
    m_xCbxDragStripes->set_sensitive(!bReadOnly);
    m_xCbxDragStripesImg->set_visible(bReadOnly);

    bReadOnly = officecfg::Office::Impress::Layout::Display::Bezier::isReadOnly();
    m_xCbxHandlesBezier->set_sensitive(!bReadOnly);
    m_xCbxHandlesBezierImg->set_visible(bReadOnly);

    m_xCbxRuler->save_state();
    m_xCbxMoveOutline->save_state();
    m_xCbxDragStripes->save_state();
diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx
index 4184cd7..79735e6 100644
--- a/sd/source/ui/inc/tpoption.hxx
+++ b/sd/source/ui/inc/tpoption.hxx
@@ -43,9 +43,13 @@ class SdTpOptionsContents final : public SfxTabPage
{
private:
    std::unique_ptr<weld::CheckButton> m_xCbxRuler;
    std::unique_ptr<weld::Widget> m_xCbxRulerImg;
    std::unique_ptr<weld::CheckButton> m_xCbxDragStripes;
    std::unique_ptr<weld::Widget> m_xCbxDragStripesImg;
    std::unique_ptr<weld::CheckButton> m_xCbxHandlesBezier;
    std::unique_ptr<weld::Widget> m_xCbxHandlesBezierImg;
    std::unique_ptr<weld::CheckButton> m_xCbxMoveOutline;
    std::unique_ptr<weld::Widget> m_xCbxMoveOutlineImg;

public:
    SdTpOptionsContents(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rInAttrs);
diff --git a/sd/uiconfig/simpress/ui/sdviewpage.ui b/sd/uiconfig/simpress/ui/sdviewpage.ui
index 52193b0..608114e 100644
--- a/sd/uiconfig/simpress/ui/sdviewpage.ui
+++ b/sd/uiconfig/simpress/ui/sdviewpage.ui
@@ -10,13 +10,13 @@
    <property name="label-xalign">0</property>
    <property name="shadow-type">none</property>
    <child>
      <object class="GtkBox" id="box1">
      <!-- n-columns=2 n-rows=4 -->
      <object class="GtkGrid">
        <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="ruler">
            <property name="label" translatable="yes" context="sdviewpage|ruler">_Rulers visible</property>
@@ -32,9 +32,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>
@@ -52,9 +51,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>
@@ -72,9 +70,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>
@@ -92,9 +89,60 @@
            </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="lockruler">
            <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="lockdragstripes">
            <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="lockhandlesbezier">
            <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="lockmoveoutline">
            <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>
      </object>