diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index 321b729..ad13cad 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -198,12 +198,6 @@ BandDesignIntf::BandDesignIntf(BandsType bandType, const QString &xmlTypeName, Q BandDesignIntf::~BandDesignIntf() { -// if (itemMode()&DesignMode){ -// foreach(BandDesignIntf* band,childBands()) { -// removeChildBand(band); -// delete band; -// } -// } delete m_bandMarker; delete m_bandNameLabel; } @@ -642,19 +636,6 @@ void BandDesignIntf::processPopUpAction(QAction *action) ItemsContainerDesignInft::processPopUpAction(action); } -//void BandDesignIntf::recalcItems(DataSourceManager* dataManager) -//{ -// foreach(BaseDesignIntf* bi, childBaseItems()){ -// ContentItemDesignIntf* ci = dynamic_cast(bi); -// if (bi){ -// ContentItemDesignIntf* pci = dynamic_cast(bi->patternItem()); -// ci->setContent(pci->content()); -// } -// } - -// updateItemSize(dataManager,FirstPass,height()); -//} - BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) { int maxBottom = 0; @@ -921,9 +902,9 @@ void BandDesignIntf::setAlternateBackgroundColor(const QColor &alternateBackgrou } } -qreal BandDesignIntf::bottomSpace() const +qreal BandDesignIntf::bottomSpace() { - return height()-findMaxBottom(); + return m_bottomSpace; } void BandDesignIntf::slotPropertyObjectNameChanged(const QString &, const QString& newName) @@ -957,14 +938,9 @@ void BandDesignIntf::setKeepTopSpace(bool value) } } -int BandDesignIntf::bootomSpace() const +void BandDesignIntf::setBottomSpace(qreal bottomSpace) { - return m_bottomSpace; -} - -void BandDesignIntf::setBootomSpace(int bootomSpace) -{ - m_bottomSpace = bootomSpace; + m_bottomSpace = bottomSpace; } bool BandDesignIntf::repeatOnEachRow() const @@ -1137,7 +1113,6 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p spaceBorder += borderLineSize() + 2; } - spaceBorder += m_bottomSpace; restoreLinks(); snapshotItemsLayout(); @@ -1163,6 +1138,15 @@ void BandDesignIntf::updateBandNameLabel() if (m_bandNameLabel) m_bandNameLabel->updateLabel(bandTitle()); } +void BandDesignIntf::initFromItem(BaseDesignIntf *source) +{ + ItemsContainerDesignInft::initFromItem(source); + BandDesignIntf* source_band = dynamic_cast(source); + if (source_band){ + this->setBottomSpace(source_band->bottomSpace()); + } +} + QColor BandDesignIntf::selectionColor() const { return Qt::yellow; diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 8960eeb..584260f 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -156,8 +156,8 @@ public: virtual bool isUnique() const; void setItemMode(BaseDesignIntf::ItemMode mode); void updateItemSize(DataSourceManager *dataManager, RenderPass pass=FirstPass, int maxHeight=0); -// void recalcItems(DataSourceManager* dataManager); void updateBandNameLabel(); + void initFromItem(BaseDesignIntf* source); virtual QColor selectionColor() const; int bandIndex() const; @@ -261,11 +261,10 @@ public: void setAlternateBackgroundColor(const QColor &alternateBackgroundColor); bool useAlternateBackgroundColor() const; void setUseAlternateBackgroundColor(bool useAlternateBackgroundColor); - qreal bottomSpace() const; + qreal bottomSpace(); + void setBottomSpace(qreal bottomSpace); void setBackgroundModeProperty(BGMode value); void setBackgroundOpacity(int value); - int bootomSpace() const; - void setBootomSpace(int bootomSpace); void updateBandMarkerGeometry(); int shiftItems() const; void setShiftItems(int shiftItems); diff --git a/limereport/lrbasedesignintf.h b/limereport/lrbasedesignintf.h index 4314de9..1c9d828 100644 --- a/limereport/lrbasedesignintf.h +++ b/limereport/lrbasedesignintf.h @@ -265,7 +265,7 @@ public: virtual BaseDesignIntf* cloneItem(LimeReport::BaseDesignIntf::ItemMode mode, QObject* owner=0, QGraphicsItem* parent=0); virtual BaseDesignIntf* cloneItemWOChild(LimeReport::BaseDesignIntf::ItemMode mode, QObject* owner=0, QGraphicsItem* parent=0); virtual BaseDesignIntf* createSameTypeItem(QObject* owner=0, QGraphicsItem* parent=0) = 0; - void initFromItem(BaseDesignIntf* source); + virtual void initFromItem(BaseDesignIntf* source); virtual bool canBeSplitted(int height) const; virtual qreal minHeight() const {return 0;} diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index d412b19..9551811 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -596,7 +596,7 @@ BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesign bandClone = renderData(patternBand); } - if (isLast) bandClone->setBootomSpace(1); + if (isLast) bandClone->setBottomSpace(1); if (mode == ForcedStartPage){ savePage(); @@ -1341,9 +1341,9 @@ void ReportRender::createTOCMarker(bool startNewRange) BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, int height, BandDesignIntf* patternBand) { - int sliceHeight = height; - BandDesignIntf* upperBandPart = dynamic_cast(band->cloneUpperPart(sliceHeight)); - BandDesignIntf* bottomBandPart = dynamic_cast(band->cloneBottomPart(sliceHeight)); + //int sliceHeight = height; + BandDesignIntf* upperBandPart = dynamic_cast(band->cloneUpperPart(height)); + BandDesignIntf* bottomBandPart = dynamic_cast(band->cloneBottomPart(height)); if (!bottomBandPart->isEmpty()){ if (patternBand->keepFooterTogether()) closeFooterGroup(patternBand); @@ -1351,6 +1351,7 @@ BandDesignIntf *ReportRender::saveUppperPartReturnBottom(BandDesignIntf *band, i bottomBandPart->copyBookmarks(band); } if (!upperBandPart->isEmpty()){ + upperBandPart->setBottomSpace(0); upperBandPart->updateItemSize(m_datasources, FirstPass, height); registerBand(upperBandPart); upperBandPart->copyBookmarks(band); @@ -1397,6 +1398,7 @@ BandDesignIntf *ReportRender::renderData(BandDesignIntf *patternBand, bool emitB } emit(patternBand->preparedForRender()); + bandClone->setBottomSpace(patternBand->height() - patternBand->findMaxBottom()); bandClone->updateItemSize(m_datasources); //m_scriptEngineContext->baseDesignIntfToScript(bandClone);