IOleUndoUnit
The IOleUndoUnit
interface is the main interface on an undo unit. An undo unit encapsulates the
information necessary to undo or redo a single action.
When an
object s state changes and it needs to create an undo unit, it first needs to
know what parent units are open. It calls the IOleUndoManager::GetOpenParentState
If the method
returns S_OK, but the UAS_BLOCKED flag is set, then the open parent is a
blocking parent. The object does not need to create an undo unit, since it
would be immediately discarded. If the return value is S_OK and neither of the
bit flags are set, then the object creates the undo unit and calls IOleUndoManager::Add
on the undo manager.
The object
should retain a pointer to the undo manager.
When to Implement
An object
creates an undo unit that implements this interface when the end user has performed
an action that can be undone. The object calls the IOleUndoManager::Add
When to Use
The undo
manager calls the Do and GetDescription methods in this interface
to perform undo actions and to get strings that can be displayed in the user
interface to describe the undo action. A parent undo unit can call the GetUnitType
and OnNextAdd methods.
Methods in VTable Order
IUnknown Methods |
Description |
QueryInterface |
Returns a
pointer to a specified interface. |
AddRef |
Increments
the reference count. |
Release |
Decrements
the reference count. |
IOleUndoUnit
Methods |
Description |
Do |
Instructs
the undo unit to carry out its action. |
GetDescription |
Returns a
string that describes the undo unit and can be used in the undo or redo user
interface. |
GetUnitType |
Returns the
CLSID and a type identifier for the undo unit. |
OnNextAdd |
Notifies
the last undo unit in the collection that a new unit has been added. |
See Also