mirror of
				https://github.com/fralx/LimeReport.git
				synced 2025-11-04 07:01:26 +03:00 
			
		
		
		
	Merge branch 'master' into develop
# Conflicts: # limereport/lrreportrender.cpp # limereport/lrreportrender.h
This commit is contained in:
		@@ -289,11 +289,24 @@ void ReportRender::clearPageMap()
 | 
			
		||||
    m_renderedPages.clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ReportRender::extractGroupsFunction(BandDesignIntf *band)
 | 
			
		||||
{
 | 
			
		||||
bool ReportRender::containsGroupFunctions(BandDesignIntf *band){
 | 
			
		||||
    foreach(BaseDesignIntf* item,band->childBaseItems()){
 | 
			
		||||
        ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
 | 
			
		||||
        if (contentItem&&(contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}")))){
 | 
			
		||||
        if (contentItem){
 | 
			
		||||
            QString content = contentItem->content();
 | 
			
		||||
            foreach(QString functionName, m_datasources->groupFunctionNames()){
 | 
			
		||||
                QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
 | 
			
		||||
                if (rx.indexIn(content)>=0){
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ReportRender::extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band){
 | 
			
		||||
    if ( contentItem && contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}"))){
 | 
			
		||||
        foreach(const QString &functionName, m_datasources->groupFunctionNames()){
 | 
			
		||||
            QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
 | 
			
		||||
            QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
 | 
			
		||||
@@ -323,28 +336,23 @@ void ReportRender::extractGroupsFunction(BandDesignIntf *band)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool ReportRender::containsGroupsFunction(BandDesignIntf *band){
 | 
			
		||||
    foreach(BaseDesignIntf* item,band->childBaseItems()){
 | 
			
		||||
void ReportRender::extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band){
 | 
			
		||||
    foreach (BaseDesignIntf* item, baseItem->childBaseItems()) {
 | 
			
		||||
        ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
 | 
			
		||||
        if (contentItem){
 | 
			
		||||
            QString content = contentItem->content();
 | 
			
		||||
            foreach(QString functionName, m_datasources->groupFunctionNames()){
 | 
			
		||||
                QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
 | 
			
		||||
                if (rx.indexIn(content)>=0){
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
        if (contentItem) extractGroupFuntionsFromItem(contentItem, band);
 | 
			
		||||
        else extractGroupFunctionsFromContainer(item, band);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ReportRender::extractGroupFunctions(BandDesignIntf *band)
 | 
			
		||||
{
 | 
			
		||||
    foreach(BaseDesignIntf* item,band->childBaseItems()){
 | 
			
		||||
        ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
 | 
			
		||||
    extractGroupFunctionsFromContainer(band, band);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void ReportRender::replaceGroupFunctionsInItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band){
 | 
			
		||||
    if (contentItem){
 | 
			
		||||
        QString content = contentItem->content();
 | 
			
		||||
        foreach(const QString &functionName, m_datasources->groupFunctionNames()){
 | 
			
		||||
@@ -364,6 +372,19 @@ void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ReportRender::replaceGroupFunctionsInContainer(BaseDesignIntf* baseItem, BandDesignIntf* band)
 | 
			
		||||
{
 | 
			
		||||
    foreach(BaseDesignIntf* item, baseItem->childBaseItems()){
 | 
			
		||||
        ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
 | 
			
		||||
        if (contentItem) replaceGroupFunctionsInItem(contentItem, band);
 | 
			
		||||
        else replaceGroupFunctionsInContainer(item, band);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ReportRender::replaceGroupsFunction(BandDesignIntf *band)
 | 
			
		||||
{
 | 
			
		||||
    replaceGroupFunctionsInContainer(band, band);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BandDesignIntf* ReportRender::renderBand(BandDesignIntf *patternBand, BandDesignIntf* bandData, ReportRender::DataRenderMode mode, bool isLast)
 | 
			
		||||
@@ -681,7 +702,7 @@ void ReportRender::renderDataHeader(BandDesignIntf *header)
 | 
			
		||||
{
 | 
			
		||||
    recalcIfNeeded(header);
 | 
			
		||||
    BandDesignIntf* renderedHeader = renderBand(header, 0);
 | 
			
		||||
    if (containsGroupsFunction(header))
 | 
			
		||||
    if (containsGroupFunctions(header))
 | 
			
		||||
        m_recalcBands.append(renderedHeader);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -725,7 +746,7 @@ void ReportRender::renderGroupHeader(BandDesignIntf *parentBand, IDataSource* da
 | 
			
		||||
            } else {
 | 
			
		||||
                renderedHeader = renderBand(band, 0, StartNewPageAsNeeded);
 | 
			
		||||
            }
 | 
			
		||||
            if (containsGroupsFunction(band))
 | 
			
		||||
            if (containsGroupFunctions(band))
 | 
			
		||||
                m_recalcBands.append(renderedHeader);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -764,11 +785,11 @@ void ReportRender::initGroups()
 | 
			
		||||
{
 | 
			
		||||
    m_datasources->clearGroupFunction();
 | 
			
		||||
    foreach(BandDesignIntf* band, m_patternPageItem->childBands()){
 | 
			
		||||
        if (band->isFooter()) extractGroupsFunction(band);
 | 
			
		||||
        if (band->isFooter()) extractGroupFunctions(band);
 | 
			
		||||
        if (band->isHeader()){
 | 
			
		||||
            IGroupBand* gb = dynamic_cast<IGroupBand*>(band);
 | 
			
		||||
            if (gb) gb->closeGroup();
 | 
			
		||||
            extractGroupsFunction(band);
 | 
			
		||||
            extractGroupFunctions(band);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,7 @@ namespace LimeReport{
 | 
			
		||||
 | 
			
		||||
class PageDesignIntf;
 | 
			
		||||
class BandDesignIntf;
 | 
			
		||||
class ContentItemDesignIntf;
 | 
			
		||||
 | 
			
		||||
class GroupBandsHolder: public QList<BandDesignIntf*>{
 | 
			
		||||
public:
 | 
			
		||||
@@ -112,8 +113,12 @@ private:
 | 
			
		||||
    qreal   calcPageFooterHeight(PageItemDesignIntf* patternPage);
 | 
			
		||||
    qreal   calcSlicePercent(qreal height);
 | 
			
		||||
 | 
			
		||||
    bool    containsGroupsFunction(BandDesignIntf* band);
 | 
			
		||||
    void    extractGroupsFunction(BandDesignIntf* band);
 | 
			
		||||
    bool	containsGroupFunctions(BandDesignIntf* band);
 | 
			
		||||
    void	extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
 | 
			
		||||
    void    extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
 | 
			
		||||
    void    extractGroupFunctions(BandDesignIntf* band);
 | 
			
		||||
    void    replaceGroupFunctionsInItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band);
 | 
			
		||||
    void    replaceGroupFunctionsInContainer(BaseDesignIntf* baseItem, BandDesignIntf* band);
 | 
			
		||||
    void    replaceGroupsFunction(BandDesignIntf* band);
 | 
			
		||||
 | 
			
		||||
    BandDesignIntf *findRecalcableBand(BandDesignIntf *patternBand);
 | 
			
		||||
@@ -183,6 +188,7 @@ private:
 | 
			
		||||
    QVector<BandDesignIntf*> m_columnedBandItems;
 | 
			
		||||
    unsigned long long m_curentNameIndex;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
} // namespace LimeReport
 | 
			
		||||
#endif // LRREPORTRENDER_H
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user