summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-06-24 11:33:59 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-06-24 12:35:09 +0200
commitbe57d41dc64acc47611fdb59568b25500ad5c690 (patch)
tree55336f62216ce19b7b8b091d434286a9b6a9f062 /sw
parent466ee86cabe049ddaa873b831a895386162cb3aa (diff)
Add sw::UndoManager::dumpAsXml()
So that it's easy to see where the implementation for a given undo action is. Change-Id: I652826d2933451b84a05eecc3982c8cbf2db3764
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/docnode/nodedump.cxx33
-rw-r--r--sw/source/core/inc/UndoManager.hxx3
2 files changed, 36 insertions, 0 deletions
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 3c1b3c1c9833..df9a8fb48945 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -10,6 +10,7 @@
#include "doc.hxx"
#include "drawdoc.hxx"
#include <IDocumentDrawModelAccess.hxx>
+#include <UndoManager.hxx>
#include "ndtxt.hxx"
#include "MarkManager.hxx"
#include "docary.hxx"
@@ -178,6 +179,7 @@ void SwDoc::dumpAsXml( xmlTextWriterPtr w )
writer.writeFormatAttribute( "ptr", "%p", this );
m_pNodes->dumpAsXml( writer );
mpMarkManager->dumpAsXml( writer );
+ m_pUndoManager->dumpAsXml(writer);
mpFldTypes->dumpAsXml( writer );
mpTxtFmtCollTbl->dumpAsXml( writer );
mpCharFmtTbl->dumpAsXml( writer );
@@ -918,4 +920,35 @@ void SwExtraRedlineTbl::dumpAsXml( xmlTextWriterPtr w )
writer.endElement( ); // swextraredlinetbl
}
+void lcl_dumpSfxUndoAction(WriterHelper& writer, SfxUndoAction* pAction)
+{
+ writer.startElement("undoAction");
+ writer.writeFormatAttribute("symbol", "%s", BAD_CAST(typeid(*pAction).name()));
+ writer.writeFormatAttribute("comment", "%s", BAD_CAST(OUStringToOString(pAction->GetComment(), RTL_TEXTENCODING_UTF8).getStr()));
+
+ if (SfxListUndoAction* pList = dynamic_cast<SfxListUndoAction*>(pAction))
+ {
+ writer.startElement("list");
+ writer.writeFormatAttribute("size", TMP_FORMAT, pList->aUndoActions.size());
+ for (size_t i = 0; i < pList->aUndoActions.size(); ++i)
+ lcl_dumpSfxUndoAction(writer, pList->aUndoActions[i].pAction);
+ writer.endElement();
+ }
+
+ writer.endElement();
+}
+
+void sw::UndoManager::dumpAsXml(xmlTextWriterPtr w)
+{
+ WriterHelper writer(w);
+
+ writer.startElement("m_pUndoManager");
+ writer.writeFormatAttribute("nUndoActionCount", TMP_FORMAT, GetUndoActionCount());
+
+ for (size_t i = 0; i < GetUndoActionCount(); ++i)
+ lcl_dumpSfxUndoAction(writer, GetUndoAction(i));
+
+ writer.endElement();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/UndoManager.hxx b/sw/source/core/inc/UndoManager.hxx
index 65d3b03422c1..43c59950ddeb 100644
--- a/sw/source/core/inc/UndoManager.hxx
+++ b/sw/source/core/inc/UndoManager.hxx
@@ -23,6 +23,7 @@
#include <IDocumentUndoRedo.hxx>
#include <boost/shared_ptr.hpp>
#include <svx/sdrundomanager.hxx>
+#include <ndarr.hxx>
class IDocumentDrawModelAccess;
class IDocumentRedlineAccess;
@@ -84,6 +85,8 @@ public:
SwNodes const& GetUndoNodes() const;
SwNodes & GetUndoNodes();
+ void dumpAsXml(xmlTextWriterPtr w);
+
private:
IDocumentDrawModelAccess & m_rDrawModelAccess;
IDocumentRedlineAccess & m_rRedlineAccess;