summaryrefslogtreecommitdiff
path: root/svl/inc/svl
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-11-30 09:25:41 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@oracle.com>2010-11-30 09:25:41 +0100
commit6877464dd7203ee78ded1eabd9a29298d2953cd6 (patch)
tree77d745e862b427cc0259db0e72061aef4152d486 /svl/inc/svl
parentc93023f2ad77f399a065f907ab840b22be1ddca3 (diff)
undoapi: introduced an (optional) SfxUndoContext for SfxUndoAction::Undo/Redo
Diffstat (limited to 'svl/inc/svl')
-rw-r--r--svl/inc/svl/undo.hxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/svl/inc/svl/undo.hxx b/svl/inc/svl/undo.hxx
index fb1ae16a01d8..b1bec6332f61 100644
--- a/svl/inc/svl/undo.hxx
+++ b/svl/inc/svl/undo.hxx
@@ -35,6 +35,7 @@
#include <boost/scoped_ptr.hpp>
#include <vector>
+#include <memory>
//====================================================================
@@ -47,6 +48,14 @@ public:
//====================================================================
+class SVL_DLLPUBLIC SfxUndoContext
+{
+public:
+ virtual ~SfxUndoContext() = 0;
+};
+
+//====================================================================
+
class SVL_DLLPUBLIC SfxUndoAction
{
BOOL bLinked;
@@ -58,7 +67,9 @@ public:
virtual BOOL IsLinked();
virtual void SetLinked( BOOL bIsLinked = TRUE );
virtual void Undo();
+ virtual void UndoWithContext( SfxUndoContext& i_context );
virtual void Redo();
+ virtual void RedoWithContext( SfxUndoContext& i_context );
virtual void Repeat(SfxRepeatTarget&);
virtual BOOL CanRepeat(SfxRepeatTarget&) const;
@@ -163,7 +174,9 @@ class SVL_DLLPUBLIC SfxListUndoAction : public SfxUndoAction, public SfxUndoArra
SfxListUndoAction( const UniString &rComment,
const UniString rRepeatComment, USHORT Id, SfxUndoArray *pFather);
virtual void Undo();
+ virtual void UndoWithContext( SfxUndoContext& i_context );
virtual void Redo();
+ virtual void RedoWithContext( SfxUndoContext& i_context );
virtual void Repeat(SfxRepeatTarget&);
virtual BOOL CanRepeat(SfxRepeatTarget&) const;
@@ -382,6 +395,20 @@ public:
*/
void RemoveOldestUndoActions( USHORT const i_count );
+protected:
+ /** retrieve the context for a to-be-executed Undo or Redo operation
+
+ This method is called immediately before an SfxUndoAction is undo or redone. If a derived class provides a non-<NULL/>
+ context here, it is passed to SfxUndoAction's UndoWithContext resp. RedoWithContext. If no context is provided,
+ the SfxUndoAction's normal Undo/Redo is called.
+
+ The method is called with the UndoManager's mutex locked.
+
+ The default implementation of the method returns a <NULL/> context.
+ */
+ virtual ::std::auto_ptr< SfxUndoContext >
+ GetUndoContext();
+
private:
USHORT ImplLeaveListAction( const bool i_merge, ::svl::undo::impl::UndoManagerGuard& i_guard );
bool ImplAddUndoAction_NoNotify( SfxUndoAction* pAction, BOOL bTryMerge, ::svl::undo::impl::UndoManagerGuard& i_guard );