summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-12-28 18:43:54 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-28 19:25:59 +0100
commit337aa303284b42c4fb13bff4beffdcf445a715cd (patch)
tree1ef4b886329f07bc8673352d43d278853e93f2a7 /sw
parentdaebeae541d354c36e42434411e64755c70329e3 (diff)
Factor out SwFmtCol::dumpAsXml() from docnode
Change-Id: Ic41b981c989aec658e95889b72bd76ecacb13a9a
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/fmtclds.hxx4
-rw-r--r--sw/source/core/docnode/nodedump.cxx10
-rw-r--r--sw/source/core/layout/atrfrm.cxx32
3 files changed, 39 insertions, 7 deletions
diff --git a/sw/inc/fmtclds.hxx b/sw/inc/fmtclds.hxx
index 3370a983d3b5..a98e39f19341 100644
--- a/sw/inc/fmtclds.hxx
+++ b/sw/inc/fmtclds.hxx
@@ -54,6 +54,8 @@ public:
sal_uInt16 GetLower() const { return nLower; }
sal_uInt16 GetLeft () const { return nLeft; }
sal_uInt16 GetRight() const { return nRight; }
+
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
typedef boost::ptr_vector<SwColumn> SwColumns;
@@ -160,6 +162,8 @@ public:
/** As above except that it @return the width of PrtArea -
that corresponds to what constitutes the column for the user. */
sal_uInt16 CalcPrtColWidth( sal_uInt16 nCol, sal_uInt16 nAct ) const;
+
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
inline const SwFmtCol &SwAttrSet::GetCol(bool bInP) const
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index a3771f04b84f..8ebd230120f5 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -449,6 +449,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
case RES_WRAP_INFLUENCE_ON_OBJPOS:
static_cast<const SwFmtWrapInfluenceOnObjPos*>(pItem)->dumpAsXml(writer);
break;
+ case RES_COL:
+ static_cast<const SwFmtCol*>(pItem)->dumpAsXml(writer);
+ break;
default: bDone = false; break;
}
if (bDone)
@@ -506,13 +509,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
case XATTR_FILLBMP_STRETCH:
pWhich = "fill bitmap stretch";
break;
- case RES_COL:
- {
- pWhich = "columns formatting";
- const SwFmtCol* pFmtCol = static_cast<const SwFmtCol*>(pItem);
- oValue = "number of columns: " + OString::number(pFmtCol->GetColumns().size());
- break;
- }
case RES_PROTECT:
pWhich = "protect";
break;
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 9da00f2af4d7..a0f0bd2eb487 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -790,6 +790,17 @@ bool SwColumn::operator==( const SwColumn &rCmp ) const
GetLower() == rCmp.GetLower();
}
+void SwColumn::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("swColumn"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWish"), BAD_CAST(OString::number(nWish).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nUpper"), BAD_CAST(OString::number(nUpper).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLower"), BAD_CAST(OString::number(nLower).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLeft"), BAD_CAST(OString::number(nLeft).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nRight"), BAD_CAST(OString::number(nRight).getStr()));
+ xmlTextWriterEndElement(pWriter);
+}
+
SwFmtCol::SwFmtCol( const SwFmtCol& rCpy )
: SfxPoolItem( RES_COL ),
m_eLineStyle( rCpy.m_eLineStyle ),
@@ -1116,6 +1127,27 @@ bool SwFmtCol::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
return bRet;
}
+void SwFmtCol::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("swFmtCol"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eLineStyle"), BAD_CAST(OString::number(m_eLineStyle).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLineWidth"), BAD_CAST(OString::number(m_nLineWidth).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aLineColor"), BAD_CAST(m_aLineColor.AsRGBHexString().toUtf8().getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLineHeight"), BAD_CAST(OString::number(m_nLineHeight).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eAdj"), BAD_CAST(OString::number(m_eAdj).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidth"), BAD_CAST(OString::number(m_nWidth).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidthAdjustValue"), BAD_CAST(OString::number(m_aWidthAdjustValue).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bOrtho"), BAD_CAST(OString::boolean(m_bOrtho).getStr()));
+
+ xmlTextWriterStartElement(pWriter, BAD_CAST("aColumns"));
+ for (const SwColumn& rColumn : m_aColumns)
+ rColumn.dumpAsXml(pWriter);
+ xmlTextWriterEndElement(pWriter);
+
+ xmlTextWriterEndElement(pWriter);
+}
+
// Partially implemented inline in hxx
SwFmtSurround::SwFmtSurround( SwSurround eFly ) :
SfxEnumItem( RES_SURROUND, sal_uInt16( eFly ) )