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 c1d81cb..18ad2b8 100644 Binary files a/translations/limereport_ru.qm and b/translations/limereport_ru.qm differ diff --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