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 <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna
2019-10-21 21:18:03 +02:00
parent 349386559c
commit 6243ea0374
3 changed files with 50 additions and 0 deletions
+5
View File
@@ -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
+1
View File
@@ -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);
+44
View File
@@ -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: */