2016-02-17 10:11:00 +03:00
|
|
|
/***************************************************************************
|
|
|
|
* This file is part of the Lime Report project *
|
|
|
|
* Copyright (C) 2015 by Alexander Arin *
|
|
|
|
* 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 LRREPORTDESIGNINTF_H
|
|
|
|
#define LRREPORTDESIGNINTF_H
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QSettings>
|
|
|
|
#include <QPrintDialog>
|
2016-11-01 20:42:45 +03:00
|
|
|
//#include <QJSEngine>
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
#include "lrglobal.h"
|
|
|
|
#include "lrdatasourcemanagerintf.h"
|
|
|
|
#include "lrscriptenginemanagerintf.h"
|
2016-03-30 23:21:44 +03:00
|
|
|
#include "lrpreviewreportwidget.h"
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
class QPrinter;
|
|
|
|
|
|
|
|
namespace LimeReport {
|
|
|
|
|
|
|
|
class PrintRange{
|
|
|
|
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;}
|
|
|
|
private:
|
|
|
|
QPrintDialog::PrintRange m_rangeType;
|
|
|
|
int m_fromPage;
|
|
|
|
int m_toPage;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DataSourceManager;
|
|
|
|
class ReportEnginePrivate;
|
2016-06-10 18:05:18 +03:00
|
|
|
class PageDesignIntf;
|
|
|
|
class PageItemDesignIntf;
|
2017-03-22 14:42:09 +03:00
|
|
|
class ReportDesignWidget;
|
|
|
|
class PreviewReportWidget;
|
2016-06-10 18:05:18 +03:00
|
|
|
|
|
|
|
typedef QList< QSharedPointer<PageItemDesignIntf> > ReportPages;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
class LIMEREPORT_EXPORT ReportEngine : public QObject{
|
|
|
|
Q_OBJECT
|
2017-03-22 14:42:09 +03:00
|
|
|
friend class ReportDesignWidget;
|
|
|
|
friend class PreviewReportWidget;
|
2017-08-05 01:38:19 +03:00
|
|
|
friend class TranslationEditor;
|
2016-02-17 10:11:00 +03:00
|
|
|
public:
|
|
|
|
static void setSettings(QSettings *value){m_settings=value;}
|
|
|
|
public:
|
|
|
|
explicit ReportEngine(QObject *parent = 0);
|
|
|
|
~ReportEngine();
|
|
|
|
bool printReport(QPrinter *printer=0);
|
2017-04-21 23:03:56 +03:00
|
|
|
bool printPages(ReportPages pages, QPrinter *printer);
|
2016-02-17 10:11:00 +03:00
|
|
|
void printToFile(const QString& fileName);
|
2016-06-10 18:05:18 +03:00
|
|
|
PageDesignIntf *createPreviewScene(QObject *parent = 0);
|
2016-02-17 10:19:50 +03:00
|
|
|
bool printToPDF(const QString& fileName);
|
2016-08-08 15:50:04 +03:00
|
|
|
void previewReport(PreviewHints hints = PreviewBarsUserSetting);
|
2016-02-17 10:11:00 +03:00
|
|
|
void designReport();
|
|
|
|
void setShowProgressDialog(bool value);
|
|
|
|
IDataSourceManager* dataManager();
|
|
|
|
IScriptEngineManager* scriptManager();
|
2017-04-20 05:43:48 +03:00
|
|
|
bool loadFromFile(const QString& fileName, bool autoLoadPreviewOnChange = false);
|
2016-02-17 10:11:00 +03:00
|
|
|
bool loadFromByteArray(QByteArray *data);
|
2016-02-17 10:39:17 +03:00
|
|
|
bool loadFromString(const QString& data);
|
2016-02-17 10:11:00 +03:00
|
|
|
QString reportFileName();
|
2016-04-21 14:58:21 +03:00
|
|
|
void setReportFileName(const QString& fileName);
|
2016-02-17 10:11:00 +03:00
|
|
|
bool saveToFile();
|
|
|
|
bool saveToFile(const QString& fileName);
|
2016-02-17 10:39:17 +03:00
|
|
|
QByteArray saveToByteArray();
|
|
|
|
QString saveToString();
|
2016-02-17 10:11:00 +03:00
|
|
|
QString lastError();
|
2016-02-17 10:39:17 +03:00
|
|
|
void setCurrentReportsDir(const QString& dirName);
|
|
|
|
void setReportName(const QString& name);
|
|
|
|
QString reportName();
|
2016-03-30 23:21:44 +03:00
|
|
|
PreviewReportWidget *createPreviewWidget(QWidget *parent = 0);
|
2016-04-06 22:03:58 +03:00
|
|
|
void setPreviewWindowTitle(const QString& title);
|
|
|
|
void setPreviewWindowIcon(const QIcon& icon);
|
2017-02-03 14:20:30 +03:00
|
|
|
void setResultEditable(bool value);
|
|
|
|
bool resultIsEditable();
|
2016-12-13 12:47:46 +03:00
|
|
|
bool isBusy();
|
2017-02-16 04:11:39 +03:00
|
|
|
void setPassPharse(QString& passPharse);
|
2017-07-29 00:54:43 +03:00
|
|
|
QList<QLocale::Language> aviableLanguages();
|
|
|
|
bool setReportLanguage(QLocale::Language language);
|
2017-11-01 22:09:19 +03:00
|
|
|
Qt::LayoutDirection previewLayoutDirection();
|
|
|
|
void setPreviewLayoutDirection(const Qt::LayoutDirection& previewLayoutDirection);
|
2016-02-17 10:11:00 +03:00
|
|
|
signals:
|
|
|
|
void renderStarted();
|
|
|
|
void renderFinished();
|
|
|
|
void renderPageFinished(int renderedPageCount);
|
2016-02-17 10:39:17 +03:00
|
|
|
void onLoad(bool& loaded);
|
|
|
|
void onSave();
|
2016-04-21 17:44:58 +03:00
|
|
|
void saveFinished();
|
2016-02-17 10:11:00 +03:00
|
|
|
public slots:
|
|
|
|
void cancelRender();
|
|
|
|
protected:
|
|
|
|
ReportEnginePrivate * const d_ptr;
|
|
|
|
ReportEngine(ReportEnginePrivate &dd, QObject * parent=0);
|
|
|
|
private:
|
|
|
|
Q_DECLARE_PRIVATE(ReportEngine)
|
|
|
|
static QSettings* m_settings;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace LimeReport
|
|
|
|
|
|
|
|
#endif // LRREPORTDESIGNINTF_H
|