sw/inc/cellatr.hxx                |    4 ++++
 sw/inc/cellfml.hxx                |    2 ++
 sw/inc/expfld.hxx                 |    2 ++
 sw/source/core/attr/cellatr.cxx   |   17 +++++++++++++++++
 sw/source/core/fields/cellfml.cxx |    8 ++++++++
 sw/source/core/fields/tblcalc.cxx |   13 +++++++++++++
 6 files changed, 46 insertions(+)

New commits:
commit d896b03b0aefee24bcb5c3c07809e59ff6bf1efa
Author:     Miklos Vajna <[email protected]>
AuthorDate: Mon Dec 1 08:44:13 2025 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Tue Dec 2 10:05:07 2025 +0100

    sw doc model xml dump: handle SwTableBoxValue
    
    And same for SwTableBoxFormula and SwTableFormula.
    
    The formula string is a bit scary, "sum <1020213664:1020214688>"
    seems to refer to SwTableBox* 0x3ccf39a0 and SwTableBox* 0x3ccf3da0.
    
    SwTableField is similar, but it's a field, although it inherits from the
    same SwTableFormula, so the code between the cell property and the field
    is nicely shared.
    
    Change-Id: I10d21198eb65630c98e9a666924924cd58a7840d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194902
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx
index a84760f20034..2e9603fb77bf 100644
--- a/sw/inc/cellatr.hxx
+++ b/sw/inc/cellatr.hxx
@@ -92,6 +92,8 @@ public:
         ChgValid(false);
     }
     void Calc( SwTableCalcPara& rCalcPara, double& rValue );
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 class SW_DLLPUBLIC SwTableBoxValue final : public SfxPoolItem
@@ -113,6 +115,8 @@ public:
     }
 
     double GetValue() const                     { return m_nValue; }
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 inline const SwTableBoxNumFormat      &SwAttrSet::GetTableBoxNumFormat(bool 
bInP) const
diff --git a/sw/inc/cellfml.hxx b/sw/inc/cellfml.hxx
index a4f6bb2e5366..756e9de571ff 100644
--- a/sw/inc/cellfml.hxx
+++ b/sw/inc/cellfml.hxx
@@ -56,6 +56,7 @@ public:
     void SetLastTableBox( const SwTableBox* pBox )    { m_pLastTableBox = 
pBox; }
 };
 
+typedef struct _xmlTextWriter* xmlTextWriterPtr;
 class SW_DLLPUBLIC SwTableFormula
 {
 typedef void (SwTableFormula::*FnScanFormula)( const SwTable&, OUStringBuffer&,
@@ -145,6 +146,7 @@ public:
     // are all boxes valid which this formula relies on?
     bool HasValidBoxes() const;
     static sal_uInt16 GetLnPosInTable( const SwTable& rTable, const 
SwTableBox* pBox );
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index 92bb4c343238..62b501ff160f 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -416,6 +416,8 @@ public:
     virtual void        SetPar2(const OUString& rStr) override;
     virtual bool        QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) 
const override;
     virtual bool        PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich 
) override;
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 #endif // INCLUDED_SW_INC_EXPFLD_HXX
diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx
index a14d28a55d2f..e6db5de76dfe 100644
--- a/sw/source/core/attr/cellatr.cxx
+++ b/sw/source/core/attr/cellatr.cxx
@@ -155,6 +155,14 @@ void SwTableBoxFormula::Calc( SwTableCalcPara& rCalcPara, 
double& rValue )
     }
 }
 
+void SwTableBoxFormula::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableBoxFormula"));
+    SfxPoolItem::dumpAsXml(pWriter);
+    SwTableFormula::dumpAsXml(pWriter);
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 SwTableBoxValue::SwTableBoxValue()
     : SfxPoolItem( RES_BOXATR_VALUE ), m_nValue( 0 )
 {
@@ -180,4 +188,13 @@ SwTableBoxValue* SwTableBoxValue::Clone( SfxItemPool* ) 
const
     return new SwTableBoxValue( m_nValue );
 }
 
+void SwTableBoxValue::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableBoxValue"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"),
+                                      
BAD_CAST(OString::number(m_nValue).getStr()));
+    SfxPoolItem::dumpAsXml(pWriter);
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/fields/cellfml.cxx 
b/sw/source/core/fields/cellfml.cxx
index 074a1221487c..2a82ed5eee69 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -1095,6 +1095,14 @@ sal_uInt16 SwTableFormula::GetLnPosInTable( const 
SwTable& rTable, const SwTable
     return nRet;
 }
 
+void SwTableFormula::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableFormula"));
+    (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", 
this);
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("formula"), 
BAD_CAST(m_sFormula.toUtf8().getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 void SwTableFormula::SplitMergeBoxNm_( const SwTable& rTable, OUStringBuffer& 
rNewStr,
                     OUString& rFirstBox, OUString* pLastBox, void* pPara ) 
const
 {
diff --git a/sw/source/core/fields/tblcalc.cxx 
b/sw/source/core/fields/tblcalc.cxx
index 3ba0e908ba76..6b93483d943b 100644
--- a/sw/source/core/fields/tblcalc.cxx
+++ b/sw/source/core/fields/tblcalc.cxx
@@ -208,4 +208,17 @@ bool SwTableField::PutValue( const uno::Any& rAny, 
sal_uInt16 nWhichId )
     return bRet;
 }
 
+void SwTableField::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwTableField"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("expand"),
+                                      BAD_CAST(m_sExpand.toUtf8().getStr()));
+    (void)xmlTextWriterWriteAttribute(
+        pWriter, BAD_CAST("sub-type"),
+        BAD_CAST(OString::number(static_cast<int>(m_nSubType)).getStr()));
+    SwValueField::dumpAsXml(pWriter);
+    SwTableFormula::dumpAsXml(pWriter);
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to