diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-22 12:07:43 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-02-22 17:40:36 +0100 |
commit | 7b7d11209bf15604532467126d8704eaf5f51799 (patch) | |
tree | 590858eb2199e10cb33371b51976e7d002b3a137 | |
parent | 4e91003337f8f35810efa00322d041fb4ff94df7 (diff) |
Extract SwRangeRedline::dumpAsXml() from SwRedlineTbl
Change-Id: Ia0eea8a0c4ef7a8297da185d8187017e76bea422
-rw-r--r-- | sw/inc/redline.hxx | 1 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 83 |
2 files changed, 44 insertions, 40 deletions
diff --git a/sw/inc/redline.hxx b/sw/inc/redline.hxx index b789ce6ea2e1..533c027628a2 100644 --- a/sw/inc/redline.hxx +++ b/sw/inc/redline.hxx @@ -293,6 +293,7 @@ public: bool operator==( const SwRangeRedline& ) const; bool operator<( const SwRangeRedline& ) const; + void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; /// Base object for 'Redlines' that are not of 'Ranged' type (like table row insert\delete) diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 20dcda5dfc18..82ce470da54d 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -572,47 +572,9 @@ void SwRedlineTbl::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); for (sal_uInt16 nCurRedlinePos = 0; nCurRedlinePos < size(); ++nCurRedlinePos) - { - const SwRangeRedline* pRedline = operator[](nCurRedlinePos); - xmlTextWriterStartElement(pWriter, BAD_CAST("swRangeRedline")); - - xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", pRedline); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number(pRedline->GetSeqNo()).getStr())); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("author"), BAD_CAST(SW_MOD()->GetRedlineAuthor(pRedline->GetAuthor()).toUtf8().getStr())); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("date"), BAD_CAST(DateTimeToOString(pRedline->GetTimeStamp()).getStr())); + operator[](nCurRedlinePos)->dumpAsXml(pWriter); - OString sRedlineType; - switch (pRedline->GetType()) - { - case nsRedlineType_t::REDLINE_INSERT: - sRedlineType = "REDLINE_INSERT"; - break; - case nsRedlineType_t::REDLINE_DELETE: - sRedlineType = "REDLINE_DELETE"; - break; - case nsRedlineType_t::REDLINE_FORMAT: - sRedlineType = "REDLINE_FORMAT"; - break; - default: - sRedlineType = "UNKNOWN"; - break; - } - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(sRedlineType.getStr())); - - xmlTextWriterStartElement(pWriter, BAD_CAST("point")); - pRedline->GetPoint()->dumpAsXml(pWriter); - xmlTextWriterEndElement(pWriter); - xmlTextWriterStartElement(pWriter, BAD_CAST("mark")); - pRedline->GetMark()->dumpAsXml(pWriter); - xmlTextWriterEndElement(pWriter); - - const SwRedlineExtraData* pExtraRedlineData = pRedline->GetExtraData(); - xmlTextWriterStartElement(pWriter, BAD_CAST("swRedlineExtraData")); - xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(pExtraRedlineData).name())); - xmlTextWriterEndElement(pWriter); // swRadlineExtraData - xmlTextWriterEndElement(pWriter); // swRangeRedline - } - xmlTextWriterEndElement(pWriter); // swRedlineTbl + xmlTextWriterEndElement(pWriter); } SwRedlineExtraData::~SwRedlineExtraData() @@ -1651,6 +1613,47 @@ OUString SwRangeRedline::GetDescr(sal_uInt16 nPos) return aResult; } +void SwRangeRedline::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("swRangeRedline")); + + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("id"), BAD_CAST(OString::number(GetSeqNo()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("author"), BAD_CAST(SW_MOD()->GetRedlineAuthor(GetAuthor()).toUtf8().getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("date"), BAD_CAST(DateTimeToOString(GetTimeStamp()).getStr())); + + OString sRedlineType; + switch (GetType()) + { + case nsRedlineType_t::REDLINE_INSERT: + sRedlineType = "REDLINE_INSERT"; + break; + case nsRedlineType_t::REDLINE_DELETE: + sRedlineType = "REDLINE_DELETE"; + break; + case nsRedlineType_t::REDLINE_FORMAT: + sRedlineType = "REDLINE_FORMAT"; + break; + default: + sRedlineType = "UNKNOWN"; + break; + } + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(sRedlineType.getStr())); + + xmlTextWriterStartElement(pWriter, BAD_CAST("point")); + GetPoint()->dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); + xmlTextWriterStartElement(pWriter, BAD_CAST("mark")); + GetMark()->dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); + + const SwRedlineExtraData* pExtraRedlineData = GetExtraData(); + xmlTextWriterStartElement(pWriter, BAD_CAST("swRedlineExtraData")); + xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(pExtraRedlineData).name())); + xmlTextWriterEndElement(pWriter); // swRadlineExtraData + xmlTextWriterEndElement(pWriter); +} + bool SwExtraRedlineTbl::Insert( SwExtraRedline* p ) { m_aExtraRedlines.push_back( p ); |