30 #ifndef BASEITEMINTERFACE_H 31 #define BASEITEMINTERFACE_H 35 #include <QGraphicsWidget> 46 #define ITEMVIEWTYPE QGraphicsItem::UserType + 101 48 #define SAVEIFCHANGED(OLD, NEW) \ 53 #define PROCESS_NEW_PROPERTY_VALUE(PropertyName, VALUE) \ 54 if (d-> PropertyName == VALUE) \ 56 d-> PropertyName = VALUE; \ 57 if (d->state == CuteReport::NormalState) { \ 58 emit PropertyName##Changed ( d-> PropertyName ); \ 62 #define PROCESS_NEW_PROPERTY_VALUE_WITH_GUI_UPDATE(PropertyName, VALUE) \ 63 if (d-> PropertyName == VALUE) \ 65 d-> PropertyName = VALUE; \ 67 if (d->state == CuteReport::NormalState) { \ 68 emit PropertyName##Changed ( d-> PropertyName ); \ 72 #define PROPERTY_CHANGE_SIGNALS(PropertyName) \ 73 if (d->state == CuteReport::NormalState) { \ 74 emit PropertyName##Changed ( d-> PropertyName ); \ 78 #define NOTPROPERTY_CHANGE_SIGNALS(SIGNALNAME, VARIABLE) \ 79 if (d->state == NormalState) { \ 80 emit SIGNALNAME ( VARIABLE ); \ 93 class DesignerItemInterface;
95 class BaseItemHelperInterface;
96 class BaseItemInterfacePrivate;
97 class RenderedItemInterfacePrivate;
98 class ItemInterfaceView;
99 class RendererInterface;
100 class RenderedItemInterface;
101 class RendererPublicInterface;
102 class ReportInterface;
103 class ItemExternalDataInterface;
104 class ScriptEngineInterface;
113 Q_ENUMS(
Frame ResizeFlags BorderType BaseItemFlag)
115 Q_PROPERTY(
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
116 Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged)
118 Q_PROPERTY(Frames frame READ frame WRITE setFrame NOTIFY frameChanged)
119 Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
120 Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged)
121 Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen NOTIFY borderPenChanged)
122 Q_PROPERTY(QString borderType READ borderTypeStr WRITE setBorderTypeStr NOTIFY borderTypeChanged)
123 Q_PROPERTY(QBrush backgroundBrush READ backgroundBrush WRITE setBackgroundBrush NOTIFY backgroundBrushChanged)
124 Q_PROPERTY(
int order READ order WRITE setOrder NOTIFY orderChanged)
125 Q_PROPERTY(
int baseItemFlags READ baseItemFlags WRITE setBaseItemFlags NOTIFY baseItemFlagsChanged DESIGNABLE
false)
127 Q_PROPERTY(BorderType borderType READ borderType WRITE setBorderType NOTIFY borderTypeChanged DESIGNABLE
false STORED
false)
128 Q_PROPERTY(QStringList _borderType_variants READ _borderType_variants DESIGNABLE
false STORED
false)
130 Q_PROPERTY(
int _current_property READ _currentProperty WRITE _setCurrentProperty DESIGNABLE
false STORED
false)
131 Q_PROPERTY(QString _current_property_description READ _current_property_description DESIGNABLE
false STORED
false)
132 Q_PROPERTY(
int _current_property_precision READ _current_property_precision DESIGNABLE
false STORED
false)
133 Q_PROPERTY(QIcon _icon READ itemIcon DESIGNABLE
false STORED
false)
141 Q_DECLARE_FLAGS(Frames,
Frame)
154 BaseReportItem = 0x0001,
156 AutoRenamedFromBaseReport = 0x0004
165 virtual bool moduleInit();
170 virtual void check_gui();
171 virtual void update_gui();
172 virtual void init_gui() = 0;
175 virtual BaseItemInterface * clone(
bool withChildren =
true,
bool init =
true)
const;
183 virtual int childLevel();
187 virtual QList<BaseItemInterface *> childrenAt(
const QPointF & localPos);
188 QList<BaseItemInterface *> allChildrenAt(
const QPointF & localPos);
191 virtual QByteArray serialize();
192 virtual void deserialize(QByteArray &data);
194 virtual bool canContain(QObject *
object);
195 virtual ItemInterfaceView * view();
198 virtual void saveState();
199 virtual void restoreState();
202 virtual void renderInit(CuteReport::ScriptEngineInterface *scriptEngine, CuteReport::InitFlags flags) = 0;
205 virtual void renderReset();
211 virtual bool renderBegin() = 0;
214 virtual RenderedItemInterface * renderView(quint32
id) = 0;
219 virtual bool renderEnd();
231 virtual bool selfRendering();
234 virtual bool childrenSelfRendering();
236 virtual QIcon itemIcon()
const = 0;
237 virtual QString itemGroup()
const = 0;
240 virtual Unit unit()
const;
241 virtual void setUnit(
Unit unit);
250 virtual QRectF boundingRect(
Unit unit =
UnitNotDefined,
bool withTransformation =
true,
bool withBorder =
true)
const;
253 virtual qint8 frame()
const;
254 virtual void setFrame(Frames frame);
255 virtual qreal opacity()
const;
256 virtual void setOpacity(qreal opacity);
257 virtual qreal rotation()
const;
258 virtual void setRotation(qreal angle);
260 virtual QPen borderPen()
const;
261 virtual void setBorderPen(
const QPen & pen);
262 virtual QBrush backgroundBrush()
const;
263 virtual void setBackgroundBrush(
const QBrush & brush);
267 virtual QString borderTypeStr()
const;
268 virtual void setBorderTypeStr(
const QString & borderType);
270 int resizeFlags()
const;
272 int baseItemFlags()
const;
273 void setBaseItemFlags(
int flags,
bool value =
true);
275 bool isBaseItemFlagSet(
int flag);
277 virtual bool enabled()
const;
278 virtual void setEnabled(
bool b =
true);
280 virtual int order()
const;
281 virtual void setOrder(
int order);
283 virtual void setDpi(
int dpi);
284 virtual int dpi()
const;
288 virtual QList<CuteReport::InternalStringData>
renderingStrings(){
return QList<InternalStringData>();}
291 static void paintBegin(QPainter * painter,
const QStyleOptionGraphicsItem *option, BaseItemInterfacePrivate * data,
const QRectF &boundingRect = QRectF(),
RenderingType type =
RenderingTemplate);
292 static void paintEnd(QPainter * painter,
const QStyleOptionGraphicsItem *option, BaseItemInterfacePrivate *data,
const QRectF &boundingRect = QRectF(),
RenderingType type =
RenderingTemplate);
293 static QRectF paintArea(
const BaseItemInterfacePrivate * data,
const QRectF &boundingRect = QRectF());
294 static qreal borderWidth(
const BaseItemInterfacePrivate * data,
Unit unit =
UnitNotDefined, qreal *insideWidth = 0, qreal *outsideWidth = 0);
296 virtual QTransform transform()
const;
310 QRectF absoluteBoundingRect(
Unit unit =
UnitNotDefined,
bool withTransformation =
true,
bool withBorder =
true)
const;
314 static QFont fontPrepared(
const QFont & font, qint16 dpi);
315 static QPen penPrepared(
const QPen & pen, qint16 dpi);
316 static QTransform transform(
const BaseItemInterfacePrivate *d);
317 static QPointF transformedPos(
const BaseItemInterfacePrivate *d,
const QRectF &rect);
319 static BorderType borderTypeFromString(
const QString & bType);
320 static QString borderTypeToString(
BorderType bType);
324 QStringList _borderType_variants();
328 virtual QString _current_property_description()
const;
329 virtual int _current_property_precision()
const;
337 void aboutToBeDeleted();
340 void unitChanged(
Unit);
341 void geometryChanged(QRectF newGeometry);
342 void opacityChanged(qreal newOpacity);
343 void frameChanged(Frames);
344 void rotationChanged(qreal angle);
345 void borderPenChanged(QPen pen);
346 void backgroundBrushChanged(QBrush brush);
347 void dpiChanged(
int dpi);
348 void enabledChanged(
bool);
349 void orderChanged(
int);
351 void renderingStringsChanged();
354 void borderTypeChanged(QString);
355 void baseItemFlagsChanged(
int);
357 void boundingRectChanged();
368 void printCreateBefore();
374 void printDataBefore();
393 void pushContext(BaseItemInterfacePrivate * r);
399 void setResizeFlags(
int resizeFlags);
400 static const QRectF adjustRect(QRectF & rect,
const QPen & pen);
401 virtual void adjustOrder();
402 virtual void updateMeassure();
405 void renderInitBase(CuteReport::ScriptEngineInterface *scriptEngine, CuteReport::InitFlags flags);
406 void rendererBeginBaseStart(BaseItemInterfacePrivate *p);
407 void rendererBeginBaseEnd();
408 void renderResetBase();
410 BaseItemInterfacePrivate * d_ptr;
411 BaseItemInterfacePrivate * orig_ptr;
412 QList <BaseItemInterfacePrivate*> dataStack;
413 ItemInterfaceView * m_gui;
417 int m_currentProperty;
427 friend class BaseRenderedItemInterface;
428 friend class ItemInterfaceView;
436 virtual bool screenBack(
bool accept =
true){Q_UNUSED(accept);
return false;}
440 Q_DECLARE_OPERATORS_FOR_FLAGS(BaseItemInterface::Frames)
451 #endif // BASEITEMINTERFACE_H
Definition: abstractpainterdelegate.h:42
virtual void childRemoved(BaseItemInterface *item)
Definition: baseiteminterface.h:397
virtual ItemExternalDataInterface * createDataObjectByTypeName(const QString &className)
Definition: baseiteminterface.h:176
virtual bool screenBack(bool accept=true)
Definition: baseiteminterface.h:436
QList< StdEditorProperty > StdEditorPropertyList
Definition: cutereport_types.h:262
virtual QList< CuteReport::InternalStringData > renderingStrings()
Definition: baseiteminterface.h:288
Definition: cutereport_types.h:111
Definition: bandinterface.h:44
Definition: cutereport_types.h:109
RenderingType
Definition: cutereport_types.h:177
Definition: cutereport_types.h:178
Definition: pageinterface.h:74
TODO v2: rename to ReportObject.
Definition: reportinterface.h:71
Frame
Definition: cutereport_types.h:107
virtual void renderSiblingsBefore(QList< BaseItemInterface *> siblings)
Definition: baseiteminterface.h:226
virtual void _setCurrentProperty(int num)
Definition: baseiteminterface.h:326
TemplateItemDetailLevel
for Designer
Definition: cutereport_types.h:268
BaseItemFlag
Definition: baseiteminterface.h:153
virtual void renderCannotFitToPage()
Definition: baseiteminterface.h:223
Definition: cutereport_types.h:103
ResizeFlags
Definition: baseiteminterface.h:143
Frame
Definition: baseiteminterface.h:136
Definition: baseiteminterface.h:432
Definition: reportplugininterface.h:53
Definition: cutereport_types.h:110
BorderType
Definition: baseiteminterface.h:151
virtual void renderSiblingsAfter(QList< BaseItemInterface *> siblings)
Definition: baseiteminterface.h:228
virtual void childAdded(BaseItemInterface *item)
Definition: baseiteminterface.h:396
virtual BaseItemHelperInterface * createHelper(CuteReport::DesignerItemInterface *designer)
Definition: baseiteminterface.h:190
virtual int _currentProperty()
Definition: baseiteminterface.h:327
#define CUTEREPORT_EXPORTS
Definition: cutereport_globals.h:47
virtual void sync()
Definition: baseiteminterface.h:435
virtual void renderPassStart()
Definition: baseiteminterface.h:221
Unit
Definition: cutereport_types.h:95
virtual int itemSortOrderInGroup() const
Definition: baseiteminterface.h:238
Definition: cutereport_types.h:108
Definition: baseiteminterface.h:107
virtual bool isSplitAllowed() const
Definition: baseiteminterface.h:286
Definition: reportcore.h:83
virtual void renderPassEnd()
Definition: baseiteminterface.h:222