diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2020-05-13 10:31:36 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2020-05-13 15:59:12 +0200 |
commit | 7e9b6bfa481851e6505547c596633794a9efd0ed (patch) | |
tree | 05391c0dd21d8301c20c5055c9245a7a47faecfa | |
parent | 943fbfad668da76f7d0ebd4f4d8cdd67224d2f01 (diff) |
sw doc model xml dump: show wrap polygon of graphic nodes
It seems this is in mm100, counted from the pixel size of the underlying
graphic, using the graphic's DPI. Fairly non-trivial, given the rest of
sw uses twips.
Change-Id: I10c1b6b5fbc231ebb9c4df9cd265424f2a2973bc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94102
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
-rw-r--r-- | sw/source/core/docnode/node.cxx | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 5c5b648f7cb5..a4253380c6cd 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -894,6 +894,43 @@ void SwNode::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr())); + switch (GetNodeType()) + { + case SwNodeType::Grf: + { + auto pNoTextNode = static_cast<const SwNoTextNode*>(this); + const tools::PolyPolygon* pContour = pNoTextNode->HasContour(); + if (pContour) + { + xmlTextWriterStartElement(pWriter, BAD_CAST("pContour")); + for (sal_uInt16 i = 0; i < pContour->Count(); ++i) + { + xmlTextWriterStartElement(pWriter, BAD_CAST("polygon")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), + BAD_CAST(OString::number(i).getStr())); + const tools::Polygon& rPolygon = pContour->GetObject(i); + for (sal_uInt16 j = 0; j < rPolygon.GetSize(); ++j) + { + xmlTextWriterStartElement(pWriter, BAD_CAST("point")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), + BAD_CAST(OString::number(j).getStr())); + const Point& rPoint = rPolygon.GetPoint(j); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"), + BAD_CAST(OString::number(rPoint.X()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"), + BAD_CAST(OString::number(rPoint.Y()).getStr())); + xmlTextWriterEndElement(pWriter); + } + xmlTextWriterEndElement(pWriter); + } + xmlTextWriterEndElement(pWriter); + } + } + break; + default: + break; + } + xmlTextWriterEndElement(pWriter); if (GetNodeType() == SwNodeType::End) xmlTextWriterEndElement(pWriter); // end start node |