Quantum GIS API Documentation
1.7.4
|
00001 /*************************************************************************** 00002 qgscomposeritemcommand.h 00003 ------------------------ 00004 begin : 2010-11-18 00005 copyright : (C) 2010 by Marco Hugentobler 00006 email : marco dot hugentobler at sourcepole dot ch 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef QGSCOMPOSERITEMCOMMAND_H 00019 #define QGSCOMPOSERITEMCOMMAND_H 00020 00021 #include <QUndoCommand> 00022 #include <QDomDocument> 00023 00024 class QgsComposerItem; 00025 00027 class CORE_EXPORT QgsComposerItemCommand: public QUndoCommand 00028 { 00029 public: 00030 QgsComposerItemCommand( QgsComposerItem* item, const QString& text, QUndoCommand* parent = 0 ); 00031 virtual ~QgsComposerItemCommand(); 00032 00034 void undo(); 00036 void redo(); 00037 00039 void savePreviousState(); 00041 void saveAfterState(); 00042 00043 QDomDocument previousState() const { return mPreviousState.cloneNode().toDocument(); } 00044 QDomDocument afterState() const { return mAfterState.cloneNode().toDocument(); } 00045 00047 bool containsChange() const; 00048 00049 protected: 00051 QgsComposerItem* mItem; 00053 QDomDocument mPreviousState; 00055 QDomDocument mAfterState; 00056 00058 bool mFirstRun; 00059 00060 void saveState( QDomDocument& stateDoc ) const; 00061 void restoreState( QDomDocument& stateDoc ) const; 00062 }; 00063 00066 class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand 00067 { 00068 public: 00069 enum Context 00070 { 00071 Unknown = 0, 00072 //composer label 00073 ComposerLabelSetText, 00074 ComposerLabelSetId, 00075 //composer map 00076 ComposerMapRotation, 00077 ComposerMapAnnotationDistance, 00078 //composer legend 00079 ComposerLegendText, 00080 LegendSymbolWidth, 00081 LegendSymbolHeight, 00082 LegendLayerSpace, 00083 LegendSymbolSpace, 00084 LegendIconSymbolSpace, 00085 LegendBoxSpace, 00086 //composer picture 00087 ComposerPictureRotation, 00088 // composer scalebar 00089 ScaleBarLineWidth, 00090 ScaleBarHeight, 00091 ScaleBarSegmentSize, 00092 ScaleBarSegmentsLeft, 00093 ScaleBarNSegments, 00094 ScaleBarUnitText, 00095 ScaleBarMapUnitsSegment, 00096 ScaleBarLabelBarSize, 00097 ScaleBarBoxContentSpace, 00098 // composer table 00099 TableMaximumFeatures, 00100 TableMargin, 00101 TableGridStrokeWidth, 00102 //composer shape 00103 ShapeRotation, 00104 ShapeOutlineWidth, 00105 //composer arrow 00106 ArrowOutlineWidth, 00107 ArrowHeadWidth, 00108 //item 00109 ItemOutlineWidth 00110 }; 00111 00112 QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text ); 00113 ~QgsComposerMergeCommand(); 00114 00115 bool mergeWith( const QUndoCommand * command ); 00116 int id() const { return ( int )mContext; } 00117 00118 private: 00119 Context mContext; 00120 }; 00121 00122 #endif // QGSCOMPOSERITEMCOMMAND_H