summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Bakos <bakos.attilakaroly@nisz.hu>2020-05-14 15:48:21 +0200
committerMichael Stahl <michael.stahl@allotropia.de>2022-01-12 20:38:10 +0100
commite6f6cac6a36c1a63950871dfba22ad9565c0a0c6 (patch)
tree289fd2773a1288ab606cf3e12bc582e17b0f1ab6
parentbda711f33d9ec67a3b3507cf256fdf5d85b9ae23 (diff)
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@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 4bdff3c731a9f8ef11ffdae804a99a47f119ee50)
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf133065.odtbin0 -> 64161 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx27
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx25
3 files changed, 52 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf133065.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 08ac6fb4ed86..193a1990b622 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -77,6 +77,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/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index ef65e060583b..f987ca7dfff0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -5573,6 +5573,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