diff --git a/limereport/bands/lrdataband.h b/limereport/bands/lrdataband.h index eebba46..5e73d56 100644 --- a/limereport/bands/lrdataband.h +++ b/limereport/bands/lrdataband.h @@ -62,6 +62,7 @@ class DataHeaderBand : public BandDesignIntf Q_OBJECT Q_PROPERTY(bool reprintOnEachPage READ reprintOnEachPage WRITE setReprintOnEachPage) Q_PROPERTY(int columnsCount READ columnsCount WRITE setColumnsCount) + Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) public: DataHeaderBand(QObject* owner=0, QGraphicsItem* parent=0); bool isUnique() const {return false;} @@ -76,6 +77,7 @@ private: class DataFooterBand : public BandDesignIntf { Q_OBJECT + Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) public: DataFooterBand(QObject* owner=0, QGraphicsItem* parent=0); bool isUnique() const {return false;} diff --git a/limereport/bands/lrsubdetailband.cpp b/limereport/bands/lrsubdetailband.cpp index 2d5a0e7..baaa936 100644 --- a/limereport/bands/lrsubdetailband.cpp +++ b/limereport/bands/lrsubdetailband.cpp @@ -106,7 +106,7 @@ QColor SubDetailBand::bandColor() const //SubDetailHeaderBand SubDetailHeaderBand::SubDetailHeaderBand(QObject *owner, QGraphicsItem *parent) - :BandDesignIntf(BandDesignIntf::SubDetailHeader,xmlTagHeader,owner,parent), m_printAlways(false) + :BandDesignIntf(BandDesignIntf::SubDetailHeader,xmlTagHeader,owner,parent) { setBandTypeText(tr("SubDetailHeader")); setMarkerColor(bandColor()); @@ -130,7 +130,7 @@ BaseDesignIntf *SubDetailHeaderBand::createSameTypeItem(QObject *owner, QGraphic //SubDetailFooterBand SubDetailFooterBand::SubDetailFooterBand(QObject *owner, QGraphicsItem *parent) - : BandDesignIntf(BandDesignIntf::SubDetailFooter,xmlTagFooter,owner,parent), m_printAlways(false) + : BandDesignIntf(BandDesignIntf::SubDetailFooter,xmlTagFooter,owner,parent) { setMarkerColor(bandColor()); } diff --git a/limereport/bands/lrsubdetailband.h b/limereport/bands/lrsubdetailband.h index f93f8e1..ab0340f 100644 --- a/limereport/bands/lrsubdetailband.h +++ b/limereport/bands/lrsubdetailband.h @@ -59,14 +59,10 @@ class SubDetailHeaderBand : public BandDesignIntf public: SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0); bool isUnique() const; - void setPrintAlways(bool value){m_printAlways=value;} - bool printAlways(){return m_printAlways;} protected: QColor bandColor() const; private: BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); -private: - bool m_printAlways; }; class SubDetailFooterBand : public BandDesignIntf @@ -75,8 +71,6 @@ class SubDetailFooterBand : public BandDesignIntf Q_PROPERTY(bool printAlways READ printAlways() WRITE setPrintAlways()) public: SubDetailFooterBand(QObject* owner = 0, QGraphicsItem* parent=0); - void setPrintAlways(bool value){m_printAlways=value;} - bool printAlways(){return m_printAlways;} virtual bool isUnique() const; bool isFooter() const{return true;} protected: @@ -84,7 +78,6 @@ protected: private: BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0); private: - bool m_printAlways; }; } diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index bdbd593..8788de8 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -143,7 +143,8 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q m_columnsFillDirection(Horizontal), m_reprintOnEachPage(false), m_startNewPage(false), - m_startFromNewPage(false) + m_startFromNewPage(false), + m_printAlways(false) { setPosibleResizeDirectionFlags(ResizeBottom); setPosibleMoveFlags(TopBotom); @@ -716,6 +717,16 @@ void BandDesignIntf::childBandDeleted(QObject *band) m_childBands.removeAt(m_childBands.indexOf(reinterpret_cast(band))); } +bool BandDesignIntf::printAlways() const +{ + return m_printAlways; +} + +void BandDesignIntf::setPrintAlways(bool printAlways) +{ + m_printAlways = printAlways; +} + bool BandDesignIntf::startFromNewPage() const { return m_startFromNewPage; diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 9410fc6..ea41965 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -83,6 +83,7 @@ private: struct ItemSortContainer; typedef QSharedPointer< ItemSortContainer > PItemSortContainer; + class BandDesignIntf : public BaseDesignIntf { Q_OBJECT @@ -210,6 +211,9 @@ public: bool startFromNewPage() const; void setStartFromNewPage(bool startFromNewPage); bool canContainChildren(){ return true;} + bool printAlways() const; + void setPrintAlways(bool printAlways); + signals: void bandRendered(BandDesignIntf* band); protected: @@ -260,6 +264,7 @@ private: bool m_reprintOnEachPage; bool m_startNewPage; bool m_startFromNewPage; + bool m_printAlways; }; class DataBandDesignIntf : public BandDesignIntf{ diff --git a/limereport/lrbasedesignintf.cpp b/limereport/lrbasedesignintf.cpp index 1a9f47b..5353440 100644 --- a/limereport/lrbasedesignintf.cpp +++ b/limereport/lrbasedesignintf.cpp @@ -176,6 +176,12 @@ void BaseDesignIntf::setWidth(qreal width) updateItemAlign(); } +QString BaseDesignIntf::setItemWidth(qreal width) +{ + setWidth(width * mmFactor()); + return QString(); +} + qreal BaseDesignIntf::height() const { return rect().height(); @@ -191,6 +197,12 @@ void BaseDesignIntf::setHeight(qreal height) setGeometry(QRectF(rect().x(), rect().y(), rect().width(), height)); } +QString BaseDesignIntf::setItemHeight(qreal height) +{ + setHeight(height * mmFactor()); + return QString(); +} + QFont BaseDesignIntf::transformToSceneFont(const QFont& value) const { QFont f = value; diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 440a53e..bb93d23 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -248,6 +248,9 @@ public: virtual bool canContainChildren(){ return false;} ReportSettings* reportSettings() const; void setReportSettings(ReportSettings *reportSettings); + + Q_INVOKABLE QString setItemWidth(qreal width); + Q_INVOKABLE QString setItemHeight(qreal height); protected: //ICollectionContainer diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 12f6e42..17e880f 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -404,12 +404,18 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) if (dataBand && !dataBand->datasourceName().isEmpty()) bandDatasource = datasources()->dataSource(dataBand->datasourceName()); + BandDesignIntf* header = dataBand->bandHeader(); + BandDesignIntf* footer = dataBand->bandFooter(); + + if (header && header->printAlways()) renderBand(header); + if(bandDatasource && !bandDatasource->eof() && !m_renderCanceled){ QString varName = QLatin1String("line_")+dataBand->objectName().toLower(); datasources()->setReportVariable(varName,1); - renderBand(dataBand->bandHeader()); + if (header && !header->printAlways()) + renderBand(header); if (dataBand->bandHeader() && dataBand->bandHeader()->reprintOnEachPage()) m_reprintableBands.append(dataBand->bandHeader()); @@ -456,11 +462,17 @@ void ReportRender::renderDataBand(BandDesignIntf *dataBand) renderGroupFooter(dataBand); - renderBand(dataBand->bandFooter(),StartNewPageAsNeeded); + if (footer && !footer->printAlways()) + renderBand(footer,StartNewPageAsNeeded); + datasources()->deleteVariable(varName); + } else if (bandDatasource==0) { renderBand(dataBand,StartNewPageAsNeeded); } + + if (footer && footer->printAlways()) + renderBand(footer,StartNewPageAsNeeded); } void ReportRender::renderPageHeader(PageItemDesignIntf *patternPage)