[Libreoffice-commits] core.git: sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jun 24 03:38:39 PDT 2014
sw/source/core/docnode/nodedump.cxx | 33 +++++++++++++++++++++++++++++++++
sw/source/core/inc/UndoManager.hxx | 3 +++
2 files changed, 36 insertions(+)
New commits:
commit be57d41dc64acc47611fdb59568b25500ad5c690
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jun 24 11:33:59 2014 +0200
Add sw::UndoManager::dumpAsXml()
So that it's easy to see where the implementation for a given undo
action is.
Change-Id: I652826d2933451b84a05eecc3982c8cbf2db3764
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 3c1b3c1..df9a8fb 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 65d3b03..43c5995 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;
More information about the Libreoffice-commits
mailing list