QGIS API Documentation  2.14.0-Essen
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 
26 class CORE_EXPORT QgsComposerMultiFrameCommand: public QUndoCommand
27 {
28  public:
29  QgsComposerMultiFrameCommand( QgsComposerMultiFrame* multiFrame, const QString& text, QUndoCommand* parent = nullptr );
31 
32  void undo() override;
33  void redo() override;
34 
35  void savePreviousState();
36  void saveAfterState();
37 
38  QDomDocument previousState() const { return mPreviousState.cloneNode().toDocument(); }
39  QDomDocument afterState() const { return mAfterState.cloneNode().toDocument(); }
40 
42  bool containsChange() const;
43 
44  const QgsComposerMultiFrame* multiFrame() const { return mMultiFrame; }
45 
46  protected:
48 
51 
52  bool mFirstRun;
53 
54  QgsComposerMultiFrameCommand(); //forbidden
55  void saveState( QDomDocument& stateDoc );
56  void restoreState( QDomDocument& stateDoc );
57  bool checkFirstRun();
58 };
59 
64 {
65  public:
66  enum Context
67  {
68  Unknown = 0,
69  //composer html
73  //attribute table
77  TableCellStyle
78  };
79 
82 
83  bool mergeWith( const QUndoCommand * command ) override;
84  int id() const override { return static_cast< int >( mContext ); }
85 
86  private:
87  Context mContext;
88 };
89 
90 #endif // QGSCOMPOSERMULTIFRAMECOMMAND_H
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()
const QgsComposerMultiFrame * multiFrame() const
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