[Libreoffice-commits] core.git: include/svl svl/source sw/source
Miklos Vajna
vmiklos at collabora.co.uk
Sat Jan 31 09:10:03 PST 2015
include/svl/undo.hxx | 2 ++
svl/source/undo/undo.cxx | 21 +++++++++++++++++++++
sw/source/core/docnode/nodedump.cxx | 20 +-------------------
3 files changed, 24 insertions(+), 19 deletions(-)
New commits:
commit e4b0d63c134e7833db562f4eef93bbf828ea1b9d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Sat Jan 31 18:09:05 2015 +0100
Extract SfxUndoAction::dumpAsXml() from sw
Change-Id: I7ec2071150c03b61f3f681dbd26968ae3c535742
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx
index 92a9907..2c19238 100644
--- a/include/svl/undo.hxx
+++ b/include/svl/undo.hxx
@@ -71,6 +71,7 @@ public:
virtual OUString GetComment() const;
virtual OUString GetRepeatComment(SfxRepeatTarget&) const;
virtual sal_uInt16 GetId() const;
+ virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
private:
SfxUndoAction( const SfxUndoAction& ); // disabled
@@ -159,6 +160,7 @@ public:
virtual sal_uInt16 GetId() const SAL_OVERRIDE;
void SetComment(const OUString& rComment);
+ void dumpAsXml(struct _xmlTextWriter* pWriter) const SAL_OVERRIDE;
};
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 772dd43..1fcc649 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -24,6 +24,7 @@
#include <osl/mutex.hxx>
#include <comphelper/flagguard.hxx>
#include <tools/diagnose_ex.h>
+#include <libxml/xmlwriter.h>
#include <vector>
#include <list>
@@ -135,6 +136,14 @@ bool SfxUndoAction::CanRepeat(SfxRepeatTarget&) const
return true;
}
+void SfxUndoAction::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("sfxUndoAction"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"), BAD_CAST(typeid(*this).name()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("comment"), BAD_CAST(GetComment().toUtf8().getStr()));
+ xmlTextWriterEndElement(pWriter);
+}
+
struct MarkedUndoAction
{
SfxUndoAction* pAction;
@@ -1372,6 +1381,18 @@ bool SfxListUndoAction::Merge( SfxUndoAction *pNextAction )
return !aUndoActions.empty() && aUndoActions[aUndoActions.size()-1].pAction->Merge( pNextAction );
}
+void SfxListUndoAction::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ xmlTextWriterStartElement(pWriter, BAD_CAST("sfxListUndoAction"));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("size"), BAD_CAST(OString::number(aUndoActions.size()).getStr()));
+ SfxUndoAction::dumpAsXml(pWriter);
+
+ for (size_t i = 0; i < aUndoActions.size(); ++i)
+ aUndoActions.GetUndoAction(i)->dumpAsXml(pWriter);
+
+ xmlTextWriterEndElement(pWriter);
+}
+
/**
* Creates a LinkAction which points to another UndoManager.
* Gets that UndoManagers current Action and sets it as that UndoManager's
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 67ea050..902c494 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -656,24 +656,6 @@ void SwExtraRedlineTbl::dumpAsXml( xmlTextWriterPtr w ) const
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.GetUndoAction(i));
- writer.endElement();
- }
-
- writer.endElement();
-}
-
void sw::UndoManager::dumpAsXml(xmlTextWriterPtr w)
{
WriterHelper writer(w);
@@ -682,7 +664,7 @@ void sw::UndoManager::dumpAsXml(xmlTextWriterPtr w)
writer.writeFormatAttribute("nUndoActionCount", TMP_FORMAT, GetUndoActionCount());
for (size_t i = 0; i < GetUndoActionCount(); ++i)
- lcl_dumpSfxUndoAction(writer, GetUndoAction(i));
+ GetUndoAction(i)->dumpAsXml(w);
writer.endElement();
}
More information about the Libreoffice-commits
mailing list