sw/source/core/docnode/node.cxx | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
New commits: commit 7e9b6bfa481851e6505547c596633794a9efd0ed Author: Miklos Vajna <[email protected]> AuthorDate: Wed May 13 10:31:36 2020 +0200 Commit: Miklos Vajna <[email protected]> CommitDate: Wed May 13 15:59:12 2020 +0200 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 <[email protected]> Tested-by: Jenkins 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 _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
