diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-24 09:02:46 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-11-24 09:02:59 +0100 |
commit | 3b3cfa0e016de7712200785bc70ef2d6a5877113 (patch) | |
tree | 519b4a8da253ad3a6e3e95def355b90b23581874 | |
parent | c9067dd0e13a51e70b71c4730e08cd518477a4f3 (diff) |
Factor out EditTextObject::dumpAsXml() from SwDoc::dumpAsXml()
Change-Id: I1dae910e9d14db56d6388a71d76b1a479d5786b0
-rw-r--r-- | editeng/CppunitTest_editeng_core.mk | 1 | ||||
-rw-r--r-- | editeng/Library_editeng.mk | 1 | ||||
-rw-r--r-- | editeng/source/editeng/editobj.cxx | 13 | ||||
-rw-r--r-- | include/editeng/editobj.hxx | 3 | ||||
-rw-r--r-- | sw/source/core/docnode/nodedump.cxx | 11 |
5 files changed, 19 insertions, 10 deletions
diff --git a/editeng/CppunitTest_editeng_core.mk b/editeng/CppunitTest_editeng_core.mk index f66caec8a243..ea7f6896b52b 100644 --- a/editeng/CppunitTest_editeng_core.mk +++ b/editeng/CppunitTest_editeng_core.mk @@ -44,6 +44,7 @@ $(eval $(call gb_CppunitTest_use_libraries,editeng_core, \ $(eval $(call gb_CppunitTest_use_externals,editeng_core,\ boost_headers \ icuuc \ + libxml2 \ )) $(eval $(call gb_CppunitTest_set_include,editeng_core,\ diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk index 22f4c086085d..0e9c6c2c4a21 100644 --- a/editeng/Library_editeng.mk +++ b/editeng/Library_editeng.mk @@ -152,6 +152,7 @@ $(eval $(call gb_Library_use_externals,editeng,\ boost_headers \ icuuc \ icu_headers \ + libxml2 \ )) # Runtime dependency for unit-tests diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx index b100bd47299d..89bc9fe86aea 100644 --- a/editeng/source/editeng/editobj.cxx +++ b/editeng/source/editeng/editobj.cxx @@ -464,6 +464,19 @@ void EditTextObject::Dump() const } #endif +void EditTextObject::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + xmlTextWriterStartElement(pWriter, BAD_CAST("editTextObject")); + sal_Int32 nCount = GetParagraphCount(); + for (sal_Int32 i = 0; i < nCount; ++i) + { + xmlTextWriterStartElement(pWriter, BAD_CAST("paragraph")); + xmlTextWriterWriteString(pWriter, BAD_CAST(GetText(i).toUtf8().getStr())); + xmlTextWriterEndElement(pWriter); + } + xmlTextWriterEndElement(pWriter); +} + // from SfxItemPoolUser void EditTextObjectImpl::ObjectInDestruction(const SfxItemPool& rSfxItemPool) { diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx index fcf42073c753..622626807472 100644 --- a/include/editeng/editobj.hxx +++ b/include/editeng/editobj.hxx @@ -33,6 +33,8 @@ #include <vector> +#include <libxml/xmlwriter.h> + class SfxItemPool; class SfxStyleSheetPool; class SvxFieldItem; @@ -146,6 +148,7 @@ public: #if DEBUG_EDIT_ENGINE void Dump() const; #endif + void dumpAsXml(xmlTextWriterPtr pWriter) const; }; #endif // INCLUDED_EDITENG_EDITOBJ_HXX diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx index 812c881d1dec..9268d7f9b1cb 100644 --- a/sw/source/core/docnode/nodedump.cxx +++ b/sw/source/core/docnode/nodedump.cxx @@ -162,16 +162,7 @@ void lcl_dumpSdrModel(WriterHelper& writer, const SdrModel* pModel) writer.startElement("outliner"); writer.writeFormatAttribute("ptr", "%p", pOutliner); if (pOutliner) - { - const EditTextObject& rEditObj = pOutliner->GetTextObject(); - sal_Int32 nPara = rEditObj.GetParagraphCount(); - for (sal_Int32 j = 0; j < nPara; ++j) - { - writer.startElement("paragraph"); - xmlTextWriterWriteString(writer, BAD_CAST(OUStringToOString(rEditObj.GetText(j), RTL_TEXTENCODING_UTF8).getStr())); - writer.endElement(); - } - } + pOutliner->GetTextObject().dumpAsXml(writer); writer.endElement(); } writer.endElement(); |