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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 13 13:22:16 UTC 2019


 sw/inc/ndole.hxx                |    4 ++++
 sw/source/core/docnode/node.cxx |    4 +---
 sw/source/core/ole/ndole.cxx    |   26 ++++++++++++++++++++++++++
 3 files changed, 31 insertions(+), 3 deletions(-)

New commits:
commit abf05ba7fc625d87190759d927f8776594840ea1
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Aug 13 12:28:06 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Tue Aug 13 15:21:32 2019 +0200

    sw doc model xml dump: improve OLE node handling
    
    So it's possible to see if we have a dummy, common or OLE embedding.
    
    Change-Id: I8c241211a149ca5261fdf8171cd2814fced8de79
    Reviewed-on: https://gerrit.libreoffice.org/77403
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx
index 21896f6f99c0..852fffd84e3d 100644
--- a/sw/inc/ndole.hxx
+++ b/sw/inc/ndole.hxx
@@ -76,6 +76,8 @@ public:
         basegfx::B2DRange& rRange,
         bool bSynchron);
     void resetBufferedData();
+
+    void dumpAsXml(xmlTextWriterPtr pWriter) const;
 };
 
 // SwOLENode
@@ -123,6 +125,8 @@ public:
     virtual bool SavePersistentData() override;
     virtual bool RestorePersistentData() override;
 
+    virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override;
+
     bool IsInGlobalDocSection() const;
     bool IsOLEObjectDeleted() const;
 
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 206fcdaf1f0a..8ab7544a9a13 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -879,6 +879,7 @@ void SwNode::dumpAsXml(xmlTextWriterPtr pWriter) const
         break;
     case SwNodeType::Start:
     case SwNodeType::Text:
+    case SwNodeType::Ole:
         abort(); // overridden
     case SwNodeType::Table:
         pName = "table";
@@ -886,9 +887,6 @@ void SwNode::dumpAsXml(xmlTextWriterPtr pWriter) const
     case SwNodeType::Grf:
         pName = "grf";
         break;
-    case SwNodeType::Ole:
-        pName = "ole";
-        break;
     default: break;
     }
     xmlTextWriterStartElement(pWriter, BAD_CAST(pName));
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index 33bbb3c95681..02096632ebbb 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -58,6 +58,7 @@
 #include <comphelper/threadpool.hxx>
 #include <atomic>
 #include <deque>
+#include <libxml/xmlwriter.h>
 
 using namespace utl;
 using namespace com::sun::star::uno;
@@ -287,6 +288,18 @@ bool SwOLENode::RestorePersistentData()
     return true;
 }
 
+void SwOLENode::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SwOLENode"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"),
+                                BAD_CAST(OString::number(GetIndex()).getStr()));
+
+    GetOLEObj().dumpAsXml(pWriter);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 /**
  * OLE object is transported into UNDO area
  */
@@ -1104,6 +1117,19 @@ void SwOLEObj::resetBufferedData()
     }
 }
 
+void SwOLEObj::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+    xmlTextWriterStartElement(pWriter, BAD_CAST("SwOLEObj"));
+    xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
+
+    xmlTextWriterStartElement(pWriter, BAD_CAST("m_xOLERef"));
+    xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"),
+                                BAD_CAST(typeid(*m_xOLERef.GetObject().get()).name()));
+    xmlTextWriterEndElement(pWriter);
+
+    xmlTextWriterEndElement(pWriter);
+}
+
 SwOLELRUCache::SwOLELRUCache()
     : utl::ConfigItem("Office.Common/Cache")
     , m_nLRU_InitSize( 20 )


More information about the Libreoffice-commits mailing list