sw/inc/fmtftn.hxx                   |    2 ++
 sw/source/core/txtnode/atrftn.cxx   |   13 +++++++++++++
 sw/source/core/txtnode/txatbase.cxx |    1 +
 3 files changed, 16 insertions(+)

New commits:
commit 938f2754d67173ceae8db043e0aac1315210850e
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Jan 23 11:17:37 2023 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Jan 23 12:55:44 2023 +0000

    sw doc model xml dump: show endnote info about footnote formats
    
    The text-attr doesn't know if this is a footnote or endnote, so let's
    show its format, which has this info.
    
    Change-Id: Ib36621f3206188f48e87fbc7f7899cbe2c8b4326
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146002
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/fmtftn.hxx b/sw/inc/fmtftn.hxx
index 8636b7024909..a34b2b83b482 100644
--- a/sw/inc/fmtftn.hxx
+++ b/sw/inc/fmtftn.hxx
@@ -96,6 +96,8 @@ public:
     unotools::WeakReference<SwXFootnote> const& GetXFootnote() const
         { return m_wXFootnote; }
     void SetXFootnote(rtl::Reference<SwXFootnote> const& xNote);
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 #endif
diff --git a/sw/source/core/txtnode/atrftn.cxx 
b/sw/source/core/txtnode/atrftn.cxx
index 52c3e1147aae..1624e6d29f96 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -280,6 +280,19 @@ uno::Reference<text::XTextRange> 
SwFormatFootnote::getAnchor(SwDoc& rDoc) const
     return xRet;
 }
 
+void SwFormatFootnote::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatFootnote"));
+    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("text-attr"), 
"%p", m_pTextAttr);
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("endnote"),
+                                      
BAD_CAST(OString::boolean(m_bEndNote).getStr()));
+
+    SfxPoolItem::dumpAsXml(pWriter);
+
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 SwTextFootnote::SwTextFootnote( SwFormatFootnote& rAttr, sal_Int32 nStartPos )
     : SwTextAttr( rAttr, nStartPos )
     , m_pTextNode( nullptr )
diff --git a/sw/source/core/txtnode/txatbase.cxx 
b/sw/source/core/txtnode/txatbase.cxx
index 3a92c471ec72..9fdd1212543f 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -154,6 +154,7 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
             GetFormatField().dumpAsXml(pWriter);
             break;
         case RES_TXTATR_FTN:
+            GetFootnote().dumpAsXml(pWriter);
             break;
         case RES_TXTATR_LINEBREAK:
             GetLineBreak().dumpAsXml(pWriter);

Reply via email to