sd/source/ui/dlg/tpoption.cxx                    |   59 ++++++++++++++++++-----
 sd/source/ui/inc/tpoption.hxx                    |    3 +
 sd/uiconfig/simpress/ui/optimpressgeneralpage.ui |   53 +++++++++++++++-----
 3 files changed, 92 insertions(+), 23 deletions(-)

New commits:
commit 60969b81dd710f26e50f3428f5544ae368010d79
Author:     Balazs Varga <balazs.varga.ext...@allotropia.de>
AuthorDate: Fri Nov 24 18:00:44 2023 +0100
Commit:     Balazs Varga <balazs.varga.ext...@allotropia.de>
CommitDate: Mon Nov 27 08:49:18 2023 +0100

    tdf#158241 - UI: Part 43 - Unify lockdown behavior of Options dialog
    
    for Draw - General Page.
    
    Change-Id: Ib17d638580011362cde5c2adea7e7e2d6e7d0eb0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159936
    Tested-by: Jenkins
    Reviewed-by: Balazs Varga <balazs.varga.ext...@allotropia.de>

diff --git a/sd/source/ui/dlg/tpoption.cxx b/sd/source/ui/dlg/tpoption.cxx
index 300b5caedd71..f6f5b4f5aa7e 100644
--- a/sd/source/ui/dlg/tpoption.cxx
+++ b/sd/source/ui/dlg/tpoption.cxx
@@ -24,6 +24,7 @@
 #include <comphelper/string.hxx>
 #include <com/sun/star/uno/Exception.hpp>
 #include <officecfg/Office/Impress.hxx>
+#include <officecfg/Office/Draw.hxx>
 #include <sfx2/module.hxx>
 #include <svx/svxids.hrc>
 #include <svx/strarray.hxx>
@@ -255,6 +256,7 @@ SdTpOptionsMisc::SdTpOptionsMisc(weld::Container* pPage, 
weld::DialogController*
     : SfxTabPage(pPage, pController, 
"modules/simpress/ui/optimpressgeneralpage.ui", "OptSavePage", &rInAttrs)
     , nWidth(0)
     , nHeight(0)
+    , m_bDrawMode(false)
     , m_xCbxQuickEdit(m_xBuilder->weld_check_button("qickedit"))
     , m_xCbxQuickEditImg(m_xBuilder->weld_widget("lockqickedit"))
     , m_xCbxPickThrough(m_xBuilder->weld_check_button("textselected"))
@@ -276,6 +278,7 @@ SdTpOptionsMisc::SdTpOptionsMisc(weld::Container* pPage, 
weld::DialogController*
     , m_xCbxCompatibilityImg(m_xBuilder->weld_widget("lockcbCompatibility"))
     , m_xScaleFrame(m_xBuilder->weld_frame("scaleframe"))
     , m_xCbScale(m_xBuilder->weld_combo_box("scaleBox"))
+    , m_xCbScaleImg(m_xBuilder->weld_widget("lockscaleBox"))
     , m_xNewDocLb(m_xBuilder->weld_label("newdoclbl"))
     , m_xFiInfo1(m_xBuilder->weld_label("info1"))
     , 
m_xMtrFldOriginalWidth(m_xBuilder->weld_metric_spin_button("metricWidthFields", 
FieldUnit::MM))
@@ -284,6 +287,7 @@ SdTpOptionsMisc::SdTpOptionsMisc(weld::Container* pPage, 
weld::DialogController*
     , m_xFiInfo2(m_xBuilder->weld_label("info2"))
     , 
m_xMtrFldOriginalHeight(m_xBuilder->weld_metric_spin_button("metricHeightFields",
 FieldUnit::MM))
     , m_xCbxDistort(m_xBuilder->weld_check_button("distortcb"))
+    , m_xCbxDistortImg(m_xBuilder->weld_widget("lockdistortcb"))
     , m_xMtrFldInfo1(m_xBuilder->weld_metric_spin_button("metricInfo1Fields", 
FieldUnit::MM))
     , m_xMtrFldInfo2(m_xBuilder->weld_metric_spin_button("metricInfo2Fields", 
FieldUnit::MM))
 {
@@ -500,42 +504,54 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs )
 {
     SdOptionsMiscItem aOptsItem( rAttrs->Get( ATTR_OPTIONS_MISC ) );
 
-    bool bReadOnly = 
officecfg::Office::Impress::Misc::NewDoc::AutoPilot::isReadOnly();
+    bool bReadOnly = m_bDrawMode ? false : 
officecfg::Office::Impress::Misc::NewDoc::AutoPilot::isReadOnly();
     m_xCbxStartWithTemplate->set_active( 
aOptsItem.GetOptionsMisc().IsStartWithTemplate() );
     m_xCbxStartWithTemplate->set_sensitive(!bReadOnly);
     m_xCbxStartWithTemplateImg->set_visible(bReadOnly);
 
-    bReadOnly = officecfg::Office::Impress::Misc::ObjectMoveable::isReadOnly();
+    bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Misc::ObjectMoveable::isReadOnly() :
+        officecfg::Office::Impress::Misc::ObjectMoveable::isReadOnly();
     m_xCbxMarkedHitMovesAlways->set_active( 
aOptsItem.GetOptionsMisc().IsMarkedHitMovesAlways() );
     m_xCbxMarkedHitMovesAlways->set_sensitive(!bReadOnly);
     m_xCbxMarkedHitMovesAlwaysImg->set_visible(bReadOnly);
 
-    bReadOnly = 
officecfg::Office::Impress::Misc::TextObject::QuickEditing::isReadOnly();
+    bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Misc::TextObject::QuickEditing::isReadOnly() :
+        
officecfg::Office::Impress::Misc::TextObject::QuickEditing::isReadOnly();
     m_xCbxQuickEdit->set_active( aOptsItem.GetOptionsMisc().IsQuickEdit() );
     m_xCbxQuickEdit->set_sensitive(!bReadOnly);
     m_xCbxQuickEditImg->set_visible(bReadOnly);
 
-    bReadOnly = 
officecfg::Office::Impress::Misc::TextObject::Selectable::isReadOnly();
+    bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Misc::TextObject::Selectable::isReadOnly() :
+        officecfg::Office::Impress::Misc::TextObject::Selectable::isReadOnly();
     m_xCbxPickThrough->set_active( aOptsItem.GetOptionsMisc().IsPickThrough() 
);
     m_xCbxPickThrough->set_sensitive(!bReadOnly);
     m_xCbxPickThroughImg->set_visible(bReadOnly);
 
-    bReadOnly = 
officecfg::Office::Impress::Misc::BackgroundCache::isReadOnly();
+    bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Misc::BackgroundCache::isReadOnly() :
+        officecfg::Office::Impress::Misc::BackgroundCache::isReadOnly();
     m_xCbxMasterPageCache->set_active( 
aOptsItem.GetOptionsMisc().IsMasterPagePaintCaching() );
     m_xCbxMasterPageCache->set_sensitive(!bReadOnly);
     m_xCbxMasterPageCacheImg->set_visible(bReadOnly);
 
-    bReadOnly = 
officecfg::Office::Impress::Misc::CopyWhileMoving::isReadOnly();
+    bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Misc::CopyWhileMoving::isReadOnly() :
+        officecfg::Office::Impress::Misc::CopyWhileMoving::isReadOnly();
     m_xCbxCopy->set_active( aOptsItem.GetOptionsMisc().IsDragWithCopy() );
     m_xCbxCopy->set_sensitive(!bReadOnly);
     m_xCbxCopyImg->set_visible(bReadOnly);
 
-    bReadOnly = 
officecfg::Office::Impress::Misc::Compatibility::AddBetween::isReadOnly();
+    bReadOnly = m_bDrawMode ? false : 
officecfg::Office::Impress::Misc::Compatibility::AddBetween::isReadOnly();
     m_xCbxCompatibility->set_active( 
aOptsItem.GetOptionsMisc().IsSummationOfParagraphs() );
     m_xCbxCompatibility->set_sensitive(!bReadOnly);
     m_xCbxCompatibilityImg->set_visible(bReadOnly);
 
     m_xCbxDistort->set_active( 
aOptsItem.GetOptionsMisc().IsCrookNoContortion() );
+    if (m_bDrawMode)
+    {
+        bReadOnly = officecfg::Office::Draw::Misc::NoDistort::isReadOnly();
+        m_xCbxDistort->set_sensitive(!bReadOnly);
+        m_xCbxDistortImg->set_visible(bReadOnly);
+    }
+
     m_xCbxStartWithTemplate->save_state();
     m_xCbxMarkedHitMovesAlways->save_state();
     m_xCbxQuickEdit->save_state();
@@ -575,16 +591,28 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs )
     }
 
     if (SdOptionsGeneric::isMetricSystem())
-        bReadOnly = 
officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::isReadOnly();
+    {
+        bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Layout::Other::MeasureUnit::Metric::isReadOnly() :
+            
officecfg::Office::Impress::Layout::Other::MeasureUnit::Metric::isReadOnly();
+    }
     else
-        bReadOnly = 
officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::isReadOnly();
+    {
+        bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Layout::Other::MeasureUnit::NonMetric::isReadOnly() :
+            
officecfg::Office::Impress::Layout::Other::MeasureUnit::NonMetric::isReadOnly();
+    }
     m_xLbMetric->set_sensitive(!bReadOnly);
     m_xLbMetricImg->set_visible(bReadOnly);
 
     if (SdOptionsGeneric::isMetricSystem())
-        bReadOnly = 
officecfg::Office::Impress::Layout::Other::TabStop::Metric::isReadOnly();
+    {
+        bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Layout::Other::TabStop::Metric::isReadOnly() :
+            
officecfg::Office::Impress::Layout::Other::TabStop::Metric::isReadOnly();
+    }
     else
-        bReadOnly = 
officecfg::Office::Impress::Layout::Other::TabStop::NonMetric::isReadOnly();
+    {
+        bReadOnly = m_bDrawMode ? 
officecfg::Office::Draw::Layout::Other::TabStop::NonMetric::isReadOnly() :
+            
officecfg::Office::Impress::Layout::Other::TabStop::NonMetric::isReadOnly();
+    }
     m_xMtrFldTabstop->set_sensitive(!bReadOnly);
     m_xMtrFldTabstopImg->set_visible(bReadOnly);
 
@@ -597,6 +625,13 @@ void SdTpOptionsMisc::Reset( const SfxItemSet* rAttrs )
     nHeight = rAttrs->Get( ATTR_OPTIONS_SCALE_HEIGHT ).GetValue();
 
     m_xCbScale->set_entry_text( GetScale( nX, nY ) );
+    if (m_bDrawMode)
+    {
+        bReadOnly = officecfg::Office::Draw::Zoom::ScaleX::isReadOnly() &&
+            officecfg::Office::Draw::Zoom::ScaleY::isReadOnly();
+        m_xCbScale->set_sensitive(!bReadOnly);
+        m_xCbScaleImg->set_visible(bReadOnly);
+    }
 
     m_xMtrFldOriginalWidth->hide();
     m_xMtrFldOriginalWidth->set_text( aInfo1 ); // empty
@@ -644,6 +679,8 @@ void SdTpOptionsMisc::SetDrawMode()
     m_xMtrFldOriginalHeight->show();
     m_xCbxDistort->show();
     m_xCbxCompatibility->hide();
+
+    m_bDrawMode = true;
 }
 
 OUString SdTpOptionsMisc::GetScale( sal_Int32 nX, sal_Int32 nY )
diff --git a/sd/source/ui/inc/tpoption.hxx b/sd/source/ui/inc/tpoption.hxx
index 79735e6a3f81..e53c55284cf0 100644
--- a/sd/source/ui/inc/tpoption.hxx
+++ b/sd/source/ui/inc/tpoption.hxx
@@ -76,6 +76,7 @@ private:
     OUString aInfo1;
     OUString aInfo2;
 
+    bool                m_bDrawMode;
     MapUnit             ePoolUnit;
 
     std::unique_ptr<weld::CheckButton> m_xCbxQuickEdit;
@@ -105,6 +106,7 @@ private:
     //Scale
     std::unique_ptr<weld::Frame> m_xScaleFrame;
     std::unique_ptr<weld::ComboBox> m_xCbScale;
+    std::unique_ptr<weld::Widget> m_xCbScaleImg;
     std::unique_ptr<weld::Label> m_xNewDocLb;
     std::unique_ptr<weld::Label> m_xFiInfo1;
     std::unique_ptr<weld::MetricSpinButton> m_xMtrFldOriginalWidth;
@@ -113,6 +115,7 @@ private:
     std::unique_ptr<weld::Label> m_xFiInfo2;
     std::unique_ptr<weld::MetricSpinButton> m_xMtrFldOriginalHeight;
     std::unique_ptr<weld::CheckButton> m_xCbxDistort;
+    std::unique_ptr<weld::Widget> m_xCbxDistortImg;
     std::unique_ptr<weld::MetricSpinButton> m_xMtrFldInfo1;
     std::unique_ptr<weld::MetricSpinButton> m_xMtrFldInfo2;
 
diff --git a/sd/uiconfig/simpress/ui/optimpressgeneralpage.ui 
b/sd/uiconfig/simpress/ui/optimpressgeneralpage.ui
index 60f023ea7881..77a97b7c67b0 100644
--- a/sd/uiconfig/simpress/ui/optimpressgeneralpage.ui
+++ b/sd/uiconfig/simpress/ui/optimpressgeneralpage.ui
@@ -358,7 +358,17 @@
                   </packing>
                 </child>
                 <child>
-                  <placeholder/>
+                  <object class="GtkImage" id="lockdistortcb">
+                    <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>
             </child>
@@ -569,7 +579,7 @@
             <property name="label-xalign">0</property>
             <property name="shadow-type">none</property>
             <child>
-              <!-- n-columns=4 n-rows=3 -->
+              <!-- n-columns=5 n-rows=3 -->
               <object class="GtkGrid" id="grid7">
                 <property name="visible">True</property>
                 <property name="can-focus">False</property>
@@ -588,7 +598,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>
@@ -602,7 +612,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>
@@ -616,7 +626,7 @@
                     <property name="xalign">0</property>
                   </object>
                   <packing>
-                    <property name="left-attach">2</property>
+                    <property name="left-attach">3</property>
                     <property name="top-attach">1</property>
                   </packing>
                 </child>
@@ -631,7 +641,7 @@
                     <property name="digits">2</property>
                   </object>
                   <packing>
-                    <property name="left-attach">1</property>
+                    <property name="left-attach">2</property>
                     <property name="top-attach">1</property>
                   </packing>
                 </child>
@@ -646,7 +656,7 @@
                     <property name="digits">2</property>
                   </object>
                   <packing>
-                    <property name="left-attach">3</property>
+                    <property name="left-attach">4</property>
                     <property name="top-attach">1</property>
                   </packing>
                 </child>
@@ -660,7 +670,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>
@@ -674,7 +684,7 @@
                     <property name="adjustment">adjustment3</property>
                   </object>
                   <packing>
-                    <property name="left-attach">1</property>
+                    <property name="left-attach">2</property>
                     <property name="top-attach">2</property>
                   </packing>
                 </child>
@@ -688,7 +698,7 @@
                     <property name="xalign">0</property>
                   </object>
                   <packing>
-                    <property name="left-attach">2</property>
+                    <property name="left-attach">3</property>
                     <property name="top-attach">2</property>
                   </packing>
                 </child>
@@ -702,7 +712,7 @@
                     <property name="adjustment">adjustment5</property>
                   </object>
                   <packing>
-                    <property name="left-attach">3</property>
+                    <property name="left-attach">4</property>
                     <property name="top-attach">2</property>
                   </packing>
                 </child>
@@ -724,10 +734,29 @@
                     </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="lockscaleBox">
+                    <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>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
                 <child>
                   <placeholder/>
                 </child>

Reply via email to