[Libreoffice-commits] core.git: sw/inc sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Feb 9 14:02:05 UTC 2021


 sw/inc/txatbase.hxx                 |    2 +-
 sw/inc/txtftn.hxx                   |    1 +
 sw/source/core/txtnode/atrftn.cxx   |   29 +++++++++++++++++++++++++++++
 sw/source/core/txtnode/txatbase.cxx |    5 +++++
 4 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit 0239f033f77eeaac5ae3d74f2a9cb273cf0bfd41
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Feb 9 12:34:28 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Feb 9 15:01:25 2021 +0100

    sw doc model xml dump: show more details of SwTextFootnote
    
    Most importantly the node index of the referred footnote.
    
    Change-Id: Ibfa333a57052ffd5c9d7edab960f72041348c9fa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110632
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx
index 90509a929309..824f28ff1bd2 100644
--- a/sw/inc/txatbase.hxx
+++ b/sw/inc/txatbase.hxx
@@ -121,7 +121,7 @@ public:
     inline const SwFormatINetFormat           &GetINetFormat() const;
     inline const SwFormatRuby              &GetRuby() const;
 
-    void dumpAsXml(xmlTextWriterPtr pWriter) const;
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 class SAL_DLLPUBLIC_RTTI SwTextAttrEnd : public virtual SwTextAttr
diff --git a/sw/inc/txtftn.hxx b/sw/inc/txtftn.hxx
index 9d6aa60ff49b..c451b89e7abe 100644
--- a/sw/inc/txtftn.hxx
+++ b/sw/inc/txtftn.hxx
@@ -64,6 +64,7 @@ public:
     sal_uInt16 GetSeqRefNo() const      { return m_nSeqNo; }
 
     static void SetUniqueSeqRefNo( SwDoc& rDoc );
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 inline const SwTextNode& SwTextFootnote::GetTextNode() const
diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx
index 02188cf011de..a621f2a41902 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <libxml/xmlwriter.h>
+
 #include <fmtftn.hxx>
 
 #include <doc.hxx>
@@ -576,4 +578,31 @@ void SwTextFootnote::CheckCondColl()
 //FEATURE::CONDCOLL
 }
 
+void SwTextFootnote::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SwTextFootnote"));
+    SwTextAttr::dumpAsXml(pWriter);
+
+    if (m_pStartNode)
+    {
+        xmlTextWriterStartElement(pWriter, BAD_CAST("m_pStartNode"));
+        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
+                                    BAD_CAST(OString::number(m_pStartNode->GetIndex()).getStr()));
+        xmlTextWriterEndElement(pWriter);
+    }
+    if (m_pTextNode)
+    {
+        xmlTextWriterStartElement(pWriter, BAD_CAST("m_pTextNode"));
+        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
+                                    BAD_CAST(OString::number(m_pTextNode->GetIndex()).getStr()));
+        xmlTextWriterEndElement(pWriter);
+    }
+    xmlTextWriterStartElement(pWriter, BAD_CAST("m_nSeqNo"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+                                BAD_CAST(OString::number(m_nSeqNo).getStr()));
+    xmlTextWriterEndElement(pWriter);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/txtnode/txatbase.cxx b/sw/source/core/txtnode/txatbase.cxx
index 7f46fd178f37..cf4583f1473a 100644
--- a/sw/source/core/txtnode/txatbase.cxx
+++ b/sw/source/core/txtnode/txatbase.cxx
@@ -89,6 +89,9 @@ void SwTextAttrEnd::SetEnd(sal_Int32 n)
 void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
 {
     xmlTextWriterStartElement(pWriter, BAD_CAST("SwTextAttr"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s",
+                                      BAD_CAST(typeid(*this).name()));
 
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("start"), BAD_CAST(OString::number(m_nStart).getStr()));
     if (End())
@@ -154,6 +157,8 @@ void SwTextAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
         case RES_TXTATR_INPUTFIELD:
             GetFormatField().dumpAsXml(pWriter);
             break;
+        case RES_TXTATR_FTN:
+            break;
         default:
             SAL_WARN("sw.core", "Unhandled TXTATR");
             break;


More information about the Libreoffice-commits mailing list