summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/undo.hxx5
-rw-r--r--svl/source/undo/undo.cxx10
2 files changed, 14 insertions, 1 deletions
diff --git a/include/svl/undo.hxx b/include/svl/undo.hxx
index 2012df9a6ad8..95684f50690c 100644
--- a/include/svl/undo.hxx
+++ b/include/svl/undo.hxx
@@ -21,6 +21,7 @@
#include <svl/svldllapi.h>
#include <rtl/ustring.hxx>
+#include <tools/datetime.hxx>
#include <limits>
#include <memory>
@@ -68,11 +69,15 @@ public:
virtual sal_uInt16 GetId() const;
/// ID of the view shell that created this undo action.
virtual sal_Int32 GetViewShellId() const;
+ /// Timestamp when this undo item was created.
+ const DateTime& GetDateTime() const;
virtual void dumpAsXml(struct _xmlTextWriter* pWriter) const;
private:
SfxUndoAction( const SfxUndoAction& ) = delete;
SfxUndoAction& operator=( const SfxUndoAction& ) = delete;
+
+ DateTime m_aDateTime;
};
diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx
index 8481ed3986ab..0fa3867326f3 100644
--- a/svl/source/undo/undo.cxx
+++ b/svl/source/undo/undo.cxx
@@ -26,6 +26,7 @@
#include <comphelper/flagguard.hxx>
#include <tools/diagnose_ex.h>
#include <libxml/xmlwriter.h>
+#include <unotools/datetime.hxx>
#include <vector>
#include <list>
@@ -62,7 +63,8 @@ SfxUndoAction::~SfxUndoAction()
SfxUndoAction::SfxUndoAction()
-: mpSfxLinkUndoAction(nullptr)
+: mpSfxLinkUndoAction(nullptr),
+ m_aDateTime(DateTime::SYSTEM)
{
}
@@ -89,6 +91,11 @@ sal_Int32 SfxUndoAction::GetViewShellId() const
return -1;
}
+const DateTime& SfxUndoAction::GetDateTime() const
+{
+ return m_aDateTime;
+}
+
OUString SfxUndoAction::GetRepeatComment(SfxRepeatTarget&) const
{
return GetComment();
@@ -142,6 +149,7 @@ void SfxUndoAction::dumpAsXml(xmlTextWriterPtr pWriter) const
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("symbol"), BAD_CAST(typeid(*this).name()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("comment"), BAD_CAST(GetComment().toUtf8().getStr()));
xmlTextWriterWriteAttribute(pWriter, BAD_CAST("viewShellId"), BAD_CAST(OString::number(GetViewShellId()).getStr()));
+ xmlTextWriterWriteAttribute(pWriter, BAD_CAST("dateTime"), BAD_CAST(utl::toISO8601(m_aDateTime.GetUNODateTime()).toUtf8().getStr()));
xmlTextWriterEndElement(pWriter);
}