sw/inc/pagedesc.hxx | 5 ++++ sw/source/core/doc/docfmt.cxx | 1 sw/source/core/layout/pagedesc.cxx | 44 +++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+)
New commits: commit 6243ea0374aca5bf426a3a70428913166bc2cdc8 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Oct 21 17:24:01 2019 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Oct 21 21:18:03 2019 +0200 Related: tdf#124770 sw doc model xml dump: handle page descriptions SwPageDesc is more or less just a named wrapper around one or more frame formats, and we know how to dump them already. This helps understanding cases where previously you could only (easily) see the value of a page size at import time at UNO API level (in mm100) and later the computed layout frame sizes (in twips), but not the doc model sizes (in twips). Change-Id: Iad7e8059b2c8d7785d33504c878f2d7ada6004b0 Reviewed-on: https://gerrit.libreoffice.org/81255 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx index 522986f87c1b..86e3fc075a7c 100644 --- a/sw/inc/pagedesc.hxx +++ b/sw/inc/pagedesc.hxx @@ -42,6 +42,7 @@ class SfxPoolItem; class SwTextFormatColl; class SwNode; class SwPageDescs; +typedef struct _xmlTextWriter* xmlTextWriterPtr; /// Footnote information. class SW_DLLPUBLIC SwPageFootnoteInfo @@ -273,6 +274,8 @@ public: SwPageDesc( const SwPageDesc& ); virtual ~SwPageDesc() override; + + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; namespace std { @@ -431,6 +434,8 @@ public: bool contains( const value_type& x ) const { return x->m_pdList == this; } + + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; #endif // INCLUDED_SW_INC_PAGEDESC_HXX diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index f2e9b105e355..deacc7c61609 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1939,6 +1939,7 @@ void SwDoc::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); m_pNodes->dumpAsXml(pWriter); + m_PageDescs.dumpAsXml(pWriter); maDBData.dumpAsXml(pWriter); mpMarkManager->dumpAsXml(pWriter); m_pUndoManager->dumpAsXml(pWriter); diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index a0c7e08ee45b..56211090e081 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <libxml/xmlwriter.h> + #include <editeng/pbinitem.hxx> #include <editeng/ulspitem.hxx> #include <editeng/boxitem.hxx> @@ -425,6 +427,36 @@ SwPageDesc* SwPageDesc::GetByName(SwDoc& rDoc, const OUString& rName) return nullptr; } +void SwPageDesc::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("SwPageDesc")); + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_StyleName"), "%s", + BAD_CAST(m_StyleName.toUtf8().getStr())); + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_pFollow"), "%p", m_pFollow); + xmlTextWriterWriteFormatAttribute( + pWriter, BAD_CAST("m_eUse"), "0x%s", + BAD_CAST(OString::number(static_cast<int>(m_eUse), 16).getStr())); + + xmlTextWriterStartElement(pWriter, BAD_CAST("m_Master")); + m_Master.dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); + + xmlTextWriterStartElement(pWriter, BAD_CAST("m_Left")); + m_Left.dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); + + xmlTextWriterStartElement(pWriter, BAD_CAST("m_FirstMaster")); + m_FirstMaster.dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); + + xmlTextWriterStartElement(pWriter, BAD_CAST("m_FirstLeft")); + m_FirstLeft.dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); + + xmlTextWriterEndElement(pWriter); +} + SwPageFootnoteInfo::SwPageFootnoteInfo() : m_nMaxHeight( 0 ) , m_nLineWidth(10) @@ -587,4 +619,16 @@ void SwPageDescs::erase( size_type index_ ) erase( begin() + index_ ); } +void SwPageDescs::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("SwPageDescs")); + + for (const auto& pPageDesc : m_PosIndex) + { + pPageDesc->dumpAsXml(pWriter); + } + + xmlTextWriterEndElement(pWriter); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits