sw/qa/extras/ooxmlexport/data/tdf137641_RelativeFromTopMargin.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport9.cxx | 30 ++++++++++ sw/source/filter/ww8/docxsdrexport.cxx | 3 + 3 files changed, 33 insertions(+)
New commits: commit c690d49770d0c93a95bd8c3d11e95c1d17a17a60 Author: Szabolcs Toth <toth.szabo...@nisz.hu> AuthorDate: Wed Oct 14 16:32:05 2020 +0200 Commit: László Németh <nem...@numbertext.org> CommitDate: Tue Oct 27 13:35:49 2020 +0100 tdf#137641 DOCX export: fix relative from top page border alignment. Follow-up of commit 1c593e1916c9164c7db71da2017cfc26972f8e9f (tdf#133045 sw: add shape alignment to the top page border). Change-Id: Ie5bc536556b72030d17829a917f91a15ad5157a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104660 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> diff --git a/sw/qa/extras/ooxmlexport/data/tdf137641_RelativeFromTopMargin.docx b/sw/qa/extras/ooxmlexport/data/tdf137641_RelativeFromTopMargin.docx new file mode 100644 index 000000000000..2cd299ff211a Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf137641_RelativeFromTopMargin.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index 1ff3ccf8ec3e..4c0dfbf9ebbb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -1560,6 +1560,36 @@ 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") +{ + xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); + + assertXPath(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV", + "relativeFrom", "topMargin"); + assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "top"); + assertXPath(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV", + "relativeFrom", "topMargin"); + assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[2]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV/wp:align", + "bottom"); + assertXPath(pXmlDoc, + "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent[3]/mc:Choice/w:drawing/" + "wp:anchor/wp:positionV", + "relativeFrom", "topMargin"); + assertXPathContent(pXmlDoc, + "/w:document/w:body/w:p[2]/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: */ diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index a1656ea75fab..41ca25235c48 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -509,6 +509,9 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons case text::RelOrientation::PAGE_PRINT_AREA: relativeFromV = "margin"; break; + case text::RelOrientation::PAGE_PRINT_AREA_TOP: + relativeFromV = "topMargin"; + break; case text::RelOrientation::PAGE_PRINT_AREA_BOTTOM: relativeFromV = "bottomMargin"; break; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits