From 9bf0ba0ded80a9862a41a44b720c98385a8f6dc4 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Fri, 28 Jun 2019 23:42:35 +0300 Subject: [PATCH] Print process has been changed and printBehavior property has been added. --- limereport/lrpageitemdesignintf.cpp | 14 ++++++++-- limereport/lrpageitemdesignintf.h | 9 +++++++ limereport/lrreportengine.cpp | 24 +++++++++++++----- .../objectinspector/lrobjectitemmodel.cpp | 1 + .../propertyItems/lrenumpropitem.cpp | 2 ++ translations/limereport_ru.qm | Bin 122748 -> 123030 bytes translations/limereport_ru.ts | 14 +++++++++- 7 files changed, 55 insertions(+), 9 deletions(-) diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index b9c5693..47715c8 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -51,7 +51,7 @@ PageItemDesignIntf::PageItemDesignIntf(QObject *owner, QGraphicsItem *parent) : m_pageOrientaion(Portrait), m_pageSize(A4), m_sizeChainging(false), m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false), m_isExtendedInDesignMode(false), m_extendedHeight(1000), m_isTOC(false), m_setPageSizeToPrinter(false), - m_endlessHeight(false), m_printable(true), m_pageFooter(0) + m_endlessHeight(false), m_printable(true), m_pageFooter(0), m_printBehavior(Split) { setFixedPos(true); setPossibleResizeDirectionFlags(Fixed); @@ -65,7 +65,7 @@ PageItemDesignIntf::PageItemDesignIntf(const PageSize pageSize, const QRectF &re m_pageOrientaion(Portrait), m_pageSize(pageSize), m_sizeChainging(false), m_fullPage(false), m_oldPrintMode(false), m_resetPageNumber(false), m_isExtendedInDesignMode(false), m_extendedHeight(1000), m_isTOC(false), m_setPageSizeToPrinter(false), - m_endlessHeight(false), m_printable(true), m_pageFooter(0) + m_endlessHeight(false), m_printable(true), m_pageFooter(0), m_printBehavior(Split) { setFixedPos(true); setPossibleResizeDirectionFlags(Fixed); @@ -344,6 +344,16 @@ void PageItemDesignIntf::initColumnsPos(QVector &posByColumns, qreal pos, } } +void PageItemDesignIntf::setPrintBehavior(const PrintBehavior &printBehavior) +{ + m_printBehavior = printBehavior; +} + +PageItemDesignIntf::PrintBehavior PageItemDesignIntf::printBehavior() const +{ + return m_printBehavior; +} + QString PageItemDesignIntf::printerName() const { return m_printerName; diff --git a/limereport/lrpageitemdesignintf.h b/limereport/lrpageitemdesignintf.h index 466b360..f804776 100644 --- a/limereport/lrpageitemdesignintf.h +++ b/limereport/lrpageitemdesignintf.h @@ -44,6 +44,7 @@ class PageItemDesignIntf : public ItemsContainerDesignInft Q_OBJECT Q_ENUMS(Orientation) Q_ENUMS(PageSize) + Q_ENUMS(PrintBehavior) Q_PROPERTY(int topMargin READ topMargin WRITE setTopMargin) Q_PROPERTY(int bottomMargin READ bottomMargin WRITE setBottomMargin) Q_PROPERTY(int rightMargin READ rightMargin WRITE setRightMargin) @@ -62,9 +63,11 @@ class PageItemDesignIntf : public ItemsContainerDesignInft Q_PROPERTY(bool printable READ isPrintable WRITE setPrintable) Q_PROPERTY(QString printerName READ printerName WRITE setPrinterName) Q_PROPERTY(UnitType units READ unitType WRITE setUnitTypeProperty) + Q_PROPERTY(PrintBehavior printBehavior READ printBehavior WRITE setPrintBehavior) friend class ReportRender; public: enum Orientation { Portrait = QPrinter::Portrait, Landscape = QPrinter::Landscape }; + enum PrintBehavior {Scale, Split}; enum PageSize { A4 = QPrinter::A4, B5 = QPrinter::B5, Letter = QPrinter::Letter, Legal = QPrinter::Legal, Executive = QPrinter::Executive, @@ -163,6 +166,9 @@ public: BandDesignIntf *pageFooter() const; void setPageFooter(BandDesignIntf *pageFooter); + PrintBehavior printBehavior() const; + void setPrintBehavior(const PrintBehavior &printBehavior); + signals: void beforeFirstPageRendered(); void afterLastPageRendered(); @@ -205,6 +211,9 @@ private: bool m_printable; QString m_printerName; BandDesignIntf* m_pageFooter; + PrintBehavior m_printBehavior; + + }; typedef QList ReportPages; diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index abcfc37..8006745 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -1790,16 +1790,28 @@ bool PrintProcessor::printPage(PageItemDesignIntf::Ptr page) printerPageRect = QRectF(0,0,(printerPageRect.size().width() + rightMargin + leftMargin) * page->unitFactor(), (printerPageRect.size().height() + bottomMargin +topMargin) * page->unitFactor()); - if (m_printer->pageSize() != static_cast(page->pageSize()) && + if (page->printBehavior() == PageItemDesignIntf::Split && m_printer->pageSize() != static_cast(page->pageSize()) && printerPageRect.width() < page->geometry().width()) { qreal pageWidth = page->geometry().width(); + qreal pageHeight = page->geometry().height(); QRectF currentPrintingRect = printerPageRect; - while (pageWidth>0){ - renderPage.render(m_painter, m_printer->pageRect(), currentPrintingRect); - currentPrintingRect.adjust(printerPageRect.size().width(),0,printerPageRect.size().width(),0); - pageWidth -= printerPageRect.size().width(); - if (pageWidth>0) m_printer->newPage(); + qreal curHeight = 0; + qreal curWidth = 0; + bool first = true; + while (pageHeight > 0){ + while (curWidth < pageWidth){ + if (!first) m_printer->newPage(); else first = false; + renderPage.render(m_painter, m_printer->pageRect(), currentPrintingRect); + currentPrintingRect.adjust(printerPageRect.size().width(), 0, printerPageRect.size().width(), 0); + curWidth += printerPageRect.size().width(); + + } + pageHeight -= printerPageRect.size().height(); + curHeight += printerPageRect.size().height(); + currentPrintingRect = printerPageRect; + currentPrintingRect.adjust(0, curHeight, 0, curHeight); + curWidth = 0; } } else { diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index 23fa281..ea92de3 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -162,6 +162,7 @@ void QObjectPropertyModel::translatePropertyName() tr("option3"); tr("units"); tr("geometryLocked"); + tr("printBehavior"); } void QObjectPropertyModel::clearObjectsList() diff --git a/limereport/objectinspector/propertyItems/lrenumpropitem.cpp b/limereport/objectinspector/propertyItems/lrenumpropitem.cpp index d38331d..385b2d6 100644 --- a/limereport/objectinspector/propertyItems/lrenumpropitem.cpp +++ b/limereport/objectinspector/propertyItems/lrenumpropitem.cpp @@ -145,6 +145,8 @@ void EnumPropItem::translateEnumItemName() tr("Table"); tr("Millimeters"); tr("Inches"); + tr("Scale"); + tr("Split"); } void EnumPropItem::setPropertyEditorData(QWidget *propertyEditor, const QModelIndex &) const diff --git a/translations/limereport_ru.qm b/translations/limereport_ru.qm index c1d81cb6d1805cd682ed2e52293f42f979d5ea9c..18ad2b88ee1a568937de2e810ad9e816a30db67b 100644 GIT binary patch delta 5462 zcmXY#c|c9+8^@pLp5^ZM8rhd9Yh-P)FCk(qnJkG(GnkGZp7yY5%o(U+s|tSaa2#D0a?Ut>wss8ZjVys<7X*M?4$5lZ4#eX;Jz}F#LL8Ux00kjOFVsm!gGyder9{?mcAr;xe=#KB5BeM z;wn=WHaJ4koLHh4S4diOka%GPNvAC^eiem67aMs?7)fVweZ_N<3Ui2Fz9H%IIpU6| zNZ#0(xb`0)40x`9^n|FlR?i@J5|QU70lCb~I-`j=tB%(pb4|y_ahF8j)6Hg-+<`N%E zq7kc8iAq}8$j(<3E?7<@*5J9Edo(f%_q&BK)DCBG06 z`nDs#c{p#klKft|5$`=qe*aYv=kKI3OVf#jDK_#>Ed_+RK>v!Fbr+LpU#N(IH0`H^5lLyek&%21H4*WlhXyqUX7`~QPt7j9H)uh#D>Jr`G zqOc^`MsDOwk=j&ZcOQyAXYE7W=p>~~P9{E}r<5}#2%+wj{ScZ=@Ss0Hy8n*y#W3XD z5xTS*IlDiWuDK%5|N2J7jo`^mE9s7hinzmL@G)ql=R=>u#6DCW08K+~(?2a?!PX86 zSNG$p`(6?2_HZ>T4(KmmcIYDz_gl;@)*#fzy=ISOXgth~y?1ROdM2{};l;$;N3*3O ziMW%jaMb~x(YO=Qy#+icVis|$S{&2tD)HE(99y)T_+%(=nFpWOyU1G;qhYa~ygj!U zabN>3IMtq*^4V%Tm_LTk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ff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index d1ea17d..8d506fa 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1001,6 +1001,14 @@ p, li { white-space: pre-wrap; } Inches Дюймы + + Scale + Масштабировать + + + Split + Разделять на части + LimeReport::FlagsPropItem @@ -1873,7 +1881,7 @@ p, li { white-space: pre-wrap; } setPageSizeToPrinter - Оправитьпараметры страницы в принтер + Отправить параметры страницы в принтер fillInSecondPass @@ -1963,6 +1971,10 @@ p, li { white-space: pre-wrap; } geometryLocked Геометрия заблокирована + + printBehavior + Режим печати + LimeReport::RectPropItem