summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-02-02 20:10:17 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-02-03 07:11:51 +0000
commit2422e1b0418d057e08ef08251e8638d1478631fe (patch)
treede22e2752b37d79297365a2a816b2f4b28bcef18 /sw/source
parenta834bbad8295cba0ca88a91a524aad48640271ec (diff)
sw layout xml dump: extract SwTable::dumpAsXml() from SwTableNode
The idea is that each class only dumps itself & what it owns, otherwise the same info is dumped multiple times. Change-Id: Ib21bd2d31aa0d70d58b2b8aa453e0ede788c7144 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146511 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/docnode/ndtbl.cxx12
-rw-r--r--sw/source/core/table/swtable.cxx17
2 files changed, 18 insertions, 11 deletions
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 77f7a4d3e97c..5e2cd8605bdd 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2488,17 +2488,7 @@ void SwTableNode::dumpAsXml(xmlTextWriterPtr pWriter) const
if (m_pTable)
{
- (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTable"));
- (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", m_pTable.get());
- m_pTable->GetFrameFormat()->dumpAsXml(pWriter);
- for (const auto& pLine : m_pTable->GetTabLines())
- {
- (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableLine"));
- (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", pLine);
- pLine->GetFrameFormat()->dumpAsXml(pWriter);
- (void)xmlTextWriterEndElement(pWriter);
- }
- (void)xmlTextWriterEndElement(pWriter);
+ m_pTable->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 7fa3c3caea4d..06c76771434d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include <libxml/xmlwriter.h>
+
#include <hintids.hxx>
#include <hints.hxx>
#include <editeng/lrspitem.hxx>
@@ -1610,6 +1612,21 @@ bool SwTable::IsDeleted() const
return true;
}
+void SwTable::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTable"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+ GetFrameFormat()->dumpAsXml(pWriter);
+ for (const auto& pLine : GetTabLines())
+ {
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableLine"));
+ (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", pLine);
+ pLine->GetFrameFormat()->dumpAsXml(pWriter);
+ (void)xmlTextWriterEndElement(pWriter);
+ }
+ (void)xmlTextWriterEndElement(pWriter);
+}
+
// TODO Set HasTextChangesOnly=true, if needed based on the redlines in the cells.
// At tracked row deletion, return with the newest deletion of the row or
// at tracked row insertion, return with the oldest insertion in the row, which