sw/qa/extras/ooxmlexport/data/tdf133065.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 27 +++++++++++++++++++++++++++ sw/qa/inc/swmodeltestbase.hxx | 1 + sw/source/filter/ww8/docxattributeoutput.cxx | 25 +++++++++++++++++++++++++ 4 files changed, 53 insertions(+)
New commits: commit e9aaa97d6791cd40ef8bf577dd7450e6a409ab29 Author: Attila Bakos <bakos.attilakar...@nisz.hu> AuthorDate: Thu May 14 15:48:21 2020 +0200 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Sun Jul 26 14:41:55 2020 +0200 tdf#133065 tdf#133602 DOCX export: fix OLE wrap regression caused by commit 2150fdc7d0f63288ac56c33cb898589512057642 (tdf#131539 DOCX export: fix position of OLE objects). The wrap setting of the anchored OLE object were not preserved. Note: It needs also z-order export for background mode. Co-authored-by: Tibor Nagy Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94220 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 8233feccaada8cf5f5bbcb1fc365ee99299dd701) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95983 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit e0ba88a08c9c16fd805e13956ac9676f4ddfd377) Change-Id: I7f8c48019157dda00bcc97a490c5f582eccf1b22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99303 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> diff --git a/sw/qa/extras/ooxmlexport/data/tdf133065.odt b/sw/qa/extras/ooxmlexport/data/tdf133065.odt new file mode 100644 index 000000000000..a5e1b3587a5d Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf133065.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index fa22174fc0e5..18c2648becd3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -75,6 +75,33 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf123873, "tdf123873.docx") p_XmlDoc, "/w:document/w:body/w:p[2]/w:r[2]/w:drawing/wp:anchor/wp:wrapTopAndBottom"); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(Tdf133065, "tdf133065.odt") +{ + auto pxmldoc = parseExport("word/document.xml"); + CPPUNIT_ASSERT(pxmldoc); + OUString aVal; + + aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[3]/w:r[2]/w:object/v:shape/w10:wrap", "type"); + CPPUNIT_ASSERT(aVal.indexOf("square") > -1); + aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[3]/w:r[2]/w:object/v:shape/w10:wrap", "side"); + CPPUNIT_ASSERT(aVal.indexOf("left") > -1); + + aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[8]/w:r[2]/w:object/v:shape/w10:wrap", "type"); + CPPUNIT_ASSERT(aVal.indexOf("square") > -1); + aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[8]/w:r[2]/w:object/v:shape/w10:wrap", "side"); + CPPUNIT_ASSERT(aVal.indexOf("right") > -1); + + aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[12]/w:r[2]/w:object/v:shape/w10:wrap", "type"); + CPPUNIT_ASSERT(aVal.indexOf("square") > -1); + aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[12]/w:r[2]/w:object/v:shape/w10:wrap", "side"); + CPPUNIT_ASSERT(aVal.indexOf("largest") > -1); + + aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[20]/w:r[2]/w:object/v:shape/w10:wrap", "type"); + CPPUNIT_ASSERT(aVal.indexOf("topAndBottom") > -1); + + aVal = getXPath(pxmldoc, "/w:document/w:body/w:p[24]/w:r[2]/w:object/v:shape/w10:wrap", "type"); + CPPUNIT_ASSERT(aVal.indexOf("square") > -1); +} DECLARE_OOXMLIMPORT_TEST(testTdf129888vml, "tdf129888vml.docx") { diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 38f8e95a4a40..d62b92b58fc0 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -962,6 +962,7 @@ protected: xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a14"), BAD_CAST("http://schemas.microsoft.com/office/drawing/2010/main")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("c"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/chart")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("o"), BAD_CAST("urn:schemas-microsoft-com:office:office")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("w10"), BAD_CAST("urn:schemas-microsoft-com:office:word")); // odt xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("office"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:office:1.0")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("style"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:style:1.0")); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 782343dbd6ab..d5ebe12bad2f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5574,6 +5574,31 @@ void DocxAttributeOutput::WriteOLE( SwOLENode& rNode, const Size& rSize, const S FSNS( XML_r, XML_id ), sImageId.toUtf8(), FSNS( XML_o, XML_title ), "" ); + //export wrap settings + if(rFlyFrameFormat && rFlyFrameFormat->GetAnchor().GetAnchorId() != RndStdIds::FLY_AS_CHAR) + { + const SwFormatSurround aWrap = rFlyFrameFormat->GetSurround(); + bool bIsCountur = aWrap.IsContour(); + + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_NONE) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "topAndBottom"); + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_PARALLEL && !bIsCountur) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "square"); + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_PARALLEL && bIsCountur) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "tight"); + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_DYNAMIC && !bIsCountur) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "square", XML_side, "largest"); + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_LEFT && !bIsCountur) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "square", XML_side, "left"); + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_RIGHT && !bIsCountur) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "square", XML_side, "right"); + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_DYNAMIC && bIsCountur) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "tight", XML_side, "largest"); + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_LEFT && bIsCountur) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "tight", XML_side, "left"); + if (aWrap.GetSurround() == text::WrapTextMode::WrapTextMode_RIGHT && bIsCountur) + m_pSerializer->singleElementNS(XML_w10, XML_wrap, XML_type, "tight", XML_side, "right"); + } m_pSerializer->endElementNS( XML_v, XML_shape ); // OLE object definition _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits