2010-12-02 09:55:42 +00:00
|
|
|
/**\ingroup MapComposer
|
|
|
|
Undo command to undo/redo all composer item related changes*/
|
|
|
|
class QgsComposerItemCommand: QUndoCommand
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgscomposeritemcommand.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
QgsComposerItemCommand( QgsComposerItem* item, const QString& text, QUndoCommand* parent = 0 );
|
|
|
|
virtual ~QgsComposerItemCommand();
|
|
|
|
|
|
|
|
/**Reverses the command*/
|
|
|
|
void undo();
|
|
|
|
/**Replays the command*/
|
|
|
|
void redo();
|
|
|
|
|
|
|
|
/**Saves current item state as previous state*/
|
|
|
|
void savePreviousState();
|
|
|
|
/**Saves current item state as after state*/
|
|
|
|
void saveAfterState();
|
|
|
|
|
|
|
|
QDomDocument previousState() const;
|
|
|
|
QDomDocument afterState() const;
|
|
|
|
|
|
|
|
/**Returns true if previous state and after state are valid and different*/
|
|
|
|
bool containsChange() const;
|
2012-09-24 02:28:15 +02:00
|
|
|
|
|
|
|
const QgsComposerItem* item() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void saveState( QDomDocument& stateDoc ) const;
|
|
|
|
void restoreState( QDomDocument& stateDoc ) const;
|
2010-12-02 09:55:42 +00:00
|
|
|
};
|
|
|
|
|
2012-09-24 02:28:15 +02:00
|
|
|
/**A composer command that merges together with other commands having the same context (=id). Keeps the oldest previous state and uses the
|
2010-12-02 09:55:42 +00:00
|
|
|
newest after state. The purpose is to avoid too many micro changes in the history*/
|
2012-09-24 02:28:15 +02:00
|
|
|
class QgsComposerMergeCommand : QgsComposerItemCommand
|
2010-12-02 09:55:42 +00:00
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include "qgscomposeritemcommand.h"
|
|
|
|
%End
|
|
|
|
public:
|
|
|
|
enum Context
|
|
|
|
{
|
|
|
|
Unknown = 0,
|
|
|
|
//composer label
|
|
|
|
ComposerLabelSetText,
|
2012-09-24 02:28:15 +02:00
|
|
|
ComposerLabelSetId,
|
2010-12-02 09:55:42 +00:00
|
|
|
//composer map
|
|
|
|
ComposerMapRotation,
|
|
|
|
ComposerMapAnnotationDistance,
|
|
|
|
//composer legend
|
|
|
|
ComposerLegendText,
|
2013-06-23 16:00:16 +02:00
|
|
|
LegendColumnCount,
|
|
|
|
LegendSplitLayer,
|
|
|
|
LegendEqualColumnWidth,
|
2010-12-02 09:55:42 +00:00
|
|
|
LegendSymbolWidth,
|
|
|
|
LegendSymbolHeight,
|
2013-12-30 19:50:00 +11:00
|
|
|
LegendWmsLegendWidth,
|
|
|
|
LegendWmsLegendHeight,
|
2013-06-23 16:00:16 +02:00
|
|
|
LegendTitleSpaceBottom,
|
2012-09-24 02:28:15 +02:00
|
|
|
LegendGroupSpace,
|
2010-12-02 09:55:42 +00:00
|
|
|
LegendLayerSpace,
|
|
|
|
LegendSymbolSpace,
|
|
|
|
LegendIconSymbolSpace,
|
|
|
|
LegendBoxSpace,
|
2013-06-23 16:00:16 +02:00
|
|
|
LegendColumnSpace,
|
2010-12-02 09:55:42 +00:00
|
|
|
//composer picture
|
|
|
|
ComposerPictureRotation,
|
|
|
|
// composer scalebar
|
|
|
|
ScaleBarLineWidth,
|
|
|
|
ScaleBarHeight,
|
|
|
|
ScaleBarSegmentSize,
|
|
|
|
ScaleBarSegmentsLeft,
|
|
|
|
ScaleBarNSegments,
|
|
|
|
ScaleBarUnitText,
|
|
|
|
ScaleBarMapUnitsSegment,
|
|
|
|
ScaleBarLabelBarSize,
|
|
|
|
ScaleBarBoxContentSpace,
|
|
|
|
// composer table
|
|
|
|
TableMaximumFeatures,
|
|
|
|
TableMargin,
|
|
|
|
TableGridStrokeWidth,
|
|
|
|
//composer shape
|
2013-12-30 19:50:00 +11:00
|
|
|
ShapeCornerRadius,
|
2010-12-02 09:55:42 +00:00
|
|
|
ShapeOutlineWidth,
|
|
|
|
//composer arrow
|
|
|
|
ArrowOutlineWidth,
|
|
|
|
ArrowHeadWidth,
|
|
|
|
//item
|
2012-09-24 02:28:15 +02:00
|
|
|
ItemOutlineWidth,
|
2013-12-30 19:50:00 +11:00
|
|
|
ItemMove,
|
2014-04-13 22:19:47 +10:00
|
|
|
ItemRotation,
|
|
|
|
ItemTransparency
|
2010-12-02 09:55:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
QgsComposerMergeCommand( Context c, QgsComposerItem* item, const QString& text );
|
|
|
|
~QgsComposerMergeCommand();
|
|
|
|
|
|
|
|
bool mergeWith( const QUndoCommand * command );
|
|
|
|
int id() const;
|
2012-09-24 02:28:15 +02:00
|
|
|
};
|