summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-12-22 10:34:04 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-12-22 19:33:56 +0100
commit68a5ae93c68d195d33963c94b5c3ac1eb5dc1ce0 (patch)
treef91b1220cd140dc4a7212e85add36a4563d04726 /sw
parentcc15d898721f90412cf03ff76e4163cc91251d67 (diff)
Factor out SwFmtAnchor::dumpAsXml() from nodedump
Change-Id: I080fd80cf0a2fd0531edcb21f189aaf4fd922ecc
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/fmtanchr.hxx2
-rw-r--r--sw/source/core/docnode/nodedump.cxx33
-rw-r--r--sw/source/core/layout/atrfrm.cxx24
3 files changed, 29 insertions, 30 deletions
diff --git a/sw/inc/fmtanchr.hxx b/sw/inc/fmtanchr.hxx
index f7e80620e73a..294e2e2c9835 100644
--- a/sw/inc/fmtanchr.hxx
+++ b/sw/inc/fmtanchr.hxx
@@ -71,6 +71,8 @@ public:
void SetType( RndStdIds nRndId ) { nAnchorId = nRndId; }
void SetPageNum( sal_uInt16 nNew ) { nPageNum = nNew; }
void SetAnchor( const SwPosition *pPos );
+
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const;
};
inline const SwFmtAnchor &SwAttrSet::GetAnchor(bool bInP) const
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 971f6b8c6d0c..227b3a61f61e 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -435,6 +435,9 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
case RES_HORI_ORIENT:
static_cast<const SwFmtHoriOrient*>(pItem)->dumpAsXml(writer);
break;
+ case RES_ANCHOR:
+ static_cast<const SwFmtAnchor*>(pItem)->dumpAsXml(writer);
+ break;
default: bDone = false; break;
}
if (bDone)
@@ -449,36 +452,6 @@ void lcl_dumpSfxItemSet(WriterHelper& writer, const SfxItemSet* pSet)
boost::optional<OString> oValue;
switch (pItem->Which())
{
- case RES_ANCHOR:
- {
- pWhich = "frame anchor";
- const SwFmtAnchor* pAnchor = static_cast<const SwFmtAnchor*>(pItem);
- switch (pAnchor->GetAnchorId())
- {
- case FLY_AT_PARA:
- oValue = "anchor type: at-para";
- break;
- case FLY_AS_CHAR:
- oValue = "anchor type: as-char";
- break;
- case FLY_AT_PAGE:
- oValue = "anchor type: at-page";
- break;
- case FLY_AT_FLY:
- oValue = "anchor type: at-fly";
- break;
- case FLY_AT_CHAR:
- oValue = "anchor type: at-char";
- break;
- default:
- oValue = "anchor type: " + OString::number(pAnchor->GetAnchorId());
- break;
- }
- const SwPosition* pPosition = pAnchor->GetCntntAnchor();
- if (pPosition)
- oValue = *oValue + ", node index: " + OString::number(pPosition->nNode.GetNode().GetIndex()) + ", index: " + OString::number(pPosition->nContent.GetIndex());
- break;
- }
case RES_SURROUND:
{
pWhich = "frame surround";
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 070bb4ba061b..3c3b0b902b6d 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -1666,6 +1666,30 @@ bool SwFmtAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
return bRet;
}
+void SwFmtAnchor::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("swFmtAnchor"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+
+ if (m_pCntntAnchor)
+ {
+ std::stringstream aCntntAnchor;
+ aCntntAnchor << *m_pCntntAnchor;
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("pCntntAnchor"), BAD_CAST(aCntntAnchor.str().c_str()));
+ }
+ else
+ xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("pCntntAnchor"), "%p", m_pCntntAnchor.get());
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nAnchorType"), BAD_CAST(OString::number(nAnchorId).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPageNum"), BAD_CAST(OString::number(nPageNum).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nOrder"), BAD_CAST(OString::number(mnOrder).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nOrderCounter"), BAD_CAST(OString::number(mnOrderCounter).getStr()));
+ OUString aPresentation;
+ GetPresentation(SFX_ITEM_PRESENTATION_NAMELESS, SFX_MAPUNIT_100TH_MM, SFX_MAPUNIT_100TH_MM, aPresentation);
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(aPresentation.toUtf8().getStr()));
+
+ xmlTextWriterEndElement(pWriter);
+}
+
// Partially implemented inline in hxx
SwFmtURL::SwFmtURL() :
SfxPoolItem( RES_URL ),