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 LRPREVIEWREPORTWINDOW_H
|
|
|
|
#define LRPREVIEWREPORTWINDOW_H
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
#include "lrpreparedpagesintf.h"
|
|
|
|
#include "serializators/lrxmlreader.h"
|
|
|
|
|
2016-04-02 16:07:01 +03:00
|
|
|
#include <QComboBox>
|
2024-09-04 17:31:16 +03:00
|
|
|
#include <QDomComment>
|
2017-03-22 14:42:09 +03:00
|
|
|
#include <QEventLoop>
|
2024-09-04 17:31:16 +03:00
|
|
|
#include <QMainWindow>
|
2019-02-20 13:54:26 +03:00
|
|
|
#include <QPrinter>
|
2019-10-16 02:08:45 +03:00
|
|
|
#include <QProgressBar>
|
2024-09-04 17:31:16 +03:00
|
|
|
#include <QSettings>
|
|
|
|
#include <QSpinBox>
|
2016-06-10 18:05:18 +03:00
|
|
|
|
2016-03-04 04:53:34 +03:00
|
|
|
namespace LimeReport {
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
namespace Ui {
|
2024-09-04 17:31:16 +03:00
|
|
|
class PreviewReportWindow;
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
2016-03-04 04:53:34 +03:00
|
|
|
|
2017-03-22 14:42:09 +03:00
|
|
|
class PreviewReportWidget;
|
|
|
|
class FontEditorWidget;
|
|
|
|
class TextAlignmentEditorWidget;
|
|
|
|
class ReportEngine;
|
|
|
|
class PageItemDesignIntf;
|
2024-09-04 17:31:16 +03:00
|
|
|
typedef QList<QSharedPointer<PageItemDesignIntf>> ReportPages;
|
2017-03-22 14:42:09 +03:00
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
class PreviewReportWindow: public QMainWindow {
|
|
|
|
Q_OBJECT
|
2016-02-17 10:11:00 +03:00
|
|
|
public:
|
2024-09-04 17:31:16 +03:00
|
|
|
explicit PreviewReportWindow(ReportEngine* report, QWidget* parent = 0, QSettings* settings = 0,
|
|
|
|
Qt::WindowFlags flags = Qt::WindowFlags());
|
2016-02-17 10:11:00 +03:00
|
|
|
~PreviewReportWindow();
|
|
|
|
void setPages(ReportPages pages);
|
2019-02-20 13:54:26 +03:00
|
|
|
void setDefaultPrinter(QPrinter* printer);
|
2016-02-17 10:11:00 +03:00
|
|
|
void exec();
|
|
|
|
void initPreview(int pagesCount);
|
2017-04-20 05:43:48 +03:00
|
|
|
void reloadPreview();
|
2016-02-17 10:11:00 +03:00
|
|
|
void setSettings(QSettings* value);
|
|
|
|
void setErrorMessages(const QStringList& value);
|
2016-08-02 22:33:33 +03:00
|
|
|
void setToolBarVisible(bool value);
|
|
|
|
void setStatusBarVisible(bool value);
|
|
|
|
void setMenuVisible(bool value);
|
2017-02-03 14:20:30 +03:00
|
|
|
void setHideResultEditButton(bool value);
|
2019-04-10 16:23:50 +03:00
|
|
|
void setHidePrintButton(bool value);
|
|
|
|
void setHideSaveToFileButton(bool value);
|
|
|
|
void setHidePrintToPdfButton(bool value);
|
|
|
|
void setEnablePrintMenu(bool value);
|
2016-02-17 10:11:00 +03:00
|
|
|
QSettings* settings();
|
2018-07-11 02:42:43 +03:00
|
|
|
ScaleType previewScaleType() const;
|
2024-09-04 17:31:16 +03:00
|
|
|
void setPreviewScaleType(const ScaleType& previewScaleType, int percent = 0);
|
2019-02-18 15:16:55 +03:00
|
|
|
QColor previewPageBackgroundColor();
|
|
|
|
void setPreviewPageBackgroundColor(QColor color);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
protected:
|
|
|
|
void writeSetting();
|
|
|
|
void restoreSetting();
|
2024-09-04 17:31:16 +03:00
|
|
|
void closeEvent(QCloseEvent*);
|
|
|
|
void resizeEvent(QResizeEvent* e);
|
|
|
|
void moveEvent(QMoveEvent* e);
|
|
|
|
void showEvent(QShowEvent*);
|
2016-08-08 15:50:04 +03:00
|
|
|
void selectStateIcon();
|
2016-02-17 10:11:00 +03:00
|
|
|
public slots:
|
|
|
|
void slotPrint();
|
|
|
|
void slotPriorPage();
|
|
|
|
void slotNextPage();
|
|
|
|
void slotZoomIn();
|
|
|
|
void slotZoomOut();
|
|
|
|
void slotPageNavigatorChanged(int value);
|
|
|
|
void slotShowErrors();
|
|
|
|
void on_actionSaveToFile_triggered();
|
2016-06-10 18:05:18 +03:00
|
|
|
void slotSelectionChanged();
|
|
|
|
void on_actionEdit_Mode_triggered(bool checked);
|
2016-02-17 10:11:00 +03:00
|
|
|
void slotFirstPage();
|
|
|
|
void slotLastPage();
|
2016-02-17 10:19:50 +03:00
|
|
|
void slotPrintToPDF();
|
2016-03-30 23:19:05 +03:00
|
|
|
void slotPageChanged(int pageIndex);
|
2019-02-21 03:20:26 +03:00
|
|
|
void slotInsertNewTextItem();
|
2019-03-01 23:48:28 +03:00
|
|
|
void slotActivateItemSelectionMode();
|
|
|
|
void slotDeleteSelectedItems();
|
2016-04-02 16:07:01 +03:00
|
|
|
private slots:
|
|
|
|
void on_actionFit_page_width_triggered();
|
|
|
|
void on_actionFit_page_triggered();
|
|
|
|
void on_actionOne_to_one_triggered();
|
|
|
|
void scaleComboboxChanged(QString text);
|
2024-09-04 17:31:16 +03:00
|
|
|
void slotScalePercentChanged(int percent);
|
2016-04-21 12:25:16 +03:00
|
|
|
void on_actionShowMessages_toggled(bool value);
|
2016-08-08 15:50:04 +03:00
|
|
|
void on_actionShow_Toolbar_triggered();
|
2019-03-01 23:48:28 +03:00
|
|
|
void slotCurrentPageChanged(int page);
|
|
|
|
void slotItemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType);
|
2019-10-16 02:08:45 +03:00
|
|
|
void slotPrintingStarted(int pageCount);
|
|
|
|
void slotPagePrintingFinished(int pageIndex);
|
|
|
|
void slotPrintingFinished();
|
|
|
|
void slotCancelPrinting(bool);
|
2019-05-29 16:32:58 +03:00
|
|
|
signals:
|
|
|
|
void onSave(bool& saved, LimeReport::IPreparedPages* pages);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
private:
|
|
|
|
ItemsReaderIntf* reader();
|
2016-04-02 16:07:01 +03:00
|
|
|
void initPercentCombobox();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
private:
|
2024-09-04 17:31:16 +03:00
|
|
|
Ui::PreviewReportWindow* ui;
|
2016-02-17 10:11:00 +03:00
|
|
|
QSpinBox* m_pagesNavigator;
|
|
|
|
QSharedPointer<ItemsReaderIntf> m_reader;
|
|
|
|
QEventLoop m_eventLoop;
|
|
|
|
bool m_changingPage;
|
|
|
|
QSettings* m_settings;
|
|
|
|
bool m_ownedSettings;
|
2016-06-10 18:05:18 +03:00
|
|
|
FontEditorWidget* m_fontEditor;
|
|
|
|
TextAlignmentEditorWidget* m_textAlignmentEditor;
|
|
|
|
int m_priorScrolValue;
|
2016-03-30 23:19:05 +03:00
|
|
|
PreviewReportWidget* m_previewReportWidget;
|
2016-04-02 16:07:01 +03:00
|
|
|
QComboBox* m_scalePercent;
|
2018-07-11 02:42:43 +03:00
|
|
|
ScaleType m_previewScaleType;
|
|
|
|
int m_previewScalePercent;
|
2018-08-07 23:30:40 +03:00
|
|
|
bool m_scalePercentChanging;
|
2019-10-16 02:08:45 +03:00
|
|
|
QProgressBar* m_progressBar;
|
|
|
|
QWidget* m_progressWidget;
|
2016-02-17 10:11:00 +03:00
|
|
|
};
|
2024-09-04 17:31:16 +03:00
|
|
|
} // namespace LimeReport
|
2016-02-17 10:11:00 +03:00
|
|
|
#endif // LRPREVIEWREPORTWINDOW_H
|