summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-02-03 15:36:03 +0100
committerMiklos Vajna <vmiklos@collabora.com>2021-02-09 14:10:44 +0100
commit4e544c7776207d2c7725e10a13896c9eb3265370 (patch)
tree0b1a3b7136a15866f1afc012208df82d3a22ed7d
parentabcb758941d955bd5f822ae164fdcdd7870d1d55 (diff)
tdf#91920 sw page gutter margin: add ODF filter
Note that the context filter is not set, since fo:margin affects left margin, but should not affect the gutter margin. Also put the new entry at the end, but before the header and footer sections, so the attribute is written to the correct XML element. (cherry picked from commit 11e91719ef362e38b3b92e525763a5a89f4eeecb) Conflicts: schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng Change-Id: I3588d4e76cd713efed168eb93b9456bba96727fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110627 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--include/xmloff/xmltoken.hxx1
-rw-r--r--schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng11
-rw-r--r--sw/qa/extras/odfexport/data/gutter-left.odtbin0 -> 19355 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx13
-rw-r--r--xmloff/source/core/xmltoken.cxx1
-rw-r--r--xmloff/source/style/PageMasterStyleMap.cxx3
-rw-r--r--xmloff/source/token/tokens.txt1
7 files changed, 30 insertions, 0 deletions
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index daa4a74db6a2..74e51fb7c41e 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3371,6 +3371,7 @@ namespace xmloff { namespace token {
XML_RESOLVED,
XML_PAGE_CONTENT_BOTTOM,
+ XML_MARGIN_GUTTER,
XML_TOKEN_END
};
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 7058d37de220..f99e708a2a52 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2274,6 +2274,17 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
</rng:optional>
</rng:define>
+ <!-- TODO: no proposal for loext:margin-gutter="..." -->
+ <rng:define name="style-page-layout-properties-attlist" combine="interleave">
+ <rng:optional>
+ <rng:attribute name="loext:margin-gutter">
+ <rng:choice>
+ <rng:ref name="length"/>
+ </rng:choice>
+ </rng:attribute>
+ </rng:optional>
+ </rng:define>
+
<!-- just a test-case for user-defined attributes, move along, nothing to see here... -->
<rng:define name="style-table-cell-properties-attlist" combine="interleave">
<rng:optional>
diff --git a/sw/qa/extras/odfexport/data/gutter-left.odt b/sw/qa/extras/odfexport/data/gutter-left.odt
new file mode 100644
index 000000000000..a5ce541ef078
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/gutter-left.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index a9cc169a6116..7bdb9163e372 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2442,5 +2442,18 @@ DECLARE_ODFEXPORT_TEST(tdf135942, "nestedTableInFooter.odt")
}
}
+DECLARE_ODFEXPORT_TEST(testGutterLeft, "gutter-left.odt")
+{
+ uno::Reference<beans::XPropertySet> xPageStyle;
+ getStyles("PageStyles")->getByName("Standard") >>= xPageStyle;
+ sal_Int32 nGutterMargin{};
+ xPageStyle->getPropertyValue("GutterMargin") >>= nGutterMargin;
+ // Without the accompanying fix in place, this test would have failed with:
+ // - Expected: 1270
+ // - Actual : 0
+ // i.e. gutter margin was lost.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270), nGutterMargin);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 5dea024e336f..3978c2673edc 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3364,6 +3364,7 @@ namespace xmloff { namespace token {
TOKEN( "resolved", XML_RESOLVED ),
TOKEN( "page-content-bottom", XML_PAGE_CONTENT_BOTTOM ),
+ TOKEN("margin-gutter", XML_MARGIN_GUTTER),
#if OSL_DEBUG_LEVEL > 0
{ 0, nullptr, nullptr, XML_TOKEN_END }
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index 641b7471450d..dc6290fd4e8d 100644
--- a/xmloff/source/style/PageMasterStyleMap.cxx
+++ b/xmloff/source/style/PageMasterStyleMap.cxx
@@ -31,6 +31,8 @@ using namespace ::xmloff::token;
MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_012)
#define PLMAP_ODF13(name,prefix,token,type,context) \
MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_013)
+#define PLMAP_EXT(name,prefix,token,type,context) \
+ MAP(name, prefix, token, type|XML_TYPE_PROP_PAGE_LAYOUT, context, SvtSaveOptions::ODFSVER_FUTURE_EXTENDED)
#define HFMAP(name,prefix,token,type,context) \
MAP(name, prefix, token, type|XML_TYPE_PROP_HEADER_FOOTER, context, SvtSaveOptions::ODFSVER_010)
@@ -153,6 +155,7 @@ const XMLPropertyMapEntry aXMLPageMasterStyleMap[] =
PLMAP( "FootnoteLineTextDistance", XML_NAMESPACE_STYLE, XML__EMPTY, XML_TYPE_MEASURE|MID_FLAG_SPECIAL_ITEM, CTF_PM_FTN_LINE_DISTANCE ),
PLMAP( "FootnoteLineWeight", XML_NAMESPACE_STYLE, XML_FOOTNOTE_SEP, XML_TYPE_MEASURE16|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_WEIGHT ),
PLMAP( "FootnoteLineStyle", XML_NAMESPACE_STYLE, XML_EMPTY, XML_TYPE_STRING|MID_FLAG_ELEMENT_ITEM, CTF_PM_FTN_LINE_STYLE ),
+ PLMAP_EXT("GutterMargin", XML_NAMESPACE_LO_EXT, XML_MARGIN_GUTTER, XML_TYPE_MEASURE, 0),
//////////////////////////////////////////////////////////////////////////
//Index 92: Section for 'header-style' own section, all members *have* to use CTF_PM_HEADERFLAG in the context entry (the 5th one)
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 8d4fe1b66358..e20206b5b96a 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -3131,4 +3131,5 @@ creator-initials
transliteration-spellout
resolved
page-content-bottom
+margin-gutter
TOKEN_END_DUMMY