[Libreoffice-commits] core.git: include/svx svx/Library_svxcore.mk svx/source sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Nov 28 02:25:16 PST 2014


 include/svx/svdobj.hxx              |    2 ++
 svx/Library_svxcore.mk              |    1 +
 svx/source/svdraw/svdobj.cxx        |   18 ++++++++++++++++++
 sw/source/core/docnode/nodedump.cxx |   17 ++---------------
 4 files changed, 23 insertions(+), 15 deletions(-)

New commits:
commit c25aa2ad4306d011df03100aa54d0b3b72a7a9f5
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 28 09:05:16 2014 +0100

    Factor out SdrObject::dumpAsXml() from SwDoc::dumpAsXml()
    
    Change-Id: I043f740c73f1b39d81383f4f1eab2aae009ac2ba

diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx
index 5a5ab9b..30c3961 100644
--- a/include/svx/svdobj.hxx
+++ b/include/svx/svdobj.hxx
@@ -961,6 +961,8 @@ public:
 
     OString stringify() const;
 
+    void dumpAsXml(struct _xmlTextWriter* pWriter) const;
+
 protected:
     // Sets a new UNO shape
     //
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index 420a6b8..39d6be5 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -87,6 +87,7 @@ $(eval $(call gb_Library_use_externals,svxcore,\
 	icu_headers \
 	mesa_headers \
 	glew \
+	libxml2 \
 ))
 
 ifeq ($(OS),MACOSX)
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 470881f..ac2fff1 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -37,6 +37,7 @@
 #include <drawinglayer/processor2d/linegeometryextractor2d.hxx>
 #include <editeng/editeng.hxx>
 #include <editeng/eeitem.hxx>
+#include <editeng/outlobj.hxx>
 #include <math.h>
 #include <sfx2/objface.hxx>
 #include <sfx2/objsh.hxx>
@@ -133,6 +134,7 @@
 #include <svdobjuserdatalist.hxx>
 
 #include <boost/scoped_ptr.hpp>
+#include <libxml/xmlwriter.h>
 
 using namespace ::com::sun::star;
 
@@ -1750,6 +1752,22 @@ OString SdrObject::stringify() const
     return aString.makeStringAndClear();
 }
 
+void SdrObject::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("sdrObject"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*this).name()));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("name"), "%s", BAD_CAST(GetName().toUtf8().getStr()));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("title"), "%s", BAD_CAST(GetTitle().toUtf8().getStr()));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("description"), "%s", BAD_CAST(GetDescription().toUtf8().getStr()));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("nOrdNum"), "%" SAL_PRIuUINT32, GetOrdNumDirect());
+
+    if (const OutlinerParaObject* pOutliner = GetOutlinerParaObject())
+        pOutliner->dumpAsXml(pWriter);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 bool SdrObject::BegTextEdit(SdrOutliner& /*rOutl*/)
 {
     return false;
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 87a2ae4..7e7795c 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -147,21 +147,8 @@ void lcl_dumpSdrModel(WriterHelper& writer, const SdrModel* pModel)
             const size_t nObjCount = pPage->GetObjCount();
             for (size_t i = 0; i < nObjCount; ++i)
             {
-                const SdrObject* pObject = pPage->GetObj(i);
-                writer.startElement("sdrObject");
-                writer.writeFormatAttribute("ptr", "%p", pObject);
-                if (pObject)
-                {
-                    writer.writeFormatAttribute("symbol", "%s", BAD_CAST(typeid(*pObject).name()));
-                    writer.writeFormatAttribute("name", "%s", BAD_CAST(OUStringToOString(pObject->GetName(), RTL_TEXTENCODING_UTF8).getStr()));
-                    writer.writeFormatAttribute("title", "%s", BAD_CAST(OUStringToOString(pObject->GetTitle(), RTL_TEXTENCODING_UTF8).getStr()));
-                    writer.writeFormatAttribute("description", "%s", BAD_CAST(OUStringToOString(pObject->GetDescription(), RTL_TEXTENCODING_UTF8).getStr()));
-                    writer.writeFormatAttribute("nOrdNum", TMP_FORMAT, pObject->GetOrdNumDirect());
-
-                    if (const OutlinerParaObject* pOutliner = pObject->GetOutlinerParaObject())
-                        pOutliner->dumpAsXml(writer);
-                }
-                writer.endElement();
+                if (const SdrObject* pObject = pPage->GetObj(i))
+                    pObject->dumpAsXml(writer);
             }
         }
         writer.endElement();


More information about the Libreoffice-commits mailing list