From 9071c5070cbcf6bba00285cdd9b062e961a10287 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 19 Dec 2014 09:04:41 +0100 Subject: Factor out SwFmtCntnt::dumpAsXml() from nodedump Change-Id: I6adcaa8534efefa474d489125d3fb95f150e3e89 --- sw/inc/fmtcntnt.hxx | 2 ++ sw/source/core/docnode/nodedump.cxx | 10 +++------- sw/source/core/layout/atrfrm.cxx | 8 ++++++++ 3 files changed, 13 insertions(+), 7 deletions(-) (limited to 'sw') diff --git a/sw/inc/fmtcntnt.hxx b/sw/inc/fmtcntnt.hxx index c4efe4f7989c..a33b545be1a2 100644 --- a/sw/inc/fmtcntnt.hxx +++ b/sw/inc/fmtcntnt.hxx @@ -44,6 +44,8 @@ public: const SwNodeIndex *GetCntntIdx() const { return pStartNode; } void SetNewCntntIdx( const SwNodeIndex *pIdx ); + + void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; inline const SwFmtCntnt &SwAttrSet::GetCntnt(bool bInP) const diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index f6cd7f85eafb..c0cda7594cc9 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -423,6 +423,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet) case RES_CHRATR_FONTSIZE: static_cast(pItem)->dumpAsXml(writer); break; + case RES_CNTNT: + static_cast(pItem)->dumpAsXml(writer); + break; default: bDone = false; break; } if (bDone) @@ -437,13 +440,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet) boost::optional oValue; switch (pItem->Which()) { - case RES_CNTNT: - { - pWhich = "content"; - const SwFmtCntnt* pCntnt = static_cast(pItem); - oValue = "node index: " + OString::number(pCntnt->GetCntntIdx()->GetNode().GetIndex()); - break; - } case RES_FRM_SIZE: { pWhich = "frame size"; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 43f6666f5332..dbf0caaf6848 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -555,6 +555,14 @@ SfxPoolItem* SwFmtCntnt::Clone( SfxItemPool* ) const return new SwFmtCntnt( *this ); } +void SwFmtCntnt::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("swFmtCntnt")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("startNode"), BAD_CAST(OString::number(pStartNode->GetNode().GetIndex()).getStr())); + xmlTextWriterEndElement(pWriter); +} + // Partially implemented inline in hxx SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc &rCpy ) : SfxPoolItem( RES_PAGEDESC ), -- cgit