diff options
| author | Szabolcs <szabolcs450@gmail.com> | 2020-03-24 15:38:14 +0100 |
|---|---|---|
| committer | László Németh <nemeth@numbertext.org> | 2020-04-08 12:54:45 +0200 |
| commit | 08a11f8fe19560b000c62da00d7425b4f500d605 (patch) | |
| tree | 418d37486d2a60bb829d252ab7dea5c5f639826e | |
| parent | 792c730f3cda4f5c312921a62ecae3d322ad9b72 (diff) | |
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>
| -rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx | bin | 0 -> 4980 bytes | |||
| -rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 12 | ||||
| -rw-r--r-- | sw/source/filter/ww8/docxsdrexport.cxx | 8 |
3 files changed, 18 insertions, 2 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx b/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx Binary files differnew file mode 100644 index 000000000000..514eeddbafb8 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf104565_ArrowPosition.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 498cf8a95772..99aa70e27cd5 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -1115,6 +1115,18 @@ DECLARE_OOXMLEXPORT_TEST(testArrowFlipXY, "tdf100751_arrowBothFlip.docx") 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 fbdee23ebd70..66ab33a15ac9 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -441,8 +441,12 @@ void DocxSdrExport::startDMLAnchorInline(const SwFrameFormat* pFrameFormat, cons ->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 |
