summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzabolcs Toth <toth.szabolcs@nisz.hu>2020-10-28 09:50:00 +0100
committerBalazs Varga <varga.balazs3@nisz.hu>2020-10-30 11:53:40 +0100
commit799522882159b839cc7aeec2fbc48f767507a30c (patch)
tree53026582651de46eb683c5f5fb5a72164d85142a
parentFix unoidl-check build condition for cross builds (diff)
downloadcore-799522882159b839cc7aeec2fbc48f767507a30c.tar.gz
core-799522882159b839cc7aeec2fbc48f767507a30c.zip
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@nisz.hu>
-rw-r--r--oox/source/vml/vmlshape.cxx4
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docxbin0 -> 13163 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx34
3 files changed, 37 insertions, 1 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf137642_Vertical_Alignment_toppage.docx
Binary files 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: */