Kaydet (Commit) 68a5ae93 authored tarafından Miklos Vajna's avatar Miklos Vajna

Factor out SwFmtAnchor::dumpAsXml() from nodedump

Change-Id: I080fd80cf0a2fd0531edcb21f189aaf4fd922ecc
üst cc15d898
......@@ -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
......
......@@ -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";
......
......@@ -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 ),
......
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