sw/inc/redline.hxx              |    4 ++++
 sw/source/core/doc/docredln.cxx |   31 +++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

New commits:
commit b2919d5b5ee4e057c99219f5541efc388b2d19b7
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Jun 26 08:56:54 2025 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Jun 26 18:53:24 2025 +0200

    sw doc model xml dump: show the item set of a format redline
    
    Turns out Writer can have a format redline on top of direct formatting,
    but this wasn't visible in the doc model dump, add this.
    
    Change-Id: I863136da16935ed93772f49934618bb96cefbbc4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187056
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx
index b119cf5fd2d4..1eb738e370bb 100644
--- a/sw/inc/redline.hxx
+++ b/sw/inc/redline.hxx
@@ -47,6 +47,8 @@ public:
 
     virtual void Reject( SwPaM& rPam ) const;
     virtual bool operator == ( const SwRedlineExtraData& ) const;
+
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 class SW_DLLPUBLIC SwRedlineExtraData_FormatColl final : public 
SwRedlineExtraData
@@ -67,6 +69,8 @@ public:
     void SetItemSet( const SfxItemSet& rSet );
     SfxItemSet* GetItemSet( ) const { return m_pSet.get(); }
     void SetFormatAll( bool bAll )               { m_bFormatAll = bAll; }
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 class SwRedlineExtraData_Format final : public SwRedlineExtraData
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index a5ca99139dca..7d0baef0c994 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1119,6 +1119,15 @@ bool SwRedlineExtraData::operator == ( const 
SwRedlineExtraData& ) const
     return false;
 }
 
+void SwRedlineExtraData::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwRedlineExtraData"));
+    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("typeName"),
+                                      BAD_CAST(typeid(*this).name()));
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 SwRedlineExtraData_FormatColl::SwRedlineExtraData_FormatColl( UIName aColl,
                                                 sal_uInt16 nPoolFormatId,
                                                 const SfxItemSet* pItemSet,
@@ -1201,6 +1210,23 @@ void SwRedlineExtraData_FormatColl::SetItemSet( const 
SfxItemSet& rSet )
         m_pSet.reset();
 }
 
+void SwRedlineExtraData_FormatColl::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, 
BAD_CAST("SwRedlineExtraData_FormatColl"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("format-name"), 
BAD_CAST(m_sFormatNm.toString().toUtf8().getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("pool-id"), 
BAD_CAST(OString::number(m_nPoolId).getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("format-all"), 
BAD_CAST(OString::boolean(m_bFormatAll).getStr()));
+
+    SwRedlineExtraData::dumpAsXml(pWriter);
+
+    if (m_pSet)
+    {
+        m_pSet->dumpAsXml(pWriter);
+    }
+
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 SwRedlineExtraData_Format::SwRedlineExtraData_Format( const SfxItemSet& rSet )
 {
     SfxItemIter aIter( rSet );
@@ -1427,6 +1453,11 @@ void SwRedlineData::dumpAsXml(xmlTextWriterPtr pWriter) 
const
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), 
BAD_CAST(sRedlineType.getStr()));
     (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("moved"), 
BAD_CAST(OString::number(m_nMovedID).getStr()));
 
+    if (m_pExtraData)
+    {
+        m_pExtraData->dumpAsXml(pWriter);
+    }
+
     (void)xmlTextWriterEndElement(pWriter);
 }
 

Reply via email to