QGIS API Documentation  2.5.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
72  HtmlBreakDistance
73  };
74 
75  QgsComposerMultiFrameMergeCommand( Context c, QgsComposerMultiFrame* multiFrame, const QString& text );
77 
78  bool mergeWith( const QUndoCommand * command );
79  int id() const { return ( int )mContext; }
80 
81  private:
82  Context mContext;
83 };
84 
85 #endif // QGSCOMPOSERMULTIFRAMECOMMAND_H
QDomDocument previousState() const
Definition: qgscomposermultiframecommand.h:38
int id() const
Definition: qgscomposermultiframecommand.h:79
Definition: qgscomposermultiframecommand.h:70
Definition: qgscomposermultiframecommand.h:71
Definition: qgsexpression.cpp:123
QDomDocument mAfterState
Definition: qgscomposermultiframecommand.h:50
Context
Definition: qgscomposermultiframecommand.h:66
QDomDocument afterState() const
Definition: qgscomposermultiframecommand.h:39
Abstract base class for composer entries with the ability to distribute the content to several frames...
Definition: qgscomposermultiframe.h:33
const QgsComposerMultiFrame * multiFrame() const
Definition: qgscomposermultiframecommand.h:44
Definition: qgscomposermultiframecommand.h:26
A composer command that merges together with other commands having the same context (=id) for multi f...
Definition: qgscomposermultiframecommand.h:63
QDomDocument mPreviousState
Definition: qgscomposermultiframecommand.h:49
bool mFirstRun
Definition: qgscomposermultiframecommand.h:52
QgsComposerMultiFrame * mMultiFrame
Definition: qgscomposermultiframecommand.h:47