diff --git a/common.pri b/common.pri index 3a6d8d3..140ddb7 100644 --- a/common.pri +++ b/common.pri @@ -141,7 +141,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 88 +LIMEREPORT_VERSION_RELEASE = 90 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/lrbanddesignintf.cpp b/limereport/lrbanddesignintf.cpp index fe7a5a6..cfa9eb0 100644 --- a/limereport/lrbanddesignintf.cpp +++ b/limereport/lrbanddesignintf.cpp @@ -643,18 +643,18 @@ 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()); - } - } +//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()); -} +// updateItemSize(dataManager,FirstPass,height()); +//} BaseDesignIntf* BandDesignIntf::cloneUpperPart(int height, QObject *owner, QGraphicsItem *parent) { @@ -1159,17 +1159,6 @@ void BandDesignIntf::updateItemSize(DataSourceManager* dataManager, RenderPass p BaseDesignIntf::updateItemSize(dataManager, pass, maxHeight); } -void BandDesignIntf::restoreItems() -{ - foreach(BaseDesignIntf* bi, childBaseItems()){ - ContentItemDesignIntf* ci = dynamic_cast(bi); - if (ci){ - ContentItemDesignIntf* pci = dynamic_cast(bi->patternItem()); - ci->setContent(pci->content()); - } - } -} - void BandDesignIntf::updateBandNameLabel() { if (m_bandNameLabel) m_bandNameLabel->updateLabel(bandTitle()); diff --git a/limereport/lrbanddesignintf.h b/limereport/lrbanddesignintf.h index 0def742..71d02e1 100644 --- a/limereport/lrbanddesignintf.h +++ b/limereport/lrbanddesignintf.h @@ -156,8 +156,7 @@ public: virtual bool isUnique() const; void setItemMode(BaseDesignIntf::ItemMode mode); void updateItemSize(DataSourceManager *dataManager, RenderPass pass=FirstPass, int maxHeight=0); - void restoreItems(); - void recalcItems(DataSourceManager* dataManager); +// void recalcItems(DataSourceManager* dataManager); void updateBandNameLabel(); virtual QColor selectionColor() const; diff --git a/limereport/lrreportrender.cpp b/limereport/lrreportrender.cpp index 60e2adc..3c885a5 100644 --- a/limereport/lrreportrender.cpp +++ b/limereport/lrreportrender.cpp @@ -359,20 +359,30 @@ void ReportRender::clearPageMap() m_renderedPages.clear(); } -bool ReportRender::containsGroupFunctions(BandDesignIntf *band){ - foreach(BaseDesignIntf* item,band->childBaseItems()){ - ContentItemDesignIntf* contentItem = dynamic_cast(item); - if (contentItem){ - QString content = contentItem->content(); - foreach(QString functionName, m_datasources->groupFunctionNames()){ + +bool checkContentItem(ContentItemDesignIntf* item, DataSourceManager* datasources){ + QString content = item->content(); + foreach(QString functionName, datasources->groupFunctionNames()){ #if QT_VERSION < 0x060000 - QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName)); - if (rx.indexIn(content)>=0){ - return true; - } + QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName)); + if (rx.indexIn(content)>=0){ + return true; + } #else - // TODO: Qt6 port + // TODO: Qt6 port #endif + } + return false; +} + +bool ReportRender::containsGroupFunctions(BaseDesignIntf *container){ + if (container){ + foreach (BaseDesignIntf* item, container->childBaseItems()) { + ContentItemDesignIntf* contentItem = dynamic_cast(item); + if (contentItem){ + if (checkContentItem(contentItem, m_datasources)) return true; + } else { + if (containsGroupFunctions(item)) return true; } } } @@ -846,11 +856,21 @@ BandDesignIntf* ReportRender::findRecalcableBand(BandDesignIntf* patternBand){ return 0; } +void restoreItemsWithGroupFunctions(BaseDesignIntf* container, DataSourceManager* datasources){ + foreach(BaseDesignIntf* bi, container->childBaseItems()){ + ContentItemDesignIntf* pci = dynamic_cast(bi->patternItem()); + if (pci && checkContentItem(pci, datasources)){ + ContentItemDesignIntf* ci = dynamic_cast(bi); + ci->setContent(pci->content()); + } else restoreItemsWithGroupFunctions(bi, datasources); + } +} + void ReportRender::recalcIfNeeded(BandDesignIntf* band){ BandDesignIntf* recalcBand = findRecalcableBand(band); if (recalcBand){ QString bandName = recalcBand->objectName(); - recalcBand->restoreItems(); + restoreItemsWithGroupFunctions(recalcBand, m_datasources); recalcBand->setObjectName(recalcBand->patternItem()->objectName()); replaceGroupsFunction(recalcBand); recalcBand->updateItemSize(datasources()); diff --git a/limereport/lrreportrender.h b/limereport/lrreportrender.h index 155b7a8..97f818b 100644 --- a/limereport/lrreportrender.h +++ b/limereport/lrreportrender.h @@ -139,7 +139,7 @@ private: qreal calcPageFooterHeight(PageItemDesignIntf* patternPage); qreal calcSlicePercent(qreal height); - bool containsGroupFunctions(BandDesignIntf* band); + bool containsGroupFunctions(BaseDesignIntf *container); void extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band); void extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band); void extractGroupFunctions(BandDesignIntf* band);