QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgscomposermultiframecommand.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposermultiframecommand.h
3  ------------------------------
4  begin : 2012-08-02
5  copyright : (C) 2012 by Marco Hugentobler
6  email : marco dot hugentobler at sourcepole dot ch
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 QGSCOMPOSERMULTIFRAMECOMMAND_H
19 #define QGSCOMPOSERMULTIFRAMECOMMAND_H
20 
21 #include <QUndoCommand>
22 #include <QDomDocument>
23 
25 
29 class CORE_EXPORT QgsComposerMultiFrameCommand: public QUndoCommand
30 {
31  public:
32  QgsComposerMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text, QUndoCommand* parent = nullptr );
34 
35  void undo() override;
36  void redo() override;
37 
38  void savePreviousState();
39  void saveAfterState();
40 
41  QDomDocument previousState() const { return mPreviousState.cloneNode().toDocument(); }
42  QDomDocument afterState() const { return mAfterState.cloneNode().toDocument(); }
43 
45  bool containsChange() const;
46 
47  const QgsComposerMultiFrame* multiFrame() const { return mMultiFrame; }
48 
49  protected:
51 
54 
55  bool mFirstRun;
56 
57  QgsComposerMultiFrameCommand(); //forbidden
58  void saveState( QDomDocument& stateDoc );
59  void restoreState( QDomDocument& stateDoc );
60  bool checkFirstRun();
61 };
62 
68 {
69  public:
70  enum Context
71  {
72  Unknown = 0,
73  //composer html
77  //attribute table
81  TableCellStyle
82  };
83 
86 
87  bool mergeWith( const QUndoCommand * command ) override;
88  int id() const override { return static_cast< int >( mContext ); }
89 
90  private:
91  Context mContext;
92 };
93 
94 #endif // QGSCOMPOSERMULTIFRAMECOMMAND_H
const QgsComposerMultiFrame * multiFrame() const
virtual bool mergeWith(const QUndoCommand *command)
Abstract base class for composer items with the ability to distribute the content to several frames (...
virtual void redo()
A composer command that merges together with other commands having the same context (=id) for multi f...
virtual void undo()
QDomNode cloneNode(bool deep) const
QDomDocument toDocument() const