18#ifndef QGSLAYOUTUNDOCOMMAND_H
19#define QGSLAYOUTUNDOCOMMAND_H
21#include <QUndoCommand>
23#include <QDomDocument>
47 int id()
const override {
return mId; }
54 void saveBeforeState();
61 void saveAfterState();
68 QDomDocument
beforeState()
const {
return mBeforeState.cloneNode().toDocument(); }
75 QDomDocument
afterState()
const {
return mAfterState.cloneNode().toDocument(); }
80 virtual bool containsChange()
const;
91 virtual void saveState( QDomDocument &stateDoc )
const = 0;
105 void setAfterState(
const QDomDocument &stateDoc );
108 bool mFirstRun =
true;
113 QDomDocument mBeforeState;
116 QDomDocument mAfterState;
Base class for commands to undo/redo layout and layout object changes.
virtual void saveState(QDomDocument &stateDoc) const =0
Saves the state of the object to the specified stateDoc.
QDomDocument beforeState() const
Returns the before state for the layout.
virtual void restoreState(QDomDocument &stateDoc)=0
Restores the state of the object from the specified stateDoc.
QDomDocument afterState() const
Returns the after state for the layout.
Interface for layout objects which support undo/redo commands.
virtual QgsAbstractLayoutUndoCommand * createCommand(const QString &text, int id=0, QUndoCommand *parent=nullptr)=0
Creates a new layout undo command with the specified text and parent.
virtual ~QgsLayoutUndoObjectInterface()=default
Destructor for QgsLayoutUndoObjectInterface.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.