sw/source/ui/config/optpage.cxx           |   36 ++++++++++++++++++++++--------
 sw/source/uibase/inc/optpage.hxx          |    1 
 sw/uiconfig/swriter/ui/viewoptionspage.ui |   12 +++++++++-
 3 files changed, 39 insertions(+), 10 deletions(-)

New commits:
commit 49c200cf9f3e8f61716a15bf67dee9f54d2931fa
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Tue Nov 21 13:26:01 2023 +0100
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Tue Nov 21 21:03:03 2023 +0100

    tdf#158140 - UI: Part 33 - Unify lockdown behavior of Options dialog
    
    for Writer/Web - View Page.
    
    Change-Id: Idcd271493461bbd7a945e0ad5484715279a19c98
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159780
    Tested-by: Jenkins
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>

diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 294e25772da0..90ea14acf64f 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -52,6 +52,7 @@
 #include <editeng/svxenum.hxx>
 #include <officecfg/Office/Common.hxx>
 #include <officecfg/Office/Writer.hxx>
+#include <officecfg/Office/WriterWeb.hxx>
 #include <sal/macros.h>
 #include <sfx2/dialoghelper.hxx>
 #include <sfx2/printer.hxx>
@@ -108,6 +109,7 @@ SwContentOptPage::SwContentOptPage(weld::Container* pPage, 
weld::DialogControlle
     , m_xSettingsLabel(m_xBuilder->weld_label("settingslabel"))
     , m_xMetricLabel(m_xBuilder->weld_label("measureunitlabel"))
     , m_xMetricLB(m_xBuilder->weld_combo_box("measureunit"))
+    , m_xMetricImg(m_xBuilder->weld_widget("lockmeasureunit"))
     , m_xShowInlineTooltips(m_xBuilder->weld_check_button("changestooltip"))
     , m_xShowInlineTooltipsImg(m_xBuilder->weld_widget("lockchangestooltip"))
     , 
m_xShowOutlineContentVisibilityButton(m_xBuilder->weld_check_button("outlinecontentvisibilitybutton"))
@@ -203,35 +205,42 @@ static void lcl_SelectMetricLB(weld::ComboBox& rMetric, 
TypedWhichId<SfxUInt16It
 void SwContentOptPage::Reset(const SfxItemSet* rSet)
 {
     bool bReadOnly = false;
+    bool bWebOptionsPage = m_xSettingsFrame->is_visible();
     const SwElemItem* pElemAttr = rSet->GetItemIfSet( FN_PARAM_ELEM , false );
     if(pElemAttr)
     {
-        bReadOnly = 
officecfg::Office::Writer::Content::Display::Table::isReadOnly();
+        bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Content::Display::Table::isReadOnly() :
+            
officecfg::Office::WriterWeb::Content::Display::Table::isReadOnly();
         m_xTableCB->set_active(pElemAttr->m_bTable);
         m_xTableCB->set_sensitive(!bReadOnly);
         m_xTableImg->set_visible(bReadOnly);
 
-        bReadOnly = 
officecfg::Office::Writer::Content::Display::GraphicObject::isReadOnly();
+        bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Content::Display::GraphicObject::isReadOnly() :
+            
officecfg::Office::WriterWeb::Content::Display::GraphicObject::isReadOnly();
         m_xGrfCB->set_active(pElemAttr->m_bGraphic);
         m_xGrfCB->set_sensitive(!bReadOnly);
         m_xGrfImg->set_visible(bReadOnly);
 
-        bReadOnly = 
officecfg::Office::Writer::Content::Display::DrawingControl::isReadOnly();
+        bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Content::Display::DrawingControl::isReadOnly() :
+            
officecfg::Office::WriterWeb::Content::Display::DrawingControl::isReadOnly();
         m_xDrwCB->set_active(pElemAttr->m_bDrawing);
         m_xDrwCB->set_sensitive(!bReadOnly);
         m_xDrwImg->set_visible(bReadOnly);
 
-        bReadOnly = 
officecfg::Office::Writer::Content::Display::Note::isReadOnly();
+        bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Content::Display::Note::isReadOnly() :
+            officecfg::Office::WriterWeb::Content::Display::Note::isReadOnly();
         m_xPostItCB->set_active(pElemAttr->m_bNotes);
         m_xPostItCB->set_sensitive(!bReadOnly);
         m_xPostItCB->set_visible(pElemAttr->m_bNotes);
 
-        bReadOnly = 
officecfg::Office::Writer::Layout::Line::Guide::isReadOnly();
+        bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Layout::Line::Guide::isReadOnly() :
+            officecfg::Office::WriterWeb::Layout::Line::Guide::isReadOnly();
         m_xCrossCB->set_active(pElemAttr->m_bCrosshair);
         m_xCrossCB->set_sensitive(!bReadOnly);
         m_xCrossImg->set_visible(bReadOnly);
 
-        bReadOnly = 
officecfg::Office::Writer::Layout::Window::VerticalRuler::isReadOnly();
+        bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Layout::Window::VerticalRuler::isReadOnly() :
+            
officecfg::Office::WriterWeb::Layout::Window::VerticalRuler::isReadOnly();
         m_xVRulerCBox->set_active(pElemAttr->m_bVertRuler);
         m_xVRulerCBox->set_sensitive(!bReadOnly);
         m_xVRulerImg->set_visible(bReadOnly);
@@ -241,7 +250,8 @@ void SwContentOptPage::Reset(const SfxItemSet* rSet)
         m_xVRulerRightCBox->set_sensitive(!bReadOnly);
         m_xVRulerRightImg->set_visible(bReadOnly);
 
-        bReadOnly = 
officecfg::Office::Writer::Layout::Window::SmoothScroll::isReadOnly();
+        bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Layout::Window::SmoothScroll::isReadOnly() :
+            
officecfg::Office::WriterWeb::Layout::Window::SmoothScroll::isReadOnly();
         m_xSmoothCBox->set_active(pElemAttr->m_bSmoothScroll);
         m_xSmoothCBox->set_sensitive(!bReadOnly);
         m_xSmoothImg->set_visible(bReadOnly);
@@ -277,14 +287,22 @@ void SwContentOptPage::Reset(const SfxItemSet* rSet)
         m_xFieldHiddenParaImg->set_visible(bReadOnly);
     }
 
-    bReadOnly = 
officecfg::Office::Writer::Layout::Window::HorizontalRulerUnit::isReadOnly();
+    bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Layout::Window::HorizontalRulerUnit::isReadOnly() :
+        
officecfg::Office::WriterWeb::Layout::Window::HorizontalRulerUnit::isReadOnly();
     m_xHMetric->set_sensitive(!bReadOnly);
     m_xHMetricImg->set_visible(bReadOnly);
 
-    bReadOnly = 
officecfg::Office::Writer::Layout::Window::VerticalRulerUnit::isReadOnly();
+    bReadOnly = !bWebOptionsPage ? 
officecfg::Office::Writer::Layout::Window::VerticalRulerUnit::isReadOnly() :
+        
officecfg::Office::WriterWeb::Layout::Window::VerticalRulerUnit::isReadOnly();
     m_xVMetric->set_sensitive(!bReadOnly);
 
     m_xMetricLB->set_active(-1);
+    if (bWebOptionsPage)
+    {
+        bReadOnly = 
officecfg::Office::WriterWeb::Layout::Other::MeasureUnit::isReadOnly();
+        m_xMetricLB->set_sensitive(!bReadOnly);
+        m_xMetricImg->set_visible(bReadOnly);
+    }
     lcl_SelectMetricLB(*m_xMetricLB, SID_ATTR_METRIC, *rSet);
     lcl_SelectMetricLB(*m_xHMetric, FN_HSCROLL_METRIC, *rSet);
     lcl_SelectMetricLB(*m_xVMetric, FN_VSCROLL_METRIC, *rSet);
diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx
index ba9c585d9d99..4c5734253d35 100644
--- a/sw/source/uibase/inc/optpage.hxx
+++ b/sw/source/uibase/inc/optpage.hxx
@@ -60,6 +60,7 @@ class SwContentOptPage final : public SfxTabPage
     std::unique_ptr<weld::Label> m_xSettingsLabel;
     std::unique_ptr<weld::Label> m_xMetricLabel;
     std::unique_ptr<weld::ComboBox> m_xMetricLB;
+    std::unique_ptr<weld::Widget> m_xMetricImg;
 
     std::unique_ptr<weld::CheckButton> m_xShowInlineTooltips;
     std::unique_ptr<weld::Widget> m_xShowInlineTooltipsImg;
diff --git a/sw/uiconfig/swriter/ui/viewoptionspage.ui 
b/sw/uiconfig/swriter/ui/viewoptionspage.ui
index c527a16abbd0..7d1ba0354c27 100644
--- a/sw/uiconfig/swriter/ui/viewoptionspage.ui
+++ b/sw/uiconfig/swriter/ui/viewoptionspage.ui
@@ -734,7 +734,17 @@
                       </packing>
                     </child>
                     <child>
-                      <placeholder/>
+                      <object class="GtkImage" id="lockmeasureunit">
+                        <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>
                   </object>
                 </child>

Reply via email to