cui/source/inc/page.hxx           |    1 +
 cui/source/tabpages/page.cxx      |   16 ++++++++++++++++
 cui/uiconfig/ui/pageformatpage.ui |   16 +++++++++++++++-
 sw/source/core/layout/wsfrm.cxx   |    1 +
 sw/source/uibase/utlui/uitool.cxx |    6 ++++++
 5 files changed, 39 insertions(+), 1 deletion(-)

New commits:
commit d48a4174708ce0850577dba76dccaf85c4f6ffa1
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Apr 1 10:09:45 2021 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Apr 1 12:42:53 2021 +0200

    tdf#140343 sw page rtl gutter margin: add UI
    
    And extend SwFrame::UpdateAttrFrame() so that the layout is updated when
    the UI mutates the doc model.
    
    Change-Id: I4112388981187226f97ec39f4c44ffb3cc1e5253
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113440
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 1d92d275d3a1..e3c5aa4ed268 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -125,6 +125,7 @@ private:
     std::unique_ptr<weld::ComboBox> m_xRegisterLB;
     std::unique_ptr<weld::Label> m_xGutterPositionFT;
     std::unique_ptr<weld::ComboBox> m_xGutterPositionLB;
+    std::unique_ptr<weld::CheckButton> m_xRtlGutterCB;
     std::unique_ptr<weld::CheckButton> m_xBackgroundFullSizeCB;
     std::unique_ptr<weld::Label> m_xInsideLbl;
     std::unique_ptr<weld::Label> m_xOutsideLbl;
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index 53dfe1e5cb5d..729aef82bbfd 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -179,6 +179,7 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, 
weld::DialogController*
     , m_xRegisterLB(m_xBuilder->weld_combo_box("comboRegisterStyle"))
     , m_xGutterPositionFT(m_xBuilder->weld_label("labelGutterPosition"))
     , m_xGutterPositionLB(m_xBuilder->weld_combo_box("comboGutterPosition"))
+    , m_xRtlGutterCB(m_xBuilder->weld_check_button("checkRtlGutter"))
     , 
m_xBackgroundFullSizeCB(m_xBuilder->weld_check_button("checkBackgroundFullSize"))
     // Strings stored in UI
     , m_xInsideLbl(m_xBuilder->weld_label("labelInner"))
@@ -383,6 +384,14 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
             // Left.
             m_xGutterPositionLB->set_active(0);
         }
+        it = rGrabBagItem.GetGrabBag().find("RtlGutter");
+        bool bRtlGutter{};
+        if (it != rGrabBagItem.GetGrabBag().end())
+        {
+            it->second >>= bRtlGutter;
+            m_xRtlGutterCB->set_active(bRtlGutter);
+            m_xRtlGutterCB->show();
+        }
         it = rGrabBagItem.GetGrabBag().find("BackgroundFullSize");
         bool isBackgroundFullSize{};
         if (it != rGrabBagItem.GetGrabBag().end())
@@ -572,6 +581,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
     m_xHorzBox->save_state();
     m_xAdaptBox->save_state();
     m_xGutterPositionLB->save_value();
+    m_xRtlGutterCB->save_state();
     m_xBackgroundFullSizeCB->save_state();
 
     CheckMarginEdits( true );
@@ -669,6 +679,12 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
             aGrabBagItem.GetGrabBag()["GutterAtTop"] <<= bGutterAtTop;
             bModified = true;
         }
+        if (m_xRtlGutterCB->get_state_changed_from_saved())
+        {
+            bool const bRtlGutter(m_xRtlGutterCB->get_active());
+            aGrabBagItem.GetGrabBag()["RtlGutter"] <<= bRtlGutter;
+            bModified = true;
+        }
         if (m_xBackgroundFullSizeCB->get_state_changed_from_saved())
         {
             bool const 
isBackgroundFullSize(m_xBackgroundFullSizeCB->get_active());
diff --git a/cui/uiconfig/ui/pageformatpage.ui 
b/cui/uiconfig/ui/pageformatpage.ui
index b6974eebc15d..3a28c29409a5 100644
--- a/cui/uiconfig/ui/pageformatpage.ui
+++ b/cui/uiconfig/ui/pageformatpage.ui
@@ -706,6 +706,20 @@
                 <child>
                   <placeholder/>
                 </child>
+                <child>
+                  <object class="GtkCheckButton" id="checkRtlGutter">
+                    <property name="label" translatable="yes" 
context="pageformatpage|checkRtlGutter">Gutter on right side of page</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="no_show_all">True</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">8</property>
+                  </packing>
+                </child>
                 <child>
                   <object class="GtkCheckButton" id="checkBackgroundFullSize">
                     <property name="label" translatable="yes" 
context="pageformatpage|checkBackgroundFullSize">Background covers 
margins</property>
@@ -723,7 +737,7 @@
                   </object>
                   <packing>
                     <property name="left_attach">1</property>
-                    <property name="top_attach">8</property>
+                    <property name="top_attach">9</property>
                   </packing>
                 </child>
               </object>
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index fccf94925187..631d728ba4bd 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -536,6 +536,7 @@ void SwFrame::UpdateAttrFrame( const SfxPoolItem *pOld, 
const SfxPoolItem *pNew,
             [[fallthrough]];
         case RES_LR_SPACE:
         case RES_UL_SPACE:
+        case RES_RTL_GUTTER:
             rInvFlags |= 0x0B;
             break;
 
diff --git a/sw/source/uibase/utlui/uitool.cxx 
b/sw/source/uibase/utlui/uitool.cxx
index 24dc581bac2f..b971dc95bb2c 100644
--- a/sw/source/uibase/utlui/uitool.cxx
+++ b/sw/source/uibase/utlui/uitool.cxx
@@ -282,6 +282,10 @@ void ItemSetToPageDesc( const SfxItemSet& rSet, 
SwPageDesc& rPageDesc )
         {
             rMaster.SetFormatAttr(SfxBoolItem(RES_BACKGROUND_FULL_SIZE, 
bValue));
         }
+        if (pGrabBag->GetGrabBag().find("RtlGutter")->second >>= bValue)
+        {
+            rMaster.SetFormatAttr(SfxBoolItem(RES_RTL_GUTTER, bValue));
+        }
     }
 
     // Transfer all general frame attributes
@@ -593,6 +597,8 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, 
SfxItemSet& rSet)
     }
     oGrabBag->GetGrabBag()["BackgroundFullSize"] <<=
         
rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_BACKGROUND_FULL_SIZE)->GetValue();
+    oGrabBag->GetGrabBag()["RtlGutter"] <<=
+        rMaster.GetAttrSet().GetItem<SfxBoolItem>(RES_RTL_GUTTER)->GetValue();
     rSet.Put(*oGrabBag);
 }
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to