|
QGIS API Documentation
master-6227475
|
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 const QgsComposerItem* item() const { return mItem; } 00050 00051 protected: 00053 QgsComposerItem* mItem; 00055 QDomDocument mPreviousState; 00057 QDomDocument mAfterState; 00058 00060 bool mFirstRun; 00061 00062 void saveState( QDomDocument& stateDoc ) const; 00063 void restoreState( QDomDocument& stateDoc ) const; 00064 }; 00065 00068 class CORE_EXPORT QgsComposerMergeCommand: public QgsComposerItemCommand 00069 { 00070 public: 00071 enum Context 00072 { 00073 Unknown = 0, 00074 //composer label 00075 ComposerLabelSetText, 00076 ComposerLabelSetId, 00077 ComposerLabelRotation, 00078 //composer map 00079 ComposerMapRotation, 00080 ComposerMapAnnotationDistance, 00081 //composer legend 00082 ComposerLegendText, 00083 LegendColumnCount, 00084 LegendSplitLayer, 00085 LegendEqualColumnWidth, 00086 LegendSymbolWidth, 00087 LegendSymbolHeight, 00088 LegendGroupSpace, 00089 LegendLayerSpace, 00090 LegendSymbolSpace, 00091 LegendIconSymbolSpace, 00092 LegendBoxSpace, 00093 LegendColumnSpace, 00094 //composer picture 00095 ComposerPictureRotation, 00096 // composer scalebar 00097 ScaleBarLineWidth, 00098 ScaleBarHeight, 00099 ScaleBarSegmentSize, 00100 ScaleBarSegmentsLeft, 00101 ScaleBarNSegments, 00102 ScaleBarUnitText, 00103 ScaleBarMapUnitsSegment, 00104 ScaleBarLabelBarSize, 00105 ScaleBarBoxContentSpace, 00106 // composer table 00107 TableMaximumFeatures, 00108 TableMargin, 00109 TableGridStrokeWidth, 00110 //composer shape 00111 ShapeRotation, 00112 ShapeOutlineWidth, 00113 //composer arrow 00114 ArrowOutlineWidth, 00115 ArrowHeadWidth, 00116 //item 00117 ItemOutlineWidth, 00118 ItemMove 00119 }; 00120 00121 QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text ); 00122 ~QgsComposerMergeCommand(); 00123 00124 bool mergeWith( const QUndoCommand * command ); 00125 int id() const { return ( int )mContext; } 00126 00127 private: 00128 Context mContext; 00129 }; 00130 00131 #endif // QGSCOMPOSERITEMCOMMAND_H