[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - sw/qa sw/source
Attila Bakos (via logerrit)
logerrit at kemper.freedesktop.org
Tue Jun 16 11:30:36 UTC 2020
sw/qa/extras/ooxmlexport/data/tdf133065.odt |binary
sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 28 +++++++++++++++++++++++++++
sw/qa/inc/swmodeltestbase.hxx | 1
sw/source/filter/ww8/docxattributeoutput.cxx | 25 ++++++++++++++++++++++++
4 files changed, 54 insertions(+)
New commits:
commit e0ba88a08c9c16fd805e13956ac9676f4ddfd377
Author: Attila Bakos <bakos.attilakaroly at nisz.hu>
AuthorDate: Thu May 14 15:48:21 2020 +0200
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 16 13:30:05 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
Change-Id: I7f8c48019157dda00bcc97a490c5f582eccf1b22
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94220
Tested-by: László Németh <nemeth at numbertext.org>
Reviewed-by: László Németh <nemeth at numbertext.org>
(cherry picked from commit 8233feccaada8cf5f5bbcb1fc365ee99299dd701)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95983
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
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 43cdd62d5b20..e2c5f0dbf9b6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -114,6 +114,34 @@ 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_OOXMLEXPORT_TEST(testTdf130814model, "tdf130814.docx")
{
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x1F497D), getProperty<sal_Int32>(getRun(getParagraph(2), 1), "CharColor"));
diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx
index 32db863d5d3d..8265801f36f8 100644
--- a/sw/qa/inc/swmodeltestbase.hxx
+++ b/sw/qa/inc/swmodeltestbase.hxx
@@ -989,6 +989,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 2df0e557ae1e..7cca8917d565 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5608,6 +5608,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
More information about the Libreoffice-commits
mailing list