summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-02 12:22:15 +0100
committerAndras Timar <andras.timar@collabora.com>2021-04-01 08:48:04 +0200
commitc67b6871f73e2c6b6c925ff571a9ba6b2f34914f (patch)
tree4e18c907b8397e17f3ef4b15c77b839fcb461432
parent[cp] Let the PRODUCTVERSION be 2021 (diff)
downloadcore-c67b6871f73e2c6b6c925ff571a9ba6b2f34914f.tar.gz
core-c67b6871f73e2c6b6c925ff571a9ba6b2f34914f.zip
sw page gutter margin: add doc model
The page gutter defines the amount of extra space added to the specified margin, above any existing margin values. This can be helpful in case of printed books: e.g. 1cm left margin, 1cm right margin, then some additional gutter margin on the left can mean that once the book is printed and binding consumes its space, the remaining left/right margin is matching. This is just the doc model, other parts will come in follow-up commits. Change-Id: Ibd3e836ced664b57e817f5c0952098460b683089 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110290 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--editeng/source/items/frmitems.cxx5
-rw-r--r--include/editeng/lrspitem.hxx4
2 files changed, 9 insertions, 0 deletions
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 283fc2fb6eab..1f2d3975a995 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -288,6 +288,7 @@ SvxLRSpaceItem::SvxLRSpaceItem( const sal_uInt16 nId ) :
nTxtLeft ( 0 ),
nLeftMargin ( 0 ),
nRightMargin ( 0 ),
+ m_nGutterMargin(0),
nPropFirstLineOffset( 100 ),
nPropLeftMargin( 100 ),
nPropRightMargin( 100 ),
@@ -307,6 +308,7 @@ SvxLRSpaceItem::SvxLRSpaceItem( const tools::Long nLeft, const tools::Long nRigh
nTxtLeft ( nTLeft ),
nLeftMargin ( nLeft ),
nRightMargin ( nRight ),
+ m_nGutterMargin(0),
nPropFirstLineOffset( 100 ),
nPropLeftMargin( 100 ),
nPropRightMargin( 100 ),
@@ -471,6 +473,7 @@ bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const
return (
nFirstLineOffset == rOther.GetTextFirstLineOffset() &&
nTxtLeft == rOther.GetTextLeft() &&
+ m_nGutterMargin == rOther.GetGutterMargin() &&
nLeftMargin == rOther.GetLeft() &&
nRightMargin == rOther.GetRight() &&
nPropFirstLineOffset == rOther.GetPropTextFirstLineOffset() &&
@@ -593,6 +596,8 @@ void SvxLRSpaceItem::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nTxtLeft"), BAD_CAST(OString::number(nTxtLeft).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLeftMargin"), BAD_CAST(OString::number(nLeftMargin).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nRightMargin"), BAD_CAST(OString::number(nRightMargin).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nGutterMargin"),
+ BAD_CAST(OString::number(m_nGutterMargin).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropFirstLineOffset"), BAD_CAST(OString::number(nPropFirstLineOffset).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropLeftMargin"), BAD_CAST(OString::number(nPropLeftMargin).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropRightMargin"), BAD_CAST(OString::number(nPropRightMargin).getStr()));
diff --git a/include/editeng/lrspitem.hxx b/include/editeng/lrspitem.hxx
index b04944326407..9b3ec7734a8e 100644
--- a/include/editeng/lrspitem.hxx
+++ b/include/editeng/lrspitem.hxx
@@ -51,6 +51,8 @@ class EDITENG_DLLPUBLIC SvxLRSpaceItem final : public SfxPoolItem
tools::Long nTxtLeft; // We spend a sal_uInt16
tools::Long nLeftMargin; // nLeft or the negative first-line indent
tools::Long nRightMargin; // The unproblematic right edge
+ /// The amount of extra space added to the left margin.
+ tools::Long m_nGutterMargin;
sal_uInt16 nPropFirstLineOffset, nPropLeftMargin, nPropRightMargin;
short nFirstLineOffset; // First-line indent _always_ relative to nTxtLeft
@@ -116,6 +118,8 @@ public:
{ return nPropFirstLineOffset; }
void SetTextFirstLineOffsetValue( const short nValue )
{ nFirstLineOffset = nValue; }
+ void SetGutterMargin(const tools::Long nGutterMargin) { m_nGutterMargin = nGutterMargin; }
+ tools::Long GetGutterMargin() const { return m_nGutterMargin; }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
virtual boost::property_tree::ptree dumpAsJSON() const override;