Kaydet (Commit) 9e04fac5 authored tarafından Markus Mohrhard's avatar Markus Mohrhard

add dumpAsXml methods to more pool items

Change-Id: Ia33ac2dfa23bdc4e2990e6d028d1bae7fedfe4f5
Reviewed-on: https://gerrit.libreoffice.org/63853
Tested-by: Jenkins
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 91aba7ca
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <sal/log.hxx> #include <sal/log.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include <unotools/fontdefs.hxx> #include <unotools/fontdefs.hxx>
#include <unotools/intlwrapper.hxx>
#include <vcl/outdev.hxx> #include <vcl/outdev.hxx>
#include <vcl/unohelp.hxx> #include <vcl/unohelp.hxx>
#include <editeng/eeitem.hxx> #include <editeng/eeitem.hxx>
...@@ -1745,6 +1746,18 @@ bool SvxColorItem::GetPresentation ...@@ -1745,6 +1746,18 @@ bool SvxColorItem::GetPresentation
return true; return true;
} }
void SvxColorItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SvxColorItem"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
OUString aStr;
IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
GetPresentation( SfxItemPresentation::Complete, MapUnit::Map100thMM, MapUnit::Map100thMM, aStr, aIntlWrapper);
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr()));
xmlTextWriterEndElement(pWriter);
}
void SvxColorItem::SetValue( const Color& rNewCol ) void SvxColorItem::SetValue( const Color& rNewCol )
{ {
......
...@@ -68,6 +68,8 @@ public: ...@@ -68,6 +68,8 @@ public:
return mColor; return mColor;
} }
void SetValue(const Color& rNewColor); void SetValue(const Color& rNewColor);
void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
}; };
// XXX: to be moved in a separate header. // XXX: to be moved in a separate header.
......
...@@ -121,6 +121,7 @@ public: ...@@ -121,6 +121,7 @@ public:
virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override
{ return new SfxInt32Item(*this); } { return new SfxInt32Item(*this); }
void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
}; };
...@@ -140,6 +141,8 @@ public: ...@@ -140,6 +141,8 @@ public:
virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override virtual SfxPoolItem * Clone(SfxItemPool * = nullptr) const override
{ return new SfxUInt32Item(*this); } { return new SfxUInt32Item(*this); }
void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
}; };
#endif // INCLUDED_SVL_INTITEM_HXX #endif // INCLUDED_SVL_INTITEM_HXX
......
...@@ -44,6 +44,8 @@ public: ...@@ -44,6 +44,8 @@ public:
const basegfx::B3DVector& GetValue() const { return aVal; } const basegfx::B3DVector& GetValue() const { return aVal; }
virtual sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override; virtual sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override;
void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
}; };
#endif #endif
......
...@@ -138,6 +138,14 @@ SfxPoolItem* SfxInt32Item::CreateDefault() ...@@ -138,6 +138,14 @@ SfxPoolItem* SfxInt32Item::CreateDefault()
return new SfxInt32Item(); return new SfxInt32Item();
}; };
void SfxInt32Item::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SfxInt32Item"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr()));
xmlTextWriterEndElement(pWriter);
}
// class SfxUInt32Item // class SfxUInt32Item
...@@ -147,6 +155,14 @@ SfxPoolItem* SfxUInt32Item::CreateDefault() ...@@ -147,6 +155,14 @@ SfxPoolItem* SfxUInt32Item::CreateDefault()
return new SfxUInt32Item(); return new SfxUInt32Item();
}; };
void SfxUInt32Item::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SfxUInt32Item"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(GetValue()).getStr()));
xmlTextWriterEndElement(pWriter);
}
SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_uInt32 nValue): SfxMetricItem::SfxMetricItem(sal_uInt16 which, sal_uInt32 nValue):
SfxInt32Item(which, nValue) SfxInt32Item(which, nValue)
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <comphelper/fileformat.h> #include <comphelper/fileformat.h>
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include <rtl/math.hxx> #include <rtl/math.hxx>
#include <libxml/xmlwriter.h>
#include <svx/e3ditem.hxx> #include <svx/e3ditem.hxx>
...@@ -98,4 +99,14 @@ sal_uInt16 SvxB3DVectorItem::GetVersion (sal_uInt16 nFileFormatVersion) const ...@@ -98,4 +99,14 @@ sal_uInt16 SvxB3DVectorItem::GetVersion (sal_uInt16 nFileFormatVersion) const
return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) ? USHRT_MAX : 0; return (nFileFormatVersion == SOFFICE_FILEFORMAT_31) ? USHRT_MAX : 0;
} }
void SvxB3DVectorItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("SvxB3DVectorItem"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"), BAD_CAST(OString::number(aVal.getX()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"), BAD_CAST(OString::number(aVal.getY()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("z"), BAD_CAST(OString::number(aVal.getZ()).getStr()));
xmlTextWriterEndElement(pWriter);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment