Quantum GIS API Documentation
1.7.4
|
Undo command to undo/redo all composer item related changes. More...
#include <qgscomposeritemcommand.h>
Public Member Functions | |
QgsComposerItemCommand (QgsComposerItem *item, const QString &text, QUndoCommand *parent=0) | |
virtual | ~QgsComposerItemCommand () |
void | undo () |
Reverses the command. | |
void | redo () |
Replays the command. | |
void | savePreviousState () |
Saves current item state as previous state. | |
void | saveAfterState () |
Saves current item state as after state. | |
QDomDocument | previousState () const |
QDomDocument | afterState () const |
bool | containsChange () const |
Returns true if previous state and after state are valid and different. | |
Protected Member Functions | |
void | saveState (QDomDocument &stateDoc) const |
void | restoreState (QDomDocument &stateDoc) const |
Protected Attributes | |
QgsComposerItem * | mItem |
Target item of the command. | |
QDomDocument | mPreviousState |
XML that saves the state before executing the command. | |
QDomDocument | mAfterState |
XML containing the state after executing the command. | |
bool | mFirstRun |
Flag to prevent the first redo() if the command is pushed to the undo stack. |
Undo command to undo/redo all composer item related changes.
Definition at line 27 of file qgscomposeritemcommand.h.
QgsComposerItemCommand::QgsComposerItemCommand | ( | QgsComposerItem * | item, |
const QString & | text, | ||
QUndoCommand * | parent = 0 |
||
) |
Definition at line 21 of file qgscomposeritemcommand.cpp.
QgsComposerItemCommand::~QgsComposerItemCommand | ( | ) | [virtual] |
Definition at line 26 of file qgscomposeritemcommand.cpp.
QDomDocument QgsComposerItemCommand::afterState | ( | ) | const [inline] |
Definition at line 44 of file qgscomposeritemcommand.h.
Referenced by QgsComposerMergeCommand::mergeWith().
bool QgsComposerItemCommand::containsChange | ( | ) | const |
Returns true if previous state and after state are valid and different.
Definition at line 45 of file qgscomposeritemcommand.cpp.
References mAfterState, and mPreviousState.
Referenced by QgsComposition::endCommand().
QDomDocument QgsComposerItemCommand::previousState | ( | ) | const [inline] |
Definition at line 43 of file qgscomposeritemcommand.h.
void QgsComposerItemCommand::redo | ( | ) |
Replays the command.
Definition at line 35 of file qgscomposeritemcommand.cpp.
References mAfterState, mFirstRun, and restoreState().
void QgsComposerItemCommand::restoreState | ( | QDomDocument & | stateDoc | ) | const [protected] |
Definition at line 71 of file qgscomposeritemcommand.cpp.
References mItem, QgsComposerItem::readXML(), and QgsComposerItem::repaint().
Saves current item state as after state.
Definition at line 55 of file qgscomposeritemcommand.cpp.
References mAfterState, and saveState().
Referenced by QgsComposition::alignSelectedItemsBottom(), QgsComposition::alignSelectedItemsHCenter(), QgsComposition::alignSelectedItemsLeft(), QgsComposition::alignSelectedItemsRight(), QgsComposition::alignSelectedItemsTop(), QgsComposition::alignSelectedItemsVCenter(), QgsComposition::endCommand(), and QgsComposition::updateZValues().
Saves current item state as previous state.
Definition at line 50 of file qgscomposeritemcommand.cpp.
References mPreviousState, and saveState().
Referenced by QgsComposition::alignSelectedItemsBottom(), QgsComposition::alignSelectedItemsHCenter(), QgsComposition::alignSelectedItemsLeft(), QgsComposition::alignSelectedItemsRight(), QgsComposition::alignSelectedItemsTop(), QgsComposition::alignSelectedItemsVCenter(), QgsComposition::beginCommand(), and QgsComposition::updateZValues().
void QgsComposerItemCommand::saveState | ( | QDomDocument & | stateDoc | ) | const [protected] |
Definition at line 60 of file qgscomposeritemcommand.cpp.
References mItem, and QgsComposerItem::writeXML().
Referenced by saveAfterState(), and savePreviousState().
void QgsComposerItemCommand::undo | ( | ) |
Reverses the command.
Definition at line 30 of file qgscomposeritemcommand.cpp.
References mPreviousState, and restoreState().
QDomDocument QgsComposerItemCommand::mAfterState [protected] |
XML containing the state after executing the command.
Definition at line 55 of file qgscomposeritemcommand.h.
Referenced by containsChange(), QgsComposerMergeCommand::mergeWith(), redo(), and saveAfterState().
bool QgsComposerItemCommand::mFirstRun [protected] |
Flag to prevent the first redo() if the command is pushed to the undo stack.
Definition at line 58 of file qgscomposeritemcommand.h.
Referenced by redo().
QgsComposerItem* QgsComposerItemCommand::mItem [protected] |
Target item of the command.
Definition at line 51 of file qgscomposeritemcommand.h.
Referenced by restoreState(), and saveState().
QDomDocument QgsComposerItemCommand::mPreviousState [protected] |
XML that saves the state before executing the command.
Definition at line 53 of file qgscomposeritemcommand.h.
Referenced by containsChange(), savePreviousState(), and undo().