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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Mar 1 10:07:28 UTC 2021


 sw/inc/authfld.hxx                |    1 +
 sw/source/core/fields/authfld.cxx |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

New commits:
commit e08eb980c9f376195ee31dd7e5429bf32d847772
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Mar 1 09:25:04 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Mar 1 11:06:37 2021 +0100

    sw doc model xml dump: show SwAuthEntry
    
    To see the author/title/etc of bibliography fields.
    
    Change-Id: Ia466c96d3d17b52b94a85070edd023a0579e970a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111732
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/authfld.hxx b/sw/inc/authfld.hxx
index 55c095596845..cdfcf7f9f55a 100644
--- a/sw/inc/authfld.hxx
+++ b/sw/inc/authfld.hxx
@@ -44,6 +44,7 @@ public:
     inline OUString const & GetAuthorField(ToxAuthorityField ePos) const;
     inline void             SetAuthorField(ToxAuthorityField ePos,
                                             const OUString& rField);
+    void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 struct SwTOXSortKey
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index 8399ca3dc681..ad60d02db173 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -612,6 +612,10 @@ void SwAuthorityField::dumpAsXml(xmlTextWriterPtr pWriter) const
 
     xmlTextWriterStartElement(pWriter, BAD_CAST("m_xAuthEntry"));
     xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", m_xAuthEntry.get());
+    if (m_xAuthEntry.is())
+    {
+        m_xAuthEntry->dumpAsXml(pWriter);
+    }
     xmlTextWriterEndElement(pWriter);
     xmlTextWriterStartElement(pWriter, BAD_CAST("m_nTempSequencePos"));
     xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
@@ -660,6 +664,21 @@ const char* const aFieldNames[] =
     "ISBN"
 };
 
+void SwAuthEntry::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SwAuthEntry"));
+
+    for (int i = 0; i < AUTH_FIELD_END; ++i)
+    {
+        xmlTextWriterStartElement(pWriter, BAD_CAST("m_aAuthField"));
+        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("key"), BAD_CAST(aFieldNames[i]));
+        xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(m_aAuthFields[i].toUtf8().getStr()));
+        xmlTextWriterEndElement(pWriter);
+    }
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 bool    SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const
 {
     if(!GetTyp())


More information about the Libreoffice-commits mailing list