summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-04 14:07:21 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-09 17:08:50 +0100
commit3739a08653fbdb2c9268f7386dfccfad052aca82 (patch)
tree1a0e916566030be92c651996eacf5b54c311bd9d
parent7a55bce5effb2ca89a0a386182a1dbabfac0c889 (diff)
tdf#91920 sw page gutter margin: add UI
Also update the preview widget and hide the new UI in Calc/Impress. (cherry picked from commit e1d7242341ec148b631a96e6d63697bce6a497c9) Change-Id: Ic5c0ba100f6e886651d83c04961e9f0566a4202c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110638 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--cui/source/inc/page.hxx2
-rw-r--r--cui/source/tabpages/page.cxx24
-rw-r--r--cui/uiconfig/ui/pageformatpage.ui32
3 files changed, 57 insertions, 1 deletions
diff --git a/cui/source/inc/page.hxx b/cui/source/inc/page.hxx
index 1019a9fbc214..a2d2dcf5dda4 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 508984bf882b..7a46f0fa2ae5 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 );
@@ -478,6 +486,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;
}
@@ -493,6 +504,9 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
m_xLayoutBox->hide();
m_xPageText->hide();
+ m_xGutterMarginLbl->hide();
+ m_xGutterMarginEdit->hide();
+
break;
}
default: ;//prevent warning
@@ -514,6 +528,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();
@@ -593,6 +608,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)
{
@@ -1012,7 +1033,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 0135d61e7457..3e6b46452f25 100644
--- a/cui/uiconfig/ui/pageformatpage.ui
+++ b/cui/uiconfig/ui/pageformatpage.ui
@@ -463,6 +463,38 @@
</child>
</object>
</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">