2017-11-24 00:13:47 +03:00
|
|
|
#ifndef LRRENDERENGINE_H
|
|
|
|
#define LRRENDERENGINE_H
|
|
|
|
|
|
|
|
#include "lrdatasourcemanagerintf.h"
|
2024-09-04 17:31:16 +03:00
|
|
|
#include "lrglobal.h"
|
2017-11-24 00:13:47 +03:00
|
|
|
#include "lrpreviewreportwidget.h"
|
2024-09-04 17:31:16 +03:00
|
|
|
#include "lrscriptenginemanagerintf.h"
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPrintDialog>
|
|
|
|
#include <QSettings>
|
2017-11-24 00:13:47 +03:00
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
namespace LimeReport {
|
2017-11-24 00:13:47 +03:00
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
class PrintRange {
|
2017-11-24 00:13:47 +03:00
|
|
|
public:
|
2024-09-04 17:31:16 +03:00
|
|
|
int fromPage() const { return m_fromPage; }
|
|
|
|
int toPage() const { return m_toPage; }
|
|
|
|
QPrintDialog::PrintRange rangeType() const { return m_rangeType; }
|
|
|
|
PrintRange(QAbstractPrintDialog::PrintRange rangeType = QPrintDialog::AllPages,
|
|
|
|
int fromPage = 0, int toPage = 0);
|
|
|
|
void setRangeType(QAbstractPrintDialog::PrintRange rangeType) { m_rangeType = rangeType; }
|
|
|
|
void setFromPage(int fromPage) { m_fromPage = fromPage; }
|
|
|
|
void setToPage(int toPage) { m_toPage = toPage; }
|
|
|
|
|
2017-11-24 00:13:47 +03:00
|
|
|
private:
|
|
|
|
QPrintDialog::PrintRange m_rangeType;
|
|
|
|
int m_fromPage;
|
|
|
|
int m_toPage;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DataSourceManager;
|
|
|
|
class PageDesignIntf;
|
|
|
|
class PageItemDesignIntf;
|
|
|
|
class PreviewReportWidget;
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
typedef QList<QSharedPointer<PageItemDesignIntf>> ReportPages;
|
2017-11-24 00:13:47 +03:00
|
|
|
|
|
|
|
class RenderEnginePrivate;
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
class LIMEREPORT_EXPORT RenderEngine: public QObject {
|
2017-11-24 00:13:47 +03:00
|
|
|
Q_OBJECT
|
|
|
|
friend class PreviewReportWidget;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2017-11-24 00:13:47 +03:00
|
|
|
public:
|
2024-09-04 17:31:16 +03:00
|
|
|
static void setSettings(QSettings* value) { m_settings = value; }
|
|
|
|
|
2017-11-24 00:13:47 +03:00
|
|
|
public:
|
2024-09-04 17:31:16 +03:00
|
|
|
explicit RenderEngine(QObject* parent = 0);
|
|
|
|
explicit RenderEngine(RenderEnginePrivate* dd, QObject* parent = 0);
|
2017-11-24 00:13:47 +03:00
|
|
|
~RenderEngine();
|
2024-09-04 17:31:16 +03:00
|
|
|
bool printReport(QPrinter* printer = 0);
|
|
|
|
bool printPages(ReportPages pages, QPrinter* printer);
|
|
|
|
void printToFile(const QString& fileName);
|
|
|
|
PageDesignIntf* createPreviewScene(QObject* parent = 0);
|
|
|
|
bool printToPDF(const QString& fileName);
|
|
|
|
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
|
2017-11-24 00:13:47 +03:00
|
|
|
IDataSourceManager* dataManager();
|
|
|
|
IScriptEngineManager* scriptManager();
|
2024-09-04 17:31:16 +03:00
|
|
|
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
|
|
|
|
bool loadFromByteArray(QByteArray* data);
|
|
|
|
bool loadFromString(const QString& data);
|
2017-11-24 00:13:47 +03:00
|
|
|
QString reportFileName();
|
2024-09-04 17:31:16 +03:00
|
|
|
void setReportFileName(const QString& fileName);
|
2017-11-24 00:13:47 +03:00
|
|
|
QString lastError();
|
2024-09-04 17:31:16 +03:00
|
|
|
PreviewReportWidget* createPreviewWidget(QWidget* parent = 0);
|
2017-11-24 00:13:47 +03:00
|
|
|
void setPreviewWindowTitle(const QString& title);
|
|
|
|
void setPreviewWindowIcon(const QIcon& icon);
|
|
|
|
void setResultEditable(bool value);
|
|
|
|
bool resultIsEditable();
|
|
|
|
bool isBusy();
|
|
|
|
void setPassPharse(QString& passPharse);
|
|
|
|
QList<QLocale::Language> aviableLanguages();
|
|
|
|
bool setReportLanguage(QLocale::Language language);
|
|
|
|
Qt::LayoutDirection previewLayoutDirection();
|
|
|
|
void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection);
|
2024-09-04 17:31:16 +03:00
|
|
|
QSettings* settings() { return m_settings; }
|
2017-11-24 00:13:47 +03:00
|
|
|
signals:
|
|
|
|
void renderStarted();
|
|
|
|
void renderFinished();
|
|
|
|
void renderPageFinished(int renderedPageCount);
|
|
|
|
void onLoad(bool& loaded);
|
|
|
|
public slots:
|
|
|
|
void cancelRender();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2017-11-24 00:13:47 +03:00
|
|
|
protected:
|
|
|
|
QObject* d_ptr;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2017-11-24 00:13:47 +03:00
|
|
|
private:
|
|
|
|
static QSettings* m_settings;
|
|
|
|
void init();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
2017-11-24 00:13:47 +03:00
|
|
|
private:
|
|
|
|
Q_DECLARE_PRIVATE(RenderEngine)
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace LimeReport
|
|
|
|
#endif // LRRENDERENGINE_H
|