[Libreoffice-commits] core.git: sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Apr 2 02:30:43 PDT 2014


 sw/source/core/docnode/nodedump.cxx |   35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

New commits:
commit b0606fa6f8ab8bc3ee8b90eaedb34019c4d6657d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Apr 2 11:22:51 2014 +0200

    sw doc model dump: include contents of draw page
    
    Change-Id: I8f1687ba7aacfff47695fd43062c92d2eb034a29

diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index d6e1207..aee1ca2 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -26,6 +26,8 @@
 #include <editeng/rsiditem.hxx>
 #include <editeng/fontitem.hxx>
 #include <editeng/fhgtitem.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdmodel.hxx>
 #include <tools/datetimeutils.hxx>
 
 #include <libxml/encoding.h>
@@ -109,6 +111,38 @@ static const char* TMP_FORMAT_I32 = "%" SAL_PRIdINT32;
 
 }
 
+void lcl_dumpSdrModel(WriterHelper& writer, const SdrModel* pModel)
+{
+    writer.startElement("sdrModel");
+    writer.writeFormatAttribute("ptr", "%p", pModel);
+    if (pModel)
+    {
+        const SdrPage* pPage = pModel->GetPage(0);
+        writer.startElement("sdrPage");
+        writer.writeFormatAttribute("ptr", "%p", pPage);
+        if (pPage)
+        {
+            sal_Int32 nObjCount = pPage->GetObjCount();
+            for (sal_Int32 i = 0; i < nObjCount; ++i)
+            {
+                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.endElement();
+            }
+        }
+        writer.endElement();
+    }
+    writer.endElement();
+}
+
 void SwDoc::dumpAsXml( xmlTextWriterPtr w )
 {
     WriterHelper writer( w );
@@ -122,6 +156,7 @@ void SwDoc::dumpAsXml( xmlTextWriterPtr w )
     mpNumRuleTbl->dumpAsXml( writer );
     mpRedlineTbl->dumpAsXml( writer );
     mpExtraRedlineTbl->dumpAsXml( writer );
+    lcl_dumpSdrModel( writer, mpDrawModel );
     writer.endElement();
 }
 


More information about the Libreoffice-commits mailing list