LimeReport/limereport/lrreportdesignwindow.h

301 lines
11 KiB
C
Raw Permalink Normal View History

2016-02-17 10:11:00 +03:00
/***************************************************************************
* This file is part of the Lime Report project *
2021-08-18 20:21:36 +03:00
* Copyright (C) 2021 by Alexander Arin *
2016-02-17 10:11:00 +03:00
* 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"
2017-11-27 23:14:05 +03:00
#include "lrreportdesignwindowintrerface.h"
2016-02-17 10:11:00 +03:00
namespace LimeReport{
class ObjectInspectorWidget;
class QObjectPropertyModel;
class ReportDesignWidget;
class DataBrowser;
2016-06-10 18:05:18 +03:00
class ScriptBrowser;
2016-02-17 10:11:00 +03:00
class BaseDesignIntf;
class PageDesignIntf;
class ObjectBrowser;
2017-11-27 23:14:05 +03:00
class ReportDesignWindow : public ReportDesignWindowInterface
2016-02-17 10:11:00 +03:00
{
Q_OBJECT
public:
2017-11-24 00:13:47 +03:00
explicit ReportDesignWindow(ReportEnginePrivateInterface *report, QWidget *parent = 0, QSettings* settings=0);
2016-02-17 10:11:00 +03:00
~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();
2016-06-10 18:05:18 +03:00
void slotNewPage();
void slotDeletePage();
2016-02-17 10:11:00 +03:00
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();
2018-06-21 14:29:00 +03:00
void slotVLayout();
2016-02-17 10:11:00 +03:00
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);
2016-06-10 18:05:18 +03:00
void slotActivePageChanged();
2016-02-17 10:11:00 +03:00
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);
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-09-16 01:59:56 +03:00
void slotPageAdded(PageDesignIntf* );
2016-06-10 18:05:18 +03:00
void slotPageDeleted();
2019-02-14 00:21:57 +03:00
void slotFilterTextChanged(const QString& filter);
#ifdef HAVE_QTDESIGNER_INTEGRATION
void slotDeleteDialog();
void slotAddNewDialog();
#endif
void slotLockSelectedItems();
void slotUnlockSelectedItems();
void slotSelectOneLevelItems();
void slotCancelRendering(bool);
2016-02-17 10:11:00 +03:00
protected:
void closeEvent(QCloseEvent *event);
void resizeEvent(QResizeEvent *);
void showEvent(QShowEvent* event);
2016-02-17 10:11:00 +03:00
void moveEvent(QMoveEvent *);
2016-02-17 10:19:50 +03:00
void hideDockWidgets(Qt::DockWidgetArea area, bool value);
bool isDockAreaVisible(Qt::DockWidgetArea area);
2018-01-24 20:59:53 +03:00
void setDocWidgetsVisibility(bool visible);
2021-11-02 22:30:29 +03:00
void keyPressEvent(QKeyEvent *event);
2018-01-24 20:59:53 +03:00
2016-02-17 10:11:00 +03:00
private:
void initReportEditor(ReportEnginePrivate* report);
2016-02-17 10:11:00 +03:00
void createActions();
void createBandsButton();
void createMainMenu();
void createToolBars();
void createReportToolBar();
void createItemsActions();
void createObjectInspector();
void createObjectsBrowser();
2017-11-24 00:13:47 +03:00
void initReportEditor(ReportEnginePrivateInterface* report);
2016-02-17 10:11:00 +03:00
void createDataWindow();
2016-06-10 18:05:18 +03:00
void createScriptWindow();
#ifdef HAVE_QTDESIGNER_INTEGRATION
void createDialogWidgetBox();
void createDialogPropertyEditor();
void createDialogObjectInspector();
void createDialogActionEditor();
void createDialogResourceEditor();
void createDialogSignalSlotEditor();
void createDialogDesignerToolBar();
#endif
2016-02-17 10:11:00 +03:00
void updateRedoUndo();
2016-09-16 01:59:56 +03:00
void updateAvaibleBands();
2016-02-17 10:11:00 +03:00
void startNewReport();
void writePosition();
void writeState();
2016-02-19 04:03:48 +03:00
void createRecentFilesMenu();
void removeNotExistedRecentFiles();
void removeNotExistedRecentFilesFromMenu(const QString& fileName);
void addRecentFile(const QString& fileName);
void showDefaultToolBars();
void showDefaultEditors();
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;
#ifdef HAVE_QTDESIGNER_INTEGRATION
QToolBar* m_dialogDesignerToolBar;
#endif
2016-02-17 10:11:00 +03:00
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;
QAction* m_settingsAction;
QAction* m_useGridAction;
2016-02-21 01:08:54 +03:00
QAction* m_useMagnetAction;
2016-06-10 18:05:18 +03:00
QAction* m_newPageAction;
QAction* m_deletePageAction;
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_newTearOffBand;
2016-02-17 10:11:00 +03:00
QAction* m_aboutAction;
QAction* m_editLayoutMode;
QAction* m_addHLayout;
2018-06-21 14:29:00 +03:00
QAction* m_addVLayout;
2016-02-17 10:19:50 +03:00
QAction* m_hideLeftPanel;
QAction* m_hideRightPanel;
#ifdef HAVE_QTDESIGNER_INTEGRATION
QAction* m_deleteDialogAction;
QAction* m_addNewDialogAction;
#endif
QAction* m_lockSelectedItemsAction;
QAction* m_unlockSelectedItemsAction;
QAction* m_selectOneLevelItems;
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;
ReportDesignWidget* m_reportDesignWidget;
DataBrowser * m_dataBrowser;
2016-06-10 18:05:18 +03:00
ScriptBrowser* m_scriptBrowser;
2016-02-17 10:11:00 +03:00
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;
QVector<QDockWidget*> m_pageEditors;
QVector<QDockWidget*> m_dialogEditors;
2017-04-18 20:00:59 +03:00
QVector<QDockWidget*> m_docksToTabify;
ReportDesignWidget::EditorTabType m_editorTabType;
QByteArray m_editorsStates[ReportDesignWidget::TabTypeCount];
QVector<QToolBar*> m_pageTools;
QVector<QToolBar*> m_dialogTools;
2017-10-02 16:37:38 +03:00
bool m_reportItemIsLocked;
2018-01-24 20:59:53 +03:00
QMap<QDockWidget*, bool> m_leftDocVisibleState;
QMap<QDockWidget*, bool> m_rightDocVisibleState;
2019-02-14 00:21:57 +03:00
QSortFilterProxyModel* m_filterModel;
QWidget* m_progressWidget;
QProgressBar* m_progressBar;
QLabel* m_progressLabel;
void createProgressBar();
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