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. *
|
|
|
|
****************************************************************************/
|
|
|
|
#include <QPrinter>
|
|
|
|
#include <QPrintDialog>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QDesktopWidget>
|
|
|
|
|
|
|
|
#include "time.h"
|
|
|
|
|
|
|
|
#include "lrreportengine_p.h"
|
|
|
|
#include "lrreportengine.h"
|
|
|
|
|
|
|
|
#include "lrpagedesignintf.h"
|
|
|
|
#include "lrdatasourcemanager.h"
|
|
|
|
#include "lrdatabrowser.h"
|
|
|
|
#include "lrreportdesignwindow.h"
|
|
|
|
|
|
|
|
#include "serializators/lrxmlwriter.h"
|
|
|
|
#include "serializators/lrxmlreader.h"
|
|
|
|
#include "lrreportrender.h"
|
|
|
|
#include "lrpreviewreportwindow.h"
|
2016-03-30 23:21:44 +03:00
|
|
|
#include "lrpreviewreportwidget.h"
|
|
|
|
#include "lrpreviewreportwidget_p.h"
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
namespace LimeReport{
|
|
|
|
|
|
|
|
QSettings* ReportEngine::m_settings = 0;
|
|
|
|
|
|
|
|
ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
|
|
|
|
QObject(parent), m_fileName(""), m_settings(0), m_ownedSettings(false),
|
2016-02-17 10:39:17 +03:00
|
|
|
m_printer(new QPrinter(QPrinter::HighResolution)), m_printerSelected(false),
|
2016-04-06 22:03:58 +03:00
|
|
|
m_showProgressDialog(true), m_reportName(""), m_activePreview(0),
|
2017-02-03 14:20:30 +03:00
|
|
|
m_previewWindowIcon(":/report/images/logo32"), m_previewWindowTitle(tr("Preview")),
|
|
|
|
m_reportRendering(false), m_resultIsEditable(true)
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
2017-01-28 02:20:15 +03:00
|
|
|
m_datasources = new DataSourceManager(this);
|
|
|
|
m_datasources->setReportSettings(&m_reportSettings);
|
2016-06-10 18:05:18 +03:00
|
|
|
m_scriptEngineContext = new ScriptEngineContext(this);
|
2016-02-17 10:11:00 +03:00
|
|
|
m_datasources->setObjectName("datasources");
|
|
|
|
connect(m_datasources,SIGNAL(loadCollectionFinished(QString)),this,SLOT(slotDataSourceCollectionLoaded(QString)));
|
|
|
|
}
|
|
|
|
|
|
|
|
ReportEnginePrivate::~ReportEnginePrivate()
|
|
|
|
{
|
2016-04-21 17:53:31 +03:00
|
|
|
if (m_designerWindow) {
|
|
|
|
m_designerWindow->close();
|
|
|
|
}
|
2016-02-20 13:37:18 +03:00
|
|
|
if (m_activePreview){
|
|
|
|
m_activePreview->close();
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
foreach(PageDesignIntf* page,m_pages) delete page;
|
|
|
|
m_pages.clear();
|
|
|
|
if (m_ownedSettings&&m_settings) delete m_settings;
|
|
|
|
}
|
|
|
|
|
|
|
|
QObject* ReportEnginePrivate::createElement(const QString &, const QString &)
|
|
|
|
{
|
|
|
|
return appendPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
QObject *ReportEnginePrivate::elementAt(const QString &, int index)
|
|
|
|
{
|
|
|
|
return pageAt(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
PageDesignIntf *ReportEnginePrivate::createPage(const QString &pageName)
|
|
|
|
{
|
2016-02-20 13:37:18 +03:00
|
|
|
PageDesignIntf* page =new PageDesignIntf();
|
2016-02-17 10:11:00 +03:00
|
|
|
page->setObjectName(pageName);
|
|
|
|
page->setReportEditor(this);
|
2016-06-24 23:15:59 +03:00
|
|
|
page->setReportSettings(&m_reportSettings);
|
2016-02-17 10:11:00 +03:00
|
|
|
return page;
|
|
|
|
}
|
|
|
|
|
|
|
|
PageDesignIntf *ReportEnginePrivate::appendPage(const QString &pageName)
|
|
|
|
{
|
|
|
|
PageDesignIntf* page = createPage(pageName);
|
|
|
|
m_pages.append(page);
|
|
|
|
return page;
|
|
|
|
}
|
|
|
|
|
2016-06-10 18:05:18 +03:00
|
|
|
bool ReportEnginePrivate::deletePage(PageDesignIntf *page){
|
|
|
|
QList<PageDesignIntf*>::iterator it = m_pages.begin();
|
|
|
|
while (it != m_pages.end()){
|
|
|
|
if (*it == page) {
|
|
|
|
it = m_pages.erase(it);
|
|
|
|
return true;
|
|
|
|
} else ++it;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
PageDesignIntf *ReportEnginePrivate::createPreviewPage()
|
|
|
|
{
|
|
|
|
return createPage();
|
|
|
|
}
|
|
|
|
|
|
|
|
int ReportEnginePrivate::elementsCount(const QString &)
|
|
|
|
{
|
|
|
|
return m_pages.count();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::collectionLoadFinished(const QString &)
|
|
|
|
{
|
|
|
|
foreach (PageDesignIntf* page, m_pages) {
|
|
|
|
page->setReportEditor(this);
|
2016-06-24 23:15:59 +03:00
|
|
|
page->setReportSettings(&m_reportSettings);
|
2016-02-17 10:19:50 +03:00
|
|
|
page->setSceneRect(-Const::SCENE_MARGIN,-Const::SCENE_MARGIN,
|
|
|
|
page->pageItem()->width()+Const::SCENE_MARGIN*2,
|
|
|
|
page->pageItem()->height()+Const::SCENE_MARGIN*2);
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
emit pagesLoadFinished();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::saveError(QString message)
|
|
|
|
{
|
|
|
|
m_lastError = message;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::showError(QString message)
|
|
|
|
{
|
|
|
|
QMessageBox::critical(0,tr("Error"),message);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::slotDataSourceCollectionLoaded(const QString &collectionName)
|
|
|
|
{
|
|
|
|
emit datasourceCollectionLoadFinished(collectionName);
|
|
|
|
}
|
|
|
|
|
2016-02-20 13:37:18 +03:00
|
|
|
void ReportEnginePrivate::slotPreviewWindowDestroed(QObject* window)
|
|
|
|
{
|
|
|
|
if (m_activePreview == window){
|
|
|
|
m_activePreview = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
void ReportEnginePrivate::clearReport()
|
|
|
|
{
|
|
|
|
foreach(PageDesignIntf* page,m_pages) delete page;
|
|
|
|
m_pages.clear();
|
|
|
|
m_datasources->clear(DataSourceManager::Owned);
|
|
|
|
m_fileName="";
|
2016-06-10 18:05:18 +03:00
|
|
|
m_scriptEngineContext->clear();
|
2016-06-24 23:15:59 +03:00
|
|
|
m_reportSettings.setDefaultValues();
|
2016-02-17 10:11:00 +03:00
|
|
|
emit cleared();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::printReport(ItemsReaderIntf::Ptr reader, QPrinter& printer)
|
|
|
|
{
|
|
|
|
LimeReport::PageDesignIntf renderPage;
|
|
|
|
renderPage.setItemMode(PrintMode);
|
|
|
|
if (reader->first()){
|
|
|
|
reader->readItem(renderPage.pageItem());
|
2016-04-21 00:09:15 +03:00
|
|
|
printer.setFullPage(renderPage.pageItem()->fullPage());
|
2016-02-17 10:11:00 +03:00
|
|
|
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
|
|
|
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
|
|
|
|
2016-04-21 00:09:15 +03:00
|
|
|
if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){
|
|
|
|
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
|
|
|
|
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
|
|
|
|
renderPage.pageItem()->sizeMM();
|
|
|
|
printer.setPaperSize(pageSize,QPrinter::Millimeter);
|
|
|
|
} else {
|
|
|
|
printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize());
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
QPainter painter(&printer);
|
|
|
|
renderPage.render(&painter);
|
|
|
|
|
|
|
|
while (reader->next()){
|
|
|
|
printer.newPage();
|
|
|
|
renderPage.removeAllItems();
|
|
|
|
reader->readItem(renderPage.pageItem());
|
|
|
|
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
|
|
|
renderPage.render(&painter);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, const PrintRange& printRange)
|
|
|
|
{
|
|
|
|
LimeReport::PageDesignIntf renderPage;
|
|
|
|
renderPage.setItemMode(PrintMode);
|
|
|
|
QPainter* painter=0;
|
|
|
|
|
|
|
|
bool isFirst = true;
|
|
|
|
int currenPage = 1;
|
|
|
|
foreach(PageItemDesignIntf::Ptr page,pages){
|
|
|
|
|
|
|
|
if (
|
|
|
|
(printRange.rangeType()==QPrintDialog::AllPages) ||
|
|
|
|
( (printRange.rangeType()==QPrintDialog::PageRange) &&
|
|
|
|
(currenPage>=printRange.fromPage()) &&
|
|
|
|
(currenPage<=printRange.toPage())
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
|
|
|
|
QPointF pagePos = page->pos();
|
|
|
|
page->setPos(0,0);
|
|
|
|
renderPage.setPageItem(page);
|
|
|
|
renderPage.setSceneRect(renderPage.pageItem()->mapToScene(renderPage.pageItem()->rect()).boundingRect());
|
2016-05-26 22:19:12 +03:00
|
|
|
if (renderPage.pageItem()->oldPrintMode()){
|
|
|
|
printer.setPageMargins(renderPage.pageItem()->leftMargin(),
|
|
|
|
renderPage.pageItem()->topMargin(),
|
|
|
|
renderPage.pageItem()->rightMargin(),
|
|
|
|
renderPage.pageItem()->bottomMargin(),
|
|
|
|
QPrinter::Millimeter);
|
|
|
|
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
2016-04-21 00:09:15 +03:00
|
|
|
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
|
2016-05-26 22:19:12 +03:00
|
|
|
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
|
|
|
|
renderPage.pageItem()->sizeMM();
|
2016-04-21 00:09:15 +03:00
|
|
|
printer.setPaperSize(pageSize,QPrinter::Millimeter);
|
|
|
|
} else {
|
2016-05-26 22:19:12 +03:00
|
|
|
printer.setFullPage(renderPage.pageItem()->fullPage());
|
|
|
|
printer.setOrientation((QPrinter::Orientation)renderPage.pageItem()->pageOrientation());
|
|
|
|
if (renderPage.pageItem()->pageSize()==PageItemDesignIntf::Custom){
|
|
|
|
QSizeF pageSize = (renderPage.pageItem()->pageOrientation()==PageItemDesignIntf::Landscape)?
|
|
|
|
QSizeF(renderPage.pageItem()->sizeMM().height(),renderPage.pageItem()->sizeMM().width()):
|
|
|
|
renderPage.pageItem()->sizeMM();
|
|
|
|
printer.setPaperSize(pageSize,QPrinter::Millimeter);
|
|
|
|
} else {
|
|
|
|
printer.setPaperSize((QPrinter::PageSize)renderPage.pageItem()->pageSize());
|
|
|
|
}
|
2016-04-21 00:09:15 +03:00
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
if (!isFirst){
|
|
|
|
printer.newPage();
|
|
|
|
} else {
|
|
|
|
isFirst=false;
|
|
|
|
painter = new QPainter(&printer);
|
|
|
|
}
|
|
|
|
|
|
|
|
renderPage.render(painter);
|
|
|
|
page->setPos(pagePos);
|
|
|
|
}
|
|
|
|
|
|
|
|
currenPage++;
|
|
|
|
}
|
2016-02-18 21:09:00 +03:00
|
|
|
delete painter;
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEnginePrivate::printReport(QPrinter* printer)
|
|
|
|
{
|
|
|
|
if (!printer&&!m_printerSelected){
|
|
|
|
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
|
|
|
|
m_printerSelected = dialog.exec()!=QDialog::Rejected;
|
|
|
|
}
|
|
|
|
if (!printer&&!m_printerSelected) return false;
|
|
|
|
|
|
|
|
printer =(printer)?printer:m_printer.data();
|
|
|
|
if (printer&&printer->isValid()){
|
|
|
|
try{
|
2016-06-10 18:05:18 +03:00
|
|
|
dataManager()->setDesignTime(false);
|
|
|
|
ReportPages pages = renderToPages();
|
2016-02-17 10:11:00 +03:00
|
|
|
dataManager()->setDesignTime(true);
|
2016-06-10 18:05:18 +03:00
|
|
|
if (pages.count()>0){
|
|
|
|
printReport(pages,*printer,PrintRange());
|
|
|
|
}
|
|
|
|
} catch(ReportError &exception){
|
|
|
|
saveError(exception.what());
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!printer&&!m_printerSelected){
|
|
|
|
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
|
|
|
|
m_printerSelected = dialog.exec()!=QDialog::Rejected;
|
|
|
|
if (m_printerSelected){
|
|
|
|
printRange.setRangeType(dialog.printRange());
|
|
|
|
printRange.setFromPage(dialog.fromPage());
|
|
|
|
printRange.setToPage(dialog.toPage());
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!printer&&!m_printerSelected) return false;
|
|
|
|
|
|
|
|
printer =(printer)?printer:m_printer.data();
|
|
|
|
if (printer&&printer->isValid()){
|
|
|
|
try{
|
|
|
|
if (pages.count()>0){
|
|
|
|
printReport(
|
|
|
|
pages,
|
|
|
|
*printer,
|
|
|
|
printRange
|
|
|
|
);
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
} catch(ReportError &exception){
|
|
|
|
saveError(exception.what());
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
} else return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::printToFile(const QString &fileName)
|
|
|
|
{
|
|
|
|
if (!fileName.isEmpty()){
|
|
|
|
QFile file(fileName);
|
|
|
|
if (file.open(QIODevice::WriteOnly)){
|
|
|
|
QTextStream out(&file);
|
|
|
|
try {
|
|
|
|
dataManager()->setDesignTime(false);
|
|
|
|
out<<renderToString();
|
|
|
|
dataManager()->setDesignTime(true);
|
|
|
|
} catch( ReportError &exception){
|
|
|
|
saveError(exception.what());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
file.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:19:50 +03:00
|
|
|
bool ReportEnginePrivate::printToPDF(const QString &fileName)
|
|
|
|
{
|
|
|
|
if (!fileName.isEmpty()){
|
2016-04-07 20:21:48 +03:00
|
|
|
QFileInfo fi(fileName);
|
|
|
|
QString fn = fileName;
|
|
|
|
if (fi.suffix().isEmpty())
|
|
|
|
fn+=".pdf";
|
2016-02-17 10:19:50 +03:00
|
|
|
QPrinter printer;
|
2016-04-07 20:21:48 +03:00
|
|
|
printer.setOutputFileName(fn);
|
2016-02-17 10:19:50 +03:00
|
|
|
printer.setOutputFormat(QPrinter::PdfFormat);
|
|
|
|
return printReport(&printer);
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-08-02 22:33:33 +03:00
|
|
|
void ReportEnginePrivate::previewReport(PreviewHints hints)
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
|
|
|
QTime start = QTime::currentTime();
|
|
|
|
try{
|
|
|
|
dataManager()->setDesignTime(false);
|
|
|
|
ReportPages pages = renderToPages();
|
|
|
|
dataManager()->setDesignTime(true);
|
|
|
|
if (pages.count()>0){
|
2016-03-02 21:17:37 +03:00
|
|
|
PreviewReportWindow* w = new PreviewReportWindow(this,0,settings());
|
2016-04-06 20:41:50 +03:00
|
|
|
w->setWindowFlags(Qt::Dialog|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint| Qt::WindowMinMaxButtonsHint);
|
2016-02-17 10:11:00 +03:00
|
|
|
w->setAttribute(Qt::WA_DeleteOnClose,true);
|
|
|
|
w->setWindowModality(Qt::ApplicationModal);
|
2016-04-06 22:03:58 +03:00
|
|
|
//w->setWindowIcon(QIcon(":/report/images/main.ico"));
|
|
|
|
w->setWindowIcon(m_previewWindowIcon);
|
|
|
|
w->setWindowTitle(m_previewWindowTitle);
|
2016-02-17 10:11:00 +03:00
|
|
|
w->setSettings(settings());
|
|
|
|
w->setPages(pages);
|
|
|
|
if (!dataManager()->errorsList().isEmpty()){
|
|
|
|
w->setErrorMessages(dataManager()->errorsList());
|
|
|
|
}
|
2016-08-02 22:33:33 +03:00
|
|
|
|
2016-08-08 15:50:04 +03:00
|
|
|
if (!hints.testFlag(PreviewBarsUserSetting)){
|
|
|
|
w->setMenuVisible(!hints.testFlag(HidePreviewMenuBar));
|
|
|
|
w->setStatusBarVisible(!hints.testFlag(HidePreviewStatusBar));
|
|
|
|
w->setToolBarVisible(!hints.testFlag(HidePreviewToolBar));
|
|
|
|
}
|
2016-08-02 22:33:33 +03:00
|
|
|
|
2017-02-03 14:20:30 +03:00
|
|
|
w->setHideResultEditButton(resultIsEditable());
|
|
|
|
|
2016-02-20 13:37:18 +03:00
|
|
|
m_activePreview = w;
|
|
|
|
connect(w,SIGNAL(destroyed(QObject*)), this, SLOT(slotPreviewWindowDestroed(QObject*)));
|
2016-02-17 10:11:00 +03:00
|
|
|
qDebug()<<"render time ="<<start.msecsTo(QTime::currentTime());
|
|
|
|
w->exec();
|
|
|
|
}
|
|
|
|
} catch (ReportError &exception){
|
|
|
|
saveError(exception.what());
|
|
|
|
showError(exception.what());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-30 23:21:44 +03:00
|
|
|
PreviewReportWidget* ReportEnginePrivate::createPreviewWidget(QWidget* parent){
|
|
|
|
|
|
|
|
PreviewReportWidget* widget = new PreviewReportWidget(this, parent);
|
|
|
|
try{
|
|
|
|
dataManager()->setDesignTime(false);
|
|
|
|
ReportPages pages = renderToPages();
|
|
|
|
dataManager()->setDesignTime(true);
|
|
|
|
if (pages.count()>0)
|
|
|
|
widget->d_ptr->setPages(pages);
|
|
|
|
} catch (ReportError &exception){
|
|
|
|
saveError(exception.what());
|
|
|
|
showError(exception.what());
|
|
|
|
}
|
|
|
|
return widget;
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
PageDesignIntf* ReportEnginePrivate::createPreviewScene(QObject* parent){
|
|
|
|
PageDesignIntf* result = 0;
|
|
|
|
try {
|
|
|
|
ReportPages pages = renderToPages();
|
|
|
|
result = new PageDesignIntf(parent);
|
|
|
|
result->setPageItems(pages);
|
|
|
|
} catch (ReportError &exception){
|
|
|
|
saveError(exception.what());
|
|
|
|
showError(exception.what());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
void ReportEnginePrivate::emitSaveReport()
|
|
|
|
{
|
|
|
|
emit onSave();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEnginePrivate::emitLoadReport()
|
|
|
|
{
|
|
|
|
bool result = false;
|
|
|
|
emit onLoad(result);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-04-21 17:44:58 +03:00
|
|
|
void ReportEnginePrivate::emitSaveFinished()
|
|
|
|
{
|
|
|
|
emit saveFinished();
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
bool ReportEnginePrivate::isSaved()
|
|
|
|
{
|
|
|
|
foreach (PageDesignIntf* page, m_pages) {
|
|
|
|
if (!page->isSaved()) return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::setCurrentReportsDir(const QString &dirName)
|
|
|
|
{
|
|
|
|
if (QDir(dirName).exists())
|
|
|
|
m_reportsDir = dirName;
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
void ReportEnginePrivate::cancelRender()
|
|
|
|
{
|
|
|
|
if (m_reportRender)
|
|
|
|
m_reportRender->cancelRender();
|
2016-12-13 12:47:46 +03:00
|
|
|
m_reportRendering = false;
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
2016-06-10 18:05:18 +03:00
|
|
|
PageDesignIntf* ReportEngine::createPreviewScene(QObject* parent){
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->createPreviewScene(parent);
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
void ReportEnginePrivate::designReport()
|
|
|
|
{
|
2016-04-21 17:53:31 +03:00
|
|
|
if (!m_designerWindow) {
|
|
|
|
m_designerWindow = new LimeReport::ReportDesignWindow(this,QApplication::activeWindow(),settings());
|
|
|
|
m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true);
|
|
|
|
m_designerWindow->setWindowIcon(QIcon(":report/images/logo32"));
|
|
|
|
m_designerWindow->setShowProgressDialog(m_showProgressDialog);
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef Q_OS_WIN
|
|
|
|
m_designerWindow->setWindowModality(Qt::ApplicationModal);
|
2016-02-17 10:11:00 +03:00
|
|
|
#endif
|
|
|
|
if (QApplication::activeWindow()==0){
|
2016-04-21 17:53:31 +03:00
|
|
|
m_designerWindow->show();;
|
2016-02-17 10:11:00 +03:00
|
|
|
} else {
|
2016-04-21 17:53:31 +03:00
|
|
|
m_designerWindow->showModal();
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::setSettings(QSettings* value)
|
|
|
|
{
|
|
|
|
if (value){
|
|
|
|
if (m_ownedSettings&&m_settings)
|
|
|
|
delete m_settings;
|
|
|
|
m_settings = value;
|
|
|
|
m_ownedSettings = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QSettings*ReportEnginePrivate::settings()
|
|
|
|
{
|
|
|
|
if (m_settings){
|
|
|
|
return m_settings;
|
|
|
|
} else {
|
|
|
|
m_settings = new QSettings("LimeReport",QApplication::applicationName());
|
|
|
|
m_ownedSettings=true;
|
|
|
|
return m_settings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEnginePrivate::loadFromFile(const QString &fileName)
|
|
|
|
{
|
2016-03-19 13:33:49 +03:00
|
|
|
if (!QFile::exists(fileName)) return false;
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
clearReport();
|
2016-02-17 10:39:17 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
ItemsReaderIntf::Ptr reader = FileXMLReader::create(fileName);
|
|
|
|
if (reader->first()){
|
|
|
|
if (reader->readItem(this)){
|
|
|
|
m_fileName=fileName;
|
2016-02-17 10:39:17 +03:00
|
|
|
QFileInfo fi(fileName);
|
|
|
|
m_reportName = fi.fileName();
|
2016-02-25 02:04:06 +03:00
|
|
|
dataManager()->connectAutoConnections();
|
2016-02-17 10:11:00 +03:00
|
|
|
return true;
|
|
|
|
};
|
2016-06-10 18:05:18 +03:00
|
|
|
}
|
|
|
|
m_lastError = reader->lastError();
|
2016-02-17 10:11:00 +03:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
bool ReportEnginePrivate::loadFromByteArray(QByteArray* data, const QString &name){
|
2016-02-17 10:11:00 +03:00
|
|
|
clearReport();
|
2016-02-17 10:39:17 +03:00
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
ItemsReaderIntf::Ptr reader = ByteArrayXMLReader::create(data);
|
|
|
|
if (reader->first()){
|
|
|
|
if (reader->readItem(this)){
|
2016-02-17 10:39:17 +03:00
|
|
|
m_fileName = "";
|
|
|
|
m_reportName = name;
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEnginePrivate::loadFromString(const QString &report, const QString &name)
|
|
|
|
{
|
|
|
|
clearReport();
|
|
|
|
|
|
|
|
ItemsReaderIntf::Ptr reader = StringXMLreader::create(report);
|
|
|
|
if (reader->first()){
|
|
|
|
if (reader->readItem(this)){
|
|
|
|
m_fileName = "";
|
|
|
|
m_reportName = name;
|
2016-02-17 10:11:00 +03:00
|
|
|
return true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEnginePrivate::saveToFile(const QString &fileName)
|
|
|
|
{
|
|
|
|
if (fileName.isEmpty()) return false;
|
|
|
|
QFileInfo fi(fileName);
|
|
|
|
QString fn = fileName;
|
|
|
|
if (fi.suffix().isEmpty())
|
|
|
|
fn+=".lrxml";
|
|
|
|
|
|
|
|
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
|
|
|
|
writer->putItem(this);
|
|
|
|
m_fileName=fn;
|
|
|
|
bool saved = writer->saveToFile(fn);
|
|
|
|
if (saved){
|
|
|
|
foreach(PageDesignIntf* page, m_pages){
|
|
|
|
page->setToSaved();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return saved;
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
QByteArray ReportEnginePrivate::saveToByteArray()
|
|
|
|
{
|
|
|
|
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
|
|
|
|
writer->putItem(this);
|
|
|
|
QByteArray result = writer->saveToByteArray();
|
|
|
|
if (!result.isEmpty()){
|
|
|
|
foreach(PageDesignIntf* page, m_pages){
|
|
|
|
page->setToSaved();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ReportEnginePrivate::saveToString(){
|
|
|
|
QScopedPointer< ItemsWriterIntf > writer(new XMLWriter());
|
|
|
|
writer->putItem(this);
|
|
|
|
QString result = writer->saveToString();
|
|
|
|
if (!result.isEmpty()){
|
|
|
|
foreach(PageDesignIntf* page, m_pages){
|
|
|
|
page->setToSaved();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
bool ReportEnginePrivate::isNeedToSave()
|
|
|
|
{
|
|
|
|
foreach(PageDesignIntf* page, m_pages){
|
|
|
|
if (page->isHasChanges()) return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEnginePrivate::saveToFile()
|
|
|
|
{
|
|
|
|
if (m_fileName.isEmpty()) return false;
|
|
|
|
return saveToFile(m_fileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ReportEnginePrivate::renderToString()
|
|
|
|
{
|
|
|
|
LimeReport::ReportRender render;
|
|
|
|
dataManager()->connectAllDatabases();
|
|
|
|
dataManager()->setDesignTime(false);
|
|
|
|
if (m_pages.count()){
|
|
|
|
render.setDatasources(dataManager());
|
2016-06-10 18:05:18 +03:00
|
|
|
render.setScriptContext(scriptContext());
|
2016-02-17 10:11:00 +03:00
|
|
|
return render.renderPageToString(m_pages.at(0));
|
|
|
|
}else return QString();
|
|
|
|
}
|
|
|
|
|
2017-02-03 14:20:30 +03:00
|
|
|
bool ReportEnginePrivate::resultIsEditable() const
|
|
|
|
{
|
|
|
|
return m_resultIsEditable;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::setResultEditable(bool value)
|
|
|
|
{
|
|
|
|
m_resultIsEditable = value;
|
|
|
|
}
|
|
|
|
|
2016-06-24 23:15:59 +03:00
|
|
|
bool ReportEnginePrivate::suppressFieldAndVarError() const
|
|
|
|
{
|
|
|
|
return m_reportSettings.suppressAbsentFieldsAndVarsWarnings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::setSuppressFieldAndVarError(bool suppressFieldAndVarError)
|
|
|
|
{
|
|
|
|
m_reportSettings.setSuppressAbsentFieldsAndVarsWarnings(suppressFieldAndVarError);
|
|
|
|
}
|
|
|
|
|
2016-12-13 12:47:46 +03:00
|
|
|
bool ReportEnginePrivate::isBusy()
|
|
|
|
{
|
|
|
|
return m_reportRendering;
|
|
|
|
}
|
|
|
|
|
2016-04-06 22:03:58 +03:00
|
|
|
QString ReportEnginePrivate::previewWindowTitle() const
|
|
|
|
{
|
|
|
|
return m_previewWindowTitle;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::setPreviewWindowTitle(const QString &previewWindowTitle)
|
|
|
|
{
|
|
|
|
m_previewWindowTitle = previewWindowTitle;
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon ReportEnginePrivate::previewWindowIcon() const
|
|
|
|
{
|
|
|
|
return m_previewWindowIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEnginePrivate::setPreviewWindowIcon(const QIcon &previewWindowIcon)
|
|
|
|
{
|
|
|
|
m_previewWindowIcon = previewWindowIcon;
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
ReportPages ReportEnginePrivate::renderToPages()
|
|
|
|
{
|
2016-12-13 12:47:46 +03:00
|
|
|
if (m_reportRendering) return ReportPages();
|
2016-02-17 10:11:00 +03:00
|
|
|
m_reportRender = ReportRender::Ptr(new ReportRender);
|
2017-01-05 14:46:06 +03:00
|
|
|
|
2016-06-24 23:15:59 +03:00
|
|
|
dataManager()->clearErrors();
|
2016-02-17 10:11:00 +03:00
|
|
|
dataManager()->connectAllDatabases();
|
|
|
|
dataManager()->setDesignTime(false);
|
2017-01-05 14:46:06 +03:00
|
|
|
dataManager()->updateDatasourceModel();
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
connect(m_reportRender.data(),SIGNAL(pageRendered(int)),
|
|
|
|
this, SIGNAL(renderPageFinished(int)));
|
|
|
|
if (m_pages.count()){
|
2016-06-10 18:05:18 +03:00
|
|
|
ReportPages result;
|
2016-12-13 12:47:46 +03:00
|
|
|
m_reportRendering = true;
|
2016-02-17 10:11:00 +03:00
|
|
|
emit renderStarted();
|
|
|
|
m_reportRender->setDatasources(dataManager());
|
2016-06-10 18:05:18 +03:00
|
|
|
m_reportRender->setScriptContext(scriptContext());
|
|
|
|
|
|
|
|
foreach(PageDesignIntf* page , m_pages){
|
2016-06-24 23:33:44 +03:00
|
|
|
m_pages.at(0)->setReportSettings(&m_reportSettings);
|
2016-06-10 18:05:18 +03:00
|
|
|
result.append(m_reportRender->renderPageToPages(page));
|
2016-09-16 01:59:56 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
m_reportRender->secondRenderPass(result);
|
2016-02-17 10:11:00 +03:00
|
|
|
emit renderFinished();
|
2016-06-10 18:05:18 +03:00
|
|
|
m_reportRender.clear();
|
2016-12-13 12:47:46 +03:00
|
|
|
m_reportRendering = false;
|
2016-02-17 10:11:00 +03:00
|
|
|
return result;
|
2016-06-10 18:05:18 +03:00
|
|
|
} else {
|
2016-02-20 12:05:57 +03:00
|
|
|
return ReportPages();
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
QString ReportEnginePrivate::lastError()
|
|
|
|
{
|
|
|
|
return m_lastError;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReportEngine::ReportEngine(QObject *parent)
|
|
|
|
: QObject(parent), d_ptr(new ReportEnginePrivate())
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
d->q_ptr=this;
|
|
|
|
connect(d, SIGNAL(renderStarted()), this, SIGNAL(renderStarted()));
|
|
|
|
connect(d, SIGNAL(renderPageFinished(int)),
|
|
|
|
this, SIGNAL(renderPageFinished(int)));
|
|
|
|
connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished()));
|
2016-02-17 10:39:17 +03:00
|
|
|
connect(d, SIGNAL(onSave()), this, SIGNAL(onSave()));
|
|
|
|
connect(d, SIGNAL(onLoad(bool&)), this, SIGNAL(onLoad(bool&)));
|
2016-04-21 17:44:58 +03:00
|
|
|
connect(d, SIGNAL(saveFinished()), this, SIGNAL(saveFinished()));
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
ReportEngine::~ReportEngine()
|
|
|
|
{
|
2016-02-18 21:09:00 +03:00
|
|
|
delete d_ptr;
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEngine::printReport(QPrinter *printer)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->printReport(printer);
|
|
|
|
}
|
|
|
|
|
2016-06-10 18:05:18 +03:00
|
|
|
bool ReportEngine::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange){
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->printPages(pages,printer, printRange);
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
void ReportEngine::printToFile(const QString &fileName)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
d->printToFile(fileName);
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:19:50 +03:00
|
|
|
bool ReportEngine::printToPDF(const QString &fileName)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->printToPDF(fileName);
|
|
|
|
}
|
|
|
|
|
2016-08-02 22:33:33 +03:00
|
|
|
void ReportEngine::previewReport(PreviewHints hints)
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
if (m_settings)
|
|
|
|
d->setSettings(m_settings);
|
2016-08-02 22:33:33 +03:00
|
|
|
d->previewReport(hints);
|
2016-02-17 10:11:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEngine::designReport()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
if (m_settings)
|
|
|
|
d->setSettings(m_settings);
|
|
|
|
d->designReport();
|
|
|
|
}
|
|
|
|
|
2016-03-30 23:21:44 +03:00
|
|
|
PreviewReportWidget* ReportEngine::createPreviewWidget(QWidget *parent)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->createPreviewWidget(parent);
|
|
|
|
}
|
|
|
|
|
2016-04-06 22:03:58 +03:00
|
|
|
void ReportEngine::setPreviewWindowTitle(const QString &title)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
d->setPreviewWindowTitle(title);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEngine::setPreviewWindowIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
d->setPreviewWindowIcon(icon);
|
|
|
|
}
|
|
|
|
|
2017-02-03 14:20:30 +03:00
|
|
|
void ReportEngine::setResultEditable(bool value)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
d->setResultEditable(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEngine::resultIsEditable()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->resultIsEditable();
|
|
|
|
}
|
|
|
|
|
2016-12-13 12:47:46 +03:00
|
|
|
bool ReportEngine::isBusy()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->isBusy();
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
void ReportEngine::setShowProgressDialog(bool value)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
d->setShowProgressDialog(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
IDataSourceManager *ReportEngine::dataManager()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->dataManagerIntf();
|
|
|
|
}
|
|
|
|
|
2016-11-01 20:42:45 +03:00
|
|
|
IScriptEngineManager *ReportEngine::scriptManager()
|
2016-02-17 10:11:00 +03:00
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->scriptManagerIntf();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEngine::loadFromFile(const QString &fileName)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->loadFromFile(fileName);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEngine::loadFromByteArray(QByteArray* data){
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->loadFromByteArray(data);
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
bool ReportEngine::loadFromString(const QString &data)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->loadFromString(data);
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
QString ReportEngine::reportFileName()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->reportFileName();
|
|
|
|
}
|
|
|
|
|
2016-04-21 14:58:21 +03:00
|
|
|
void ReportEngine::setReportFileName(const QString &fileName)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->setReportFileName(fileName);
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
bool ReportEngine::saveToFile()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->saveToFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ReportEngine::saveToFile(const QString &fileName)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->saveToFile(fileName);
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
QByteArray ReportEngine::saveToByteArray()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->saveToByteArray();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ReportEngine::saveToString()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->saveToString();
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
QString ReportEngine::lastError()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->lastError();
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
void ReportEngine::setCurrentReportsDir(const QString &dirName)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->setCurrentReportsDir(dirName);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ReportEngine::setReportName(const QString &name)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->setReportName(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
QString ReportEngine::reportName()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
return d->reportName();
|
|
|
|
}
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
void ReportEngine::cancelRender()
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
d->cancelRender();
|
|
|
|
}
|
|
|
|
|
|
|
|
ReportEngine::ReportEngine(ReportEnginePrivate &dd, QObject *parent)
|
|
|
|
:QObject(parent),d_ptr(&dd)
|
|
|
|
{
|
|
|
|
Q_D(ReportEngine);
|
|
|
|
d->q_ptr=this;
|
|
|
|
connect(d, SIGNAL(renderStarted()), this, SIGNAL(renderStarted()));
|
|
|
|
connect(d, SIGNAL(renderPageFinished(int)),
|
|
|
|
this, SIGNAL(renderPageFinished(int)));
|
|
|
|
connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished()));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|