mirror of
https://github.com/fralx/LimeReport.git
synced 2025-04-01 07:03:43 +03:00
removed 'Nouveau dossier' folder
This commit is contained in:
parent
6586e39710
commit
2c2fc4cff5
File diff suppressed because it is too large
Load Diff
@ -1,536 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2021 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>
|
||||
#include <QMenu>
|
||||
#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;
|
||||
class BaseDesignIntf;
|
||||
|
||||
class LIMEREPORT_EXPORT 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;}
|
||||
virtual QColor color() const;
|
||||
BaseDesignIntf* owner() const {return m_owner;}
|
||||
private:
|
||||
QRectF m_rect;
|
||||
QColor m_color;
|
||||
BaseDesignIntf* m_owner;
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT SelectionMarker : public Marker{
|
||||
public:
|
||||
SelectionMarker(QGraphicsItem* parent=0, BaseDesignIntf* owner = 0);
|
||||
QColor color() const;
|
||||
protected:
|
||||
void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
|
||||
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
};
|
||||
|
||||
class DataSourceManager;
|
||||
class ReportRender;
|
||||
|
||||
class LIMEREPORT_EXPORT BaseDesignIntf :
|
||||
public QObject, public QGraphicsItem, public ICollectionContainer, public ObjectLoadingStateIntf {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QGraphicsItem)
|
||||
Q_FLAGS(BorderLines)
|
||||
Q_PROPERTY(QRect geometry READ geometry WRITE setGeometryProperty NOTIFY geometryChanged)
|
||||
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)
|
||||
Q_PROPERTY(QString parentName READ parentReportItemName WRITE setParentReportItem DESIGNABLE false)
|
||||
Q_PROPERTY(qreal borderLineSize READ borderLineSize WRITE setBorderLineSize)
|
||||
Q_PROPERTY(bool isVisible READ isVisible WRITE setItemVisible DESIGNABLE false)
|
||||
Q_PROPERTY(bool shadow READ hasShadow WRITE setShadow)
|
||||
Q_PROPERTY(QColor borderColor READ borderColor WRITE setBorderColor)
|
||||
Q_PROPERTY(bool geometryLocked READ isGeometryLocked WRITE setGeometryLocked)
|
||||
Q_PROPERTY(BorderStyle borderStyle READ borderStyle WRITE setBorderStyle)
|
||||
|
||||
friend class ReportRender;
|
||||
public:
|
||||
enum BGMode { TransparentMode, OpaqueMode};
|
||||
enum BorderStyle { NoStyle = Qt::NoPen,
|
||||
Solid = Qt::SolidLine,
|
||||
Dashed = Qt::DashLine,
|
||||
Dot = Qt::DotLine,
|
||||
|
||||
DashDot = Qt::DashDotLine,
|
||||
DashDotDot = Qt::DashDotDotLine,
|
||||
Doubled = 7
|
||||
};
|
||||
|
||||
|
||||
enum BrushStyle{ NoBrush,
|
||||
SolidPattern,
|
||||
Dense1Pattern,
|
||||
Dense2Pattern,
|
||||
Dense3Pattern,
|
||||
Dense4Pattern,
|
||||
Dense5Pattern,
|
||||
Dense6Pattern,
|
||||
Dense7Pattern,
|
||||
HorPattern,
|
||||
VerPattern,
|
||||
CrossPattern,
|
||||
BDiagPattern,
|
||||
FDiagPattern };
|
||||
|
||||
|
||||
enum ResizeFlags { Fixed = 0,
|
||||
ResizeLeft = 1,
|
||||
ResizeRight = 2,
|
||||
ResizeTop = 4,
|
||||
ResizeBottom = 8,
|
||||
AllDirections = 15
|
||||
};
|
||||
|
||||
enum MoveFlags { None = 0,
|
||||
LeftRight=1,
|
||||
TopBotom=2,
|
||||
All=3
|
||||
};
|
||||
|
||||
enum BorderSide {
|
||||
NoLine = 0,
|
||||
TopLine = 1,
|
||||
BottomLine = 2,
|
||||
LeftLine = 4,
|
||||
RightLine = 8,
|
||||
AllLines = 15
|
||||
};
|
||||
|
||||
enum ObjectState {ObjectLoading, ObjectLoaded, ObjectCreated};
|
||||
|
||||
enum ItemAlign {LeftItemAlign,RightItemAlign,CenterItemAlign,ParentWidthItemAlign,DesignedItemAlign};
|
||||
|
||||
enum UnitType {Millimeters, Inches};
|
||||
#if QT_VERSION >= 0x050500
|
||||
Q_ENUM(BGMode)
|
||||
Q_ENUM(BrushStyle)
|
||||
Q_ENUM(BorderStyle)
|
||||
Q_ENUM(ResizeFlags)
|
||||
Q_ENUM(MoveFlags)
|
||||
Q_ENUM(BorderSide)
|
||||
Q_ENUM(ObjectState)
|
||||
Q_ENUM(ItemAlign)
|
||||
Q_ENUM(UnitType)
|
||||
|
||||
#else
|
||||
Q_ENUMS(BGMode)
|
||||
Q_ENUMS(BrushStyle)
|
||||
Q_ENUM(BorderStyle)
|
||||
Q_ENUMS(ResizeFlags)
|
||||
Q_ENUMS(MoveFlags)
|
||||
Q_ENUMS(BorderSide)
|
||||
Q_ENUMS(ObjectState)
|
||||
Q_ENUMS(ItemAlign)
|
||||
Q_ENUMS(UnitType)
|
||||
|
||||
#endif
|
||||
// enum ExpandType {EscapeSymbols, NoEscapeSymbols, ReplaceHTMLSymbols};
|
||||
Q_DECLARE_FLAGS(BorderLines, BorderSide)
|
||||
Q_DECLARE_FLAGS(ItemMode,ItemModes)
|
||||
friend class SelectionMarker;
|
||||
public:
|
||||
BaseDesignIntf(const QString& storageTypeName, QObject* owner = 0, QGraphicsItem* parent = 0);
|
||||
virtual ~BaseDesignIntf();
|
||||
|
||||
void setParentReportItem(const QString& value);
|
||||
QString parentReportItemName() const;
|
||||
|
||||
BrushStyle backgroundBrushStyle() const {return m_backgroundBrushStyle;}
|
||||
BorderStyle borderStyle() const {return m_borderStyle;}
|
||||
void setBackgroundBrushStyle(BrushStyle value);
|
||||
QColor backgroundColor() const {return m_backgroundColor;}
|
||||
void setBackgroundColor(QColor value);
|
||||
|
||||
QPen pen() const;
|
||||
void setPen(QPen& pen);
|
||||
QFont font() const;
|
||||
void setFont(QFont& font);
|
||||
QColor fontColor() const {return m_fontColor;}
|
||||
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);
|
||||
void prepareRect(QPainter* painter, const QStyleOptionGraphicsItem*, QWidget*);
|
||||
virtual QPainterPath shape() const;
|
||||
|
||||
void setFixedPos(bool fixedPos);
|
||||
bool isFixedPos(){return m_fixedPos;}
|
||||
int resizeHandleSize() const;
|
||||
|
||||
qreal unitFactor() const;
|
||||
void setUnitType(UnitType unitType);
|
||||
UnitType unitType();
|
||||
virtual QRect geometry() const;
|
||||
void setGeometry(QRectF rect);
|
||||
|
||||
QRectF rect() const;
|
||||
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);
|
||||
|
||||
virtual void setItemMode(LimeReport::BaseDesignIntf::ItemMode mode);
|
||||
ItemMode itemMode() const {return m_itemMode;}
|
||||
|
||||
virtual void setBorderLinesFlags(LimeReport::BaseDesignIntf::BorderLines flags);
|
||||
void setGeometryProperty(QRect rect);
|
||||
PageDesignIntf* page() const;
|
||||
|
||||
BorderLines borderLines() const;
|
||||
|
||||
QString storageTypeName() const {return m_storageTypeName;}
|
||||
ReportEnginePrivate *reportEditor();
|
||||
|
||||
virtual void updateItemSize(DataSourceManager* dataManager, RenderPass pass=FirstPass, int maxHeight=0);
|
||||
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;
|
||||
virtual 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();
|
||||
|
||||
QList<BaseDesignIntf*> childBaseItems() const;
|
||||
QList<BaseDesignIntf*> allChildBaseItems();
|
||||
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);
|
||||
|
||||
int possibleResizeDirectionFlags() const;
|
||||
void setPossibleResizeDirectionFlags(int directionsFlags);
|
||||
int possibleMoveDirectionFlags() const;
|
||||
void setPossibleMoveFlags(int directionsFlags);
|
||||
|
||||
int marginSize() const {return m_margin;}
|
||||
void setMarginSize(int value);
|
||||
|
||||
QString itemTypeName() const;
|
||||
void setItemTypeName(const QString &itemTypeName);
|
||||
|
||||
qreal borderLineSize() const;
|
||||
void setBorderStyle(BorderStyle b);
|
||||
void setBorderLineSize(qreal value);
|
||||
void showEditorDialog();
|
||||
ItemAlign itemAlign() const;
|
||||
virtual void setItemAlign(const ItemAlign &itemAlign);
|
||||
void updateItemAlign();
|
||||
QPointF modifyPosForAlignedItem(const QPointF &pos);
|
||||
void turnOnJoinMarker(bool value);
|
||||
virtual bool isBand(){return false;}
|
||||
QColor borderColor() const;
|
||||
void setBorderColor(const QColor &borderColor);
|
||||
void setItemVisible(const bool& value);
|
||||
virtual bool canContainChildren() const { return false;}
|
||||
virtual bool canAcceptPaste() const{ return false;}
|
||||
ReportSettings* reportSettings() const;
|
||||
void setReportSettings(ReportSettings *reportSettings);
|
||||
void setZValueProperty(qreal value);
|
||||
QString patternName() const;
|
||||
void setPatternName(const QString &patternName);
|
||||
BaseDesignIntf* patternItem() const;
|
||||
void setPatternItem(BaseDesignIntf* patternItem);
|
||||
virtual QMap<QString, QString> getStringForTranslation();
|
||||
bool fillInSecondPass() const;
|
||||
void setFillInSecondPass(bool fillInSecondPass);
|
||||
bool isWatermark() const;
|
||||
virtual void setWatermark(bool watermark);
|
||||
void updateSelectionMarker();
|
||||
void turnOnSelectionMarker(bool value);
|
||||
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);
|
||||
bool isShapeItem() const;
|
||||
bool isPageItem() const;
|
||||
bool hasShadow();
|
||||
void setShadow(bool sh);
|
||||
Q_INVOKABLE QString setItemWidth(qreal width);
|
||||
Q_INVOKABLE QString setItemHeight(qreal height);
|
||||
Q_INVOKABLE qreal getItemWidth();
|
||||
Q_INVOKABLE qreal getItemHeight();
|
||||
Q_INVOKABLE qreal getItemPosX();
|
||||
Q_INVOKABLE qreal getItemPosY();
|
||||
Q_INVOKABLE qreal getAbsolutePosX();
|
||||
Q_INVOKABLE qreal getAbsolutePosY();
|
||||
Q_INVOKABLE QString setItemPosX(qreal xValue);
|
||||
Q_INVOKABLE QString setItemPosY(qreal yValue);
|
||||
|
||||
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);
|
||||
void hoverEnterEvent(QGraphicsSceneHoverEvent* );
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
|
||||
|
||||
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
|
||||
|
||||
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);
|
||||
virtual void parentChangedEvent(BaseDesignIntf*);
|
||||
void restoreLinks();
|
||||
virtual void restoreLinksEvent(){}
|
||||
|
||||
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 drawShadow(QPainter* painter, QRectF rect, qreal shadowSize) const;
|
||||
void drawDesignModeBorder(QPainter* painter, QRectF rect) const;
|
||||
void drawRenderModeBorder(QPainter *painter, QRectF rect) const;
|
||||
void drawResizeZone(QPainter*);
|
||||
void drawMarker(QPainter* painter, QColor color) const;
|
||||
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;}
|
||||
|
||||
virtual bool drawDesignBorders() const {return true;}
|
||||
virtual QColor selectionMarkerColor(){ return Const::SELECTION_COLOR;}
|
||||
|
||||
QString expandUserVariables(QString context, RenderPass pass, ExpandType expandType, DataSourceManager *dataManager);
|
||||
QString expandDataFields(QString context, ExpandType expandType, DataSourceManager *dataManager);
|
||||
QString expandScripts(QString context, DataSourceManager *dataManager);
|
||||
|
||||
QVariant m_varValue;
|
||||
|
||||
virtual void preparePopUpMenu(QMenu& menu){Q_UNUSED(menu)}
|
||||
virtual void processPopUpAction(QAction* action);
|
||||
|
||||
void addChildItems(QList<BaseDesignIntf*>* list);
|
||||
qreal calcAbsolutePosY(qreal currentOffset, BaseDesignIntf* item);
|
||||
qreal calcAbsolutePosX(qreal currentOffset, BaseDesignIntf* item);
|
||||
|
||||
QWidget* findRootWidget(QWidget* widget);
|
||||
void showDialog(QWidget *widget);
|
||||
|
||||
private:
|
||||
int resizeDirectionFlags(QPointF position);
|
||||
void moveSelectedItems(QPointF delta);
|
||||
Qt::CursorShape getPossibleCursor(int cursorFlags);
|
||||
void updatePossibleDirectionFlags();
|
||||
void addGuideLine(qreal x1, qreal y1, qreal x2, qreal y2);
|
||||
void removeGuideLines();
|
||||
private slots:
|
||||
void onChangeGeometryTimeOut();
|
||||
|
||||
private:
|
||||
QPointF m_startPos;
|
||||
int m_resizeHandleSize;
|
||||
int m_selectionPenSize;
|
||||
int m_possibleResizeDirectionFlags;
|
||||
int m_possibleMoveDirectionFlags;
|
||||
int m_savedPossibleResizeDirectionFlags;
|
||||
int m_savedPossibleMoveDirectionFlags;
|
||||
int m_savedFixedPos;
|
||||
int m_resizeDirectionFlags;
|
||||
qreal m_width;
|
||||
qreal m_height;
|
||||
QPen m_pen;
|
||||
QFont m_font;
|
||||
QColor m_fontColor;
|
||||
bool m_fixedPos;
|
||||
qreal m_borderLineSize;
|
||||
|
||||
|
||||
QRectF m_rect;
|
||||
mutable QRectF m_boundingRect;
|
||||
|
||||
QRectF m_oldGeometry;
|
||||
BGMode m_BGMode;
|
||||
int m_opacity;
|
||||
BorderLines m_borderLinesFlags;
|
||||
BorderStyle m_borderStyle;
|
||||
|
||||
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;
|
||||
|
||||
BrushStyle m_backgroundBrushStyle;
|
||||
QColor m_backgroundColor;
|
||||
|
||||
RenderPass m_currentPass;
|
||||
int m_margin;
|
||||
QString m_itemTypeName;
|
||||
ItemAlign m_itemAlign;
|
||||
bool m_changingItemAlign;
|
||||
QColor m_borderColor;
|
||||
ReportSettings* m_reportSettings;
|
||||
QString m_patternName;
|
||||
BaseDesignIntf* m_patternItem;
|
||||
bool m_fillInSecondPass;
|
||||
bool m_watermark;
|
||||
bool m_hovered;
|
||||
bool m_joinMarkerOn;
|
||||
SelectionMarker* m_selectionMarker;
|
||||
Marker* m_joinMarker;
|
||||
bool m_fillTransparentInDesignMode;
|
||||
QRect m_itemGeometry;
|
||||
UnitType m_unitType;
|
||||
bool m_itemGeometryLocked;
|
||||
bool m_isChangingPos;
|
||||
bool m_isMoveable;
|
||||
bool m_shadow;
|
||||
QList<QGraphicsLineItem*> guideLines;
|
||||
|
||||
signals:
|
||||
void geometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
|
||||
void posChanging(QObject* object, QPointF newPos, QPointF oldPos);
|
||||
void posChanged(QObject* object, QPointF newPos, QPointF oldPos);
|
||||
void itemSelected(LimeReport::BaseDesignIntf *item);
|
||||
void itemSelectedHasBeenChanged(BaseDesignIntf *item, bool value);
|
||||
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);
|
||||
void itemAlignChanged(BaseDesignIntf* item, const ItemAlign& oldValue, const ItemAlign& newValue);
|
||||
void itemVisibleHasChanged(BaseDesignIntf* item);
|
||||
void beforeRender();
|
||||
void afterData();
|
||||
void afterRender();
|
||||
};
|
||||
|
||||
class LIMEREPORT_EXPORT 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:
|
||||
QHash<QString,QVariant> m_bookmarks;
|
||||
};
|
||||
|
||||
} //namespace LimeReport
|
||||
|
||||
#endif // LRBASEDESIGNINTF_H
|
@ -1,162 +0,0 @@
|
||||
#include "lrbordereditor.h"
|
||||
#include "ui_lrbordereditor.h"
|
||||
#include <QColorDialog>
|
||||
#include "lrbasedesignintf.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
BorderEditor::BorderEditor(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::BorderEditor),
|
||||
m_borderStyle(1),
|
||||
m_borderWidth(1)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
connect(
|
||||
ui->borderFrame, SIGNAL(borderSideClicked(LimeReport::BaseDesignIntf::BorderSide, bool)),
|
||||
this, SLOT(checkToolButtons(LimeReport::BaseDesignIntf::BorderSide, bool))
|
||||
);
|
||||
}
|
||||
|
||||
void BorderEditor::loadItem(LimeReport::BaseDesignIntf *item)
|
||||
{
|
||||
m_item = item;
|
||||
qDebug()<<item->metaObject()->className();
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine,
|
||||
item->borderLines() & LimeReport::BaseDesignIntf::TopLine);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine,
|
||||
item->borderLines() & LimeReport::BaseDesignIntf::LeftLine);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine,
|
||||
item->borderLines() & LimeReport::BaseDesignIntf::RightLine);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine,
|
||||
item->borderLines() & LimeReport::BaseDesignIntf::BottomLine);
|
||||
|
||||
QPen pen;
|
||||
pen.setWidthF(item->borderLineSize());
|
||||
pen.setColor(item->borderColor());
|
||||
pen.setStyle((Qt::PenStyle)item->borderStyle());
|
||||
ui->borderFrame->setPen(pen);
|
||||
m_borderColor = item->borderColor().name();
|
||||
ui->listWidget->setCurrentRow((Qt::PenStyle)item->borderStyle());
|
||||
ui->comboBox->setCurrentText(QString::number(item->borderLineSize()));
|
||||
m_borderWidth = ui->comboBox->currentText().toDouble();
|
||||
m_borderStyle =ui->listWidget->currentRow();
|
||||
ui->colorIndicator->setStyleSheet(QString("background-color:%1;").arg(m_borderColor));
|
||||
}
|
||||
|
||||
LimeReport::BaseDesignIntf::BorderLines BorderEditor::borderSides()
|
||||
{
|
||||
int borders = 0;
|
||||
borders += (ui->topLine->isChecked()) ? LimeReport::BaseDesignIntf::TopLine : 0;
|
||||
borders += (ui->bottomLine->isChecked()) ? LimeReport::BaseDesignIntf::BottomLine : 0;
|
||||
borders += (ui->leftLine->isChecked()) ? LimeReport::BaseDesignIntf::LeftLine : 0;
|
||||
borders += (ui->rightLine->isChecked()) ? LimeReport::BaseDesignIntf::RightLine : 0;
|
||||
return (LimeReport::BaseDesignIntf::BorderLines) borders;
|
||||
}
|
||||
|
||||
LimeReport::BaseDesignIntf::BorderStyle BorderEditor::borderStyle()
|
||||
{
|
||||
return (LimeReport::BaseDesignIntf::BorderStyle) m_borderStyle;
|
||||
}
|
||||
|
||||
QString BorderEditor::borderColor()
|
||||
{
|
||||
return m_borderColor;
|
||||
}
|
||||
|
||||
double BorderEditor::borderWidth()
|
||||
{
|
||||
return m_borderWidth;
|
||||
}
|
||||
|
||||
bool BorderEditor::isPage()
|
||||
{
|
||||
return QString(m_item->metaObject()->className()) == "LimeReport::PageItemDesignIntf";
|
||||
}
|
||||
|
||||
BorderEditor::~BorderEditor()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void BorderEditor::on_listWidget_currentRowChanged(int currentRow)
|
||||
{
|
||||
QPen pen = ui->borderFrame->pen();
|
||||
pen.setStyle((Qt::PenStyle)currentRow);
|
||||
m_borderStyle = currentRow;
|
||||
ui->borderFrame->setPen(pen);
|
||||
}
|
||||
|
||||
void BorderEditor::on_comboBox_currentTextChanged(const QString &arg1)
|
||||
{
|
||||
QPen pen = ui->borderFrame->pen();
|
||||
pen.setWidthF(arg1.toDouble());
|
||||
ui->borderFrame->setPen(pen);
|
||||
m_borderWidth = arg1.toDouble();
|
||||
}
|
||||
|
||||
void BorderEditor::checkToolButtons(LimeReport::BaseDesignIntf::BorderSide side, bool check)
|
||||
{
|
||||
switch(side)
|
||||
{
|
||||
case BaseDesignIntf::BorderSide::TopLine:
|
||||
ui->topLine->setChecked(check);
|
||||
break;
|
||||
case BaseDesignIntf::BorderSide::BottomLine:
|
||||
ui->bottomLine->setChecked(check);
|
||||
break;
|
||||
case BaseDesignIntf::BorderSide::LeftLine:
|
||||
ui->leftLine->setChecked(check);
|
||||
break;
|
||||
case BaseDesignIntf::BorderSide::RightLine:
|
||||
ui->rightLine->setChecked(check);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BorderEditor::on_topLine_clicked(bool checked){
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine, checked);
|
||||
}
|
||||
|
||||
void BorderEditor::on_bottomLine_clicked(bool checked){
|
||||
emit ui->borderFrame->borderSideClicked(BaseDesignIntf::BorderSide::BottomLine, checked);
|
||||
}
|
||||
|
||||
void BorderEditor::on_leftLine_clicked(bool checked){
|
||||
emit ui->borderFrame->borderSideClicked(BaseDesignIntf::BorderSide::LeftLine, checked);
|
||||
}
|
||||
|
||||
void BorderEditor::on_rightLine_clicked(bool checked){
|
||||
emit ui->borderFrame->borderSideClicked(BaseDesignIntf::BorderSide::RightLine, checked);
|
||||
}
|
||||
|
||||
|
||||
void BorderEditor::on_allLines_clicked()
|
||||
{
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine, true);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine, true);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine, true);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine, true);
|
||||
}
|
||||
|
||||
void BorderEditor::on_noLines_clicked()
|
||||
{
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::TopLine, false);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::BottomLine, false);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::LeftLine, false);
|
||||
emit ui->borderFrame->borderSideClicked(LimeReport::BaseDesignIntf::BorderSide::RightLine, false);
|
||||
}
|
||||
|
||||
|
||||
void BorderEditor::on_selectColor_clicked()
|
||||
{
|
||||
QColorDialog cd(this);
|
||||
if(cd.exec() == QDialog::Rejected) return;
|
||||
QPen pen = ui->borderFrame->pen();
|
||||
pen.setColor(cd.selectedColor().name());
|
||||
m_borderColor = pen.color().name();
|
||||
ui->colorIndicator->setStyleSheet(QString("background-color:%1;").arg(m_borderColor));
|
||||
ui->borderFrame->setPen(pen);
|
||||
}
|
||||
|
||||
} // namespace LimeReport
|
@ -1,50 +0,0 @@
|
||||
#ifndef LRBORDEREDITOR_H
|
||||
#define LRBORDEREDITOR_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "lrbasedesignintf.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
namespace Ui {
|
||||
class BorderEditor;
|
||||
}
|
||||
|
||||
|
||||
class LIMEREPORT_EXPORT BorderEditor : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BorderEditor(QWidget *parent = nullptr);
|
||||
void loadItem(LimeReport::BaseDesignIntf *item);
|
||||
LimeReport::BaseDesignIntf::BorderLines borderSides();
|
||||
LimeReport::BaseDesignIntf::BorderStyle borderStyle();
|
||||
QString borderColor();
|
||||
double borderWidth();
|
||||
bool isPage();
|
||||
~BorderEditor();
|
||||
|
||||
private slots:
|
||||
void on_listWidget_currentRowChanged(int currentRow);
|
||||
void on_comboBox_currentTextChanged(const QString &arg1);
|
||||
void on_noLines_clicked();
|
||||
void on_topLine_clicked(bool checked);
|
||||
void on_bottomLine_clicked(bool checked);
|
||||
void on_leftLine_clicked(bool checked);
|
||||
void on_rightLine_clicked(bool checked);
|
||||
void on_allLines_clicked();
|
||||
void checkToolButtons(LimeReport::BaseDesignIntf::BorderSide side, bool check);
|
||||
void on_selectColor_clicked();
|
||||
|
||||
private:
|
||||
Ui::BorderEditor *ui;
|
||||
LimeReport::BaseDesignIntf *m_item;
|
||||
QString m_borderColor;
|
||||
int m_borderStyle;
|
||||
double m_borderWidth;
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
|
||||
#endif // LRBORDEREDITOR_H
|
@ -1,229 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2021 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. *
|
||||
****************************************************************************/
|
||||
#include "lrgroupbands.h"
|
||||
#include "lrglobal.h"
|
||||
#include "lrdatasourcemanager.h"
|
||||
|
||||
const QString xmlTagHeader = QLatin1String("GroupHeader");
|
||||
const QString xmlTagFooter = QLatin1String("GroupFooter");
|
||||
|
||||
namespace{
|
||||
|
||||
LimeReport::BaseDesignIntf* createHeader(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::GroupBandHeader(owner,parent);
|
||||
}
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredHeader = LimeReport::DesignElementsFactory::instance().registerCreator(
|
||||
xmlTagHeader,
|
||||
LimeReport::ItemAttribs(QObject::tr("GroupHeader"),LimeReport::Const::bandTAG),
|
||||
createHeader
|
||||
);
|
||||
|
||||
LimeReport::BaseDesignIntf * createFooter(QObject* owner, LimeReport::BaseDesignIntf* parent){
|
||||
return new LimeReport::GroupBandFooter(owner,parent);
|
||||
}
|
||||
|
||||
bool VARIABLE_IS_NOT_USED registredFooter = LimeReport::DesignElementsFactory::instance().registerCreator(
|
||||
xmlTagFooter,
|
||||
LimeReport::ItemAttribs(QObject::tr("GroupFooter"),LimeReport::Const::bandTAG),
|
||||
createFooter
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
GroupBandHeader::GroupBandHeader(QObject *owner, QGraphicsItem *parent)
|
||||
: BandDesignIntf(BandDesignIntf::GroupHeader, xmlTagHeader, owner,parent),
|
||||
m_groupFiledName(""), m_groupStarted(false), m_resetPageNumber(false),m_sortFieldNameBy(Qt::AscendingOrder)
|
||||
{
|
||||
setBandTypeText(tr("GroupHeader"));
|
||||
setFixedPos(false);
|
||||
setMarkerColor(bandColor());
|
||||
}
|
||||
|
||||
bool GroupBandHeader::isUnique() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//bool GroupBandHeader::tryToKeepTogether()
|
||||
//{
|
||||
// return m_tryToKeepTogether;
|
||||
//}
|
||||
|
||||
BaseDesignIntf *GroupBandHeader::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
|
||||
{
|
||||
return new GroupBandHeader(owner, parent);
|
||||
}
|
||||
|
||||
void GroupBandHeader::startGroup(DataSourceManager* dataManager)
|
||||
{
|
||||
m_groupStarted=true;
|
||||
|
||||
QString lineVar = QLatin1String("line_")+objectName().toLower();
|
||||
dataManager->setReportVariable(lineVar,1);
|
||||
|
||||
QString datasourceName = findDataSourceName(parentBand());
|
||||
if (dataManager->containsDatasource(datasourceName)){
|
||||
IDataSource* ds = dataManager->dataSource(datasourceName);
|
||||
if (ds && ds->columnIndexByName(m_groupFiledName)!=-1)
|
||||
{
|
||||
m_groupFieldValue=ds->data(m_groupFiledName);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_condition.isEmpty()) m_conditionValue = calcCondition(dataManager);
|
||||
}
|
||||
|
||||
QColor GroupBandHeader::bandColor() const
|
||||
{
|
||||
return QColor(Qt::darkBlue);
|
||||
}
|
||||
|
||||
QString GroupBandHeader::findDataSourceName(BandDesignIntf* parentBand){
|
||||
if (!parentBand) return "";
|
||||
if (!parentBand->datasourceName().isEmpty())
|
||||
return parentBand->datasourceName();
|
||||
else
|
||||
return findDataSourceName(parentBand->parentBand());
|
||||
|
||||
}
|
||||
|
||||
QString GroupBandHeader::condition() const
|
||||
{
|
||||
return m_condition;
|
||||
}
|
||||
|
||||
void GroupBandHeader::setCondition(const QString &condition)
|
||||
{
|
||||
m_condition = condition;
|
||||
}
|
||||
|
||||
QString GroupBandHeader::calcCondition(DataSourceManager* dataManager){
|
||||
QString result = m_condition;
|
||||
if (!m_condition.isEmpty()){
|
||||
result=expandUserVariables(result, FirstPass, NoEscapeSymbols, dataManager);
|
||||
result=expandScripts(result, dataManager);
|
||||
result=expandDataFields(result, NoEscapeSymbols, dataManager);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool GroupBandHeader::isNeedToClose(DataSourceManager* dataManager)
|
||||
{
|
||||
if (!m_groupStarted) return false;
|
||||
if ((m_groupFiledName.isNull() || m_groupFiledName.isEmpty()) && condition().isEmpty()){
|
||||
dataManager->putError(tr("Group field not found"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_condition.isEmpty()){
|
||||
return m_conditionValue != calcCondition(dataManager);
|
||||
} else {
|
||||
QString datasourceName = findDataSourceName(parentBand());
|
||||
if (dataManager->containsDatasource(datasourceName)){
|
||||
IDataSource* ds = dataManager->dataSource(datasourceName);
|
||||
|
||||
if (ds){
|
||||
if (ds->data(m_groupFiledName).isNull() && m_groupFieldValue.isNull()) return false;
|
||||
if (!ds->data(m_groupFiledName).isValid()) return false;
|
||||
return ds->data(m_groupFiledName)!=m_groupFieldValue;
|
||||
}
|
||||
} else {
|
||||
dataManager->putError(tr("Datasource \"%1\" not found!").arg(datasourceName));
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GroupBandHeader::isStarted()
|
||||
{
|
||||
return m_groupStarted;//!m_groupFieldValue.isNull();
|
||||
}
|
||||
|
||||
void GroupBandHeader::closeGroup()
|
||||
{
|
||||
m_groupFieldValue=QVariant();
|
||||
m_conditionValue="";
|
||||
m_groupStarted=false;
|
||||
}
|
||||
|
||||
int GroupBandHeader::index()
|
||||
{
|
||||
return bandIndex();
|
||||
}
|
||||
|
||||
bool GroupBandHeader::startNewPage() const
|
||||
{
|
||||
return BandDesignIntf::startNewPage();
|
||||
}
|
||||
|
||||
void GroupBandHeader::setStartNewPage(bool startNewPage)
|
||||
{
|
||||
BandDesignIntf::setStartNewPage(startNewPage);
|
||||
}
|
||||
|
||||
bool GroupBandHeader::resetPageNumber() const
|
||||
{
|
||||
return m_resetPageNumber;
|
||||
}
|
||||
|
||||
void GroupBandHeader::setResetPageNumber(bool resetPageNumber)
|
||||
{
|
||||
m_resetPageNumber = resetPageNumber;
|
||||
}
|
||||
|
||||
GroupBandFooter::GroupBandFooter(QObject *owner, QGraphicsItem *parent)
|
||||
:BandDesignIntf(BandDesignIntf::GroupFooter, xmlTagFooter, owner,parent)
|
||||
{
|
||||
setBandTypeText(tr("GroupFooter"));
|
||||
setFixedPos(false);
|
||||
setMarkerColor(bandColor());
|
||||
}
|
||||
|
||||
bool GroupBandFooter::isUnique() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QColor GroupBandFooter::bandColor() const
|
||||
{
|
||||
return QColor(Qt::darkBlue);
|
||||
}
|
||||
|
||||
BaseDesignIntf *GroupBandFooter::createSameTypeItem(QObject *owner, QGraphicsItem *parent)
|
||||
{
|
||||
return new GroupBandFooter(owner,parent);
|
||||
}
|
||||
|
||||
} //namespace LimeReport
|
@ -1,99 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2021 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 LRGROUPBANDS_H
|
||||
#define LRGROUPBANDS_H
|
||||
|
||||
#include "lrbanddesignintf.h"
|
||||
#include "lrdesignelementsfactory.h"
|
||||
#include "qnamespace.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class GroupBandHeader : public BandDesignIntf, public IGroupBand{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString groupFieldName READ groupFieldName WRITE setGroupFieldName)
|
||||
Q_PROPERTY(Qt::SortOrder SortFieldNameBy READ SortFieldNameBy WRITE setSortFieldNameBy)
|
||||
Q_PROPERTY(bool splittable READ isSplittable WRITE setSplittable )
|
||||
Q_PROPERTY(bool keepGroupTogether READ tryToKeepTogether WRITE setTryToKeepTogether)
|
||||
Q_PROPERTY(bool startNewPage READ startNewPage WRITE setStartNewPage)
|
||||
Q_PROPERTY(bool resetPageNumber READ resetPageNumber WRITE setResetPageNumber)
|
||||
Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage)
|
||||
Q_PROPERTY(QString condition READ condition WRITE setCondition)
|
||||
public:
|
||||
GroupBandHeader(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
virtual bool isUnique() const;
|
||||
QVariant groupFieldValue(){return m_groupFieldValue;}
|
||||
void setGroupFieldValue(QVariant value){m_groupFieldValue=value;}
|
||||
QString groupFieldName(){return m_groupFiledName;}
|
||||
void setGroupFieldName(QString fieldName){m_groupFiledName=fieldName;}
|
||||
QColor bandColor() const;
|
||||
bool startNewPage() const;
|
||||
void setStartNewPage(bool startNewPage);
|
||||
bool resetPageNumber() const;
|
||||
void setResetPageNumber(bool resetPageNumber);
|
||||
bool isHeader() const{return true;}
|
||||
bool isGroupHeader() const {return true;}
|
||||
QString condition() const;
|
||||
void setCondition(const QString &condition);
|
||||
Qt::SortOrder SortFieldNameBy(){return m_sortFieldNameBy;};
|
||||
void setSortFieldNameBy(Qt::SortOrder sortOrder){m_sortFieldNameBy = sortOrder;}
|
||||
private:
|
||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
void startGroup(DataSourceManager* dataManager);
|
||||
bool isNeedToClose(DataSourceManager *dataManager);
|
||||
bool isStarted();
|
||||
void closeGroup();
|
||||
int index();
|
||||
QString findDataSourceName(BandDesignIntf *parentBand);
|
||||
QString calcCondition(DataSourceManager *dataManager);
|
||||
private:
|
||||
QVariant m_groupFieldValue;
|
||||
QString m_groupFiledName;
|
||||
bool m_groupStarted;
|
||||
//bool m_startNewPage;
|
||||
bool m_resetPageNumber;
|
||||
QString m_condition;
|
||||
QString m_conditionValue;
|
||||
Qt::SortOrder m_sortFieldNameBy = Qt::AscendingOrder;
|
||||
};
|
||||
|
||||
class GroupBandFooter : public BandDesignIntf{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GroupBandFooter(QObject* owner = 0, QGraphicsItem* parent=0);
|
||||
virtual bool isUnique() const;
|
||||
QColor bandColor() const;
|
||||
virtual bool isFooter() const{return true;}
|
||||
private:
|
||||
virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0);
|
||||
};
|
||||
|
||||
} // namespace LimeReport
|
||||
#endif // LRGROUPBANDS_H
|
File diff suppressed because it is too large
Load Diff
@ -1,227 +0,0 @@
|
||||
/***************************************************************************
|
||||
* This file is part of the Lime Report project *
|
||||
* Copyright (C) 2021 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 LRREPORTRENDER_H
|
||||
#define LRREPORTRENDER_H
|
||||
#include <QObject>
|
||||
#include "lrcollection.h"
|
||||
#include "lrdatasourcemanager.h"
|
||||
#include "lrpageitemdesignintf.h"
|
||||
#include "lrscriptenginemanager.h"
|
||||
#include "serializators/lrstorageintf.h"
|
||||
|
||||
namespace LimeReport{
|
||||
|
||||
class PageDesignIntf;
|
||||
class BandDesignIntf;
|
||||
class ContentItemDesignIntf;
|
||||
|
||||
class GroupBandsHolder: public QList<BandDesignIntf*>{
|
||||
public:
|
||||
GroupBandsHolder(bool tryToKeepTogether):QList<BandDesignIntf*>(),m_tryToKeepTogether(tryToKeepTogether),
|
||||
m_dataGroup(true), m_footerGroup(false){}
|
||||
bool tryToKeepTogether(){return m_tryToKeepTogether;}
|
||||
void setTryToKeepTogether(bool value){m_tryToKeepTogether=value;}
|
||||
bool isDataGroup(){return m_dataGroup;}
|
||||
bool isFooterGroup(){ return m_footerGroup;}
|
||||
void setIsFooterGroup(){m_footerGroup=true;m_dataGroup=false;}
|
||||
private:
|
||||
bool m_tryToKeepTogether;
|
||||
bool m_dataGroup;
|
||||
bool m_footerGroup;
|
||||
};
|
||||
|
||||
|
||||
struct PagesRange{
|
||||
int firstPage;
|
||||
int lastPage;
|
||||
bool isTOC;
|
||||
};
|
||||
|
||||
class PagesRanges{
|
||||
public:
|
||||
PagesRanges(): m_TOCRangeIndex(-1) {}
|
||||
int findLastPageNumber(int index);
|
||||
int findPageNumber(int index);
|
||||
PagesRange& currentRange(bool isTOC);
|
||||
void startNewRange(bool isTOC = false);
|
||||
void addTOCMarker(bool addNewRange);
|
||||
void addPage();
|
||||
void addTOCPage();
|
||||
void clear();
|
||||
private:
|
||||
void shiftRangesNextToTOC();
|
||||
private:
|
||||
QVector<PagesRange> m_ranges;
|
||||
int m_TOCRangeIndex;
|
||||
};
|
||||
|
||||
|
||||
class ReportRender: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QObject* datasourcesManager READ datasources)
|
||||
public:
|
||||
enum DataRenderMode {StartNewPageAsNeeded, NotStartNewPage, ForcedStartPage};
|
||||
enum BandPrintMode {PrintAlwaysPrintable, PrintNotAlwaysPrintable };
|
||||
enum ResetPageNuberType{BandReset, PageReset};
|
||||
enum PageRenderStage{BeforePageHeader, AfterPageHeader};
|
||||
typedef QSharedPointer<ReportRender> Ptr;
|
||||
~ReportRender();
|
||||
ReportRender(QObject *parent = 0);
|
||||
void setDatasources(DataSourceManager* value);
|
||||
void setScriptContext(ScriptEngineContext* scriptContext);
|
||||
DataSourceManager* datasources(){return m_datasources;}
|
||||
int pageCount();
|
||||
PageItemDesignIntf::Ptr pageAt(int index);
|
||||
QString renderPageToString(PageItemDesignIntf *patternPage);
|
||||
ReportPages renderPageToPages(PageItemDesignIntf *patternPage);
|
||||
ReportPages renderTOC(PageItemDesignIntf *patternPage, bool first, bool resetPages);
|
||||
void secondRenderPass(ReportPages renderedPages);
|
||||
void createTOCMarker(bool startNewRange);
|
||||
signals:
|
||||
void pageRendered(int renderedPageCount);
|
||||
public slots:
|
||||
void cancelRender();
|
||||
private:
|
||||
void analizeContainer(BaseDesignIntf *item, BandDesignIntf *band);
|
||||
void analizeItem(ContentItemDesignIntf *item, BandDesignIntf *band);
|
||||
void analizePage(PageItemDesignIntf *patternPage);
|
||||
|
||||
void initDatasources();
|
||||
void initDatasource(const QString &name);
|
||||
void initRenderPage();
|
||||
void initVariables();
|
||||
void initGroups();
|
||||
void clearPageMap();
|
||||
|
||||
void renderPage(PageItemDesignIntf *patternPage, bool isTOC = false, bool isFirst = false, bool = false);
|
||||
BandDesignIntf* renderBand(BandDesignIntf *patternBand, BandDesignIntf *bandData, DataRenderMode mode = NotStartNewPage, bool isLast = false);
|
||||
void renderDataBand(BandDesignIntf* dataBand);
|
||||
void renderPageHeader(PageItemDesignIntf* patternPage);
|
||||
void renderReportHeader(PageItemDesignIntf* patternPage, PageRenderStage stage);
|
||||
void renderPageFooter(PageItemDesignIntf* patternPage);
|
||||
void renderPageItems(PageItemDesignIntf* patternPage);
|
||||
void renderChildHeader(BandDesignIntf* parent, BandPrintMode printMode);
|
||||
void renderChildFooter(BandDesignIntf* parent, BandPrintMode printMode);
|
||||
void renderChildBands(BandDesignIntf* parentBand);
|
||||
void recalcIfNeeded(BandDesignIntf *band);
|
||||
void renderDataHeader(BandDesignIntf* header);
|
||||
void renderGroupHeader(BandDesignIntf* parentBand, IDataSource* dataSource, bool firstTime);
|
||||
void renderGroupFooter(BandDesignIntf* parentBand);
|
||||
void moveTearOffBand();
|
||||
qreal calcPageFooterHeight(PageItemDesignIntf* patternPage);
|
||||
qreal calcSlicePercent(qreal height);
|
||||
|
||||
bool containsGroupFunctions(BaseDesignIntf *container);
|
||||
void extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
|
||||
void extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
|
||||
void extractGroupFunctions(BandDesignIntf* band);
|
||||
void replaceGroupFunctionsInItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
|
||||
void replaceGroupFunctionsInContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
|
||||
void replaceGroupsFunction(BandDesignIntf* band);
|
||||
|
||||
BandDesignIntf *findRecalcableBand(BandDesignIntf *patternBand);
|
||||
|
||||
void popPageFooterGroupValues(BandDesignIntf* dataBand);
|
||||
void pushPageFooterGroupValues(BandDesignIntf* dataBand);
|
||||
|
||||
enum GroupType{DATA,FOOTER};
|
||||
void closeGroup(BandDesignIntf* band);
|
||||
void openDataGroup(BandDesignIntf* band);
|
||||
void closeDataGroup(BandDesignIntf* band);
|
||||
void openFooterGroup(BandDesignIntf* band);
|
||||
void closeFooterGroup(BandDesignIntf* band);
|
||||
void cutGroups();
|
||||
void checkFooterGroup(BandDesignIntf* groupBand);
|
||||
void pasteGroups();
|
||||
void checkLostHeadersOnPrevPage();
|
||||
void checkLostHeadersInPrevColumn();
|
||||
|
||||
BandDesignIntf* findEnclosingGroup();
|
||||
bool registerBand(BandDesignIntf* band, bool registerInChildren=true);
|
||||
BandDesignIntf *sliceBand(BandDesignIntf* band, BandDesignIntf *patternBand, bool isLast);
|
||||
|
||||
BandDesignIntf* saveUppperPartReturnBottom(BandDesignIntf *band, int height, BandDesignIntf *patternBand);
|
||||
BandDesignIntf* renderData(BandDesignIntf* patternBand, bool emitBeforeRender = true);
|
||||
void startNewColumn();
|
||||
void startNewPage(bool isFirst = false);
|
||||
void resetPageNumber(ResetPageNuberType resetType);
|
||||
void savePage(bool isLast = false);
|
||||
QString toString();
|
||||
void initColumns();
|
||||
bool isNeedToRearrangeColumnsItems();
|
||||
BandDesignIntf* lastColumnItem(int columnIndex);
|
||||
void rearrangeColumnsItems();
|
||||
int columnItemsCount(int columnIndex);
|
||||
qreal columnHeigth(int columnIndex);
|
||||
qreal maxColumnHeight();
|
||||
void renameChildItems(BaseDesignIntf *item);
|
||||
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
|
||||
void updateTOC(BaseDesignIntf* item, int pageNumber);
|
||||
void placeBandOnPage(BandDesignIntf *band, int columnIndex);
|
||||
QColor makeBackgroundColor(BandDesignIntf *band);
|
||||
private:
|
||||
DataSourceManager* m_datasources;
|
||||
ScriptEngineContext* m_scriptEngineContext;
|
||||
PageItemDesignIntf* m_renderPageItem;
|
||||
PageItemDesignIntf* m_patternPageItem;
|
||||
QList<PageItemDesignIntf::Ptr> m_renderedPages;
|
||||
QMultiMap< BandDesignIntf*, GroupBandsHolder* > m_childBands;
|
||||
QList<BandDesignIntf*> m_reprintableBands;
|
||||
QList<BandDesignIntf*> m_recalcBands;
|
||||
QMap<QString, QVector<QString> > m_groupfunctionItems;
|
||||
int m_currentIndex;
|
||||
int m_pageCount;
|
||||
|
||||
QMap<QString,QVariant> m_popupedValues;
|
||||
QMultiMap<BandDesignIntf*,QString> m_popupedExpression;
|
||||
|
||||
qreal m_pageFooterHeight;
|
||||
qreal m_dataAreaSize;
|
||||
qreal m_reportFooterHeight;
|
||||
int m_renderedDataBandCount;
|
||||
BandDesignIntf* m_lastRenderedHeader;
|
||||
BandDesignIntf* m_lastDataBand;
|
||||
BandDesignIntf* m_lastRenderedFooter;
|
||||
BandDesignIntf* m_lastRenderedBand;
|
||||
bool m_renderCanceled;
|
||||
QVector<qreal> m_maxHeightByColumn;
|
||||
QVector<qreal> m_currentStartDataPos;
|
||||
int m_currentColumn;
|
||||
PagesRanges m_pagesRanges;
|
||||
QVector<BandDesignIntf*> m_columnedBandItems;
|
||||
unsigned long long m_currentNameIndex;
|
||||
bool m_newPageStarted;
|
||||
bool m_lostHeadersMoved;
|
||||
bool m_dataSourceSorted = false;
|
||||
|
||||
};
|
||||
} // namespace LimeReport
|
||||
#endif // LRREPORTRENDER_H
|
Loading…
Reference in New Issue
Block a user