diff --git a/limereport/bands/lrsubdetailband.h b/limereport/bands/lrsubdetailband.h index c9b4c76..7c16d51 100644 --- a/limereport/bands/lrsubdetailband.h +++ b/limereport/bands/lrsubdetailband.h @@ -63,6 +63,7 @@ class SubDetailHeaderBand : public BandDesignIntf public: SubDetailHeaderBand(QObject* owner = 0, QGraphicsItem* parent=0); bool isUnique() const; + bool isHeader() const {return true;} protected: QColor bandColor() const; private: diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index f4a1cf9..05412cb 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -171,7 +171,7 @@ void BandDesignIntf::paint(QPainter *painter, const QStyleOptionGraphicsItem *op if (itemMode() & DesignMode){ painter->save(); QString bandText = objectName(); - if (parentBand()) bandText+=QLatin1String(" connected to ")+parentBand()->objectName(); + if (parentBand()) bandText+=tr(" connected to ")+parentBand()->objectName(); QFont font("Arial", 7 * Const::fontFACTOR, -1, true); QFontMetrics fontMetrics(font); @@ -229,9 +229,15 @@ void BandDesignIntf::setBandIndex(int value) m_bandIndex=value; } -void BandDesignIntf::changeBandIndex(int value) +void BandDesignIntf::changeBandIndex(int value, bool firstTime) { - int indexOffset = value - m_bandIndex; + int indexOffset; + + if (firstTime && bandHeader()) + value += 1; + + indexOffset = value - m_bandIndex; + foreach(BandDesignIntf* band, childBands()){ int newIndex = band->bandIndex()+indexOffset; band->changeBandIndex(newIndex); @@ -293,6 +299,16 @@ bool BandDesignIntf::isConnectedToBand(BandDesignIntf::BandsType bandType) const return false; } +int BandDesignIntf::maxChildIndex(BandDesignIntf::BandsType bandType) const{ + int curIndex = bandIndex(); + foreach(BandDesignIntf* childBand, childBands()){ + if ( (childBand->bandIndex() > bandIndex()) && (childBand->bandType() < bandType) ){ + curIndex = std::max(curIndex,childBand->maxChildIndex()); + } + } + return curIndex; +} + int BandDesignIntf::maxChildIndex(QSet ignoredBands) const{ int curIndex = bandIndex(); foreach(BandDesignIntf* childBand, childBands()){ diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index e588385..eab3d90 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -131,7 +131,7 @@ public: virtual QColor selectionColor() const; int bandIndex() const; void setBandIndex(int value); - void changeBandIndex(int value); + void changeBandIndex(int value, bool firstTime = false); void setBandType(BandsType value){m_bandType=value;} QString datasourceName(); @@ -151,8 +151,10 @@ public: bool isConnectedToBand(BandDesignIntf::BandsType bandType) const; int minChildIndex(BandsType bandType); + int maxChildIndex(BandDesignIntf::BandsType bandType) const; int maxChildIndex(QSet ignoredBands = QSet()) const; + BandDesignIntf* parentBand() const {return m_parentBand;} QList childBands() const{return m_childBands;} @@ -217,7 +219,6 @@ public: void setRepeatOnEachRow(bool repeatOnEachRow); QColor alternateBackgroundColor() const; void setAlternateBackgroundColor(const QColor &alternateBackgroundColor); - signals: void bandRendered(BandDesignIntf* band); protected: diff --git a/limereport/lrpageitemdesignintf.cpp b/limereport/lrpageitemdesignintf.cpp index 150df06..2e8de0b 100644 --- a/limereport/lrpageitemdesignintf.cpp +++ b/limereport/lrpageitemdesignintf.cpp @@ -202,10 +202,16 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe int bandIndex=-1; qSort(m_bands.begin(),m_bands.end(),bandSortBandLessThenByIndex); foreach(BandDesignIntf* band,m_bands){ - if ((band->bandType()==BandDesignIntf::GroupHeader)&&(band->bandType()>bandType)) break; - if ((band->bandType()<=bandType)){ - if (bandIndex<=band->bandIndex()) bandIndex=band->maxChildIndex()+1; - } + if ((band->bandType() == BandDesignIntf::GroupHeader) && ( band->bandType() > bandType)) break; + if ((band->bandType() <= bandType)){ + if (bandIndex <= band->bandIndex()) { + if (bandType != BandDesignIntf::Data){ + bandIndex=band->maxChildIndex(bandType)+1; + } else { + bandIndex=band->maxChildIndex()+1; + } + } + } else { increaseBandIndex = true; break;} } if (bandIndex==-1) { @@ -222,7 +228,7 @@ int PageItemDesignIntf::calcBandIndex(BandDesignIntf::BandsType bandType, BandDe switch (bandType) { case BandDesignIntf::SubDetailBand: - bandIndex = parentBand->maxChildIndex() + 1; + bandIndex = parentBand->maxChildIndex(bandType) + 1; increaseBandIndex = true; break; case BandDesignIntf::SubDetailHeader: @@ -364,7 +370,8 @@ void PageItemDesignIntf::relocateBands() if (!(itemMode() & DesignMode)){ while ( (bandIndex < m_bands.count()) && ((m_bands[bandIndex]->bandType() == BandDesignIntf::TearOffBand) || - (m_bands[bandIndex]->bandType() == BandDesignIntf::PageFooter)) + (m_bands[bandIndex]->bandType() == BandDesignIntf::PageFooter) || + m_bands[bandIndex]->bandType() == BandDesignIntf::ReportFooter ) ){ bandIndex++; } @@ -588,8 +595,9 @@ void PageItemDesignIntf::bandGeometryChanged(QObject* object, QRectF newGeometry } } if (curIndex != band->bandIndex()){ - bandToSwap->changeBandIndex(band->bandIndex()); - band->changeBandIndex(curIndex); + int swapIndex = bandToSwap->maxChildIndex(); + bandToSwap->changeBandIndex(band->bandIndex(),true); + band->changeBandIndex(swapIndex,true); } relocateBands(); diff --git a/limereport/objectinspector/lrobjectitemmodel.cpp b/limereport/objectinspector/lrobjectitemmodel.cpp index 260b584..080a7a2 100644 --- a/limereport/objectinspector/lrobjectitemmodel.cpp +++ b/limereport/objectinspector/lrobjectitemmodel.cpp @@ -124,7 +124,16 @@ void QObjectPropertyModel::translatePropertyName() tr("image"); tr("keepAspectRatio"); tr("columnsCount"); - + tr("useAlternateBackgroundColor"); + tr("printBeforePageHeader"); + tr("maxScalePercent"); + tr("printOnFirstPage"); + tr("printOnLastPage"); + tr("printAlways"); + tr("repeatOnEachRow"); + tr("condition"); + tr("groupFieldName"); + tr("keepGroupTogether"); } void QObjectPropertyModel::clearObjectsList() diff --git a/translations/limereport_ru.ts b/translations/limereport_ru.ts index ccc5d63..96d6602 100644 --- a/translations/limereport_ru.ts +++ b/translations/limereport_ru.ts @@ -1000,15 +1000,15 @@ p, li { white-space: pre-wrap; } condition - Условие + Условие keepGroupTogether - Сохранять группу вместе + Сохранять группу вместе groupFieldName - Столбец группы + Столбец группы geometry @@ -1228,7 +1228,7 @@ p, li { white-space: pre-wrap; } printAlways - Печатать всегда + Печатать всегда borderColor @@ -1302,6 +1302,30 @@ p, li { white-space: pre-wrap; } pdf417CodeWords + + useAlternateBackgroundColor + Использовать альтернативный цвет фона + + + printBeforePageHeader + Печатать перед заголовком страницы + + + maxScalePercent + Максимальный процент уменьшения + + + printOnFirstPage + Печатать на первой странице + + + printOnLastPage + Печатать на последней странице + + + repeatOnEachRow + Печатать на каждой странице + LimeReport::RectMMPropItem