QGIS API Documentation  3.24.2-Tisler (13c1a02865)
qgslayoutmultiframeundocommand.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutmultiframeundocommand.h
3  ----------------------
4  begin : October 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QGSLAYOUTMULTIFRAMEUNDOCOMMAND_H
19 #define QGSLAYOUTMULTIFRAMEUNDOCOMMAND_H
20 
21 #include "qgslayoutundocommand.h"
22 #include "qgis_core.h"
23 
24 class QgsLayout;
26 
28 
30 
42 class CORE_EXPORT QgsLayoutMultiFrameUndoCommand: public QgsAbstractLayoutUndoCommand
43 {
44  public:
45 
53  QgsLayoutMultiFrameUndoCommand( QgsLayoutMultiFrame *frame, const QString &text, int id = 0, QUndoCommand *parent SIP_TRANSFERTHIS = nullptr );
54 
55  bool mergeWith( const QUndoCommand *command ) override;
56 
60  QgsLayout *layout() const;
61 
66  QString multiFrameUuid() const;
67 
68  protected:
69 
70  void saveState( QDomDocument &stateDoc ) const override;
71  void restoreState( QDomDocument &stateDoc ) override;
72 
73  virtual QgsLayoutMultiFrame *recreateItem( int itemType, QgsLayout *layout ) SIP_FACTORY;
74 
75  private:
76 
77  QString mFrameUuid;
78  QgsLayout *mLayout = nullptr;
79  int mItemType = 0;
80 
81 };
82 
93 class CORE_EXPORT QgsLayoutMultiFrameDeleteUndoCommand: public QgsLayoutMultiFrameUndoCommand
94 {
95  public:
96 
104  QgsLayoutMultiFrameDeleteUndoCommand( QgsLayoutMultiFrame *frame, const QString &text, int id = 0, QUndoCommand *parent SIP_TRANSFERTHIS = nullptr );
105  bool mergeWith( const QUndoCommand *command ) override;
106  void redo() override;
107 
108 };
109 
110 
121 class CORE_EXPORT QgsLayoutMultiFrameAddItemCommand: public QgsLayoutMultiFrameUndoCommand
122 {
123  public:
124 
132  QgsLayoutMultiFrameAddItemCommand( QgsLayoutMultiFrame *frame, const QString &text, int id = 0, QUndoCommand *parent SIP_TRANSFERTHIS = nullptr );
133  bool containsChange() const override;
134  bool mergeWith( const QUndoCommand *command ) override;
135  void undo() override;
136 
137 };
138 
140 
141 #endif //QGSLAYOUTMULTIFRAMEUNDOCOMMAND_H
Base class for commands to undo/redo layout and layout object changes.
virtual bool containsChange() const
Returns true if both the before and after states are valid and different.
virtual void saveState(QDomDocument &stateDoc) const =0
Saves the state of the object to the specified stateDoc.
virtual void restoreState(QDomDocument &stateDoc)=0
Restores the state of the object from the specified stateDoc.
Abstract base class for layout items with the ability to distribute the content to several frames (Qg...
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
Definition: qgslayout.h:51
#define SIP_NO_FILE
#define SIP_TRANSFERTHIS
Definition: qgis_sip.h:53
#define SIP_FACTORY
Definition: qgis_sip.h:76