sc/inc/attrib.hxx              |    3 +++
 sc/source/core/data/attrib.cxx |   25 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+)

New commits:
commit 8b1318324e574e510adb0c39fd744de360dd19b3
Author:     Felipe Lema <felipel...@mortemale.org>
AuthorDate: Thu Apr 1 15:57:56 2021 -0300
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Wed Nov 3 13:33:09 2021 +0100

    tdf#97667 Add XML Dump methods for Calc Pool Items
    
    Continuation of https://gerrit.libreoffice.org/c/core/+/88475
    
    Change-Id: Ic41ae7df362a796c56e95b38ccb534bbe045ead7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113497
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index 57fb4a74db58..92a0c3865c9c 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -156,6 +156,7 @@ public:
                 bHidePrint = rProtection.bHidePrint;
                 return *this;
             }
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 // page format item: contents of header and footer
@@ -188,6 +189,7 @@ public:
     void SetLeftArea( const EditTextObject& rNew );
     void SetCenterArea( const EditTextObject& rNew );
     void SetRightArea( const EditTextObject& rNew );
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 };
 
 // page format item: contents of header and footer
@@ -253,6 +255,7 @@ public:
 
     virtual bool                QueryValue( css::uno::Any& rAny, sal_uInt8 
nMemberId = 0 ) const override;
     virtual bool                PutValue( const css::uno::Any& rAny, sal_uInt8 
nMemberId ) override;
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
 
 private:
     sal_uInt16                  mnWidth;
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 6bdee5cafc29..e7cf37d4b741 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -367,6 +367,16 @@ void ScProtectionAttr::SetHidePrint( bool bHPrint)
     bHidePrint = bHPrint;
 }
 
+void ScProtectionAttr::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScProtectionAttr"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("protection"), 
BAD_CAST(OString::boolean(GetProtection()).getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("hide-formula"), 
BAD_CAST(OString::boolean(GetHideFormula()).getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("hide-cell"), 
BAD_CAST(OString::boolean(GetHideCell()).getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("hide-print"), 
BAD_CAST(OString::boolean(GetHidePrint()).getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
+}
+
 /**
  * ScPageHFItem - Dates from the Head and Foot lines
  */
@@ -484,6 +494,14 @@ void ScPageHFItem::SetRightArea( const EditTextObject& 
rNew )
 {
     pRightArea = rNew.Clone();
 }
+void ScPageHFItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScPageHFItem"));
+    GetLeftArea()->dumpAsXml(pWriter);
+    GetCenterArea()->dumpAsXml(pWriter);
+    GetRightArea()->dumpAsXml(pWriter);
+    (void)xmlTextWriterEndElement(pWriter);
+}
 
 /**
  * ScViewObjectModeItem - Display Mode of View Objects
@@ -657,6 +675,13 @@ bool ScPageScaleToItem::PutValue( const uno::Any& rAny, 
sal_uInt8 nMemberId )
     }
     return bRet;
 }
+void ScPageScaleToItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    (void)xmlTextWriterStartElement(pWriter, BAD_CAST("ScPageScaleToItem"));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("width"), 
BAD_CAST(OString::number(GetWidth()).getStr()));
+    (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("height"), 
BAD_CAST(OString::number(GetHeight()).getStr()));
+    (void)xmlTextWriterEndElement(pWriter);
+}
 
 ScCondFormatItem::ScCondFormatItem():
     SfxPoolItem( ATTR_CONDITIONAL )

Reply via email to