sw/inc/swtable.hxx               |    2 ++
 sw/source/core/docnode/node.cxx  |    6 +-----
 sw/source/core/table/swtable.cxx |    9 +++++++++
 3 files changed, 12 insertions(+), 5 deletions(-)

New commits:
commit ca22f880159d7845167f72f42c6a540191030613
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Feb 23 08:51:01 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Feb 23 10:03:33 2024 +0100

    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 <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 3d0a5732d188..69138709ebac 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 ba3d9fdb6812..4425893bc880 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 bc32a108d792..ebe99f36de31 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;

Reply via email to