QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 = 0 );
31 
32  void undo();
33  void redo();
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 
49  QDomDocument mPreviousState;
50  QDomDocument mAfterState;
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
76  TableGridStrokeWidth
77  };
78 
79  QgsComposerMultiFrameMergeCommand( Context c, QgsComposerMultiFrame* multiFrame, const QString& text );
81 
82  bool mergeWith( const QUndoCommand * command );
83  int id() const { return ( int )mContext; }
84 
85  private:
86  Context mContext;
87 };
88 
89 #endif // QGSCOMPOSERMULTIFRAMECOMMAND_H
Abstract base class for composer items with the ability to distribute the content to several frames (...
const QgsComposerMultiFrame * multiFrame() const
A composer command that merges together with other commands having the same context (=id) for multi f...