summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlexport/data/dml-shape-relsize.docxbin0 -> 15499 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx10
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx23
3 files changed, 33 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/dml-shape-relsize.docx b/sw/qa/extras/ooxmlexport/data/dml-shape-relsize.docx
new file mode 100644
index 000000000000..80ae02e0267c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/dml-shape-relsize.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5cc672f8790b..86b1d847558f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -153,6 +153,7 @@ xmlNodeSetPtr Test::getXPathNode(xmlDocPtr pXmlDoc, const OString& rXPath)
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wps"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingShape"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wpg"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingGroup"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wp"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"));
+ xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wp14"), BAD_CAST("http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("pic"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/picture"));
xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("rels"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships"));
@@ -2298,6 +2299,15 @@ DECLARE_OOXMLEXPORT_TEST(testDmlZorder, "dml-zorder.odt")
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[1]/mc:Choice/w:drawing/wp:anchor", "relativeHeight", "2");
}
+DECLARE_OOXMLEXPORT_TEST(testDmlShapeRelsize, "dml-shape-relsize.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ // Relative size wasn't exported at all.
+ assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "page");
+}
+
DECLARE_OOXMLEXPORT_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 291980636bf2..1211ef34d345 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -486,6 +486,29 @@ void DocxSdrExport::Impl::writeDMLDrawing(const SdrObject* pSdrObject, const SwF
pFS->endElementNS(XML_a, XML_graphicData);
pFS->endElementNS(XML_a, XML_graphic);
+ // Relative size of the drawing.
+ if (pSdrObject->GetRelativeWidth())
+ {
+ // At the moment drawinglayer objects are always relative from page.
+ pFS->startElementNS(XML_wp14, XML_sizeRelH,
+ XML_relativeFrom, "page",
+ FSEND);
+ pFS->startElementNS(XML_wp14, XML_pctWidth, FSEND);
+ pFS->writeEscaped(OUString::number(*pSdrObject->GetRelativeWidth() * 100 * oox::drawingml::PER_PERCENT));
+ pFS->endElementNS(XML_wp14, XML_pctWidth);
+ pFS->endElementNS(XML_wp14, XML_sizeRelH);
+ }
+ if (pSdrObject->GetRelativeHeight())
+ {
+ pFS->startElementNS(XML_wp14, XML_sizeRelV,
+ XML_relativeFrom, "page",
+ FSEND);
+ pFS->startElementNS(XML_wp14, XML_pctHeight, FSEND);
+ pFS->writeEscaped(OUString::number(*pSdrObject->GetRelativeHeight() * 100 * oox::drawingml::PER_PERCENT));
+ pFS->endElementNS(XML_wp14, XML_pctHeight);
+ pFS->endElementNS(XML_wp14, XML_sizeRelV);
+ }
+
m_rSdrExport.endDMLAnchorInline(pFrmFmt);
}