From e6b2860e88fa89b4ce7c9fdc7026dc1daf0fa700 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Fri, 13 Feb 2015 09:09:40 +0100 Subject: Extract SwTxtFmtColl::dumpAsXml() from docnode Change-Id: I3ffe83afa0e0e6f181f75319af3d5cbcc78de395 --- sw/inc/fmtcol.hxx | 2 ++ sw/source/core/doc/fmtcol.cxx | 10 ++++++++++ sw/source/core/docnode/nodedump.cxx | 10 +--------- 3 files changed, 13 insertions(+), 9 deletions(-) (limited to 'sw') diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index ce65a1c9505d..4d4b047c9897 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -130,6 +130,8 @@ public: } bool AreListLevelIndentsApplicable() const; + + void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; class SwGrfFmtColl: public SwFmtColl diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index ac80f02db507..8f6af9c8181f 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + #include #include #include @@ -462,6 +464,14 @@ bool SwTxtFmtColl::AreListLevelIndentsApplicable() const return bAreListLevelIndentsApplicable; } +void SwTxtFmtColl::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("swTxtFmtColl")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr())); + GetAttrSet().dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); +} + //FEATURE::CONDCOLL SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond, diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 3eed9fa06202..e2910b094e8b 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -308,15 +308,7 @@ void SwTxtFmtColls::dumpAsXml(xmlTextWriterPtr w) const { writer.startElement("swtxtfmtcolls"); for (size_t i = 0; i < size(); ++i) - { - const SwTxtFmtColl* pColl = GetFmt(i); - writer.startElement("swtxtfmtcoll"); - OString aName = OUStringToOString(pColl->GetName(), RTL_TEXTENCODING_UTF8); - writer.writeFormatAttribute("name", "%s", BAD_CAST(aName.getStr())); - - pColl->GetAttrSet().dumpAsXml(w); - writer.endElement(); - } + GetFmt(i)->dumpAsXml(w); writer.endElement(); } } -- cgit