sw/source/ui/frmdlg/frmpage.cxx       |   42 ++++++------
 sw/source/uibase/inc/frmpage.hxx      |   11 +--
 sw/uiconfig/swriter/ui/frmaddpage.ui  |  118 +++-------------------------------
 sw/uiconfig/swriter/ui/frmtypepage.ui |   98 +++++++++++++++++++++++++++-
 4 files changed, 134 insertions(+), 135 deletions(-)

New commits:
commit 60934c3a6a0c0e20dd83de28e1fb51280626339e
Author:     Kira Tubo <kira.t...@gmail.com>
AuthorDate: Sun Sep 1 22:46:47 2024 -0700
Commit:     Heiko Tietze <heiko.tie...@documentfoundation.org>
CommitDate: Fri Sep 6 10:12:49 2024 +0200

    tdf#149085: Move "Protect" section to "Position and Size" tab
    
    - Within properties dialog of Image, Frame, Object, move "Protect" section
    (including checkboxes Contents, Position, Size), from "Options" tab to
    "Position and Size" tab.
    - Rearrange positioning of UI elements.
    
    Change-Id: Ie55832404f47505e31202a12484cd8dedcda6bcf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172728
    Reviewed-by: Heiko Tietze <heiko.tie...@documentfoundation.org>
    Tested-by: Jenkins

diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index df2e8dbe2b1e..e6bb4eb1097b 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -390,13 +390,13 @@ FrameMap const aVAsCharHtmlMap[] =
 
 const WhichRangesContainer SwFramePage::s_aPageRg(svl::Items<
     RES_FRM_SIZE, RES_FRM_SIZE,
+    RES_PROTECT, RES_PROTECT,
     RES_VERT_ORIENT, RES_ANCHOR,
     RES_COL, RES_COL,
     RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW
 >);
 const WhichRangesContainer SwFrameAddPage::s_aAddPgRg(svl::Items<
     RES_PRINT,              RES_PRINT,
-    RES_PROTECT,            RES_PROTECT,
     FN_SET_FRM_NAME,        FN_SET_FRM_NAME,
     FN_SET_FRM_ALT_NAME,    FN_SET_FRM_ALT_NAME,
     FN_UNO_DESCRIPTION,     FN_UNO_DESCRIPTION
@@ -660,6 +660,10 @@ SwFramePage::SwFramePage(weld::Container* pPage, 
weld::DialogController* pContro
     , m_xImgRatioTop(new weld::CustomWeld(*m_xBuilder, u"daRatioTop"_ustr, 
m_aRatioTop))
     , m_xImgRatioBottom(new weld::CustomWeld(*m_xBuilder, 
u"daRatioBottom"_ustr, m_aRatioBottom))
     , m_xRealSizeBT(m_xBuilder->weld_button(u"origsize"_ustr))
+    , m_xProtectFrame(m_xBuilder->weld_widget(u"protect"_ustr))
+    , 
m_xProtectContentCB(m_xBuilder->weld_check_button(u"protectcontent"_ustr))
+    , m_xProtectFrameCB(m_xBuilder->weld_check_button(u"protectframe"_ustr))
+    , m_xProtectSizeCB(m_xBuilder->weld_check_button(u"protectsize"_ustr))
     , m_xAnchorFrame(m_xBuilder->weld_widget(u"anchorframe"_ustr))
     , m_xAnchorAtPageRB(m_xBuilder->weld_radio_button(u"topage"_ustr))
     , m_xAnchorAtParaRB(m_xBuilder->weld_radio_button(u"topara"_ustr))
@@ -1066,6 +1070,7 @@ void SwFramePage::Reset( const SfxItemSet *rSet )
             m_xFixedRatioCB->set_sensitive(false);
         // i#18732 hide checkbox in HTML mode
         m_xFollowTextFlowCB->hide();
+        m_xProtectFrame->hide();
     }
     else
     {
@@ -1108,6 +1113,12 @@ void SwFramePage::Reset( const SfxItemSet *rSet )
         m_xFlySplitCB->hide();
     }
 
+    // Pos Protected
+    const SvxProtectItem& rProt = rSet->Get(RES_PROTECT);
+    m_xProtectFrameCB->set_active(rProt.IsPosProtected());
+    m_xProtectContentCB->set_active(rProt.IsContentProtected());
+    m_xProtectSizeCB->set_active(rProt.IsSizeProtected());
+
     Init(*rSet);
     m_xAtVertPosED->save_value();
     m_xAtHorzPosED->save_value();
@@ -1138,8 +1149,16 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet)
 {
     bool bRet = false;
 
+    const SfxPoolItem* pOldItem;
+    SvxProtectItem aProt(GetItemSet().Get(RES_PROTECT));
+    aProt.SetContentProtect(m_xProtectContentCB->get_active());
+    aProt.SetSizeProtect(m_xProtectSizeCB->get_active());
+    aProt.SetPosProtect(m_xProtectFrameCB->get_active());
+    if (nullptr == (pOldItem = GetOldItem(*rSet, FN_SET_PROTECT)) || aProt != 
*pOldItem)
+        bRet |= nullptr != rSet->Put(aProt);
+
     const SfxItemSet& rOldSet = GetItemSet();
-    const SfxPoolItem* pOldItem = nullptr;
+    pOldItem = nullptr;
 
     RndStdIds eAnchorId = GetAnchor();
 
@@ -2936,10 +2955,6 @@ SwFrameAddPage::SwFrameAddPage(weld::Container* pPage, 
weld::DialogController* p
     , m_xSequenceFrame(m_xBuilder->weld_widget(u"frmSequence"_ustr))
     , m_xPrevLB(m_xBuilder->weld_combo_box(u"prev"_ustr))
     , m_xNextLB(m_xBuilder->weld_combo_box(u"next"_ustr))
-    , m_xProtectFrame(m_xBuilder->weld_widget(u"protect"_ustr))
-    , 
m_xProtectContentCB(m_xBuilder->weld_check_button(u"protectcontent"_ustr))
-    , m_xProtectFrameCB(m_xBuilder->weld_check_button(u"protectframe"_ustr))
-    , m_xProtectSizeCB(m_xBuilder->weld_check_button(u"protectsize"_ustr))
     , m_xContentAlignFrame(m_xBuilder->weld_widget(u"contentalign"_ustr))
     , m_xVertAlignLB(m_xBuilder->weld_combo_box(u"vertalign"_ustr))
     , m_xPropertiesFrame(m_xBuilder->weld_widget(u"properties"_ustr))
@@ -2975,7 +2990,6 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet )
     m_bHtmlMode = (nHtmlMode & HTMLMODE_ON) != 0;
     if (m_bHtmlMode)
     {
-        m_xProtectFrame->hide();
         m_xEditInReadonlyCB->hide();
         m_xPrintFrameCB->hide();
     }
@@ -3106,11 +3120,6 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet )
             m_xNextLB->connect_changed(aLink);
         }
     }
-    // Pos Protected
-    const SvxProtectItem& rProt = rSet->Get(RES_PROTECT);
-    m_xProtectFrameCB->set_active(rProt.IsPosProtected());
-    m_xProtectContentCB->set_active(rProt.IsContentProtected());
-    m_xProtectSizeCB->set_active(rProt.IsSizeProtected());
 
     const SwFormatEditInReadonly& rEdit = rSet->Get(RES_EDIT_IN_READONLY);
     m_xEditInReadonlyCB->set_active(rEdit.GetValue());
@@ -3177,15 +3186,6 @@ bool SwFrameAddPage::FillItemSet(SfxItemSet *rSet)
     if (m_xDescriptionED->get_value_changed_from_saved())
         bRet |= nullptr != rSet->Put(SfxStringItem(FN_UNO_DESCRIPTION, 
m_xDescriptionED->get_text()));
 
-    const SfxPoolItem* pOldItem;
-    SvxProtectItem aProt ( GetItemSet().Get(RES_PROTECT) );
-    aProt.SetContentProtect( m_xProtectContentCB->get_active() );
-    aProt.SetSizeProtect ( m_xProtectSizeCB->get_active() );
-    aProt.SetPosProtect  ( m_xProtectFrameCB->get_active() );
-    if ( nullptr == (pOldItem = GetOldItem(*rSet, FN_SET_PROTECT)) ||
-                aProt != *pOldItem )
-        bRet |= nullptr != rSet->Put( aProt);
-
     if ( m_xEditInReadonlyCB->get_state_changed_from_saved() )
         bRet |= nullptr != rSet->Put( SwFormatEditInReadonly( 
RES_EDIT_IN_READONLY, m_xEditInReadonlyCB->get_active()));
 
diff --git a/sw/source/uibase/inc/frmpage.hxx b/sw/source/uibase/inc/frmpage.hxx
index f04fb4297e8c..0ee921dc05aa 100644
--- a/sw/source/uibase/inc/frmpage.hxx
+++ b/sw/source/uibase/inc/frmpage.hxx
@@ -99,6 +99,12 @@ class SwFramePage final : public SfxTabPage
 
     std::unique_ptr<weld::Button> m_xRealSizeBT;
 
+    // protect
+    std::unique_ptr<weld::Widget> m_xProtectFrame;
+    std::unique_ptr<weld::CheckButton> m_xProtectContentCB;
+    std::unique_ptr<weld::CheckButton> m_xProtectFrameCB;
+    std::unique_ptr<weld::CheckButton> m_xProtectSizeCB;
+
     // anchor
     std::unique_ptr<weld::Widget> m_xAnchorFrame;
     std::unique_ptr<weld::RadioButton> m_xAnchorAtPageRB;
@@ -298,11 +304,6 @@ class SwFrameAddPage final : public SfxTabPage
     std::unique_ptr<weld::ComboBox> m_xPrevLB;
     std::unique_ptr<weld::ComboBox> m_xNextLB;
 
-    std::unique_ptr<weld::Widget> m_xProtectFrame;
-    std::unique_ptr<weld::CheckButton> m_xProtectContentCB;
-    std::unique_ptr<weld::CheckButton> m_xProtectFrameCB;
-    std::unique_ptr<weld::CheckButton> m_xProtectSizeCB;
-
     std::unique_ptr<weld::Widget> m_xContentAlignFrame;
     std::unique_ptr<weld::ComboBox> m_xVertAlignLB;
 
diff --git a/sw/uiconfig/swriter/ui/frmaddpage.ui 
b/sw/uiconfig/swriter/ui/frmaddpage.ui
index f73f404a9b7b..6ca01c28807c 100644
--- a/sw/uiconfig/swriter/ui/frmaddpage.ui
+++ b/sw/uiconfig/swriter/ui/frmaddpage.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.38.2 -->
+<!-- Generated with glade 3.40.0 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.20"/>
   <object class="GtkTextBuffer" id="textbuffer1">
@@ -9,7 +9,7 @@
 
 </property>
   </object>
-  <!-- n-columns=2 n-rows=4 -->
+  <!-- n-columns=1 n-rows=4 -->
   <object class="GtkGrid" id="FrameAddPage">
     <property name="visible">True</property>
     <property name="can-focus">False</property>
@@ -49,8 +49,6 @@
                   <object class="GtkGrid" id="grid1">
                     <property name="visible">True</property>
                     <property name="can-focus">False</property>
-                    <property name="margin-start">0</property>
-                    <property name="margin-top">0</property>
                     <property name="hexpand">True</property>
                     <property name="vexpand">True</property>
                     <property name="row-spacing">6</property>
@@ -111,10 +109,10 @@
                       <object class="GtkLabel" id="altname_label">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
+                        <property name="tooltip-text" translatable="yes" 
context="frmaddpage|altname_label|tooltip_text">Give a short description for 
users who do not see this object.</property>
                         <property name="label" translatable="yes" 
context="frmaddpage|altname_label">Text _Alternative:</property>
-                        <property name="tooltip_text" translatable="yes" 
context="frmaddpage|altname_label|tooltip_text">Give a short description for 
users who do not see this object.</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">altname</property>
+                        <property name="use-underline">True</property>
+                        <property name="mnemonic-widget">altname</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
@@ -126,10 +124,10 @@
                       <object class="GtkLabel" id="description_label">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
+                        <property name="tooltip-text" translatable="yes" 
context="frmaddpage|description_label">Give a longer explanation of the content 
if it is too complex to be described briefly in “Text Alternative.”</property>
                         <property name="label" translatable="yes" 
context="frmaddpage|description_label">_Description:</property>
-                        <property name="tooltip_text" translatable="yes" 
context="frmaddpage|description_label">Give a longer explanation of the content 
if it is too complex to be described briefly in “Text Alternative.”</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">description</property>
+                        <property name="use-underline">True</property>
+                        <property name="mnemonic-widget">description</property>
                         <property name="xalign">0</property>
                       </object>
                       <packing>
@@ -176,7 +174,7 @@
               </object>
               <packing>
                 <property name="left-attach">0</property>
-                <property name="top-attach">1</property>
+                <property name="top-attach">0</property>
               </packing>
             </child>
             <child>
@@ -195,7 +193,7 @@
               </object>
               <packing>
                 <property name="left-attach">0</property>
-                <property name="top-attach">2</property>
+                <property name="top-attach">1</property>
               </packing>
             </child>
           </object>
@@ -214,96 +212,6 @@
       <packing>
         <property name="left-attach">0</property>
         <property name="top-attach">0</property>
-        <property name="width">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkFrame" id="protect">
-        <property name="visible">True</property>
-        <property name="can-focus">False</property>
-        <property name="label-xalign">0</property>
-        <property name="shadow-type">none</property>
-        <child>
-          <!-- n-columns=1 n-rows=3 -->
-          <object class="GtkGrid" id="grid9">
-            <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="row-spacing">3</property>
-            <child>
-              <object class="GtkCheckButton" id="protectcontent">
-                <property name="label" translatable="yes" 
context="frmaddpage|protectcontent">_Contents</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="protectcontent-atkobject">
-                    <property name="AtkObject::accessible-description" 
translatable="yes" context="frmaddpage|extended_tip|protectcontent">Prevents 
changes to the contents of the selected item.</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">0</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="protectframe">
-                <property name="label" translatable="yes" 
context="frmaddpage|protectframe">P_osition</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="protectframe-atkobject">
-                    <property name="AtkObject::accessible-description" 
translatable="yes" context="frmaddpage|extended_tip|protectframe">Locks the 
position of the selected item in the current document.</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkCheckButton" id="protectsize">
-                <property name="label" translatable="yes" 
context="frmaddpage|protectsize">_Size</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="protectsize-atkobject">
-                    <property name="AtkObject::accessible-description" 
translatable="yes" context="frmaddpage|extended_tip|protectsize">Locks the size 
of the selected item.</property>
-                  </object>
-                </child>
-              </object>
-              <packing>
-                <property name="left-attach">0</property>
-                <property name="top-attach">2</property>
-              </packing>
-            </child>
-          </object>
-        </child>
-        <child type="label">
-          <object class="GtkLabel" id="label8">
-            <property name="visible">True</property>
-            <property name="can-focus">False</property>
-            <property name="label" translatable="yes" 
context="frmaddpage|label8">Protect</property>
-            <attributes>
-              <attribute name="weight" value="bold"/>
-            </attributes>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="left-attach">0</property>
-        <property name="top-attach">2</property>
       </packing>
     </child>
     <child>
@@ -366,7 +274,7 @@
         </child>
       </object>
       <packing>
-        <property name="left-attach">1</property>
+        <property name="left-attach">0</property>
         <property name="top-attach">2</property>
       </packing>
     </child>
@@ -473,7 +381,6 @@
       <packing>
         <property name="left-attach">0</property>
         <property name="top-attach">3</property>
-        <property name="width">2</property>
       </packing>
     </child>
     <child>
@@ -567,8 +474,8 @@
           <object class="GtkLabel" id="lbSequence">
             <property name="visible">True</property>
             <property name="can-focus">False</property>
-            <property name="label" translatable="yes" 
context="frmaddpage|labelSequence">Sequence</property>
             <property name="tooltip-text" translatable="yes" 
context="frmaddpage|labelSequence">Specify the sequence for linked 
frames.</property>
+            <property name="label" translatable="yes" 
context="frmaddpage|labelSequence">Sequence</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
@@ -578,7 +485,6 @@
       <packing>
         <property name="left-attach">0</property>
         <property name="top-attach">1</property>
-        <property name="width">2</property>
       </packing>
     </child>
     <child internal-child="accessible">
diff --git a/sw/uiconfig/swriter/ui/frmtypepage.ui 
b/sw/uiconfig/swriter/ui/frmtypepage.ui
index 2d2e85565b14..76bcaf1cd9b8 100644
--- a/sw/uiconfig/swriter/ui/frmtypepage.ui
+++ b/sw/uiconfig/swriter/ui/frmtypepage.ui
@@ -33,15 +33,15 @@
     <property name="valign">start</property>
     <property name="hexpand">True</property>
     <property name="border-width">6</property>
-    <property name="row-spacing">18</property>
+    <property name="row-spacing">12</property>
     <child>
-      <!-- n-columns=3 n-rows=1 -->
+      <!-- n-columns=3 n-rows=2 -->
       <object class="GtkGrid" id="grid3">
         <property name="visible">True</property>
         <property name="can-focus">False</property>
         <property name="hexpand">True</property>
         <property name="vexpand">True</property>
-        <property name="row-spacing">3</property>
+        <property name="row-spacing">12</property>
         <property name="column-spacing">18</property>
         <child>
           <object class="GtkFrame" id="frame2">
@@ -592,6 +592,98 @@
           <packing>
             <property name="left-attach">2</property>
             <property name="top-attach">0</property>
+            <property name="height">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkFrame" id="protect">
+            <property name="visible">True</property>
+            <property name="can-focus">False</property>
+            <property name="label-xalign">0</property>
+            <property name="shadow-type">none</property>
+            <child>
+              <!-- n-columns=3 n-rows=1 -->
+              <object class="GtkGrid" id="gridProtect">
+                <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="column-spacing">18</property>
+                <child>
+                  <object class="GtkCheckButton" id="protectcontent">
+                    <property name="label" translatable="yes" 
context="frmaddpage|protectcontent">_Contents</property>
+                    <property name="visible">True</property>
+                    <property name="can-focus">True</property>
+                    <property name="receives-default">False</property>
+                    <property name="margin-start">12</property>
+                    <property name="use-underline">True</property>
+                    <property name="draw-indicator">True</property>
+                    <child internal-child="accessible">
+                      <object class="AtkObject" id="protectcontent-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="frmaddpage|extended_tip|protectcontent">Prevents 
changes to the contents of the selected item.</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left-attach">0</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="protectframe">
+                    <property name="label" translatable="yes" 
context="frmaddpage|protectframe">P_osition</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="protectframe-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="frmaddpage|extended_tip|protectframe">Locks the 
position of the selected item in the current document.</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left-attach">1</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkCheckButton" id="protectsize">
+                    <property name="label" translatable="yes" 
context="frmaddpage|protectsize">_Size</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="protectsize-atkobject">
+                        <property name="AtkObject::accessible-description" 
translatable="yes" context="frmaddpage|extended_tip|protectsize">Locks the size 
of the selected item.</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="left-attach">2</property>
+                    <property name="top-attach">0</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label8">
+                <property name="visible">True</property>
+                <property name="can-focus">False</property>
+                <property name="label" translatable="yes" 
context="frmaddpage|label8">Protect</property>
+                <attributes>
+                  <attribute name="weight" value="bold"/>
+                </attributes>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="left-attach">0</property>
+            <property name="top-attach">1</property>
+            <property name="width">2</property>
           </packing>
         </child>
       </object>

Reply via email to