2016-03-30 23:04:59 +03:00
|
|
|
#ifndef LRPREVIEWREPORTWIDGET_H
|
|
|
|
#define LRPREVIEWREPORTWIDGET_H
|
|
|
|
|
|
|
|
#include <QWidget>
|
2018-07-11 02:42:43 +03:00
|
|
|
#include <QTimer>
|
2019-02-20 13:54:26 +03:00
|
|
|
#include <QPrinter>
|
2016-03-30 23:04:59 +03:00
|
|
|
#include "lrglobal.h"
|
2019-05-29 16:32:58 +03:00
|
|
|
#include "lrpreparedpagesintf.h"
|
2016-03-30 23:04:59 +03:00
|
|
|
|
|
|
|
namespace LimeReport {
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class PreviewReportWidget;
|
|
|
|
}
|
|
|
|
|
|
|
|
class PreviewReportWidgetPrivate;
|
|
|
|
class ReportEnginePrivate;
|
2017-03-22 14:42:09 +03:00
|
|
|
class ReportEngine;
|
2019-03-01 23:48:28 +03:00
|
|
|
class PageDesignIntf;
|
2016-03-30 23:04:59 +03:00
|
|
|
|
|
|
|
class LIMEREPORT_EXPORT PreviewReportWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
friend class ReportEnginePrivate;
|
|
|
|
friend class PreviewReportWindow;
|
|
|
|
friend class PreviewReportWidgetPrivate;
|
|
|
|
public:
|
2017-03-22 14:42:09 +03:00
|
|
|
explicit PreviewReportWidget(ReportEngine *report, QWidget *parent = 0);
|
2018-06-23 13:09:27 +03:00
|
|
|
~PreviewReportWidget();
|
|
|
|
QList<QString> aviableExporters();
|
|
|
|
bool exportReport(QString exporterName, const QMap<QString, QVariant>& params = QMap<QString, QVariant>());
|
2018-07-11 02:42:43 +03:00
|
|
|
ScaleType scaleType() const;
|
|
|
|
int scalePercent() const;
|
|
|
|
void setScaleType(const ScaleType &scaleType, int percent = 0);
|
2019-02-18 15:16:55 +03:00
|
|
|
void setPreviewPageBackgroundColor(QColor color);
|
|
|
|
QColor previewPageBackgroundColor();
|
2019-02-20 13:54:26 +03:00
|
|
|
QPrinter *defaultPrinter() const;
|
|
|
|
void setDefaultPrinter(QPrinter *defaultPrinter);
|
2019-02-21 03:20:26 +03:00
|
|
|
void startInsertTextItem();
|
2019-03-01 23:48:28 +03:00
|
|
|
void activateItemSelectionMode();
|
|
|
|
void deleteSelectedItems();
|
|
|
|
void activateCurrentPage();
|
|
|
|
|
2016-03-30 23:04:59 +03:00
|
|
|
public slots:
|
2016-03-31 04:10:04 +03:00
|
|
|
void refreshPages();
|
2016-04-02 03:38:23 +03:00
|
|
|
void zoomIn();
|
|
|
|
void zoomOut();
|
|
|
|
|
|
|
|
void firstPage();
|
|
|
|
void priorPage();
|
|
|
|
void nextPage();
|
|
|
|
void lastPage();
|
|
|
|
|
|
|
|
void print();
|
|
|
|
void printToPDF();
|
2019-11-19 23:04:04 +03:00
|
|
|
void printToExcel();
|
2016-04-02 03:38:23 +03:00
|
|
|
void pageNavigatorChanged(int value);
|
|
|
|
void saveToFile();
|
|
|
|
void setScalePercent(int percent);
|
|
|
|
void fitWidth();
|
|
|
|
void fitPage();
|
2018-07-11 02:42:43 +03:00
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *);
|
2016-03-30 23:04:59 +03:00
|
|
|
signals:
|
|
|
|
void pageChanged(int page);
|
2016-04-02 03:38:23 +03:00
|
|
|
void scalePercentChanged(int percent);
|
|
|
|
void pagesSet(int pageCount);
|
2019-03-01 23:48:28 +03:00
|
|
|
void itemInserted(LimeReport::PageDesignIntf* report, QPointF pos, const QString& ItemType);
|
2019-05-29 16:32:58 +03:00
|
|
|
void onSave(bool& saved, LimeReport::IPreparedPages* pages);
|
2016-03-30 23:04:59 +03:00
|
|
|
private slots:
|
|
|
|
void slotSliderMoved(int value);
|
|
|
|
void reportEngineDestroyed(QObject* object);
|
2016-04-05 23:06:11 +03:00
|
|
|
void slotZoomed(double);
|
2018-07-11 02:42:43 +03:00
|
|
|
void resizeDone();
|
2016-03-31 04:10:04 +03:00
|
|
|
private:
|
|
|
|
void initPreview();
|
|
|
|
void setErrorsMesagesVisible(bool visible);
|
|
|
|
void setErrorMessages(const QStringList &value);
|
2016-04-02 03:38:23 +03:00
|
|
|
void emitPageSet();
|
2016-03-30 23:04:59 +03:00
|
|
|
private:
|
|
|
|
Ui::PreviewReportWidget *ui;
|
|
|
|
PreviewReportWidgetPrivate* d_ptr;
|
2018-07-11 02:42:43 +03:00
|
|
|
ScaleType m_scaleType;
|
|
|
|
int m_scalePercent;
|
2019-02-18 15:16:55 +03:00
|
|
|
QTimer m_resizeTimer;
|
|
|
|
QColor m_previewPageBackgroundColor;
|
2019-02-20 13:54:26 +03:00
|
|
|
QPrinter* m_defaultPrinter;
|
|
|
|
void printPages(QPrinter *printer);
|
2021-06-01 23:33:38 +03:00
|
|
|
bool m_scaleChanging;
|
2016-03-30 23:04:59 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace LimeReport
|
|
|
|
#endif // LRPREVIEWREPORTWIDGET_H
|