summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzabolcs Toth <toth.szabolcs@nisz.hu>2020-10-15 16:13:08 +0200
committerLászló Németh <nemeth@numbertext.org>2020-10-29 17:52:48 +0100
commitbc9049851fd7e914fd695bcfb3c9a94a19634ce0 (patch)
tree2bc56c13a71ff0e8125b569c2a290a6474fa5cac
parentec7feef1bcd055098e49e55df3737148e62b75cb (diff)
tdf#137627 sw top page border orientation: add ODF
Map between RelOrientation::PAGE_PRINT_AREA_TOP and loext:vertical-rel="page-content-top". Follow-up of commit 1c593e1916c9164c7db71da2017cfc26972f8e9f (tdf#133045 sw: add shape alignment to the top page border). See also commit 65b7873aab5deec7157328047e869a6385e0a74a (sw from-bottom relative orientation: add ODF filter). Change-Id: I9bff7a9507152262dda7d126fa3e7e1bee6a8276 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104554 Tested-by: Jenkins Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--include/xmloff/xmltoken.hxx2
-rw-r--r--schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng2
-rw-r--r--sw/qa/extras/odfexport/data/page-content-top.odtbin0 -> 8561 bytes
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx9
-rw-r--r--xmloff/source/core/xmltoken.cxx2
-rw-r--r--xmloff/source/style/xmlexppr.cxx6
-rw-r--r--xmloff/source/text/txtprhdl.cxx2
-rw-r--r--xmloff/source/token/tokens.txt1
8 files changed, 24 insertions, 0 deletions
diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx
index 1b7a932f9399..99b94be7e2cc 100644
--- a/include/xmloff/xmltoken.hxx
+++ b/include/xmloff/xmltoken.hxx
@@ -3368,6 +3368,8 @@ namespace xmloff::token {
XML_RESOLVED,
+ XML_PAGE_CONTENT_TOP,
+
XML_PAGE_CONTENT_BOTTOM,
XML_TOKEN_END
diff --git a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
index 9167044ca87e..0c0b41ef4ca9 100644
--- a/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
+++ b/schema/libreoffice/OpenDocument-schema-v1.3+libreoffice.rng
@@ -2291,11 +2291,13 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.
</rng:optional>
</rng:define>
+ <!-- TODO: no proposal for loext:vertical-rel="page-content-top" -->
<!-- https://issues.oasis-open.org/browse/OFFICE-4073 -->
<rng:define name="common-vertical-rel-attlist" combine="interleave">
<rng:optional>
<rng:attribute name="loext:vertical-rel">
<rng:choice>
+ <rng:value>page-content-top</rng:value>
<rng:value>page-content-bottom</rng:value>
</rng:choice>
</rng:attribute>
diff --git a/sw/qa/extras/odfexport/data/page-content-top.odt b/sw/qa/extras/odfexport/data/page-content-top.odt
new file mode 100644
index 000000000000..755d50242e4e
--- /dev/null
+++ b/sw/qa/extras/odfexport/data/page-content-top.odt
Binary files differ
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 6c1f2d6ccff8..8767b76110bb 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -2624,6 +2624,15 @@ DECLARE_ODFEXPORT_TEST(testRovasNumbering, "rovas-numbering.odt")
aMap["NumberingType"].get<sal_uInt16>());
}
+DECLARE_ODFEXPORT_TEST(testPageContentTop, "page-content-top.odt")
+{
+ CPPUNIT_ASSERT_EQUAL(1, getShapes());
+ CPPUNIT_ASSERT_EQUAL(1, getPages());
+ uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
+ sal_Int16 nExpected = text::RelOrientation::PAGE_PRINT_AREA_TOP;
+ CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int16>(xShape, "VertOrientRelation"));
+}
+
DECLARE_ODFEXPORT_TEST(testPageContentBottom, "page-content-bottom.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getShapes());
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index d78de79842aa..23186f625a75 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3365,6 +3365,8 @@ namespace xmloff::token {
// For recording whether comments/annotations are resolved
TOKEN( "resolved", XML_RESOLVED ),
+ TOKEN( "page-content-top", XML_PAGE_CONTENT_TOP ),
+
TOKEN( "page-content-bottom", XML_PAGE_CONTENT_BOTTOM ),
#if OSL_DEBUG_LEVEL > 0
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
index b65669aed3c3..893e0fb36ee4 100644
--- a/xmloff/source/style/xmlexppr.cxx
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -1080,6 +1080,12 @@ void SvXMLExportPropertyMapper::_exportXML(
XML_NAMESPACE_LO_EXT,
mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex));
}
+ if (IsXMLToken(aValue, XML_PAGE_CONTENT_TOP))
+ {
+ sName = rNamespaceMap.GetQNameByKey(
+ XML_NAMESPACE_LO_EXT,
+ mpImpl->mxPropMapper->GetEntryXMLName(rProperty.mnIndex));
+ }
}
rAttrList.AddAttribute( sName, aValue );
diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx
index d430c09a8878..77dbcb1bdd27 100644
--- a/xmloff/source/text/txtprhdl.cxx
+++ b/xmloff/source/text/txtprhdl.cxx
@@ -153,6 +153,7 @@ SvXMLEnumMapEntry<sal_uInt16> const pXML_VertRel_Enum[] =
// DVO, OD 17.09.2003 #i18732# - allow vertical alignment at page
{ XML_PAGE, RelOrientation::PAGE_FRAME },
{ XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
+ { XML_PAGE_CONTENT_TOP, RelOrientation::PAGE_PRINT_AREA_TOP },
{ XML_PAGE_CONTENT_BOTTOM, RelOrientation::PAGE_PRINT_AREA_BOTTOM },
{ XML_FRAME, RelOrientation::FRAME }, // import only
{ XML_FRAME_CONTENT, RelOrientation::PRINT_AREA }, // import only
@@ -167,6 +168,7 @@ SvXMLEnumMapEntry<sal_uInt16> const pXML_VertRelPage_Enum[] =
{ XML_PAGE_CONTENT, RelOrientation::PRINT_AREA },
{ XML_PAGE, RelOrientation::PAGE_FRAME },
{ XML_PAGE_CONTENT, RelOrientation::PAGE_PRINT_AREA },
+ { XML_PAGE_CONTENT_TOP, RelOrientation::PAGE_PRINT_AREA_TOP },
{ XML_PAGE_CONTENT_BOTTOM, RelOrientation::PAGE_PRINT_AREA_BOTTOM },
{ XML_TOKEN_INVALID, 0 }
};
diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt
index 762879a26c27..a0019db4bf85 100644
--- a/xmloff/source/token/tokens.txt
+++ b/xmloff/source/token/tokens.txt
@@ -3124,5 +3124,6 @@ newline
creator-initials
transliteration-spellout
resolved
+page-content-top
page-content-bottom
TOKEN_END_DUMMY