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 LRREPORTEDITORWINDOW_H
|
|
|
|
#define LRREPORTEDITORWINDOW_H
|
|
|
|
|
|
|
|
#include <QMainWindow>
|
|
|
|
#include <QSignalMapper>
|
|
|
|
#include <QToolButton>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QFontComboBox>
|
|
|
|
#include <QSpinBox>
|
|
|
|
#include <QProgressDialog>
|
|
|
|
#include "lrbanddesignintf.h"
|
|
|
|
#include "items/editors/lrfonteditorwidget.h"
|
|
|
|
#include "items/editors/lrtextalignmenteditorwidget.h"
|
|
|
|
#include "items/editors/lritemsaligneditorwidget.h"
|
|
|
|
#include "items/editors/lritemsborderseditorwidget.h"
|
|
|
|
#include "lrobjectitemmodel.h"
|
|
|
|
|
|
|
|
namespace LimeReport{
|
|
|
|
|
|
|
|
class ObjectInspectorWidget;
|
|
|
|
class QObjectPropertyModel;
|
|
|
|
class ReportDesignWidget;
|
|
|
|
class DataBrowser;
|
|
|
|
class BaseDesignIntf;
|
|
|
|
class PageDesignIntf;
|
|
|
|
class ObjectBrowser;
|
|
|
|
|
|
|
|
class ReportDesignWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit ReportDesignWindow(ReportEnginePrivate* report, QWidget *parent = 0, QSettings* settings=0);
|
|
|
|
~ReportDesignWindow();
|
|
|
|
static ReportDesignWindow* instance(){return m_instance;}
|
|
|
|
|
|
|
|
bool checkNeedToSave();
|
|
|
|
void showModal();
|
|
|
|
void showNonModal();
|
|
|
|
void setSettings(QSettings* value);
|
|
|
|
QSettings* settings();
|
|
|
|
void restoreSetting();
|
|
|
|
void setShowProgressDialog(bool value){m_showProgressDialog = value;}
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void slotNewReport();
|
|
|
|
void slotNewTextItem();
|
|
|
|
void slotNewBand(const QString& bandType);
|
|
|
|
void slotNewBand(int bandType);
|
|
|
|
void slotSaveReport();
|
|
|
|
void slotSaveReportAs();
|
|
|
|
void slotLoadReport();
|
|
|
|
void slotZoomIn();
|
|
|
|
void slotZoomOut();
|
|
|
|
void slotEditMode();
|
|
|
|
void slotUndo();
|
|
|
|
void slotRedo();
|
|
|
|
void slotCopy();
|
|
|
|
void slotPaste();
|
|
|
|
void slotCut();
|
|
|
|
void slotDelete();
|
|
|
|
void slotEditLayoutMode();
|
|
|
|
void slotHLayout();
|
|
|
|
void slotItemSelected(LimeReport::BaseDesignIntf *item);
|
|
|
|
void slotItemPropertyChanged(const QString& objectName, const QString& propertyName, const QVariant &oldValue, const QVariant &newValue);
|
|
|
|
void slotMultiItemSelected();
|
|
|
|
void slotInsertModeStarted();
|
|
|
|
void slotItemInserted(LimeReport::PageDesignIntf* , QPointF, const QString& ItemType);
|
|
|
|
void slotItemInsertCanceled(const QString& ItemType);
|
|
|
|
void slotUpdateDataBrowser(const QString& collectionName);
|
|
|
|
void slotCommandHistoryChanged();
|
|
|
|
void slotTest();
|
|
|
|
void slotPrintReport();
|
|
|
|
void slotPreviewReport();
|
|
|
|
void slotItemActionCliked();
|
|
|
|
void slotBandAdded(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band);
|
|
|
|
void slotBandDeleted(LimeReport::PageDesignIntf*, LimeReport::BandDesignIntf*band);
|
|
|
|
void renderStarted();
|
|
|
|
void renderPageFinished(int renderedPageCount);
|
|
|
|
void renderFinished();
|
|
|
|
void slotShowAbout();
|
2016-02-17 10:19:50 +03:00
|
|
|
void slotHideLeftPanel(bool value);
|
|
|
|
void slotHideRightPanel(bool value);
|
2016-02-18 21:11:59 +03:00
|
|
|
void slotEditSettings();
|
|
|
|
void slotUseGrid(bool value);
|
2016-02-21 01:08:54 +03:00
|
|
|
void slotUseMagnet(bool value);
|
2016-02-19 04:03:48 +03:00
|
|
|
void slotLoadRecentFile(const QString fileName);
|
2016-02-17 10:11:00 +03:00
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent *event);
|
|
|
|
void resizeEvent(QResizeEvent *);
|
|
|
|
void moveEvent(QMoveEvent *);
|
2016-02-17 10:19:50 +03:00
|
|
|
void hideDockWidgets(Qt::DockWidgetArea area, bool value);
|
|
|
|
bool isDockAreaVisible(Qt::DockWidgetArea area);
|
2016-02-17 10:11:00 +03:00
|
|
|
private:
|
|
|
|
void createActions();
|
|
|
|
void createBandsButton();
|
|
|
|
void createMainMenu();
|
|
|
|
void createToolBars();
|
|
|
|
void createReportToolBar();
|
|
|
|
void createItemsActions();
|
|
|
|
void createObjectInspector();
|
|
|
|
void createObjectsBrowser();
|
|
|
|
void initReportEditor(ReportEnginePrivate* report);
|
|
|
|
void createDataWindow();
|
|
|
|
void updateRedoUndo();
|
|
|
|
void startNewReport();
|
|
|
|
void writePosition();
|
|
|
|
void writeState();
|
2016-02-19 04:03:48 +03:00
|
|
|
void createRecentFilesMenu();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
static ReportDesignWindow* m_instance;
|
|
|
|
QStatusBar* m_statusBar;
|
|
|
|
QToolBar* m_mainToolBar;
|
|
|
|
QToolBar* m_fontToolBar;
|
|
|
|
QToolBar* m_reportToolBar;
|
|
|
|
QToolBar* m_alignToolBar;
|
|
|
|
QToolButton* m_newBandButton;
|
|
|
|
QMenuBar* m_mainMenu;
|
|
|
|
QMenu* m_fileMenu;
|
|
|
|
QMenu* m_editMenu;
|
|
|
|
QMenu* m_infoMenu;
|
|
|
|
|
|
|
|
QAction* m_newReportAction;
|
|
|
|
QAction* m_newTextItemAction;
|
|
|
|
QAction* m_deleteItemAction;
|
|
|
|
QAction* m_saveReportAction;
|
|
|
|
QAction* m_saveReportAsAction;
|
|
|
|
QAction* m_loadReportAction;
|
|
|
|
QAction* m_zoomInReportAction;
|
|
|
|
QAction* m_zoomOutReportAction;
|
|
|
|
QAction* m_previewReportAction;
|
|
|
|
QAction* m_closeRenderViewAction;
|
|
|
|
QAction* m_nextPageAction;
|
|
|
|
QAction* m_priorPageAction;
|
|
|
|
QAction* m_testAction;
|
|
|
|
QAction* m_printReportAction;
|
|
|
|
QAction* m_editModeAction;
|
|
|
|
QAction* m_undoAction;
|
|
|
|
QAction* m_redoAction;
|
|
|
|
QAction* m_copyAction;
|
|
|
|
QAction* m_pasteAction;
|
|
|
|
QAction* m_cutAction;
|
2016-02-18 21:11:59 +03:00
|
|
|
QAction* m_settingsAction;
|
|
|
|
QAction* m_useGridAction;
|
2016-02-21 01:08:54 +03:00
|
|
|
QAction* m_useMagnetAction;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
QAction* m_newPageHeader;
|
|
|
|
QAction* m_newPageFooter;
|
|
|
|
QAction* m_newReportHeader;
|
|
|
|
QAction* m_newReportFooter;
|
|
|
|
QAction* m_newData;
|
2016-02-17 10:18:19 +03:00
|
|
|
QAction* m_newDataHeader;
|
|
|
|
QAction* m_newDataFooter;
|
2016-02-17 10:11:00 +03:00
|
|
|
QAction* m_newSubDetail;
|
|
|
|
QAction* m_newSubDetailHeader;
|
|
|
|
QAction* m_newSubDetailFooter;
|
|
|
|
QAction* m_newGroupHeader;
|
|
|
|
QAction* m_newGroupFooter;
|
|
|
|
QAction* m_aboutAction;
|
|
|
|
QAction* m_editLayoutMode;
|
|
|
|
QAction* m_addHLayout;
|
2016-02-17 10:19:50 +03:00
|
|
|
QAction* m_hideLeftPanel;
|
|
|
|
QAction* m_hideRightPanel;
|
2016-02-19 04:03:48 +03:00
|
|
|
QMenu* m_recentFilesMenu;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
QSignalMapper* m_bandsAddSignalsMap;
|
2016-02-19 04:03:48 +03:00
|
|
|
QSignalMapper* m_recentFilesSignalMap;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
ObjectInspectorWidget* m_objectInspector;
|
|
|
|
QObjectPropertyModel* m_propertyModel;
|
|
|
|
|
|
|
|
ReportDesignWidget* m_reportDesignWidget;
|
|
|
|
DataBrowser * m_dataBrowser;
|
|
|
|
|
|
|
|
ObjectBrowser* m_objectsBrowser;
|
|
|
|
|
|
|
|
QHash<QString,QAction*> m_actionMap;
|
|
|
|
QLabel* m_lblReportName;
|
|
|
|
QEventLoop m_eventLoop;
|
|
|
|
QFontComboBox* m_fontNameEditor;
|
|
|
|
QComboBox* m_fontSizeEditor;
|
|
|
|
QStringListModel m_fontSizeModel;
|
|
|
|
bool m_textAttibutesIsChanging;
|
|
|
|
BaseDesignIntf const * m_fontItem;
|
|
|
|
FontEditorWidget* m_fontEditorBar;
|
|
|
|
TextAlignmentEditorWidget* m_textAlignmentEditorBar;
|
|
|
|
ItemsAlignmentEditorWidget* m_itemsAlignmentEditorBar;
|
|
|
|
ItemsBordersEditorWidget* m_itemsBordersEditorBar;
|
|
|
|
QSettings* m_settings;
|
|
|
|
bool m_ownedSettings;
|
|
|
|
ValidatorIntf* m_validator;
|
|
|
|
QProgressDialog* m_progressDialog;
|
|
|
|
bool m_showProgressDialog;
|
2016-02-19 04:03:48 +03:00
|
|
|
QMap<QString,QDateTime> m_recentFiles;
|
2016-02-17 10:11:00 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
class ObjectNameValidator : public ValidatorIntf{
|
|
|
|
bool validate(const QString &propName, const QVariant &propValue, QObject *object, QString &msg);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif // LRREPORTEDITORWINDOW_H
|