editeng/CppunitTest_editeng_core.mk | 1 + editeng/Library_editeng.mk | 1 + editeng/source/editeng/editobj.cxx | 13 +++++++++++++ include/editeng/editobj.hxx | 3 +++ sw/source/core/docnode/nodedump.cxx | 11 +---------- 5 files changed, 19 insertions(+), 10 deletions(-)
New commits: commit 3b3cfa0e016de7712200785bc70ef2d6a5877113 Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Mon Nov 24 09:02:46 2014 +0100 Factor out EditTextObject::dumpAsXml() from SwDoc::dumpAsXml() Change-Id: I1dae910e9d14db56d6388a71d76b1a479d5786b0 diff --git a/editeng/CppunitTest_editeng_core.mk b/editeng/CppunitTest_editeng_core.mk index f66caec..ea7f689 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 22f4c08..0e9c6c2 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 b100bd4..89bc9fe 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 fcf4207..6226268 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 812c881..9268d7f 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits