[Libreoffice-commits] core.git: oox/source sw/qa
Szabolcs Toth (via logerrit)
logerrit at kemper.freedesktop.org
Fri Oct 30 10:54:19 UTC 2020
oox/source/vml/vmlshape.cxx | 4 +
sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx |binary
sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 34 +++++++++-
3 files changed, 37 insertions(+), 1 deletion(-)
New commits:
commit 799522882159b839cc7aeec2fbc48f767507a30c
Author: Szabolcs Toth <toth.szabolcs at nisz.hu>
AuthorDate: Wed Oct 28 09:50:00 2020 +0100
Commit: Balazs Varga <varga.balazs3 at nisz.hu>
CommitDate: Fri Oct 30 11:53:40 2020 +0100
tdf#137642 VML shape import: fix alignment from top margin
Use the new define PAGE_PRINT_AREA_TOP at import.
Everything else is handled in the previous patches.
Change-Id: Ie801ab71a33a657551dbc5bfb63d1491aaa73abd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104923
Tested-by: Jenkins
Reviewed-by: Balazs Varga <varga.balazs3 at nisz.hu>
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index a83cb6b2c76c..1e3e1f72e64d 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -608,6 +608,10 @@ static void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rType
{
rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA);
}
+ else if (rTypeModel.maPositionVerticalRelative == "top-margin-area")
+ {
+ rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA_TOP);
+ }
else if (rTypeModel.maPositionVerticalRelative == "bottom-margin-area")
{
rPropSet.setProperty(PROP_VertOrientRelation, text::RelOrientation::PAGE_PRINT_AREA_BOTTOM);
diff --git a/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx b/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx
new file mode 100644
index 000000000000..fbe8b264bbc4
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 4c0dfbf9ebbb..b9f01391e3f2 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -1560,8 +1560,9 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf115557, "tdf115557.docx")
assertXPath(pXmlDoc, "//w:footnote/w:p/w:r/w:drawing", 1);
}
-DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMargin, "tdf137641_RelativeFromTopMargin.docx")
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMarginDML, "tdf137641_RelativeFromTopMargin.docx")
{
+ // Import as DML.
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc,
@@ -1590,6 +1591,37 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMargin, "tdf1376
"center");
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAlignmentRelativeFromTopMarginVML, "tdf137642_Vertical_Alignment_toppage.docx")
+{
+ // Import as VML.
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+
+ assertXPath(pXmlDoc,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/"
+ "wp:anchor/wp:positionV",
+ "relativeFrom", "topMargin");
+ assertXPathContent(pXmlDoc,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/"
+ "wp:anchor/wp:positionV/wp:align",
+ "top");
+ assertXPath(pXmlDoc,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/"
+ "wp:anchor/wp:positionV",
+ "relativeFrom", "topMargin");
+ assertXPathContent(pXmlDoc,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/"
+ "wp:anchor/wp:positionV/wp:align",
+ "bottom");
+ assertXPath(pXmlDoc,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/"
+ "wp:anchor/wp:positionV",
+ "relativeFrom", "topMargin");
+ assertXPathContent(pXmlDoc,
+ "/w:document/w:body/w:p/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/"
+ "wp:anchor/wp:positionV/wp:align",
+ "center");
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list