2016-02-17 10:11:00 +03:00
|
|
|
/***************************************************************************
|
|
|
|
* This file is part of the Lime Report project *
|
|
|
|
* Copyright (C) 2015 by Alexander Arin *
|
|
|
|
* arin_a@bk.ru *
|
|
|
|
* *
|
|
|
|
** GNU General Public License Usage **
|
|
|
|
* *
|
|
|
|
* This library is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
** GNU Lesser General Public License **
|
|
|
|
* *
|
|
|
|
* This library is free software: you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this library. *
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
* *
|
|
|
|
* This library is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef LRBASEDESIGNINTF_H
|
|
|
|
#define LRBASEDESIGNINTF_H
|
|
|
|
#include <QObject>
|
|
|
|
#include <QFrame>
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
#include <QtGui>
|
|
|
|
#include <QtXml>
|
2017-03-02 20:22:49 +03:00
|
|
|
#include <QMenu>
|
2016-02-17 10:11:00 +03:00
|
|
|
#include "lrcollection.h"
|
|
|
|
#include "lrglobal.h"
|
|
|
|
#include "serializators/lrstorageintf.h"
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(QList<QObject*>*)
|
|
|
|
|
|
|
|
namespace LimeReport {
|
|
|
|
|
|
|
|
enum ItemModes{ DesignMode=1, PreviewMode=2, PrintMode=4, EditMode=8, LayoutEditMode=16 };
|
|
|
|
|
|
|
|
class ReportEnginePrivate;
|
|
|
|
class PageDesignIntf;
|
2019-03-01 02:47:19 +03:00
|
|
|
class BaseDesignIntf;
|
|
|
|
|
|
|
|
class Marker : public QGraphicsItem{
|
|
|
|
public:
|
|
|
|
Marker(QGraphicsItem* parent = 0, BaseDesignIntf* owner = 0): QGraphicsItem(parent), m_owner(owner){}
|
|
|
|
QRectF boundingRect() const;
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *);
|
|
|
|
void setRect(QRectF rect){prepareGeometryChange();m_rect=rect;}
|
|
|
|
void setColor(QColor color){m_color=color;}
|
|
|
|
QRectF rect() const {return m_rect;}
|
2019-06-28 20:12:47 +03:00
|
|
|
virtual QColor color() const;
|
2019-03-01 02:47:19 +03:00
|
|
|
BaseDesignIntf* owner() const {return m_owner;}
|
|
|
|
private:
|
|
|
|
QRectF m_rect;
|
|
|
|
QColor m_color;
|
|
|
|
BaseDesignIntf* m_owner;
|
|
|
|
};
|
|
|
|
|
|
|
|
class SelectionMarker : public Marker{
|
|
|
|
public:
|
|
|
|
SelectionMarker(QGraphicsItem* parent=0, BaseDesignIntf* owner = 0);
|
2019-06-28 20:12:47 +03:00
|
|
|
QColor color() const;
|
2019-03-01 02:47:19 +03:00
|
|
|
protected:
|
|
|
|
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
};
|
|
|
|
|
2016-02-17 10:28:27 +03:00
|
|
|
class DataSourceManager;
|
2017-03-02 19:47:42 +03:00
|
|
|
class ReportRender;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
class BaseDesignIntf :
|
|
|
|
public QObject, public QGraphicsItem, public ICollectionContainer, public ObjectLoadingStateIntf {
|
|
|
|
Q_OBJECT
|
|
|
|
Q_INTERFACES(QGraphicsItem)
|
|
|
|
Q_FLAGS(BorderLines)
|
2019-06-21 20:18:23 +03:00
|
|
|
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometryProperty NOTIFY geometryChanged)
|
2016-02-17 10:11:00 +03:00
|
|
|
Q_PROPERTY(ACollectionProperty children READ fakeCollectionReader DESIGNABLE false)
|
|
|
|
Q_PROPERTY(qreal zOrder READ zValue WRITE setZValueProperty DESIGNABLE false)
|
|
|
|
Q_PROPERTY(BorderLines borders READ borderLines WRITE setBorderLinesFlags)
|
2016-02-21 01:08:54 +03:00
|
|
|
Q_PROPERTY(QString parentName READ parentReportItemName WRITE setParentReportItem DESIGNABLE false)
|
2016-02-17 10:39:17 +03:00
|
|
|
Q_PROPERTY(int borderLineSize READ borderLineSize WRITE setBorderLineSize)
|
2016-04-20 19:59:33 +03:00
|
|
|
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
|
2016-04-06 20:35:13 +03:00
|
|
|
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
|
2019-06-29 18:11:00 +03:00
|
|
|
Q_PROPERTY(bool geometryLocked READ isGeometryLocked WRITE setGeometryLocked)
|
2017-08-31 02:53:34 +03:00
|
|
|
|
2017-03-02 19:47:42 +03:00
|
|
|
friend class ReportRender;
|
2016-02-17 10:11:00 +03:00
|
|
|
public:
|
2016-12-21 22:09:10 +03:00
|
|
|
enum BGMode { TransparentMode, OpaqueMode};
|
2020-03-03 05:13:46 +03:00
|
|
|
|
2016-12-21 22:09:10 +03:00
|
|
|
|
|
|
|
enum BrushStyle{ NoBrush,
|
|
|
|
SolidPattern,
|
|
|
|
Dense1Pattern,
|
|
|
|
Dense2Pattern,
|
|
|
|
Dense3Pattern,
|
|
|
|
Dense4Pattern,
|
|
|
|
Dense5Pattern,
|
|
|
|
Dense6Pattern,
|
|
|
|
Dense7Pattern,
|
|
|
|
HorPattern,
|
|
|
|
VerPattern,
|
|
|
|
CrossPattern,
|
|
|
|
BDiagPattern,
|
|
|
|
FDiagPattern };
|
2020-03-03 05:13:46 +03:00
|
|
|
|
2016-12-21 22:09:10 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
enum ResizeFlags { Fixed = 0,
|
|
|
|
ResizeLeft = 1,
|
|
|
|
ResizeRight = 2,
|
|
|
|
ResizeTop = 4,
|
|
|
|
ResizeBottom = 8,
|
|
|
|
AllDirections = 15
|
|
|
|
};
|
2020-03-03 05:13:46 +03:00
|
|
|
|
2019-06-28 20:12:47 +03:00
|
|
|
enum MoveFlags { None = 0,
|
|
|
|
LeftRight=1,
|
2016-02-17 10:11:00 +03:00
|
|
|
TopBotom=2,
|
|
|
|
All=3
|
|
|
|
};
|
2020-03-03 05:13:46 +03:00
|
|
|
|
2017-02-24 07:13:43 +03:00
|
|
|
enum BorderSide {
|
|
|
|
NoLine = 0,
|
|
|
|
TopLine = 1,
|
|
|
|
BottomLine = 2,
|
|
|
|
LeftLine = 4,
|
|
|
|
RightLine = 8,
|
|
|
|
AllLines = 15
|
2016-02-17 10:11:00 +03:00
|
|
|
};
|
2020-03-03 05:13:46 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated};
|
2020-03-03 05:13:46 +03:00
|
|
|
|
2016-02-17 10:28:27 +03:00
|
|
|
enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign};
|
2020-03-03 05:13:46 +03:00
|
|
|
|
2019-06-21 20:18:23 +03:00
|
|
|
enum UnitType {Millimeters, Inches};
|
2020-03-03 05:13:46 +03:00
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5,5, 0))
|
|
|
|
Q_ENUM(BGMode)
|
|
|
|
Q_ENUM(BrushStyle)
|
|
|
|
Q_ENUM(ResizeFlags)
|
|
|
|
Q_ENUM(MoveFlags)
|
|
|
|
Q_ENUM(BorderSide)
|
|
|
|
Q_ENUM(ObjectState)
|
|
|
|
Q_ENUM(ItemAlign)
|
2020-02-17 07:17:02 +03:00
|
|
|
Q_ENUM(UnitType)
|
2020-03-03 05:13:46 +03:00
|
|
|
#else
|
|
|
|
Q_ENUMS(BGMode)
|
|
|
|
Q_ENUMS(BrushStyle)
|
|
|
|
Q_ENUMS(ResizeFlags)
|
|
|
|
Q_ENUMS(MoveFlags)
|
|
|
|
Q_ENUMS(BorderSide)
|
|
|
|
Q_ENUMS(ObjectState)
|
|
|
|
Q_ENUMS(ItemAlign)
|
|
|
|
Q_ENUMS(UnitType)
|
|
|
|
#endif
|
2017-01-28 02:20:15 +03:00
|
|
|
// enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
2016-02-17 10:11:00 +03:00
|
|
|
Q_DECLARE_FLAGS(BorderLines, BorderSide)
|
|
|
|
Q_DECLARE_FLAGS(ItemMode,ItemModes)
|
2016-02-17 10:39:17 +03:00
|
|
|
friend class SelectionMarker;
|
2016-02-17 10:11:00 +03:00
|
|
|
public:
|
|
|
|
BaseDesignIntf(const QString& storageTypeName, QObject* owner = 0, QGraphicsItem* parent = 0);
|
|
|
|
virtual ~BaseDesignIntf();
|
|
|
|
|
2016-12-21 22:09:10 +03:00
|
|
|
void setParentReportItem(const QString& value);
|
2016-11-01 22:31:48 +03:00
|
|
|
QString parentReportItemName() const;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
2016-12-21 22:09:10 +03:00
|
|
|
BrushStyle backgroundBrushStyle() const {return m_backgroundBrushStyle;}
|
|
|
|
void setBackgroundBrushStyle(BrushStyle value);
|
|
|
|
QColor backgroundColor() const {return m_backgroundColor;}
|
|
|
|
void setBackgroundColor(QColor value);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
QPen pen() const;
|
|
|
|
void setPen(QPen& pen);
|
|
|
|
QFont font() const;
|
|
|
|
void setFont(QFont& font);
|
2016-11-01 22:31:48 +03:00
|
|
|
QColor fontColor() const {return m_fontColor;}
|
2016-02-17 10:11:00 +03:00
|
|
|
void setFontColor(QColor value){m_fontColor=value;}
|
|
|
|
|
|
|
|
virtual BGMode backgroundMode() const;
|
|
|
|
virtual void setBackgroundMode(BGMode bgMode);
|
|
|
|
virtual qreal width() const;
|
|
|
|
virtual qreal widthMM() const;
|
|
|
|
virtual void setWidth(qreal width);
|
|
|
|
virtual qreal height() const;
|
|
|
|
virtual qreal heightMM() const;
|
|
|
|
virtual void setHeight(qreal height);
|
|
|
|
virtual QPointF posMM() const;
|
|
|
|
virtual int opacity() const;
|
|
|
|
virtual void setOpacity(int opacity);
|
|
|
|
virtual void setSize(QSizeF size);
|
|
|
|
virtual QSizeF size() const;
|
|
|
|
virtual QSizeF sizeMM() const;
|
|
|
|
|
|
|
|
void paint(QPainter* ppainter, const QStyleOptionGraphicsItem* option, QWidget* widget);
|
2016-12-21 22:09:10 +03:00
|
|
|
void prepareRect(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
|
2016-02-17 10:11:00 +03:00
|
|
|
virtual QPainterPath shape() const;
|
|
|
|
|
|
|
|
void setFixedPos(bool fixedPos);
|
2019-03-01 02:47:19 +03:00
|
|
|
bool isFixedPos(){return m_fixedPos;}
|
2016-02-17 10:11:00 +03:00
|
|
|
int resizeHandleSize() const;
|
|
|
|
|
2019-06-21 20:18:23 +03:00
|
|
|
qreal unitFactor() const;
|
|
|
|
void setUnitType(UnitType unitType);
|
|
|
|
UnitType unitType();
|
|
|
|
virtual QRect geometry() const;
|
2016-02-17 10:11:00 +03:00
|
|
|
void setGeometry(QRectF rect);
|
|
|
|
|
2019-06-21 20:18:23 +03:00
|
|
|
QRectF rect() const;
|
2016-02-17 10:11:00 +03:00
|
|
|
void setupPainter(QPainter* painter) const;
|
|
|
|
virtual QRectF boundingRect() const;
|
|
|
|
|
|
|
|
virtual void moveRight();
|
|
|
|
virtual void moveLeft();
|
|
|
|
virtual void moveDown();
|
|
|
|
virtual void moveUp();
|
|
|
|
|
|
|
|
virtual void sizeRight();
|
|
|
|
virtual void sizeLeft();
|
|
|
|
virtual void sizeUp();
|
|
|
|
virtual void sizeDown();
|
|
|
|
|
|
|
|
void setItemPos(const QPointF &newPos);
|
|
|
|
void setItemPos(qreal x, qreal y);
|
|
|
|
|
2019-02-25 16:22:10 +03:00
|
|
|
virtual void setItemMode(LimeReport::BaseDesignIntf::ItemMode mode);
|
2016-02-17 10:11:00 +03:00
|
|
|
ItemMode itemMode() const {return m_itemMode;}
|
|
|
|
|
2016-04-20 19:59:33 +03:00
|
|
|
virtual void setBorderLinesFlags(LimeReport::BaseDesignIntf::BorderLines flags);
|
2019-06-21 20:18:23 +03:00
|
|
|
void setGeometryProperty(QRect rect);
|
2016-02-17 10:11:00 +03:00
|
|
|
PageDesignIntf* page();
|
|
|
|
|
|
|
|
BorderLines borderLines() const;
|
|
|
|
QString storageTypeName() const {return m_storageTypeName;}
|
|
|
|
ReportEnginePrivate *reportEditor();
|
|
|
|
|
2016-02-17 10:28:27 +03:00
|
|
|
virtual void updateItemSize(DataSourceManager* dataManager, RenderPass pass=FirstPass, int maxHeight=0);
|
2016-02-17 10:11:00 +03:00
|
|
|
virtual bool isNeedUpdateSize(RenderPass) const;
|
|
|
|
virtual BaseDesignIntf* cloneItem(LimeReport::BaseDesignIntf::ItemMode mode, QObject* owner=0, QGraphicsItem* parent=0);
|
|
|
|
virtual BaseDesignIntf* cloneItemWOChild(LimeReport::BaseDesignIntf::ItemMode mode, QObject* owner=0, QGraphicsItem* parent=0);
|
|
|
|
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0) = 0;
|
|
|
|
void initFromItem(BaseDesignIntf* source);
|
|
|
|
|
|
|
|
virtual bool canBeSplitted(int height) const;
|
|
|
|
virtual qreal minHeight() const {return 0;}
|
|
|
|
virtual bool isSplittable() const {return false;}
|
|
|
|
virtual bool isEmpty() const;
|
|
|
|
virtual BaseDesignIntf* cloneUpperPart(int height, QObject* owner=0, QGraphicsItem* parent=0);
|
|
|
|
virtual BaseDesignIntf* cloneBottomPart(int height, QObject* owner=0, QGraphicsItem* parent=0);
|
|
|
|
virtual BaseDesignIntf* cloneEmpty(int height, QObject* owner=0, QGraphicsItem* parent=0);
|
|
|
|
|
|
|
|
bool isLoaded(){return m_objectState==ObjectLoaded;}
|
|
|
|
bool isLoading(){return m_objectState==ObjectLoading;}
|
|
|
|
void objectLoadStarted();
|
|
|
|
void objectLoadFinished();
|
|
|
|
virtual void parentObjectLoadFinished();
|
|
|
|
virtual void beforeDelete();
|
|
|
|
|
2019-12-27 20:19:58 +03:00
|
|
|
QList<BaseDesignIntf*> childBaseItems() const;
|
2017-07-29 00:54:43 +03:00
|
|
|
QList<BaseDesignIntf*> allChildBaseItems();
|
2016-02-17 10:11:00 +03:00
|
|
|
BaseDesignIntf* childByName(const QString& name);
|
|
|
|
|
|
|
|
virtual QWidget *defaultEditor();
|
|
|
|
void notify(const QString &propertyName, const QVariant &oldValue, const QVariant &newValue);
|
|
|
|
void notify(const QVector<QString> &propertyNames);
|
|
|
|
|
2016-09-16 02:02:32 +03:00
|
|
|
int possibleResizeDirectionFlags() const;
|
|
|
|
void setPossibleResizeDirectionFlags(int directionsFlags);
|
|
|
|
int possibleMoveDirectionFlags() const;
|
|
|
|
void setPossibleMoveFlags(int directionsFlags);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
int marginSize() const {return m_margin;}
|
|
|
|
void setMarginSize(int value);
|
|
|
|
|
|
|
|
QString itemTypeName() const;
|
|
|
|
void setItemTypeName(const QString &itemTypeName);
|
2019-08-11 12:48:16 +03:00
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
int borderLineSize() const;
|
|
|
|
void setBorderLineSize(int value);
|
2016-02-17 10:18:19 +03:00
|
|
|
void showEditorDialog();
|
2016-02-17 10:28:27 +03:00
|
|
|
ItemAlign itemAlign() const;
|
|
|
|
virtual void setItemAlign(const ItemAlign &itemAlign);
|
|
|
|
void updateItemAlign();
|
|
|
|
QPointF modifyPosForAlignedItem(const QPointF &pos);
|
2016-02-21 01:08:54 +03:00
|
|
|
void turnOnJoinMarker(bool value);
|
|
|
|
virtual bool isBand(){return false;}
|
2016-04-06 20:35:13 +03:00
|
|
|
QColor borderColor() const;
|
|
|
|
void setBorderColor(const QColor &borderColor);
|
2016-04-20 19:59:33 +03:00
|
|
|
void setItemVisible(const bool& value);
|
2018-06-23 00:04:28 +03:00
|
|
|
virtual bool canContainChildren() const { return false;}
|
2020-08-11 20:37:21 +03:00
|
|
|
virtual bool canAcceptPaste() const{ return false;}
|
2016-06-24 23:15:59 +03:00
|
|
|
ReportSettings* reportSettings() const;
|
|
|
|
void setReportSettings(ReportSettings *reportSettings);
|
2016-08-02 00:35:57 +03:00
|
|
|
void setZValueProperty(qreal value);
|
2016-11-04 01:11:45 +03:00
|
|
|
QString patternName() const;
|
|
|
|
void setPatternName(const QString &patternName);
|
2017-03-21 18:01:35 +03:00
|
|
|
BaseDesignIntf* patternItem() const;
|
|
|
|
void setPatternItem(BaseDesignIntf* patternItem);
|
2017-07-29 00:54:43 +03:00
|
|
|
virtual QMap<QString, QString> getStringForTranslation();
|
2017-08-25 18:01:59 +03:00
|
|
|
bool fillInSecondPass() const;
|
|
|
|
void setFillInSecondPass(bool fillInSecondPass);
|
2018-03-22 17:54:18 +03:00
|
|
|
bool isWatermark() const;
|
|
|
|
virtual void setWatermark(bool watermark);
|
2019-03-01 02:47:19 +03:00
|
|
|
void updateSelectionMarker();
|
|
|
|
void turnOnSelectionMarker(bool value);
|
2020-08-11 20:37:21 +03:00
|
|
|
bool fillTransparentInDesignMode() const;
|
|
|
|
void setFillTransparentInDesignMode(bool fillTransparentInDesignMode);
|
|
|
|
void emitPosChanged(QPointF oldPos, QPointF newPos);
|
|
|
|
void emitObjectNamePropertyChanged(const QString& oldName, const QString& newName);
|
|
|
|
bool isGeometryLocked() const;
|
|
|
|
void setGeometryLocked(bool itemLocked);
|
|
|
|
bool isChangingPos() const;
|
|
|
|
void setIsChangingPos(bool isChangingPos);
|
|
|
|
|
2016-07-21 00:11:19 +03:00
|
|
|
Q_INVOKABLE QString setItemWidth(qreal width);
|
|
|
|
Q_INVOKABLE QString setItemHeight(qreal height);
|
2016-07-25 15:16:21 +03:00
|
|
|
Q_INVOKABLE qreal getItemWidth();
|
|
|
|
Q_INVOKABLE qreal getItemHeight();
|
|
|
|
Q_INVOKABLE qreal getItemPosX();
|
|
|
|
Q_INVOKABLE qreal getItemPosY();
|
2018-06-23 00:04:28 +03:00
|
|
|
Q_INVOKABLE qreal getAbsolutePosX();
|
|
|
|
Q_INVOKABLE qreal getAbsolutePosY();
|
2016-07-25 15:16:21 +03:00
|
|
|
Q_INVOKABLE QString setItemPosX(qreal xValue);
|
|
|
|
Q_INVOKABLE QString setItemPosY(qreal yValue);
|
2016-11-04 01:11:45 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
protected:
|
|
|
|
|
|
|
|
//ICollectionContainer
|
|
|
|
QObject* createElement(const QString&, const QString& elementType);
|
|
|
|
int elementsCount(const QString&);
|
|
|
|
QObject* elementAt(const QString&, int index);
|
|
|
|
void collectionLoadFinished(const QString& collectionName);
|
|
|
|
//ICollectionContainer
|
|
|
|
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent* event);
|
|
|
|
void hoverMoveEvent(QGraphicsSceneHoverEvent* event);
|
|
|
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
2020-12-30 00:40:46 +03:00
|
|
|
void hoverEnterEvent(QGraphicsSceneHoverEvent* );
|
2016-02-17 10:11:00 +03:00
|
|
|
void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
|
|
|
|
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
2019-02-25 16:22:10 +03:00
|
|
|
|
2017-02-24 07:13:43 +03:00
|
|
|
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
virtual void geometryChangedEvent(QRectF newRect, QRectF oldRect);
|
|
|
|
virtual QPen borderPen(BorderSide side) const;
|
|
|
|
virtual QColor selectionColor() const;
|
|
|
|
virtual void initFlags();
|
|
|
|
virtual void initMode(LimeReport::BaseDesignIntf::ItemMode mode);
|
|
|
|
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
|
|
|
|
virtual void childAddedEvent(BaseDesignIntf* child);
|
2016-02-17 10:28:27 +03:00
|
|
|
virtual void parentChangedEvent(BaseDesignIntf*);
|
2016-11-04 01:11:45 +03:00
|
|
|
void restoreLinks();
|
|
|
|
virtual void restoreLinksEvent(){}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
void drawTopLine(QPainter *painter, QRectF rect) const;
|
|
|
|
void drawBootomLine(QPainter *painter, QRectF rect) const;
|
|
|
|
void drawRightLine(QPainter *painter, QRectF rect) const;
|
|
|
|
void drawLeftLine(QPainter *painter, QRectF rect) const;
|
|
|
|
|
|
|
|
void drawBorder(QPainter* painter, QRectF rect) const;
|
|
|
|
void drawDesignModeBorder(QPainter* painter, QRectF rect) const;
|
|
|
|
void drawRenderModeBorder(QPainter *painter, QRectF rect) const;
|
2016-02-17 10:39:17 +03:00
|
|
|
void drawResizeZone(QPainter*);
|
2019-02-27 00:50:59 +03:00
|
|
|
void drawMarker(QPainter* painter, QColor color) const;
|
2016-02-17 10:11:00 +03:00
|
|
|
void drawPinArea(QPainter* painter) const;
|
|
|
|
|
|
|
|
void initResizeZones();
|
|
|
|
void invalidateRect(const QRectF &rect);
|
|
|
|
void invalidateRects(QVector<QRectF*> rects);
|
|
|
|
QFont transformToSceneFont(const QFont &value) const;
|
|
|
|
|
|
|
|
RenderPass currentRenderPass(){return m_currentPass;}
|
|
|
|
|
2016-02-17 10:19:50 +03:00
|
|
|
virtual bool drawDesignBorders() const {return true;}
|
2016-02-21 01:08:54 +03:00
|
|
|
virtual QColor selectionMarkerColor(){ return Const::SELECTION_COLOR;}
|
2016-11-18 01:12:23 +03:00
|
|
|
|
2017-01-28 02:20:15 +03:00
|
|
|
QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager);
|
|
|
|
QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager);
|
|
|
|
QString expandScripts(QString context, DataSourceManager *dataManager);
|
2016-11-18 01:12:23 +03:00
|
|
|
|
|
|
|
QVariant m_varValue;
|
|
|
|
|
2017-02-24 07:13:43 +03:00
|
|
|
virtual void preparePopUpMenu(QMenu& menu){Q_UNUSED(menu)}
|
2019-06-28 20:12:47 +03:00
|
|
|
virtual void processPopUpAction(QAction* action);
|
2017-02-24 07:13:43 +03:00
|
|
|
|
2017-07-29 00:54:43 +03:00
|
|
|
void addChildItems(QList<BaseDesignIntf*>* list);
|
2018-06-23 00:04:28 +03:00
|
|
|
qreal calcAbsolutePosY(qreal currentOffset, BaseDesignIntf* item);
|
|
|
|
qreal calcAbsolutePosX(qreal currentOffset, BaseDesignIntf* item);
|
2019-02-12 22:45:35 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
private:
|
|
|
|
int resizeDirectionFlags(QPointF position);
|
|
|
|
void moveSelectedItems(QPointF delta);
|
2016-09-16 02:02:32 +03:00
|
|
|
Qt::CursorShape getPossibleCursor(int cursorFlags);
|
|
|
|
void updatePossibleDirectionFlags();
|
2020-08-11 20:37:21 +03:00
|
|
|
|
2020-12-29 23:56:54 +03:00
|
|
|
private slots:
|
|
|
|
void onChangeGeometryTimeOut();
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
private:
|
|
|
|
QPointF m_startPos;
|
|
|
|
int m_resizeHandleSize;
|
|
|
|
int m_selectionPenSize;
|
2016-09-16 02:02:32 +03:00
|
|
|
int m_possibleResizeDirectionFlags;
|
|
|
|
int m_possibleMoveDirectionFlags;
|
2019-06-28 20:12:47 +03:00
|
|
|
int m_savedPossibleResizeDirectionFlags;
|
|
|
|
int m_savedPossibleMoveDirectionFlags;
|
2019-06-30 12:41:07 +03:00
|
|
|
int m_savedFixedPos;
|
2016-02-17 10:11:00 +03:00
|
|
|
int m_resizeDirectionFlags;
|
2016-12-21 22:09:10 +03:00
|
|
|
qreal m_width;
|
|
|
|
qreal m_height;
|
2016-02-17 10:11:00 +03:00
|
|
|
QPen m_pen;
|
|
|
|
QFont m_font;
|
|
|
|
QColor m_fontColor;
|
|
|
|
bool m_fixedPos;
|
2016-02-17 10:39:17 +03:00
|
|
|
int m_borderLineSize;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
QRectF m_rect;
|
|
|
|
mutable QRectF m_boundingRect;
|
|
|
|
|
|
|
|
QRectF m_oldGeometry;
|
|
|
|
BGMode m_BGMode;
|
|
|
|
int m_opacity;
|
|
|
|
BorderLines m_borderLinesFlags;
|
|
|
|
|
|
|
|
QRectF m_bottomRect;
|
|
|
|
QRectF m_topRect;
|
|
|
|
QRectF m_leftRect;
|
|
|
|
QRectF m_rightRect;
|
|
|
|
|
|
|
|
QVector<QRectF*> m_resizeAreas;
|
|
|
|
QString m_storageTypeName;
|
|
|
|
ItemMode m_itemMode;
|
|
|
|
|
|
|
|
ObjectState m_objectState;
|
|
|
|
|
2016-12-21 22:09:10 +03:00
|
|
|
BrushStyle m_backgroundBrushStyle;
|
|
|
|
QColor m_backgroundColor;
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
RenderPass m_currentPass;
|
|
|
|
int m_margin;
|
|
|
|
QString m_itemTypeName;
|
2016-02-17 10:28:27 +03:00
|
|
|
ItemAlign m_itemAlign;
|
|
|
|
bool m_changingItemAlign;
|
2016-04-06 20:35:13 +03:00
|
|
|
QColor m_borderColor;
|
2016-06-24 23:15:59 +03:00
|
|
|
ReportSettings* m_reportSettings;
|
2016-11-04 01:11:45 +03:00
|
|
|
QString m_patternName;
|
2017-03-21 18:01:35 +03:00
|
|
|
BaseDesignIntf* m_patternItem;
|
2017-08-25 18:01:59 +03:00
|
|
|
bool m_fillInSecondPass;
|
2018-06-23 00:04:28 +03:00
|
|
|
bool m_watermark;
|
2019-02-25 16:22:10 +03:00
|
|
|
bool m_hovered;
|
2019-02-27 00:50:59 +03:00
|
|
|
bool m_joinMarkerOn;
|
2019-03-01 02:47:19 +03:00
|
|
|
SelectionMarker* m_selectionMarker;
|
|
|
|
Marker* m_joinMarker;
|
2019-06-21 20:18:23 +03:00
|
|
|
bool m_fillTransparentInDesignMode;
|
|
|
|
QRect m_itemGeometry;
|
|
|
|
UnitType m_unitType;
|
2019-06-28 20:12:47 +03:00
|
|
|
bool m_itemGeometryLocked;
|
2020-04-23 21:03:22 +03:00
|
|
|
bool m_isChangingPos;
|
2020-12-29 23:56:54 +03:00
|
|
|
bool m_isMoveable;
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
signals:
|
|
|
|
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
2019-01-21 14:17:34 +03:00
|
|
|
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);
|
2016-02-17 10:11:00 +03:00
|
|
|
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
|
|
|
void itemSelected(LimeReport::BaseDesignIntf *item);
|
2020-12-30 00:40:46 +03:00
|
|
|
void itemSelectedHasBeenChanged(LimeReport::BaseDesignIntf *item, bool value);
|
2016-02-17 10:11:00 +03:00
|
|
|
void loadCollectionFinished(const QString& collectionName);
|
|
|
|
void objectLoaded(QObject* object);
|
|
|
|
void objectChanged(QObject* object);
|
|
|
|
void propertyChanged(const QString& propertName, const QVariant& oldValue,const QVariant& newValue);
|
|
|
|
void propertyObjectNameChanged(const QString& oldValue, const QString& newValue);
|
|
|
|
void propertyesChanged(QVector<QString> propertyNames);
|
2020-12-30 00:40:46 +03:00
|
|
|
void itemAlignChanged(LimeReport::BaseDesignIntf* item, const LimeReport::BaseDesignIntf::ItemAlign& oldValue, const LimeReport::BaseDesignIntf::ItemAlign& newValue);
|
|
|
|
void itemVisibleHasChanged(LimeReport::BaseDesignIntf* item);
|
2016-12-20 01:33:58 +03:00
|
|
|
void beforeRender();
|
|
|
|
void afterData();
|
|
|
|
void afterRender();
|
2016-02-17 10:11:00 +03:00
|
|
|
};
|
|
|
|
|
2019-02-12 22:45:35 +03:00
|
|
|
class BookmarkContainerDesignIntf: public BaseDesignIntf{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
BookmarkContainerDesignIntf(const QString& storageTypeName, QObject* owner = 0, QGraphicsItem* parent = 0)
|
|
|
|
:BaseDesignIntf(storageTypeName, owner, parent){}
|
|
|
|
void addBookmark(const QString& key, const QVariant& value){ m_bookmarks.insert(key, value);}
|
|
|
|
QList<QString> bookmarks(){ return m_bookmarks.keys();}
|
|
|
|
QVariant getBookMark(const QString& key);
|
|
|
|
void copyBookmarks(BookmarkContainerDesignIntf* source);
|
|
|
|
private:
|
2020-02-03 21:50:28 +03:00
|
|
|
QHash<QString,QVariant> m_bookmarks;
|
2019-02-12 22:45:35 +03:00
|
|
|
};
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
} //namespace LimeReport
|
|
|
|
|
|
|
|
#endif // LRBASEDESIGNINTF_H
|