cui/source/inc/page.hxx           |    2 ++
 cui/source/tabpages/page.cxx      |   24 +++++++++++++++++++++++-
 cui/uiconfig/ui/pageformatpage.ui |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+), 1 deletion(-)

New commits:
commit e1d7242341ec148b631a96e6d63697bce6a497c9
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Feb 4 14:07:21 2021 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Feb 4 16:52:03 2021 +0100

    tdf#91920 sw page gutter margin: add UI
    
    Also update the preview widget and hide the new UI in Calc/Impress.
    
    Change-Id: Ic5c0ba100f6e886651d83c04961e9f0566a4202c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110414
    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 1513347e481f..d4a39f9b68e3 100644
--- a/cui/source/inc/page.hxx
+++ b/cui/source/inc/page.hxx
@@ -106,6 +106,8 @@ private:
     std::unique_ptr<weld::MetricSpinButton> m_xRightMarginEdit;
     std::unique_ptr<weld::MetricSpinButton> m_xTopMarginEdit;
     std::unique_ptr<weld::MetricSpinButton> m_xBottomMarginEdit;
+    std::unique_ptr<weld::Label> m_xGutterMarginLbl;
+    std::unique_ptr<weld::MetricSpinButton> m_xGutterMarginEdit;
     // layout settings
     std::unique_ptr<weld::Label> m_xPageText;
     std::unique_ptr<weld::ComboBox> m_xLayoutBox;
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index e478fbc5f492..9a4ee5003f59 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -162,6 +162,8 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, 
weld::DialogController*
     , m_xRightMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargRight", 
FieldUnit::CM))
     , m_xTopMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargTop", 
FieldUnit::CM))
     , m_xBottomMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargBot", 
FieldUnit::CM))
+    , m_xGutterMarginLbl(m_xBuilder->weld_label("labelGutterMargin"))
+    , m_xGutterMarginEdit(m_xBuilder->weld_metric_spin_button("spinMargGut", 
FieldUnit::CM))
     , m_xPageText(m_xBuilder->weld_label("labelPageLayout"))
     , m_xLayoutBox(m_xBuilder->weld_combo_box("comboPageLayout"))
     , m_xNumberFormatText(m_xBuilder->weld_label("labelPageNumbers"))
@@ -231,6 +233,7 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, 
weld::DialogController*
     SetFieldUnit( *m_xRightMarginEdit, eFUnit );
     SetFieldUnit( *m_xTopMarginEdit, eFUnit );
     SetFieldUnit( *m_xBottomMarginEdit, eFUnit );
+    SetFieldUnit(*m_xGutterMarginEdit, eFUnit);
     SetFieldUnit( *m_xPaperWidthEdit, eFUnit );
     SetFieldUnit( *m_xPaperHeightEdit, eFUnit );
 
@@ -281,6 +284,9 @@ SvxPageDescPage::SvxPageDescPage(weld::Container* pPage, 
weld::DialogController*
     
m_xRightMarginEdit->set_max(m_xRightMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperRightMargin()),
 FieldUnit::MM);
     
m_xTopMarginEdit->set_max(m_xTopMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperTopMargin()),
 FieldUnit::MM);
     
m_xBottomMarginEdit->set_max(m_xBottomMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperBottomMargin()),
 FieldUnit::MM);
+    m_xGutterMarginEdit->set_max(
+        
m_xGutterMarginEdit->normalize(aDrawinglayerOpt.GetMaximumPaperLeftMargin()),
+        FieldUnit::MM);
 
     // Get the i18n framework numberings and add them to the listbox.
     
SvxNumOptionsTabPageHelper::GetI18nNumbering(m_xNumberFormatBox->get_widget(), 
std::numeric_limits<sal_uInt16>::max());
@@ -311,6 +317,7 @@ void SvxPageDescPage::Init_Impl()
     m_xRightMarginEdit->connect_value_changed(aLink);
     m_xTopMarginEdit->connect_value_changed(aLink);
     m_xBottomMarginEdit->connect_value_changed(aLink);
+    m_xGutterMarginEdit->connect_value_changed(aLink);
 
     m_xHorzBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
     m_xVertBox->connect_toggled(LINK(this, SvxPageDescPage, CenterHdl_Impl));
@@ -329,6 +336,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
     {
         const SvxLRSpaceItem& rLRSpace = static_cast<const 
SvxLRSpaceItem&>(*pItem);
         SetMetricValue( *m_xLeftMarginEdit, rLRSpace.GetLeft(), eUnit );
+        SetMetricValue(*m_xGutterMarginEdit, rLRSpace.GetGutterMargin(), 
eUnit);
         m_aBspWin.SetLeft(
             static_cast<sal_uInt16>(ConvertLong_Impl( rLRSpace.GetLeft(), 
eUnit )) );
         SetMetricValue( *m_xRightMarginEdit, rLRSpace.GetRight(), eUnit );
@@ -470,6 +478,9 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
             m_aBspWin.SetHorz(m_xHorzBox->get_active());
             m_aBspWin.SetVert(m_xVertBox->get_active());
 
+            m_xGutterMarginLbl->hide();
+            m_xGutterMarginEdit->hide();
+
             break;
         }
 
@@ -485,6 +496,9 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
             m_xLayoutBox->hide();
             m_xPageText->hide();
 
+            m_xGutterMarginLbl->hide();
+            m_xGutterMarginEdit->hide();
+
             break;
         }
         default: ;//prevent warning
@@ -506,6 +520,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
     m_xRightMarginEdit->save_value();
     m_xTopMarginEdit->save_value();
     m_xBottomMarginEdit->save_value();
+    m_xGutterMarginEdit->save_value();
     m_xLayoutBox->save_value();
     m_xNumberFormatBox->save_value();
     m_xPaperSizeBox->save_value();
@@ -585,6 +600,12 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
         bModified = true;
     }
 
+    if (m_xGutterMarginEdit->get_value_changed_from_saved())
+    {
+        
aMargin.SetGutterMargin(static_cast<sal_uInt16>(GetCoreValue(*m_xGutterMarginEdit,
 eUnit)));
+        bModified = true;
+    }
+
     // set left and right margins
     if (bModified)
     {
@@ -1003,7 +1024,8 @@ void SvxPageDescPage::UpdateExample_Impl( bool 
bResetbackground )
     // Margins
     m_aBspWin.SetTop( GetCoreValue( *m_xTopMarginEdit, MapUnit::MapTwip ) );
     m_aBspWin.SetBottom( GetCoreValue( *m_xBottomMarginEdit, MapUnit::MapTwip 
) );
-    m_aBspWin.SetLeft( GetCoreValue( *m_xLeftMarginEdit, MapUnit::MapTwip ) );
+    m_aBspWin.SetLeft(GetCoreValue(*m_xLeftMarginEdit, MapUnit::MapTwip)
+                      + GetCoreValue(*m_xGutterMarginEdit, MapUnit::MapTwip));
     m_aBspWin.SetRight( GetCoreValue( *m_xRightMarginEdit, MapUnit::MapTwip ) 
);
 
     // Layout
diff --git a/cui/uiconfig/ui/pageformatpage.ui 
b/cui/uiconfig/ui/pageformatpage.ui
index f37a15a250d5..cc8bef5433b3 100644
--- a/cui/uiconfig/ui/pageformatpage.ui
+++ b/cui/uiconfig/ui/pageformatpage.ui
@@ -449,6 +449,38 @@
                     <property name="top_attach">3</property>
                   </packing>
                 </child>
+                <child>
+                  <object class="GtkLabel" id="labelGutterMargin">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes" 
context="pageformatpage|labelGutterMargin">Gutter:</property>
+                    <property name="use_underline">True</property>
+                    <property name="mnemonic_widget">spinMargBot</property>
+                    <property name="xalign">0</property>
+                    <accessibility>
+                      <relation type="label-for" target="spinMargGut"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="spinMargGut">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="activates_default">True</property>
+                    <property name="truncate_multiline">True</property>
+                    <accessibility>
+                      <relation type="labelled-by" target="labelGutterMargin"/>
+                    </accessibility>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">4</property>
+                  </packing>
+                </child>
               </object>
             </child>
             <child type="label">
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to