summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-08-13 12:28:06 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-08-13 15:21:32 +0200
commitabf05ba7fc625d87190759d927f8776594840ea1 (patch)
tree15f8dde39586ba9f416e0f6a28ee05f17fc08427
parent8ce1685d2429fe790b1d6e1dd10b6a0b83dbcbed (diff)
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@collabora.com> Tested-by: Jenkins
-rw-r--r--sw/inc/ndole.hxx4
-rw-r--r--sw/source/core/docnode/node.cxx4
-rw-r--r--sw/source/core/ole/ndole.cxx26
3 files changed, 31 insertions, 3 deletions
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 )