sw/inc/swtable.hxx               |    2 ++
 sw/source/core/table/swtable.cxx |   28 +++++++++++++++++++---------
 2 files changed, 21 insertions(+), 9 deletions(-)

New commits:
commit 2b55a58a2b6918018eca11f8f8cd0452992f239a
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Apr 5 08:08:20 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Apr 5 09:22:15 2024 +0200

    sw doc model xml dump: show SwTableLine::m_aBoxes
    
    Which means we get boxes (cells) grouped by lines (rows), instead of a
    flat list of all cells in a table.
    
    Change-Id: Ibb14c6fb26b2f4b502b18544d9a08d964c45a97e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165806
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index 9d4ab72e0809..9e71c19482ff 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -436,6 +436,8 @@ public:
     // set/get (if it's possible, cached) redline type
     RedlineType GetRedlineType() const;
     void SetRedlineType(RedlineType eType) { m_eRedlineType = eType; }
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 /// SwTableBox is one table cell in the document model.
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index c71aec30e7aa..53ab9bbc465b 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1745,17 +1745,10 @@ void SwTable::dumpAsXml(xmlTextWriterPtr pWriter) const
     (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTable"));
     (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
     (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("table-format"), 
"%p", GetFrameFormat());
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("lines"));
     for (const auto& pLine : m_aLines)
     {
-        (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableLine"));
-        (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), 
"%p", pLine);
-        pLine->GetFrameFormat()->dumpAsXml(pWriter);
-        (void)xmlTextWriterEndElement(pWriter);
-    }
-    (void)xmlTextWriterStartElement(pWriter, 
BAD_CAST("tab-sort-content-boxes"));
-    for (const auto& pBox : m_TabSortContentBoxes)
-    {
-        pBox->dumpAsXml(pWriter);
+        pLine->dumpAsXml(pWriter);
     }
     (void)xmlTextWriterEndElement(pWriter);
     (void)xmlTextWriterEndElement(pWriter);
@@ -2001,6 +1994,23 @@ RedlineType SwTableLine::GetRedlineType() const
     return RedlineType::None;
 }
 
+void SwTableLine::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableLine"));
+    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+
+    GetFrameFormat()->dumpAsXml(pWriter);
+
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("boxes"));
+    for (const auto& pBox : m_aBoxes)
+    {
+        pBox->dumpAsXml(pWriter);
+    }
+    (void)xmlTextWriterEndElement(pWriter);
+
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, sal_uInt16 nLines, 
SwTableLine *pUp )
     : SwClient(nullptr)
     , m_aLines()

Reply via email to