0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-24 08:34:38 +03:00
LimeReport/include/lrrenderengine.h

99 lines
3.0 KiB
C
Raw Normal View History

2017-11-24 00:13:47 +03:00
#ifndef LRRENDERENGINE_H
#define LRRENDERENGINE_H
#include "lrdatasourcemanagerintf.h"
#include "lrglobal.h"
2017-11-24 00:13:47 +03:00
#include "lrpreviewreportwidget.h"
#include "lrscriptenginemanagerintf.h"
#include <QObject>
#include <QPrintDialog>
#include <QSettings>
2017-11-24 00:13:47 +03:00
namespace LimeReport {
2017-11-24 00:13:47 +03:00
class PrintRange {
2017-11-24 00:13:47 +03:00
public:
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;
typedef QList<QSharedPointer<PageItemDesignIntf>> ReportPages;
2017-11-24 00:13:47 +03:00
class RenderEnginePrivate;
class LIMEREPORT_EXPORT RenderEngine: public QObject {
2017-11-24 00:13:47 +03:00
Q_OBJECT
friend class PreviewReportWidget;
2017-11-24 00:13:47 +03:00
public:
static void setSettings(QSettings* value) { m_settings = value; }
2017-11-24 00:13:47 +03:00
public:
explicit RenderEngine(QObject* parent = 0);
explicit RenderEngine(RenderEnginePrivate* dd, QObject* parent = 0);
2017-11-24 00:13:47 +03:00
~RenderEngine();
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();
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();
void setReportFileName(const QString& fileName);
2017-11-24 00:13:47 +03:00
QString lastError();
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);
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();
2017-11-24 00:13:47 +03:00
protected:
QObject* d_ptr;
2017-11-24 00:13:47 +03:00
private:
static QSettings* m_settings;
void init();
2017-11-24 00:13:47 +03:00
private:
Q_DECLARE_PRIVATE(RenderEngine)
};
} // namespace LimeReport
#endif // LRRENDERENGINE_H