editeng/source/items/numitem.cxx | 31 ++++++++++++++++++++++++++++++- include/editeng/numitem.hxx | 2 ++ include/svl/eitem.hxx | 2 ++ include/svl/poolitem.hxx | 1 + svl/source/items/cenumitm.cxx | 9 +++++++++ svl/source/items/poolitem.cxx | 10 ++++++++++ svl/source/items/stritem.cxx | 1 + 7 files changed, 55 insertions(+), 1 deletion(-)
New commits: commit 553f10c71a2cc92f5f5890e24948f5277e3d2758 Author: Noel Grandin <n...@peralex.com> Date: Tue Sep 20 16:29:58 2016 +0200 add dumpAsXml() to more pool items Change-Id: I276109148bab8180ce2442f5ee69722357362453 diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 3c3fa19..800f59c 100644 --- a/editeng/source/items/numitem.cxx +++ b/editeng/source/items/numitem.cxx @@ -43,7 +43,7 @@ #include <comphelper/processfactory.hxx> #include <tools/mapunit.hxx> #include <unotools/configmgr.hxx> - +#include <libxml/xmlwriter.h> #include <editeng/unonrule.hxx> #define DEF_WRITER_LSPACE 500 //Standard Indentation @@ -691,6 +691,27 @@ void SvxNumRule::Store( SvStream &rStream ) DestroyFontToSubsFontConverter(pConverter); } +void SvxNumRule::dumpAsXml(struct _xmlTextWriter* pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("svxNumRule")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("levelCount"), BAD_CAST(OUString::number(nLevelCount).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("continuousNumbering"), BAD_CAST(OUString::number(bContinuousNumbering).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("numberingType"), BAD_CAST(OUString::number((int)eNumberingType).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("featureFlags"), BAD_CAST(OUString::number((int)nFeatureFlags).getStr())); + for(sal_uInt16 i = 0; i < SVX_MAX_NUM; i++) + { + if(aFmts[i]) + { + xmlTextWriterStartElement(pWriter, BAD_CAST("aFmts")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("i"), BAD_CAST(OUString::number(i).getStr())); + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", aFmts[i]); + xmlTextWriterEndElement(pWriter); + } + } + xmlTextWriterEndElement(pWriter); +} + + SvxNumRule::~SvxNumRule() { for(SvxNumberFormat* aFmt : aFmts) @@ -965,6 +986,14 @@ bool SvxNumBulletItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberI return false; } +void SvxNumBulletItem::dumpAsXml(struct _xmlTextWriter* pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("svxNumBulletItem")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); + pNumRule->dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); +} + SvxNumRule* SvxConvertNumRule( const SvxNumRule* pRule, sal_uInt16 nLevels, SvxNumRuleType eType ) { const sal_uInt16 nSrcLevels = pRule->GetLevelCount(); diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx index 81131a4..c789f00 100644 --- a/include/editeng/numitem.hxx +++ b/include/editeng/numitem.hxx @@ -266,6 +266,7 @@ public: SvxNumRule& operator=( const SvxNumRule& ); void Store(SvStream &rStream); + void dumpAsXml(struct _xmlTextWriter* pWriter) const; const SvxNumberFormat* Get(sal_uInt16 nLevel)const; const SvxNumberFormat& GetLevel(sal_uInt16 nLevel)const; void SetLevel(sal_uInt16 nLevel, const SvxNumberFormat& rFmt, bool bIsValid = true); @@ -308,6 +309,7 @@ public: virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override; + virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const override; }; class SvxNodeNum diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx index bed13e4..16518a7 100644 --- a/include/svl/eitem.hxx +++ b/include/svl/eitem.hxx @@ -91,6 +91,8 @@ public: const IntlWrapper * = nullptr) const override; + virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const override; + virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 = 0) const override; virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8) override; diff --git a/include/svl/poolitem.hxx b/include/svl/poolitem.hxx index feb209f..e594abb 100644 --- a/include/svl/poolitem.hxx +++ b/include/svl/poolitem.hxx @@ -245,6 +245,7 @@ public: MapUnit ePresMetric, OUString &rText, const IntlWrapper * = nullptr ) const override; + virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const override; // create a copy of itself virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx index f17ce3c..183c7f1 100644 --- a/svl/source/items/cenumitm.cxx +++ b/svl/source/items/cenumitm.cxx @@ -25,6 +25,7 @@ #include "whassert.hxx" #include <comphelper/extract.hxx> +#include <libxml/xmlwriter.h> // virtual @@ -175,6 +176,14 @@ bool SfxBoolItem::GetPresentation(SfxItemPresentation, return true; } +void SfxBoolItem::dumpAsXml(struct _xmlTextWriter* pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("sfxBoolItem")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(GetValueTextByVal(m_bValue).toUtf8().getStr())); + xmlTextWriterEndElement(pWriter); +} + // virtual bool SfxBoolItem::QueryValue(css::uno::Any& rVal, sal_uInt8) const { diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 81264d9..93fe79e 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -193,6 +193,10 @@ void SfxPoolItem::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("sfxPoolItem")); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("typeName"), BAD_CAST(typeid(*this).name())); + OUString rText; + if (GetPresentation( SFX_ITEM_PRESENTATION_COMPLETE, MAP_100TH_MM, MAP_100TH_MM, rText)) + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(rText.getStr())); xmlTextWriterEndElement(pWriter); } @@ -240,6 +244,12 @@ bool SfxVoidItem::GetPresentation return true; } +void SfxVoidItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("sfxVoidItem")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); + xmlTextWriterEndElement(pWriter); +} SfxPoolItem* SfxVoidItem::Clone(SfxItemPool *) const { diff --git a/svl/source/items/stritem.cxx b/svl/source/items/stritem.cxx index ae8727a..c00a637 100644 --- a/svl/source/items/stritem.cxx +++ b/svl/source/items/stritem.cxx @@ -58,6 +58,7 @@ void SfxStringItem::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(GetValue().toUtf8().getStr())); xmlTextWriterEndElement(pWriter); } + SfxPoolItem* SfxStringItem::CreateDefault() { return new SfxStringItem(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits