editeng/source/items/flditem.cxx |   28 ++++++++++++++++++++++++++++
 include/editeng/flditem.hxx      |    3 +++
 2 files changed, 31 insertions(+)

New commits:
commit 4cc7c5010f9ed93a7b112ce2f6fc72690c46ce2d
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Apr 1 11:33:48 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Apr 1 13:06:23 2025 +0200

    add some more SvxFieldData to the model.xml dump
    
    which I found useful in debugging
    
    Change-Id: I28045cbedbba14633a85fa6b4ebc0b8c02f36cc0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183580
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index ca0b9f43546a..6f51528519d0 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -31,6 +31,7 @@
 #include <editeng/unonames.hxx>
 
 #include <tools/debug.hxx>
+#include <libxml/xmlwriter.h>
 
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/text/XTextContent.hpp>
@@ -275,6 +276,13 @@ MetaAction* SvxFieldData::createEndComment()
     return new MetaCommentAction( "FIELD_SEQ_END"_ostr );
 }
 
+void SvxFieldData::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFieldData"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("classId"), 
BAD_CAST(OString::number(GetClassId()).getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 
 SvxFieldItem::SvxFieldItem( std::unique_ptr<SvxFieldData> pField, const 
sal_uInt16 nId ) :
     SfxPoolItem( nId )
@@ -317,6 +325,14 @@ bool SvxFieldItem::operator==( const SfxPoolItem& rItem ) 
const
             && ( *mpField == *pOtherFld );
 }
 
+void SvxFieldItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFieldItem"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), 
BAD_CAST(OString::number(Which()).getStr()));
+    if (mpField)
+        mpField->dumpAsXml(pWriter);
+    (void)xmlTextWriterEndElement(pWriter);
+}
 
 // The following are the derivatives of SvxFieldData ...
 
@@ -473,6 +489,18 @@ MetaAction* SvxURLField::createBeginComment() const
                                   2*aURL.getLength() );
 }
 
+void SvxURLField::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxURLField"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("classId"), 
BAD_CAST(OString::number(GetClassId()).getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("format"), 
BAD_CAST(OString::number(static_cast<int>(eFormat)).getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("url"), 
BAD_CAST(aURL.toUtf8().getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("representation"), 
BAD_CAST(aRepresentation.toUtf8().getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("targetFrame"), 
BAD_CAST(aTargetFrame.toUtf8().getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
+
 //
 // SvxPageTitleField methods
 //
diff --git a/include/editeng/flditem.hxx b/include/editeng/flditem.hxx
index 397e9bd516d5..76a1e3749a93 100644
--- a/include/editeng/flditem.hxx
+++ b/include/editeng/flditem.hxx
@@ -56,6 +56,7 @@ public:
 
     virtual std::unique_ptr<SvxFieldData> Clone() const;
     virtual bool            operator==( const SvxFieldData& ) const;
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 
     virtual MetaAction*     createBeginComment() const;
     static MetaAction*      createEndComment();
@@ -78,6 +79,7 @@ public:
 
     virtual bool            operator==( const SfxPoolItem& ) const override;
     virtual SvxFieldItem*   Clone( SfxItemPool *pPool = nullptr ) const 
override;
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
     const SvxFieldData*     GetField() const    { return mpField.get(); }
 };
@@ -175,6 +177,7 @@ public:
 
     virtual std::unique_ptr<SvxFieldData> Clone() const override;
     virtual bool            operator==( const SvxFieldData& ) const override;
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
     virtual MetaAction* createBeginComment() const override;
 };

Reply via email to