summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSzabolcs Toth <szabolcs450@gmail.com>2020-06-18 15:58:32 +0200
committerLászló Németh <nemeth@numbertext.org>2020-07-15 13:11:29 +0200
commit6479096dc2bd40215ff80273b4d27cadb2688cb1 (patch)
tree4e16dcb12546cb3519712d19860d3694a64c631d /sw
parenta7350a3759fd651c3cae1b7ed67cea0d55725ce2 (diff)
tdf#120760 DOCX shape import: fix Z-order with behindDoc
DrawingML attribute relativeHeight contains z-indices for shape Z-order, but this depends on behindDoc, too. We can use z-index = relativeHeight - MAX_INT32 on shapes with behindDoc=true, as a simple workaround to get correct Z-order, because unsigned relativeHeight values stored in sal_Int32, and MIN_INT32 <= -MAX_INT32, and the temporary negative z-indices will converted by GraphicZOrderHelper. Note: this commit doesn't fix the old writerfilter implementation problem, that DOCX relativeHeight is an unsignedInt value according to W3C XML Schema, i.e. its maximal value is 4294967295 (MAX_UINT32), not 2147483647 (MAX_INT32). Co-authored-by: Balázs Regényi Change-Id: I54a72a95bc69b307b2835636fff376b0aa9bc45c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96614 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docxbin0 -> 40418 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx16
2 files changed, 16 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx
new file mode 100644
index 000000000000..77a6d48dd866
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf120760_ZOrderInHeader.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index 480e9c700c08..c4208ada642a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -1319,6 +1319,22 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf112287, "tdf112287.docx")
assertXPath(pXmlDocument, "/w:document/w:body/w:p[2]/w:pPr/w:framePr","vAnchor","margin");
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testZOrderInHeader, "tdf120760_ZOrderInHeader.docx")
+{
+ // tdf#120760 Check that the Z-Order of the background is smaller than the front shape's.
+ xmlDocUniquePtr pXml = parseExport("word/header1.xml");
+ if (!pXml)
+ return;
+
+ // Get the Z-Order of the background image and of the shape in front of it.
+ sal_Int32 nBackground = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/w:drawing/wp:anchor", "relativeHeight").toInt32();
+ sal_Int32 nFrontShape = getXPath(pXml, "/w:hdr/w:p[1]/w:r[1]/mc:AlternateContent[2]"
+ "/mc:Choice/w:drawing/wp:anchor", "relativeHeight").toInt32();
+
+ // Assert that background is in the back.
+ CPPUNIT_ASSERT(nBackground < nFrontShape);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */