[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.4' - 2 commits - editeng/source include/editeng offapi/com sw/inc sw/source
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Tue Feb 9 09:28:28 UTC 2021
editeng/source/items/frmitems.cxx | 14 ++++++++++++++
include/editeng/lrspitem.hxx | 4 ++++
include/editeng/memberids.h | 1 +
offapi/com/sun/star/style/PageProperties.idl | 7 +++++++
sw/inc/unoprnms.hxx | 1 +
sw/source/core/unocore/unomap1.cxx | 1 +
6 files changed, 28 insertions(+)
New commits:
commit 2ca7964b50756b1e071c432b15eea7f079486f6c
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 2 15:49:16 2021 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Feb 9 09:59:28 2021 +0100
sw page gutter margin: add UNO API
SvxLRSpaceItem is used for all sorts of left/right margins, but gutter
only makes sense for pages, so only expose the gutter margin in the page
properties.
(cherry picked from commit 947277146e4c1ff7544371095fcc6bd5842b2d98)
Conflicts:
sw/source/core/unocore/unomap1.cxx
Change-Id: Icfca2499e944081b70bbdbc4c62e78cade25f5c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110620
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 2fde6817e43c..0de646470ecb 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -391,6 +391,11 @@ bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
rVal <<= IsAutoFirst();
break;
+ case MID_GUTTER_MARGIN:
+ rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(m_nGutterMargin)
+ : m_nGutterMargin);
+ break;
+
default:
bRet = false;
// SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have?
@@ -466,6 +471,10 @@ bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
SetAutoFirst( Any2Bool(rVal) );
break;
+ case MID_GUTTER_MARGIN:
+ SetGutterMargin(bConvert ? convertMm100ToTwip(nVal) : nVal);
+ break;
+
default:
OSL_FAIL("unknown MemberId");
return false;
diff --git a/include/editeng/memberids.h b/include/editeng/memberids.h
index bec53ca51002..0779345a6f77 100644
--- a/include/editeng/memberids.h
+++ b/include/editeng/memberids.h
@@ -129,6 +129,7 @@
#define MID_FIRST_LINE_REL_INDENT 9
#define MID_FIRST_AUTO 10
#define MID_TXT_LMARGIN 11
+#define MID_GUTTER_MARGIN 12
//ProtectItem
#define MID_PROTECT_CONTENT 0
diff --git a/offapi/com/sun/star/style/PageProperties.idl b/offapi/com/sun/star/style/PageProperties.idl
index 73242f230f90..dccd63f20b04 100644
--- a/offapi/com/sun/star/style/PageProperties.idl
+++ b/offapi/com/sun/star/style/PageProperties.idl
@@ -487,6 +487,13 @@ published service PageProperties
@since LibreOffice 6.1
*/
[optional, property, maybevoid] com::sun::star::graphic::XGraphic FooterBackGraphic;
+
+ /** determines the gutter margin of the page.
+
+ @since LibreOffice 7.2
+ */
+ [optional, property] long GutterMargin;
+
};
}; }; }; };
diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index eea6be637f62..1100a72508fb 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -66,6 +66,7 @@
#define UNO_NAME_PARA_HYPHENATION_NO_CAPS "ParaHyphenationNoCaps"
#define UNO_NAME_LEFT_MARGIN "LeftMargin"
#define UNO_NAME_RIGHT_MARGIN "RightMargin"
+#define UNO_NAME_GUTTER_MARGIN "GutterMargin"
#define UNO_NAME_HEADER_LEFT_MARGIN "HeaderLeftMargin"
#define UNO_NAME_HEADER_RIGHT_MARGIN "HeaderRightMargin"
#define UNO_NAME_FOOTER_LEFT_MARGIN "FooterLeftMargin"
diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx
index 4a8587ac81b9..08c97f878703 100644
--- a/sw/source/core/unocore/unomap1.cxx
+++ b/sw/source/core/unocore/unomap1.cxx
@@ -491,6 +491,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPageStylePropertyMa
{ OUString(UNO_NAME_BACK_TRANSPARENT), RES_BACKGROUND, cppu::UnoType<bool>::get(), PROPERTY_NONE ,MID_GRAPHIC_TRANSPARENT },
{ OUString(UNO_NAME_LEFT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, LEFT_BORDER |CONVERT_TWIPS },
{ OUString(UNO_NAME_RIGHT_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, RIGHT_BORDER |CONVERT_TWIPS },
+ { OUString(UNO_NAME_GUTTER_MARGIN), RES_LR_SPACE, cppu::UnoType<sal_Int32>::get(), PROPERTY_NONE, MID_GUTTER_MARGIN | CONVERT_TWIPS},
{ OUString(UNO_NAME_TOP_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, TOP_BORDER |CONVERT_TWIPS },
{ OUString(UNO_NAME_BOTTOM_BORDER), RES_BOX, cppu::UnoType<css::table::BorderLine>::get(), 0, BOTTOM_BORDER|CONVERT_TWIPS },
{ OUString(UNO_NAME_BORDER_DISTANCE), RES_BOX, cppu::UnoType<sal_Int32>::get(), 0, BORDER_DISTANCE|CONVERT_TWIPS },
commit 80cd760a21a0b752e4b0a540ed5eb4c9f4d41481
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 2 12:22:15 2021 +0100
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Feb 9 09:04:13 2021 +0100
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.
(cherry picked from commit 48829edfb148ff61d1e03319547151380899ba63)
Conflicts:
editeng/source/items/frmitems.cxx
include/editeng/lrspitem.hxx
Change-Id: Ibd3e836ced664b57e817f5c0952098460b683089
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110597
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 8eb8ba879533..2fde6817e43c 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -308,6 +308,7 @@ SvxLRSpaceItem::SvxLRSpaceItem( const sal_uInt16 nId ) :
nTxtLeft ( 0 ),
nLeftMargin ( 0 ),
nRightMargin ( 0 ),
+ m_nGutterMargin(0),
nPropFirstLineOfst( 100 ),
nPropLeftMargin( 100 ),
nPropRightMargin( 100 ),
@@ -327,6 +328,7 @@ SvxLRSpaceItem::SvxLRSpaceItem( const long nLeft, const long nRight,
nTxtLeft ( nTLeft ),
nLeftMargin ( nLeft ),
nRightMargin ( nRight ),
+ m_nGutterMargin(0),
nPropFirstLineOfst( 100 ),
nPropLeftMargin( 100 ),
nPropRightMargin( 100 ),
@@ -491,6 +493,7 @@ bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const
return (
nFirstLineOfst == rOther.GetTextFirstLineOfst() &&
nTxtLeft == rOther.GetTextLeft() &&
+ m_nGutterMargin == rOther.GetGutterMargin() &&
nLeftMargin == rOther.GetLeft() &&
nRightMargin == rOther.GetRight() &&
nPropFirstLineOfst == rOther.GetPropTextFirstLineOfst() &&
@@ -615,6 +618,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("nPropFirstLineOfst"), BAD_CAST(OString::number(nPropFirstLineOfst).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 3c5a06f1fe83..b31a5c6de1d6 100644
--- a/include/editeng/lrspitem.hxx
+++ b/include/editeng/lrspitem.hxx
@@ -51,6 +51,8 @@ class EDITENG_DLLPUBLIC SvxLRSpaceItem final : public SfxPoolItem
long nTxtLeft; // We spend a sal_uInt16
long nLeftMargin; // nLeft or the negative first-line indent
long nRightMargin; // The unproblematic right edge
+ /// The amount of extra space added to the left margin.
+ long m_nGutterMargin;
sal_uInt16 nPropFirstLineOfst, nPropLeftMargin, nPropRightMargin;
short nFirstLineOfst; // First-line indent _always_ relative to nTxtLeft
@@ -116,6 +118,8 @@ public:
{ return nPropFirstLineOfst; }
void SetTextFirstLineOfstValue( const short nValue )
{ nFirstLineOfst = nValue; }
+ void SetGutterMargin(const long nGutterMargin) { m_nGutterMargin = nGutterMargin; }
+ long GetGutterMargin() const { return m_nGutterMargin; }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
virtual boost::property_tree::ptree dumpAsJSON() const override;
More information about the Libreoffice-commits
mailing list