diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index cba305a70610..96bff94874dd 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3397,6 +3397,7 @@ namespace xmloff::token {
XML_PAGE_CONTENT_TOP,
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 0c0b41ef4ca9..89913cbf7e63 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2291,7 +2291,6 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
-
@@ -2304,6 +2303,17 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
+
+
+
+
+
+
+
+
+
+
+
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
Binary files /dev/null and b/sw/qa/extras/odfexport/data/gutter-left.odt differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 15704c8eeaad..98712ae76fdc 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2686,5 +2686,18 @@ DECLARE_ODFEXPORT_EXPORTONLY_TEST(tdf135942, "nestedTableInFooter.odt")
assertXPath(pXmlDoc, "/office:document-styles/office:automatic-styles/style:style[@style:family='table']", 2);
}
+DECLARE_ODFEXPORT_TEST(testGutterLeft, "gutter-left.odt")
+{
+ uno::Reference 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(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 bc8b04334ead..a75b152fb23b 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3394,6 +3394,7 @@ namespace xmloff::token {
TOKEN( "page-content-top", XML_PAGE_CONTENT_TOP ),
TOKEN( "page-content-bottom", XML_PAGE_CONTENT_BOTTOM ),
+ TOKEN("margin-gutter", XML_MARGIN_GUTTER),
#if OSL_DEBUG_LEVEL > 0
{ 0, nullptr, std::nullopt, XML_TOKEN_END }
diff --git a/xmloff/source/style/PageMasterStyleMap.cxx b/xmloff/source/style/PageMasterStyleMap.cxx
index 18519b9132dc..d7b9f41e8f02 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 e23cd24abda6..930046909201 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -3152,4 +3152,5 @@ transliteration-spellout
resolved
page-content-top
page-content-bottom
+margin-gutter
TOKEN_END_DUMMY