0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00

Finish 1.4.115

# Conflicts:
#	limereport/lrpagedesignintf.h
This commit is contained in:
Arin Alexander 2019-01-16 20:42:22 +03:00
commit a73791ce2f
3 changed files with 208 additions and 229 deletions

View File

@ -120,7 +120,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc
LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MAJOR = 1
LIMEREPORT_VERSION_MINOR = 4 LIMEREPORT_VERSION_MINOR = 4
LIMEREPORT_VERSION_RELEASE = 113 LIMEREPORT_VERSION_RELEASE = 114
LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}'
DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\"

View File

@ -68,8 +68,6 @@ bool bandSortBandLessThen(const BandDesignIntf *c1, const BandDesignIntf *c2)
PageDesignIntf::PageDesignIntf(QObject *parent): PageDesignIntf::PageDesignIntf(QObject *parent):
QGraphicsScene(parent), QGraphicsScene(parent),
m_pageSize(A4),
m_orientation(Portrait),
m_pageItem(0), m_pageItem(0),
m_insertMode(false), m_insertMode(false),
m_itemInsertRect(0), m_itemInsertRect(0),
@ -85,8 +83,6 @@ PageDesignIntf::PageDesignIntf(QObject *parent):
m_executingGroupCommand(false), m_executingGroupCommand(false),
m_settings(0), m_settings(0),
m_selectionRect(0), m_selectionRect(0),
//m_verticalGridStep(1*Const::mmFACTOR),
//m_horizontalGridStep(1*Const::mmFACTOR)
m_verticalGridStep(2), m_verticalGridStep(2),
m_horizontalGridStep(2), m_horizontalGridStep(2),
m_updating(false), m_updating(false),
@ -135,22 +131,22 @@ void PageDesignIntf::updatePageRect()
emit sceneRectChanged(sceneRect()); emit sceneRectChanged(sceneRect());
} }
PageDesignIntf::Orientation PageDesignIntf::getOrientation() //PageDesignIntf::Orientation PageDesignIntf::getOrientation()
{ //{
return m_orientation; // return m_orientation;
} //}
void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue) //void PageDesignIntf::setPageSize(PageDesignIntf::PageSize sizeType, QSizeF sizeValue)
{ //{
m_pageSize = sizeType; // m_pageSize = sizeType;
m_pageSizeValue = sizeValue; // m_pageSizeValue = sizeValue;
updatePageRect(); // updatePageRect();
} //}
PageDesignIntf::PageSize PageDesignIntf::pageSize() const //PageDesignIntf::PageSize PageDesignIntf::pageSize() const
{ //{
return m_pageSize; // return m_pageSize;
} //}
void PageDesignIntf::keyPressEvent(QKeyEvent *event) void PageDesignIntf::keyPressEvent(QKeyEvent *event)
{ {
@ -668,22 +664,22 @@ bool PageDesignIntf::isExistsObjectName(const QString &objectName, QList<QGraphi
return false; return false;
} }
QRectF PageDesignIntf::getRectByPageSize(PageDesignIntf::PageSize pageSize) //QRectF PageDesignIntf::getRectByPageSize(PageDesignIntf::PageSize pageSize)
{ //{
if (m_pageSize != Custom) { // if (m_pageSize != PageSize::Custom) {
QPrinter printer; // QPrinter printer;
printer.setOutputFormat(QPrinter::PdfFormat); // printer.setOutputFormat(QPrinter::PdfFormat);
printer.setOrientation((QPrinter::Orientation)getOrientation()); // printer.setOrientation((QPrinter::Orientation)getOrientation());
printer.setPageSize((QPrinter::PageSize)pageSize); // printer.setPageSize((QPrinter::PageSize)pageSize);
return QRectF(0, 0, printer.paperRect(QPrinter::Millimeter).width() * 10, // return QRectF(0, 0, printer.paperRect(QPrinter::Millimeter).width() * 10,
printer.paperSize(QPrinter::Millimeter).height() * 10); // printer.paperSize(QPrinter::Millimeter).height() * 10);
} // }
else { // else {
return QRectF(0, 0, m_pageSizeValue.width() * 10, // return QRectF(0, 0, m_pageSizeValue.width() * 10,
m_pageSizeValue.height() * 10); // m_pageSizeValue.height() * 10);
} // }
} //}
bool PageDesignIntf::isLoading() bool PageDesignIntf::isLoading()
{ {

View File

@ -100,227 +100,210 @@ namespace LimeReport {
class PageDesignIntf : public QGraphicsScene, public ObjectLoadingStateIntf{ class PageDesignIntf : public QGraphicsScene, public ObjectLoadingStateIntf{
Q_OBJECT Q_OBJECT
Q_PROPERTY(QObject* pageItem READ pageItem()) Q_PROPERTY(QObject* pageItem READ pageItem())
public: public:
friend class PropertyChangedCommand; friend class PropertyChangedCommand;
friend class InsertHLayoutCommand; friend class InsertHLayoutCommand;
friend class InsertVLayoutCommand; friend class InsertVLayoutCommand;
enum Orientation {Portrait, Landscape}; explicit PageDesignIntf(QObject* parent = 0);
enum PageSize {A4, B5, Letter, Legal, Executive, ~PageDesignIntf();
A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1, void updatePageRect();
B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E, void startInsertMode(const QString& ItemType);
DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom void startEditMode();
};
explicit PageDesignIntf(QObject* parent = 0); PageItemDesignIntf *pageItem();
~PageDesignIntf(); void setPageItem(PageItemDesignIntf::Ptr pageItem);
void updatePageRect(); void setPageItems(QList<PageItemDesignIntf::Ptr> pages);
Orientation getOrientation(); QList<PageItemDesignIntf::Ptr> pageItems(){return m_reportPages;}
void setPageSize(PageSize sizeType, QSizeF sizeValue=QSizeF()); bool isItemInsertMode();
PageSize pageSize() const; ReportEnginePrivate* reportEditor();
void setReportEditor(ReportEnginePrivate* value){m_reportEditor=value;}
void startInsertMode(const QString& ItemType); QStringList possibleParentItems();
void startEditMode(); void registerItem(BaseDesignIntf* item);
void registerBand(BandDesignIntf* band);
void removeAllItems();
PageItemDesignIntf *pageItem(); void setItemMode(BaseDesignIntf::ItemMode state);
void setPageItem(PageItemDesignIntf::Ptr pageItem); BaseDesignIntf::ItemMode itemMode(){return m_itemMode;}
void setPageItems(QList<PageItemDesignIntf::Ptr> pages); BaseDesignIntf* reportItemByName(const QString& name);
QList<PageItemDesignIntf::Ptr> pageItems(){return m_reportPages;} QList<BaseDesignIntf *> reportItemsByName(const QString &name);
BandDesignIntf* bandAt(QPointF pos);
BaseDesignIntf* addReportItem(const QString& itemType, QPointF pos, QSizeF size);
BaseDesignIntf* addReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);
BaseDesignIntf* createReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);
void removeReportItem(BaseDesignIntf* item, bool createComand = true);
CommandIf::Ptr removeReportItemCommand(BaseDesignIntf *item);
bool saveCommand(CommandIf::Ptr command, bool runCommand = true);
bool isItemInsertMode(); bool isCanRedo();
ReportEnginePrivate* reportEditor(); bool isCanUndo();
void setReportEditor(ReportEnginePrivate* value){m_reportEditor=value;} bool isHasChanges();
QStringList possibleParentItems(); void reactivatePageItem(PageItemDesignIntf::Ptr pageItem);
void registerItem(BaseDesignIntf* item);
void registerBand(BandDesignIntf* band);
void removeAllItems();
void setItemMode(BaseDesignIntf::ItemMode state); void setSettings(QSettings* settings){ m_settings = settings;}
BaseDesignIntf::ItemMode itemMode(){return m_itemMode;} QSettings* settings(){ return m_settings;}
BaseDesignIntf* reportItemByName(const QString& name);
QList<BaseDesignIntf *> reportItemsByName(const QString &name);
BandDesignIntf* bandAt(QPointF pos);
BaseDesignIntf* addReportItem(const QString& itemType, QPointF pos, QSizeF size);
BaseDesignIntf* addReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);
BaseDesignIntf* createReportItem(const QString& itemType, QObject *owner=0, BaseDesignIntf *parent=0);
void removeReportItem(BaseDesignIntf* item, bool createComand = true);
CommandIf::Ptr removeReportItemCommand(BaseDesignIntf *item);
bool saveCommand(CommandIf::Ptr command, bool runCommand = true);
bool isCanRedo(); QString genObjectName(const QObject& object);
bool isCanUndo();
bool isHasChanges();
void reactivatePageItem(PageItemDesignIntf::Ptr pageItem); void animateItem(BaseDesignIntf* item);
void setSelectionRect(QRectF selectionRect);
void emitRegisterdItem(BaseDesignIntf *item);
void emitItemRemoved(BaseDesignIntf* item);
void setSettings(QSettings* settings){ m_settings = settings;} DataSourceManager* datasourceManager();
QSettings* settings(){ return m_settings;} bool isSaved(){ return !m_hasHanges;}
void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag);
QString genObjectName(const QObject& object); int verticalGridStep() const;
void setVerticalGridStep(int verticalGridStep);
void animateItem(BaseDesignIntf* item); int horizontalGridStep() const;
void setSelectionRect(QRectF selectionRect); void setHorizontalGridStep(int horizontalGridStep);
void emitRegisterdItem(BaseDesignIntf *item);
void emitItemRemoved(BaseDesignIntf* item);
DataSourceManager* datasourceManager(); void beginUpdate(){m_updating = true;}
bool isSaved(){ return !m_hasHanges;} bool isUpdating(){return m_updating;}
void changeSelectedGrpoupTextAlignPropperty(const bool& horizontalAlign, Qt::AlignmentFlag flag); void endUpdate();
int verticalGridStep() const; void itemMoved(BaseDesignIntf* item);
void setVerticalGridStep(int verticalGridStep); bool magneticMovement() const;
void setMagneticMovement(bool magneticMovement);
int horizontalGridStep() const; ReportSettings *getReportSettings() const;
void setHorizontalGridStep(int horizontalGridStep); void setReportSettings(ReportSettings *reportSettings);
void beginUpdate(){m_updating = true;} void setPropertyToSelectedItems(const char *name, const QVariant &value);
bool isUpdating(){return m_updating;}
void endUpdate();
void itemMoved(BaseDesignIntf* item);
bool magneticMovement() const;
void setMagneticMovement(bool magneticMovement);
ReportSettings *getReportSettings() const;
void setReportSettings(ReportSettings *reportSettings);
void setPropertyToSelectedItems(const char *name, const QVariant &value);
protected: protected:
virtual void keyPressEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event);
virtual void keyReleaseEvent(QKeyEvent *event); virtual void keyReleaseEvent(QKeyEvent *event);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event); virtual void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *); virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *);
virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
virtual void dropEvent(QGraphicsSceneDragDropEvent *event); virtual void dropEvent(QGraphicsSceneDragDropEvent *event);
LimeReport::BandDesignIntf::BandsType findPriorType(LimeReport::BandDesignIntf::BandsType bandType); LimeReport::BandDesignIntf::BandsType findPriorType(LimeReport::BandDesignIntf::BandsType bandType);
BaseDesignIntf *findDestObject(BaseDesignIntf *item); BaseDesignIntf *findDestObject(BaseDesignIntf *item);
bool isExistsObjectName (const QString& objectName, QList<QGraphicsItem *> &itemsList) const; bool isExistsObjectName (const QString& objectName, QList<QGraphicsItem *> &itemsList) const;
QRectF getRectByPageSize(PageSize pageSize);
bool isLoading(); bool isLoading();
void objectLoadStarted(); void objectLoadStarted();
void objectLoadFinished(); void objectLoadFinished();
HorizontalLayout* internalAddHLayout(); HorizontalLayout* internalAddHLayout();
VerticalLayout* internalAddVLayout(); VerticalLayout* internalAddVLayout();
QPointF placePosOnGrid(QPointF point); QPointF placePosOnGrid(QPointF point);
QSizeF placeSizeOnGrid(QSizeF size); QSizeF placeSizeOnGrid(QSizeF size);
signals: signals:
void geometryChanged(QRectF newGeometry); void geometryChanged(QRectF newGeometry);
void insertModeStarted(); void insertModeStarted();
void itemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType); void itemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType);
void itemInsertCanceled(const QString& ItemType); void itemInsertCanceled(const QString& ItemType);
void itemSelected(LimeReport::BaseDesignIntf *item); void itemSelected(LimeReport::BaseDesignIntf *item);
void multiItemsSelected(QList<QObject*>* objectsList); void multiItemsSelected(QList<QObject*>* objectsList);
void miltiItemsSelectionFinished(); void miltiItemsSelectionFinished();
void commandHistoryChanged(); void commandHistoryChanged();
void itemPropertyChanged(const QString& objectName, const QString& propertyName, const QVariant& oldValue, const QVariant& newValue); void itemPropertyChanged(const QString& objectName, const QString& propertyName, const QVariant& oldValue, const QVariant& newValue);
void itemAdded(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item); void itemAdded(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item);
void itemRemoved(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item); void itemRemoved(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item);
void bandAdded(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band); void bandAdded(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band);
void bandRemoved(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band); void bandRemoved(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band);
void pageUpdateFinished(LimeReport::PageDesignIntf* page); void pageUpdateFinished(LimeReport::PageDesignIntf* page);
public slots: public slots:
BaseDesignIntf* addBand(const QString& bandType); BaseDesignIntf* addBand(const QString& bandType);
BaseDesignIntf* addBand(BandDesignIntf::BandsType bandType); BaseDesignIntf* addBand(BandDesignIntf::BandsType bandType);
void removeBand(LimeReport::BandDesignIntf* band); void removeBand(LimeReport::BandDesignIntf* band);
void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry); void bandGeometryChanged(QObject* object, QRectF newGeometry, QRectF oldGeometry);
void bandPosChanged(QObject* object, QPointF newPos, QPointF oldPos); void bandPosChanged(QObject* object, QPointF newPos, QPointF oldPos);
void slotUpdateItemSize(); void slotUpdateItemSize();
void undo(); void undo();
void redo(); void redo();
void copy(); void copy();
void paste(); void paste();
void deleteSelected(); void deleteSelected();
void cut(); void cut();
void setToSaved(); void setToSaved();
void bringToFront(); void bringToFront();
void sendToBack(); void sendToBack();
void alignToLeft(); void alignToLeft();
void alignToRigth(); void alignToRigth();
void alignToVCenter(); void alignToVCenter();
void alignToTop(); void alignToTop();
void alignToBottom(); void alignToBottom();
void alignToHCenter(); void alignToHCenter();
void sameWidth(); void sameWidth();
void sameHeight(); void sameHeight();
void addHLayout(); void addHLayout();
void addVLayout(); void addVLayout();
void setFont(const QFont &font); void setFont(const QFont &font);
void setTextAlign(const Qt::Alignment& alignment); void setTextAlign(const Qt::Alignment& alignment);
void setBorders(const BaseDesignIntf::BorderLines& border); void setBorders(const BaseDesignIntf::BorderLines& border);
private slots: private slots:
void slotPageGeometryChanged(QObject*, QRectF, QRectF ); void slotPageGeometryChanged(QObject*, QRectF, QRectF );
void slotItemPropertyChanged(QString propertyName, const QVariant &oldValue, const QVariant &newValue); void slotItemPropertyChanged(QString propertyName, const QVariant &oldValue, const QVariant &newValue);
void slotItemPropertyObjectNameChanged(const QString& oldName, const QString& newName); void slotItemPropertyObjectNameChanged(const QString& oldName, const QString& newName);
void bandDeleted(QObject* band); void bandDeleted(QObject* band);
void slotPageItemLoaded(QObject *); void slotPageItemLoaded(QObject *);
void slotSelectionChanged(); void slotSelectionChanged();
void slotAnimationStoped(QObject *animation); void slotAnimationStoped(QObject *animation);
private: private:
template <typename T> template <typename T>
BaseDesignIntf* internalAddBand(T bandType); BaseDesignIntf* internalAddBand(T bandType);
void finalizeInsertMode(); void finalizeInsertMode();
void saveSelectedItemsPos(); void saveSelectedItemsPos();
void saveSelectedItemsGeometry(); void saveSelectedItemsGeometry();
void checkSizeOrPosChanges(); void checkSizeOrPosChanges();
CommandIf::Ptr createChangePosCommand(); CommandIf::Ptr createChangePosCommand();
CommandIf::Ptr createChangeSizeCommand(); CommandIf::Ptr createChangeSizeCommand();
void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName, const QVariant& oldPropertyValue, const QVariant& newPropertyValue); void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName, const QVariant& oldPropertyValue, const QVariant& newPropertyValue);
void changeSelectedGroupProperty(const QString& name,const QVariant& value); void changeSelectedGroupProperty(const QString& name,const QVariant& value);
private: private:
enum JoinType{Width, Height}; enum JoinType{Width, Height};
PageSize m_pageSize; LimeReport::PageItemDesignIntf::Ptr m_pageItem;
QSizeF m_pageSizeValue; QList<PageItemDesignIntf::Ptr> m_reportPages;
Orientation m_orientation; ReportEnginePrivate* m_reportEditor;
QRectF m_geometry; bool m_insertMode;
LimeReport::PageItemDesignIntf::Ptr m_pageItem; QGraphicsItem * m_itemInsertRect;
QList<PageItemDesignIntf::Ptr> m_reportPages; QString m_insertItemType;
ReportEnginePrivate* m_reportEditor; BaseDesignIntf::ItemMode m_itemMode;
bool m_insertMode; QGraphicsRectItem* m_cutterBorder;
QGraphicsItem * m_itemInsertRect; QGraphicsRectItem* m_pageRect;
QString m_insertItemType; QVector<CommandIf::Ptr> m_commandsList;
BaseDesignIntf::ItemMode m_itemMode; QVector<ReportItemPos> m_positionStamp;
QGraphicsRectItem* m_cutterBorder; QVector<ReportItemSize> m_geometryStamp;
QGraphicsRectItem* m_pageRect; BaseDesignIntf* m_firstSelectedItem;
QVector<CommandIf::Ptr> m_commandsList; int m_currentCommand;
QVector<ReportItemPos> m_positionStamp; bool m_changeSizeMode;
QVector<ReportItemSize> m_geometryStamp; bool m_changePosMode;
BaseDesignIntf* m_firstSelectedItem; bool m_changePosOrSizeMode;
int m_currentCommand; bool m_executingCommand;
bool m_changeSizeMode; bool m_hasHanges;
bool m_changePosMode; bool m_isLoading;
bool m_changePosOrSizeMode; bool m_executingGroupCommand;
bool m_executingCommand; QSettings* m_settings;
bool m_hasHanges; QList<QObject*> m_animationList;
bool m_isLoading; QPointF m_startSelectionPoint;
bool m_executingGroupCommand; QGraphicsRectItem* m_selectionRect;
QSettings* m_settings; int m_verticalGridStep;
QList<QObject*> m_animationList; int m_horizontalGridStep;
QPointF m_startSelectionPoint; bool m_updating;
QGraphicsRectItem* m_selectionRect; int m_currentObjectIndex;
int m_verticalGridStep; bool m_multiSelectStarted;
int m_horizontalGridStep; QList<ItemProjections> m_projections;
bool m_updating; BaseDesignIntf* m_movedItem;
int m_currentObjectIndex; BaseDesignIntf* m_movedItemContainer;
bool m_multiSelectStarted; BaseDesignIntf* m_joinItem;
QList<ItemProjections> m_projections; JoinType m_joinType;
BaseDesignIntf* m_movedItem; bool m_magneticMovement;
BaseDesignIntf* m_movedItemContainer; ReportSettings* m_reportSettings;
BaseDesignIntf* m_joinItem;
JoinType m_joinType;
bool m_magneticMovement;
ReportSettings* m_reportSettings;
}; };
class AbstractPageCommand : public CommandIf{ class AbstractPageCommand : public CommandIf{