add dumpAsXml() to more pool items

Change-Id: I276109148bab8180ce2442f5ee69722357362453
This commit is contained in:
Noel Grandin 2016-09-20 16:29:58 +02:00
parent c33647429b
commit 553f10c71a
7 changed files with 55 additions and 1 deletions

View File

@ -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();

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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
{

View File

@ -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
{

View File

@ -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();