Kaydet (Commit) 2a6dc39b authored tarafından Miklos Vajna's avatar Miklos Vajna

Factor out SvxFontHeightItem::dumpAsXml() from sw

Change-Id: I8dc3a0ed7bfce62b0d20c6bff143d77c0f26963f
üst ae177f5b
...@@ -1128,6 +1128,16 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp, ...@@ -1128,6 +1128,16 @@ void SvxFontHeightItem::SetHeight( sal_uInt32 nNewHeight, sal_uInt16 nNewProp,
ePropUnit = eMetric; ePropUnit = eMetric;
} }
void SvxFontHeightItem::dumpAsXml(xmlTextWriterPtr pWriter) const
{
xmlTextWriterStartElement(pWriter, BAD_CAST("svxFontHeightItem"));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("height"), BAD_CAST(OString::number(nHeight).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("prop"), BAD_CAST(OString::number(nProp).getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("propUnit"), BAD_CAST(OString::number(ePropUnit).getStr()));
xmlTextWriterEndElement(pWriter);
}
// class SvxFontWidthItem ----------------------------------------------- // class SvxFontWidthItem -----------------------------------------------
SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) : SvxFontWidthItem::SvxFontWidthItem( const sal_uInt16 nSz, const sal_uInt16 nPrp, const sal_uInt16 nId ) :
......
...@@ -91,6 +91,8 @@ public: ...@@ -91,6 +91,8 @@ public:
sal_uInt16 GetProp() const { return nProp; } sal_uInt16 GetProp() const { return nProp; }
SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ... SfxMapUnit GetPropUnit() const { return ePropUnit; } // Percent, Twip, ...
void dumpAsXml(struct _xmlTextWriter* pWriter) const;
}; };
#endif #endif
......
...@@ -414,11 +414,15 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet) ...@@ -414,11 +414,15 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
static_cast<const SwNumRuleItem*>(pItem)->dumpAsXml(writer); static_cast<const SwNumRuleItem*>(pItem)->dumpAsXml(writer);
break; break;
case RES_CHRATR_FONT: case RES_CHRATR_FONT:
case RES_CHRATR_CTL_FONT:
static_cast<const SvxFontItem*>(pItem)->dumpAsXml(writer); static_cast<const SvxFontItem*>(pItem)->dumpAsXml(writer);
break; break;
case RES_CHRATR_BACKGROUND: case RES_CHRATR_BACKGROUND:
static_cast<const SvxBrushItem*>(pItem)->dumpAsXml(writer); static_cast<const SvxBrushItem*>(pItem)->dumpAsXml(writer);
break; break;
case RES_CHRATR_FONTSIZE:
static_cast<const SvxFontHeightItem*>(pItem)->dumpAsXml(writer);
break;
default: bDone = false; break; default: bDone = false; break;
} }
if (bDone) if (bDone)
...@@ -433,14 +437,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet) ...@@ -433,14 +437,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
boost::optional<OString> oValue; boost::optional<OString> oValue;
switch (pItem->Which()) switch (pItem->Which())
{ {
case RES_CHRATR_CTL_FONT: pWhich = "character ctl font"; break;
case RES_CHRATR_FONTSIZE:
{
pWhich = "character font size";
const SvxFontHeightItem* pFontHeightItem = static_cast<const SvxFontHeightItem*>(pItem);
oValue = "nHeight: " + OString::number(pFontHeightItem->GetHeight()) + ", nProp: " + OString::number(pFontHeightItem->GetProp());
break;
}
case RES_CNTNT: case RES_CNTNT:
{ {
pWhich = "content"; pWhich = "content";
......
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