[Libreoffice-commits] core.git: sw/qa sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Feb 12 02:31:44 PST 2014
sw/qa/extras/ooxmlexport/data/dml-zorder.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 +++++++++
sw/source/filter/ww8/docxsdrexport.cxx | 3 ++-
3 files changed, 11 insertions(+), 1 deletion(-)
New commits:
commit 9e3e7f89a0f1faf67b438098281ed6f659eac91e
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Wed Feb 12 11:17:36 2014 +0100
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
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 0000000..ba799a5
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/dml-zorder.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2a4ee6e..9bdbe36 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 205751b..a99f5ea 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");
More information about the Libreoffice-commits
mailing list