17 #ifndef QGSCOMPOSERITEM_H
18 #define QGSCOMPOSERITEM_H
23 #include <QGraphicsRectItem>
30 class QGraphicsLineItem;
44 ComposerItem = UserType + 100,
105 virtual int type()
const {
return ComposerItem; }
108 virtual void setSelected(
bool s );
111 virtual bool selected()
const {
return QGraphicsRectItem::isSelected();};
114 virtual bool writeSettings();
117 virtual bool readSettings();
120 virtual bool removeSettings();
123 void move(
double dx,
double dy );
128 virtual void moveContent(
double dx,
double dy ) { Q_UNUSED( dx ); Q_UNUSED( dy ); }
134 virtual void zoomContent(
int delta,
double x,
double y ) { Q_UNUSED( delta ); Q_UNUSED( x ); Q_UNUSED( y ); }
137 void setItemPosition(
double x,
double y, ItemPositionMode itemPoint = UpperLeft );
148 void setItemPosition(
double x,
double y,
double width,
double height, ItemPositionMode itemPoint = UpperLeft,
bool posIncludesFrame =
false );
157 virtual void setSceneRect(
const QRectF& rectangle );
163 virtual bool writeXML( QDomElement& elem, QDomDocument & doc )
const = 0;
166 bool _writeXML( QDomElement& itemElem, QDomDocument& doc )
const;
172 virtual bool readXML(
const QDomElement& itemElem,
const QDomDocument& doc ) = 0;
175 bool _readXML(
const QDomElement& itemElem,
const QDomDocument& doc );
190 void setFrameEnabled(
bool drawFrame );
198 virtual void setFrameOutlineWidth(
double outlineWidth );
206 virtual double estimatedFrameBleed()
const;
216 virtual QRectF rectWithFrame()
const;
244 void setBackgroundColor(
const QColor& backgroundColor );
247 QPainter::CompositionMode
blendMode()
const {
return mBlendMode;}
250 void setBlendMode( QPainter::CompositionMode blendMode );
255 void setTransparency(
int transparency );
264 void setEffectsEnabled(
bool effectsEnabled );
283 void cancelCommand();
290 void drawText( QPainter* p,
double x,
double y,
const QString& text,
const QFont& font )
const;
293 void drawText( QPainter* p,
const QRectF& rect,
const QString& text,
const QFont& font, Qt::AlignmentFlag halignment = Qt::AlignLeft, Qt::AlignmentFlag valignment = Qt::AlignTop )
const;
296 double textWidthMillimeters(
const QFont& font,
const QString& text )
const;
300 double fontHeightCharacterMM(
const QFont& font,
const QChar& c )
const;
303 double fontAscentMillimeters(
const QFont& font )
const;
306 double fontDescentMillimeters(
const QFont& font )
const;
309 double pixelFontSize(
double pointSize )
const;
312 QFont scaledFontPixelSize(
const QFont& font )
const;
316 void setPositionLock(
bool lock );
337 QString
id()
const {
return mId; }
341 virtual void setId(
const QString&
id );
346 QString
uuid()
const {
return mUuid; }
352 virtual void setRotation(
double r );
360 virtual void setItemRotation(
double r,
bool adjustPosition =
false );
409 virtual void drawSelectionBoxes( QPainter* p );
412 virtual void drawFrame( QPainter* p );
415 virtual void drawBackground( QPainter* p );
418 void drawArrowHead( QPainter* p,
double x,
double y,
double angle,
double arrowHeadWidth )
const;
421 double angle(
const QPointF& p1,
const QPointF& p2 )
const;
425 double rectHandlerBorderTolerance()
const;
429 double lockSymbolSize()
const;
434 double horizontalViewScaleFactor()
const;
439 bool imageSizeConsideringRotation(
double& width,
double& height,
double rotation )
const;
444 bool imageSizeConsideringRotation(
double& width,
double& height )
const;
452 QRectF largestRotatedRectWithinBounds( QRectF originalRect, QRectF boundsRect,
double rotation )
const;
455 bool cornerPointOnRotatedAndScaledRect(
double& x,
double& y,
double width,
double height,
double rotation )
const;
460 bool cornerPointOnRotatedAndScaledRect(
double& x,
double& y,
double width,
double height )
const;
463 void sizeChangedByRotation(
double& width,
double& height,
double rotation );
468 void sizeChangedByRotation(
double& width,
double& height );
474 void rotate(
double angle,
double& x,
double& y )
const;
477 QGraphicsLineItem* hAlignSnapItem();
478 void deleteHAlignSnapItem();
480 QGraphicsLineItem* vAlignSnapItem();
481 void deleteVAlignSnapItem();
482 void deleteAlignItems();
486 void itemRotationChanged(
double newRotation );
503 void init(
bool manageZValue );