diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 41a3a4b..108c4e7 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -78,7 +78,7 @@ public: explicit ReportEngine(QObject *parent = 0); ~ReportEngine(); bool printReport(QPrinter *printer=0); - bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); + bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); PageDesignIntf *createPreviewScene(QObject *parent = 0); bool printToPDF(const QString& fileName); diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index c93004c..5443adf 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -175,8 +175,7 @@ void PreviewReportWidget::print() if (!d_ptr->m_reportPages.isEmpty()) ReportEnginePrivate::printReport( d_ptr->m_reportPages, - printer, - PrintRange(dialog.printRange(),dialog.fromPage(),dialog.toPage()) + printer ); foreach(PageItemDesignIntf::Ptr pageItem, d_ptr->m_reportPages){ d_ptr->m_previewPage->reactivatePageItem(pageItem); @@ -196,7 +195,7 @@ void PreviewReportWidget::printToPDF() printer.setOutputFileName(fileName); printer.setOutputFormat(QPrinter::PdfFormat); if (!d_ptr->m_reportPages.isEmpty()){ - ReportEnginePrivate::printReport(d_ptr->m_reportPages,printer,PrintRange()); + ReportEnginePrivate::printReport(d_ptr->m_reportPages,printer); } foreach(PageItemDesignIntf::Ptr pageItem, d_ptr->m_reportPages){ d_ptr->m_previewPage->reactivatePageItem(pageItem); diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 0729fca..a6d3e50 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -209,7 +209,7 @@ void ReportEnginePrivate::printReport(ItemsReaderIntf::Ptr reader, QPrinter& pri } } -void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, const PrintRange& printRange) +void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer) { LimeReport::PageDesignIntf renderPage; renderPage.setItemMode(PrintMode); @@ -217,13 +217,13 @@ void ReportEnginePrivate::printReport(ReportPages pages, QPrinter &printer, cons bool isFirst = true; int currenPage = 1; - foreach(PageItemDesignIntf::Ptr page,pages){ + foreach(PageItemDesignIntf::Ptr page, pages){ if ( - (printRange.rangeType()==QPrintDialog::AllPages) || - ( (printRange.rangeType()==QPrintDialog::PageRange) && - (currenPage>=printRange.fromPage()) && - (currenPage<=printRange.toPage()) + (printer.printRange() == QPrinter::AllPages) || + ( (printer.printRange()==QPrinter::PageRange) && + (currenPage>=printer.fromPage()) && + (currenPage<=printer.toPage()) ) ) { @@ -295,7 +295,7 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) ReportPages pages = renderToPages(); dataManager()->setDesignTime(true); if (pages.count()>0){ - printReport(pages,*printer,PrintRange()); + printReport(pages,*printer); } } catch(ReportError &exception){ saveError(exception.what()); @@ -304,7 +304,7 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) } else return false; } -bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange) +bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer) { if (!printer&&!m_printerSelected){ QPrinterInfo pi; @@ -317,12 +317,6 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, Print #endif 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; @@ -332,8 +326,7 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, Print if (pages.count()>0){ printReport( pages, - *printer, - printRange + *printer ); } } catch(ReportError &exception){ @@ -859,9 +852,9 @@ bool ReportEngine::printReport(QPrinter *printer) return d->printReport(printer); } -bool ReportEngine::printPages(ReportPages pages, QPrinter *printer, PrintRange printRange){ +bool ReportEngine::printPages(ReportPages pages, QPrinter *printer){ Q_D(ReportEngine); - return d->printPages(pages,printer, printRange); + return d->printPages(pages,printer); } void ReportEngine::printToFile(const QString &fileName) diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 41a3a4b..108c4e7 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -78,7 +78,7 @@ public: explicit ReportEngine(QObject *parent = 0); ~ReportEngine(); bool printReport(QPrinter *printer=0); - bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); + bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); PageDesignIntf *createPreviewScene(QObject *parent = 0); bool printToPDF(const QString& fileName); diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 8a989d6..0c65284 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -63,7 +63,7 @@ class ReportEnginePrivate : public QObject, public ICollectionContainer friend class PreviewReportWidget; public: static void printReport(ItemsReaderIntf::Ptr reader, QPrinter &printer); - static void printReport(ReportPages pages, QPrinter &printer, const PrintRange &printRange); + static void printReport(ReportPages pages, QPrinter &printer); public: explicit ReportEnginePrivate(QObject *parent = 0); virtual ~ReportEnginePrivate(); @@ -85,7 +85,7 @@ public: void clearReport(); bool printReport(QPrinter *printer=0); - bool printPages(ReportPages pages, QPrinter *printer, PrintRange printRange = PrintRange()); + bool printPages(ReportPages pages, QPrinter *printer); void printToFile(const QString& fileName); bool printToPDF(const QString& fileName); void previewReport(PreviewHints hints = PreviewBarsUserSetting);