sw/inc/section.hxx                 |    2 ++
 sw/source/core/docnode/section.cxx |    9 +++++++++
 2 files changed, 11 insertions(+)

New commits:
commit 5b49927760fc4b5f5563a39646e3e5fe23c7fbc5
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Jan 10 11:05:58 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jan 10 14:02:26 2023 +0000

    sw doc model xml dump: show section names
    
    The one in SwSectionData seems to the section name visible on the UI.
    SwSectionFormat also has a name, but it looks like even the UI doesn't
    bother with maintaining that on section rename, so that's not really
    used anywhere, and only that was visible in the dump previously.
    
    Change-Id: I9a7444561cee0e42d23eaf06cb4d53171603c0df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145259
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
index 5bcd3f0c1b9a..9e29e952cdec 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -132,6 +132,8 @@ public:
 
     bool IsConnectFlag() const                  { return m_bConnectFlag; }
     void SetConnectFlag(bool const bFlag){ m_bConnectFlag = bFlag; }
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 class SW_DLLPUBLIC SwSection
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index a92694e5b58f..46ac8308abd5 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -177,6 +177,14 @@ bool SwSectionData::operator==(SwSectionData const& 
rOther) const
     // FIXME: old code ignored m_bCondHiddenFlag m_bHiddenFlag m_bConnectFlag
 }
 
+void SwSectionData::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwSectionData"));
+    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("section-name"), 
BAD_CAST(m_sSectionName.toUtf8().getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 SwSection::SwSection(
         SectionType const eType, OUString const& rName, SwSectionFormat & 
rFormat)
     : SwClient(& rFormat)
@@ -1494,6 +1502,7 @@ void SwSection::dumpAsXml(xmlTextWriterPtr pWriter) const
     (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
     (void)xmlTextWriterWriteFormatAttribute(pWriter, 
BAD_CAST("registered-in"), "%p",
                                             GetRegisteredIn());
+    m_Data.dumpAsXml(pWriter);
     (void)xmlTextWriterEndElement(pWriter);
 }
 

Reply via email to