QGIS API Documentation  2.2.0-Valmiera
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgscomposeritemcommand.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgscomposeritemcommand.h
3  ------------------------
4  begin : 2010-11-18
5  copyright : (C) 2010 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 QGSCOMPOSERITEMCOMMAND_H
19 #define QGSCOMPOSERITEMCOMMAND_H
20 
21 #include <QUndoCommand>
22 #include <QDomDocument>
23 
24 class QgsComposerItem;
25 
27 class CORE_EXPORT QgsComposerItemCommand: public QUndoCommand
28 {
29  public:
30  QgsComposerItemCommand( QgsComposerItem* item, const QString& text, QUndoCommand* parent = 0 );
31  virtual ~QgsComposerItemCommand();
32 
34  void undo();
36  void redo();
37 
39  void savePreviousState();
41  void saveAfterState();
42 
43  QDomDocument previousState() const { return mPreviousState.cloneNode().toDocument(); }
44  QDomDocument afterState() const { return mAfterState.cloneNode().toDocument(); }
45 
47  bool containsChange() const;
48 
49  const QgsComposerItem* item() const { return mItem; }
50 
51  protected:
55  QDomDocument mPreviousState;
57  QDomDocument mAfterState;
58 
60  bool mFirstRun;
61 
62  void saveState( QDomDocument& stateDoc ) const;
63  void restoreState( QDomDocument& stateDoc ) const;
64 };
65 
69 {
70  public:
71  enum Context
72  {
73  Unknown = 0,
74  //composer label
77  //composer map
80  //composer legend
96  //composer picture
98  // composer scalebar
108  // composer table
112  //composer shape
115  //composer arrow
118  //item
121  ItemRotation
122  };
123 
124  QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text );
126 
127  bool mergeWith( const QUndoCommand * command );
128  int id() const { return ( int )mContext; }
129 
130  private:
132 };
133 
134 #endif // QGSCOMPOSERITEMCOMMAND_H