18#ifndef QGSLAYOUTUNDOCOMMAND_H
19#define QGSLAYOUTUNDOCOMMAND_H
21#include <QUndoCommand>
23#include <QDomDocument>
46 int id()
const override {
return mId; }
53 void saveBeforeState();
60 void saveAfterState();
67 QDomDocument
beforeState()
const {
return mBeforeState.cloneNode().toDocument(); }
74 QDomDocument
afterState()
const {
return mAfterState.cloneNode().toDocument(); }
79 virtual bool containsChange()
const;
90 virtual void saveState( QDomDocument &stateDoc )
const = 0;
104 void setAfterState(
const QDomDocument &stateDoc );
107 bool mFirstRun =
true;
112 QDomDocument mBeforeState;
115 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
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.