DOCX export: handle relative size of drawinglayer shapes
Change-Id: If4548f7b7a530402158ce5f84febe4fe5eaf2184
This commit is contained in:
parent
30155e08a0
commit
2d93aee9bf
BIN
sw/qa/extras/ooxmlexport/data/dml-shape-relsize.docx
Normal file
BIN
sw/qa/extras/ooxmlexport/data/dml-shape-relsize.docx
Normal file
Binary file not shown.
@ -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");
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user