tdf#104565 DOCX drawing object export: fix arrow positions
Saving some arrows from ODT to DOCX scattered them around
their correct position. This happened because of a function that
recalculates the position of drawing objects when they are rotated,
according to the rotation. It turns out we don't have to do this
with lines and such.
Co-Author: Balázs Regényi
Change-Id: Iea6a34d15003cacc27a8030cb73511aba39225f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90989
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx b/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx
new file mode 100644
index 0000000..514eedd
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 498cf8a..99aa70e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -1115,6 +1115,18 @@
CPPUNIT_ASSERT(arrowStyle.indexOf(u"flip:xy") != sal_Int32(-1));
}
DECLARE_OOXMLEXPORT_TEST(testArrowPosition, "tdf104565_ArrowPosition.docx")
{
// tdf#104565: Test correct position.
xmlDocPtr pXmlDocument = parseExport("word/document.xml");
if (!pXmlDocument)
return;
// This is the correct Y coordinate, the incorrect was 817880.
assertXPathContent(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"
"/wp:positionV/wp:posOffset", "516255");
}
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 fbdee23..66ab33a 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -441,8 +441,12 @@
->getIDocumentDrawModelAccess()
.GetInvisibleHellId();
nRotation = pObj->GetRotateAngle();
lclMovePositionWithRotation(aPos, rSize, nRotation);
// Do not do this with lines.
if (pObj->GetObjIdentifier() != OBJ_LINE)
{
nRotation = pObj->GetRotateAngle();
lclMovePositionWithRotation(aPos, rSize, nRotation);
}
}
attrList->add(XML_behindDoc, bOpaque ? "0" : "1");
// Extend distance with the effect extent if the shape is not rotated, which is the opposite