sw doc model xml dump: extract SwTableBox::dumpAsXml() from SwStartNode
Ideally each class should just dump itself.
Change-Id: I8b7251553d12673258ae885436c56e342b3ddf8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163801
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 3d0a573..6913870 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -556,6 +556,8 @@ public:
SwRedlineTable::size_type GetRedline() const;
// get redline type
RedlineType GetRedlineType() const;
void dumpAsXml(xmlTextWriterPtr pWriter) const;
};
class SwCellFrame;
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index ba3d9fd..4425893 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1040,11 +1040,7 @@ void SwStartNode::dumpAsXml(xmlTextWriterPtr pWriter) const
{
if (SwTableBox* pBox = GetTableBox())
{
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableBox"));
(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", pBox);
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), BAD_CAST(OString::number(pBox->getRowSpan()).getStr()));
pBox->GetFrameFormat()->dumpAsXml(pWriter);
(void)xmlTextWriterEndElement(pWriter);
pBox->dumpAsXml(pWriter);
}
}
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index bc32a10..ebe99f3 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -3046,6 +3046,15 @@ RedlineType SwTableBox::GetRedlineType() const
return RedlineType::None;
}
void SwTableBox::dumpAsXml(xmlTextWriterPtr pWriter) const
{
(void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableBox"));
(void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
(void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), BAD_CAST(OString::number(mnRowSpan).getStr()));
GetFrameFormat()->dumpAsXml(pWriter);
(void)xmlTextWriterEndElement(pWriter);
}
struct SwTableCellInfo::Impl
{
const SwTable * m_pTable;