DOCX export: handle wp14:sizeRelH/V relativeFrom=margin for shapes

Change-Id: I913fe328376a246bf410512c4cfb018fc573094b
This commit is contained in:
Miklos Vajna
2014-02-20 16:32:23 +01:00
parent 418800e2e8
commit c2485b4c38
2 changed files with 5 additions and 5 deletions

View File

@@ -2303,8 +2303,8 @@ 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");
// Relative size wasn't exported all, then relativeFrom was "page", not "margin".
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin");
}
DECLARE_OOXMLEXPORT_TEST(testDmlGroupshapeRelsize, "dml-groupshape-relsize.docx")
@@ -2313,7 +2313,7 @@ DECLARE_OOXMLEXPORT_TEST(testDmlGroupshapeRelsize, "dml-groupshape-relsize.docx"
if (!pXmlDoc)
return;
// Relative size wasn't imported.
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "page");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/wp14:sizeRelH", "relativeFrom", "margin");
}
DECLARE_OOXMLEXPORT_TEST(testDmlGroupshapeParaspacing, "dml-groupshape-paraspacing.docx")

View File

@@ -491,7 +491,7 @@ void DocxSdrExport::Impl::writeDMLDrawing(const SdrObject* pSdrObject, const SwF
{
// At the moment drawinglayer objects are always relative from page.
pFS->startElementNS(XML_wp14, XML_sizeRelH,
XML_relativeFrom, "page",
XML_relativeFrom, (pSdrObject->GetRelativeWidthRelation() == text::RelOrientation::FRAME ? "margin" : "page"),
FSEND);
pFS->startElementNS(XML_wp14, XML_pctWidth, FSEND);
pFS->writeEscaped(OUString::number(*pSdrObject->GetRelativeWidth() * 100 * oox::drawingml::PER_PERCENT));
@@ -501,7 +501,7 @@ void DocxSdrExport::Impl::writeDMLDrawing(const SdrObject* pSdrObject, const SwF
if (pSdrObject->GetRelativeHeight())
{
pFS->startElementNS(XML_wp14, XML_sizeRelV,
XML_relativeFrom, "page",
XML_relativeFrom, (pSdrObject->GetRelativeHeightRelation() == text::RelOrientation::FRAME ? "margin" : "page"),
FSEND);
pFS->startElementNS(XML_wp14, XML_pctHeight, FSEND);
pFS->writeEscaped(OUString::number(*pSdrObject->GetRelativeHeight() * 100 * oox::drawingml::PER_PERCENT));