sw/source/core/docnode/node.cxx  |    8 --------
 sw/source/core/table/swtable.cxx |    9 ++++++++-
 2 files changed, 8 insertions(+), 9 deletions(-)

New commits:
commit 8aa0d442dee5864cd6a851569068a7657a69ee79
Author:     Miklos Vajna <[email protected]>
AuthorDate: Fri Mar 8 08:43:57 2024 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Fri Mar 8 11:59:48 2024 +0100

    sw doc model xml dump: avoid SwNode::GetTableBox()
    
    The purpose of the doc model dump is to give an idea of the doc model as
    it's in the memory. SwNode::GetTableBox() is far from trivial and can be
    problematic when invoked from e.g. an already crashed process.
    
    Rather show SwTable::m_TabSortContentBoxes, which knows the (cell) start
    node, and then this can be avoided in SwStartNode::dumpAsXml().
    
    Change-Id: Ie81181cfd41de4d4df38a8b7a430ecd5f67bc8a8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164560
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 4425893bc880..bdabf7726a5e 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1036,14 +1036,6 @@ void SwStartNode::dumpAsXml(xmlTextWriterPtr pWriter) 
const
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), 
BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr()));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), 
BAD_CAST(OString::number(sal_Int32(GetIndex())).getStr()));
 
-    if (GetStartNodeType() == SwTableBoxStartNode)
-    {
-        if (SwTableBox* pBox = GetTableBox())
-        {
-            pBox->dumpAsXml(pWriter);
-        }
-    }
-
     // (void)xmlTextWriterEndElement(pWriter); - it is a start node, so don't 
end, will make xml better nested
 }
 
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index ebe99f36de31..c71aec30e7aa 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1745,13 +1745,19 @@ 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());
-    for (const auto& pLine : GetTabLines())
+    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);
+    }
+    (void)xmlTextWriterEndElement(pWriter);
     (void)xmlTextWriterEndElement(pWriter);
 }
 
@@ -3050,6 +3056,7 @@ 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("start-node"), 
BAD_CAST(OString::number(static_cast<sal_Int32>(m_pStartNode->GetIndex())).getStr()));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("rowspan"), 
BAD_CAST(OString::number(mnRowSpan).getStr()));
     GetFrameFormat()->dumpAsXml(pWriter);
     (void)xmlTextWriterEndElement(pWriter);

Reply via email to