IOleUndoUnit::Do
Instructs the
undo unit to carry out its action. Note that if it contains child undo units,
it must call their Do methods as well.
HRESULT Do(
IOleUndoManager* pUndoManager |
//Pointer to
the undo manager |
); |
|
Parameters
pUndoManager
[in] Pointer
to the undo manager.
Return Values
S_OK
The undo unit
successfully carried out its action.
Remarks
The undo unit
is responsible for carrying out its action. Performing its own undo action
results in another action that can potentially be reversed. However, if pUndoManager
is NULL, the undo unit should perform its undo action but should not attempt to
put anything on the redo or undo stack.
If pUndoManager
is not NULL, then the unit is required to put a corresponding unit on the redo
or undo stack. As a result, this method either moves itself to the redo or undo
stack, or it creates a new undo unit and adds it to the appropriate stack.
After creating a new undo unit, this undo unit calls IOleUndoManager::Open
or IOleUndoManager::Add. The undo manager will put the new undo unit on
the undo or redo stack depending on its current state.
A parent unit
must pass to its children the same undo manager, possibly NULL, that was given
to the parent. It is permissible, but not necessary, when pUndoManager
is NULL to open a parent unit on the redo or undo stack as long as it is not
committed. A blocked parent unit ensures that nothing is added to the stack by
child units.
If this undo
unit is a parent unit, it should put itself on the redo or undo stack before
calling the Do on its children.
After calling
this method, the undo manager must release the undo unit.
Note to Implementers
See the IOleUndoManager
interface for error handling strategies for undo units. The error handling
strategy affects the implementation of this method, particularly for parent
units.
See Also