sw/inc/charfmt.hxx | 2 + sw/inc/section.hxx | 1 sw/source/core/docnode/nodedump.cxx | 52 ------------------------------------ sw/source/core/docnode/section.cxx | 16 +++++++++++ sw/source/core/layout/atrfrm.cxx | 8 +++++ sw/source/core/txtnode/chrfmt.cxx | 19 +++++++++++++ 6 files changed, 46 insertions(+), 52 deletions(-)
New commits: commit c8b36dcde79588ec71957117be1c19f3ddaec647 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Feb 16 09:19:03 2015 +0100 sw: clean up remaining format collection dumpers Change-Id: I00833847c3c9410312205751a89d319a3143d516 diff --git a/sw/inc/charfmt.hxx b/sw/inc/charfmt.hxx index 50f239b..db67d1d 100644 --- a/sw/inc/charfmt.hxx +++ b/sw/inc/charfmt.hxx @@ -37,6 +37,8 @@ class SW_DLLPUBLIC SwCharFmt : public SwFmt public: TYPEINFO_OVERRIDE(); // already in base class Client + + void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; namespace CharFmt diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx index 4a1edd4..ad89b4b 100644 --- a/sw/inc/section.hxx +++ b/sw/inc/section.hxx @@ -343,6 +343,7 @@ public: virtual bool IsInContent() const SAL_OVERRIDE; virtual ::com::sun::star::uno::Reference< ::com::sun::star::rdf::XMetadatable > MakeUnoObject() SAL_OVERRIDE; + void dumpAsXml(struct _xmlTextWriter* pWriter) const; }; diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index bd2438d..24f35e4 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -249,58 +249,6 @@ void SwStartNode::dumpAsXml( xmlTextWriterPtr w ) const // writer.endElement(); - it is a start node, so don't end, will make xml better nested } -void SwFrmFmts::dumpAsXml(xmlTextWriterPtr w, const char* pName) const -{ - WriterHelper writer(w); - if (size()) - { - writer.startElement(pName); - for (size_t i = 0; i < size(); ++i) - { - if (const SwFrmFmt* pFmt = GetFmt(i)) - pFmt->dumpAsXml(writer); - } - writer.endElement(); - } -} - -void SwCharFmts::dumpAsXml(xmlTextWriterPtr w) const -{ - WriterHelper writer(w); - if (size()) - { - writer.startElement("swcharfmts"); - for (size_t i = 0; i < size(); ++i) - { - const SwCharFmt* pFmt = GetFmt(i); - writer.startElement("swcharfmt"); - OString aName = OUStringToOString(pFmt->GetName(), RTL_TEXTENCODING_UTF8); - writer.writeFormatAttribute("name", "%s", BAD_CAST(aName.getStr())); - - pFmt->GetAttrSet().dumpAsXml(w); - writer.endElement(); - } - writer.endElement(); - } -} - -void SwSectionFmts::dumpAsXml(xmlTextWriterPtr w) const -{ - WriterHelper writer(w); - if (size()) - { - writer.startElement("swsectionfmts"); - for (size_t i = 0; i < size(); ++i) - { - const SwSectionFmt* pFmt = GetFmt(i); - writer.startElement("swsectionfmt"); - pFmt->GetAttrSet().dumpAsXml(w); - writer.endElement(); - } - writer.endElement(); - } -} - void SwTxtNode::dumpAsXml( xmlTextWriterPtr w ) const { WriterHelper writer( w ); diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index e1a90b7..37289e4 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -1086,6 +1086,22 @@ SwSectionFmt::MakeUnoObject() return xMeta; } +void SwSectionFmt::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("swSectionFmt")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr())); + GetAttrSet().dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); +} + +void SwSectionFmts::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("swSectionFmts")); + for (size_t i = 0; i < size(); ++i) + GetFmt(i)->dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); +} + // Method to break section links inside a linked section static void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd ) { diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 083f884..961b70f 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2835,6 +2835,14 @@ void SwFrmFmt::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } +void SwFrmFmts::dumpAsXml(xmlTextWriterPtr pWriter, const char* pName) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST(pName)); + for (size_t i = 0; i < size(); ++i) + GetFmt(i)->dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); +} + // class SwFlyFrmFmt // Partially implemented inline in hxx diff --git a/sw/source/core/txtnode/chrfmt.cxx b/sw/source/core/txtnode/chrfmt.cxx index 86359ff..9557ba8 100644 --- a/sw/source/core/txtnode/chrfmt.cxx +++ b/sw/source/core/txtnode/chrfmt.cxx @@ -17,8 +17,27 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <libxml/xmlwriter.h> + #include <charfmt.hxx> +#include <docary.hxx> TYPEINIT1( SwCharFmt, SwFmt ); //rtti fuer SwCharFmt +void SwCharFmt::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("swCharFmt")); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr())); + GetAttrSet().dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); +} + +void SwCharFmts::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("swCharFmts")); + for (size_t i = 0; i < size(); ++i) + GetFmt(i)->dumpAsXml(pWriter); + xmlTextWriterEndElement(pWriter); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits