diff options
author | Noel Grandin <noel@peralex.com> | 2016-09-20 16:29:58 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-09-21 09:06:33 +0200 |
commit | 553f10c71a2cc92f5f5890e24948f5277e3d2758 (patch) | |
tree | 2040ea0241bc538f5372c5a9234e0cf523e00b9e | |
parent | c33647429b179c024f0749be85c89f737a8b42db (diff) |
add dumpAsXml() to more pool items
Change-Id: I276109148bab8180ce2442f5ee69722357362453
-rw-r--r-- | editeng/source/items/numitem.cxx | 31 | ||||
-rw-r--r-- | include/editeng/numitem.hxx | 2 | ||||
-rw-r--r-- | include/svl/eitem.hxx | 2 | ||||
-rw-r--r-- | include/svl/poolitem.hxx | 1 | ||||
-rw-r--r-- | svl/source/items/cenumitm.cxx | 9 | ||||
-rw-r--r-- | svl/source/items/poolitem.cxx | 10 | ||||
-rw-r--r-- | svl/source/items/stritem.cxx | 1 |
7 files changed, 55 insertions, 1 deletions
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx index 3c3fa19d71a7..800f59cd1499 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 81131a493550..c789f005a1d0 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 bed13e458615..16518a7bea38 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 feb209fa5f71..e594abb7d400 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 f17ce3c1eb55..183c7f1f967a 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 81264d940b52..93fe79e416cc 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 ae8727a77ed1..c00a637b676c 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(); |