summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-02-12 11:17:36 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-12 11:31:20 +0100
commit9e3e7f89a0f1faf67b438098281ed6f659eac91e (patch)
tree6b08168f109b8a4a8bd5e9dede6c71f6f3401fbf
parent1a12777f46954045afbe8fffa6dd199b4b338762 (diff)
DOCX export: avoid 0 or 1 relativeHeight when it's a real value
The z-order can be any number, Word uses kind of random 32bit integers, we count from 0. It turns out 0 and 1 may have some special meaning, as counting from 2 (instead of 0) fixes the visibility the problems in the bugdoc. Change-Id: I695a625fc0ab8206cc09896bcf02ff7689f1defc
-rw-r--r--sw/qa/extras/ooxmlexport/data/dml-zorder.odtbin0 -> 9704 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx9
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx3
3 files changed, 11 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/dml-zorder.odt b/sw/qa/extras/ooxmlexport/data/dml-zorder.odt
new file mode 100644
index 000000000000..ba799a547e58
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/dml-zorder.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2a4ee6eb3596..9bdbe36e2e08 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2277,6 +2277,15 @@ DECLARE_OOXMLEXPORT_TEST(testDmlShapeTitle, "dml-shape-title.docx")
CPPUNIT_ASSERT_EQUAL(OUString("Description"), getProperty<OUString>(getShape(1), "Description"));
}
+DECLARE_OOXMLEXPORT_TEST(testDmlZorder, "dml-zorder.odt")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ // This was "0": causing that in Word, the second shape was on top, while in the original odt the first shape is on top.
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor", "relativeHeight", "2");
+}
+
DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 205751b835e3..a99f5eade8ed 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -203,7 +203,8 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrmFmt* pFrmFmt, const Size& rS
attrList->add(XML_layoutInCell, "1");
attrList->add(XML_allowOverlap, "1"); // TODO
if (const SdrObject* pObj = pFrmFmt->FindRealSdrObject())
- attrList->add(XML_relativeHeight, OString::number(pObj->GetOrdNum()));
+ // It seems 0 and 1 have special meaning: just start counting from 2 to avoid issues with that.
+ attrList->add(XML_relativeHeight, OString::number(pObj->GetOrdNum() + 2));
else
// relativeHeight is mandatory attribute, if value is not present, we must write default value
attrList->add(XML_relativeHeight, "0");