2019-12-15 09:23:27 +03:00
|
|
|
|
/***************************************************************************
|
2016-02-17 10:11:00 +03:00
|
|
|
|
* This file is part of the Lime Report project *
|
2021-08-18 20:21:36 +03:00
|
|
|
|
* Copyright (C) 2021 by Alexander Arin *
|
2016-02-17 10:11:00 +03:00
|
|
|
|
* arin_a@bk.ru *
|
|
|
|
|
* *
|
|
|
|
|
** GNU General Public License Usage **
|
|
|
|
|
* *
|
|
|
|
|
* This library is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or *
|
|
|
|
|
* (at your option) any later version. *
|
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
* *
|
|
|
|
|
** GNU Lesser General Public License **
|
|
|
|
|
* *
|
|
|
|
|
* This library is free software: you can redistribute it and/or modify *
|
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
|
* published by the Free Software Foundation, either version 3 of the *
|
|
|
|
|
* License, or (at your option) any later version. *
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
|
* License along with this library. *
|
|
|
|
|
* If not, see <http://www.gnu.org/licenses/>. *
|
|
|
|
|
* *
|
|
|
|
|
* This library is distributed in the hope that it will be useful, *
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
#include "lrreportrender.h"
|
2024-09-04 17:31:16 +03:00
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
#include "lrbanddesignintf.h"
|
2024-09-04 17:31:16 +03:00
|
|
|
|
#include "lrglobal.h"
|
2016-02-17 10:11:00 +03:00
|
|
|
|
#include "lritemdesignintf.h"
|
2024-09-04 17:31:16 +03:00
|
|
|
|
#include "lrpagedesignintf.h"
|
2016-02-17 10:11:00 +03:00
|
|
|
|
#include "lrscriptenginemanager.h"
|
|
|
|
|
#include "serializators/lrxmlreader.h"
|
|
|
|
|
#include "serializators/lrxmlwriter.h"
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
|
|
#include <stdexcept>
|
|
|
|
|
|
|
|
|
|
namespace LimeReport {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::initColumns()
|
|
|
|
|
{
|
2016-02-17 10:28:27 +03:00
|
|
|
|
m_maxHeightByColumn.clear();
|
|
|
|
|
m_currentStartDataPos.clear();
|
|
|
|
|
m_maxHeightByColumn.append(0);
|
|
|
|
|
m_currentStartDataPos.append(0);
|
2018-06-07 20:43:05 +03:00
|
|
|
|
m_currentColumn = 0;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
|
bool ReportRender::isNeedToRearrangeColumnsItems()
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_columnedBandItems.size() <= 1)
|
|
|
|
|
return false;
|
|
|
|
|
if (m_columnedBandItems[0]->columnsFillDirection() != BandDesignIntf::VerticalUniform)
|
2016-02-17 10:39:17 +03:00
|
|
|
|
return false;
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
int avg = m_columnedBandItems.size() / m_columnedBandItems[0]->columnsCount();
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
for (int i = 0; i < m_maxHeightByColumn.size(); ++i) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
qreal maxHeight = 0;
|
|
|
|
|
int maxHeightColumn = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_maxHeightByColumn[i] > maxHeight) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
maxHeight = m_maxHeightByColumn[i];
|
|
|
|
|
maxHeightColumn = i;
|
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (maxHeightColumn > 0 && columnItemsCount(maxHeightColumn) < avg
|
|
|
|
|
&& maxHeight > lastColumnItem(maxHeightColumn - 1)->height()) {
|
|
|
|
|
return true;
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
BandDesignIntf* ReportRender::lastColumnItem(int columnIndex)
|
2016-02-17 10:39:17 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (columnIndex < 0)
|
|
|
|
|
return 0;
|
|
|
|
|
for (int i = 0; i < m_columnedBandItems.size(); ++i) {
|
|
|
|
|
if (m_columnedBandItems[i]->columnIndex() > columnIndex)
|
|
|
|
|
return m_columnedBandItems[i - 1];
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
return m_columnedBandItems.last();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ReportRender::rearrangeColumnsItems()
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (isNeedToRearrangeColumnsItems()) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
qreal startHeight = columnHeigth(0);
|
2018-07-20 14:04:53 +03:00
|
|
|
|
int avg = m_columnedBandItems.size() / m_columnedBandItems[0]->columnsCount();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
for (int i = 1; i < m_columnedBandItems[0]->columnsCount(); ++i) {
|
|
|
|
|
if (columnItemsCount(i) < avg) {
|
|
|
|
|
int getCount
|
|
|
|
|
= avg * (m_columnedBandItems[0]->columnsCount() - i) - columnItemsCount(i);
|
|
|
|
|
for (int j = 0; j < getCount; ++j) {
|
|
|
|
|
BandDesignIntf* band = lastColumnItem(i - 1);
|
|
|
|
|
band->setPos(band->pos().x() + band->width(),
|
|
|
|
|
m_columnedBandItems[0]->pos().y());
|
|
|
|
|
band->setColumnIndex(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
m_renderPageItem->relocateBands();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_maxHeightByColumn[0] += startHeight - maxColumnHeight();
|
|
|
|
|
m_currentStartDataPos[0] -= startHeight - maxColumnHeight();
|
2016-02-17 10:39:17 +03:00
|
|
|
|
m_columnedBandItems.clear();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ReportRender::columnItemsCount(int columnIndex)
|
|
|
|
|
{
|
|
|
|
|
int result = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, m_columnedBandItems) {
|
|
|
|
|
if (band->columnIndex() == columnIndex)
|
2016-02-17 10:39:17 +03:00
|
|
|
|
++result;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->columnIndex() > columnIndex)
|
|
|
|
|
break;
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qreal ReportRender::columnHeigth(int columnIndex)
|
|
|
|
|
{
|
|
|
|
|
qreal result = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
for (int i = 0; i < m_columnedBandItems.size(); ++i) {
|
|
|
|
|
if (m_columnedBandItems[i]->columnIndex() == columnIndex)
|
|
|
|
|
result += m_columnedBandItems[i]->height();
|
|
|
|
|
if (m_columnedBandItems[i]->columnIndex() > columnIndex)
|
|
|
|
|
break;
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qreal ReportRender::maxColumnHeight()
|
|
|
|
|
{
|
|
|
|
|
qreal result = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
for (int i = 0; i < m_columnedBandItems[0]->columnsCount(); ++i) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
qreal curColumnHeight = columnHeigth(i);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (curColumnHeight > result)
|
|
|
|
|
result = curColumnHeight;
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renameChildItems(BaseDesignIntf* item)
|
|
|
|
|
{
|
|
|
|
|
foreach (BaseDesignIntf* child, item->childBaseItems()) {
|
|
|
|
|
if (!child->childBaseItems().isEmpty())
|
|
|
|
|
renameChildItems(child);
|
|
|
|
|
child->setObjectName(child->metaObject()->className()
|
|
|
|
|
+ QString::number(++m_currentNameIndex));
|
2016-05-26 22:21:42 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
ReportRender::ReportRender(QObject* parent):
|
|
|
|
|
QObject(parent),
|
|
|
|
|
m_renderPageItem(0),
|
|
|
|
|
m_pageCount(0),
|
|
|
|
|
m_lastRenderedHeader(0),
|
|
|
|
|
m_lastDataBand(0),
|
|
|
|
|
m_lastRenderedFooter(0),
|
|
|
|
|
m_lastRenderedBand(0),
|
|
|
|
|
m_currentColumn(0),
|
|
|
|
|
m_newPageStarted(false),
|
2020-04-17 12:28:59 +03:00
|
|
|
|
m_lostHeadersMoved(false)
|
2016-02-17 10:28:27 +03:00
|
|
|
|
{
|
|
|
|
|
initColumns();
|
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::setDatasources(DataSourceManager* value)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_datasources = value;
|
2016-09-16 01:59:56 +03:00
|
|
|
|
initVariables();
|
|
|
|
|
resetPageNumber(BandReset);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-10 18:05:18 +03:00
|
|
|
|
void ReportRender::setScriptContext(ScriptEngineContext* scriptContext)
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_scriptEngineContext = scriptContext;
|
2016-06-10 18:05:18 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::initDatasources()
|
|
|
|
|
{
|
|
|
|
|
try {
|
2016-02-17 10:18:19 +03:00
|
|
|
|
datasources()->setAllDatasourcesToFirst();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} catch (ReportError& exception) {
|
|
|
|
|
// TODO possible should thow exeption
|
|
|
|
|
QMessageBox::critical(0, tr("Error"), exception.what());
|
2016-02-17 10:18:19 +03:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::initDatasource(const QString& name)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
if (datasources()->containsDatasource(name)) {
|
2016-10-04 03:21:22 +03:00
|
|
|
|
IDataSource* ds = datasources()->dataSource(name);
|
|
|
|
|
if (ds)
|
|
|
|
|
ds->first();
|
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} catch (ReportError& exception) {
|
|
|
|
|
QMessageBox::critical(0, tr("Error"), exception.what());
|
2016-09-18 11:05:46 +03:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::analizeItem(ContentItemDesignIntf* contentItem, BandDesignIntf* band)
|
|
|
|
|
{
|
2020-03-19 20:09:35 +03:00
|
|
|
|
Q_UNUSED(band)
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (contentItem) {
|
2019-10-08 13:51:10 +03:00
|
|
|
|
QString content = contentItem->content();
|
|
|
|
|
QVector<QString> functions;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (const QString& functionName, m_datasources->groupFunctionNames()) {
|
2022-07-16 02:33:39 +03:00
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 1)
|
|
|
|
|
QRegularExpression rx = getGroupFunctionRegEx(functionName);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (content.indexOf(rx) >= 0) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
functions.append(functionName);
|
|
|
|
|
}
|
|
|
|
|
#else
|
2019-10-08 13:51:10 +03:00
|
|
|
|
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
|
|
|
|
|
rx.setMinimal(true);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (rx.indexIn(content) >= 0) {
|
2019-10-08 13:51:10 +03:00
|
|
|
|
functions.append(functionName);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
}
|
2021-08-24 10:22:30 +03:00
|
|
|
|
#endif
|
2019-10-08 13:51:10 +03:00
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (functions.size() > 0)
|
2019-10-08 13:51:10 +03:00
|
|
|
|
m_groupfunctionItems.insert(contentItem->patternName(), functions);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::analizeContainer(BaseDesignIntf* item, BandDesignIntf* band)
|
|
|
|
|
{
|
|
|
|
|
if (item) {
|
|
|
|
|
foreach (BaseDesignIntf* child, item->childBaseItems()) {
|
2021-04-12 20:22:34 +03:00
|
|
|
|
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(child);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (contentItem)
|
|
|
|
|
analizeItem(contentItem, band);
|
|
|
|
|
else
|
|
|
|
|
analizeContainer(child, band);
|
2021-04-12 20:22:34 +03:00
|
|
|
|
}
|
2019-10-08 13:51:10 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::analizePage(PageItemDesignIntf* patternPage)
|
|
|
|
|
{
|
2019-10-08 14:18:59 +03:00
|
|
|
|
m_groupfunctionItems.clear();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, patternPage->bands()) {
|
|
|
|
|
if (band->isFooter() || band->isHeader()) {
|
|
|
|
|
analizeContainer(band, band);
|
2019-10-08 13:51:10 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderPage(PageItemDesignIntf* patternPage, bool isTOC, bool /*isFirst*/,
|
|
|
|
|
bool /*resetPageNumbers*/)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2018-06-07 20:43:05 +03:00
|
|
|
|
m_currentNameIndex = 0;
|
2018-03-07 19:54:57 +03:00
|
|
|
|
m_patternPageItem = patternPage;
|
2019-01-17 00:26:27 +03:00
|
|
|
|
|
2019-10-08 13:51:10 +03:00
|
|
|
|
analizePage(patternPage);
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_patternPageItem->resetPageNumber() && m_pageCount > 0 && !isTOC) {
|
2016-09-16 01:59:56 +03:00
|
|
|
|
resetPageNumber(PageReset);
|
|
|
|
|
}
|
2017-04-20 23:34:32 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_patternPageItem->resetPageNumber() && !isTOC && m_pageCount == 0) {
|
2019-01-16 03:58:54 +03:00
|
|
|
|
m_pagesRanges.startNewRange();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
m_renderCanceled = false;
|
|
|
|
|
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
|
2016-03-14 16:14:04 +03:00
|
|
|
|
m_reportFooterHeight = 0;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
if (reportFooter)
|
|
|
|
|
m_reportFooterHeight = reportFooter->height();
|
2017-04-20 23:34:32 +03:00
|
|
|
|
|
2016-09-28 01:24:55 +03:00
|
|
|
|
initGroups();
|
2017-04-20 23:34:32 +03:00
|
|
|
|
clearPageMap();
|
2016-12-20 01:33:58 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
try {
|
2017-04-20 23:34:32 +03:00
|
|
|
|
datasources()->setAllDatasourcesToFirst();
|
|
|
|
|
datasources()->clearGroupFuntionsExpressions();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} catch (ReportError& exception) {
|
|
|
|
|
// TODO possible should thow exeption
|
|
|
|
|
QMessageBox::critical(0, tr("Error"), exception.what());
|
2017-04-20 23:34:32 +03:00
|
|
|
|
return;
|
2016-12-20 01:33:58 +03:00
|
|
|
|
}
|
|
|
|
|
|
2017-04-20 23:34:32 +03:00
|
|
|
|
clearPageMap();
|
|
|
|
|
startNewPage(true);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2017-04-20 23:34:32 +03:00
|
|
|
|
renderReportHeader(m_patternPageItem, AfterPageHeader);
|
2017-02-04 22:15:44 +03:00
|
|
|
|
|
2017-04-20 23:34:32 +03:00
|
|
|
|
BandDesignIntf* lastRenderedBand = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
for (int i = 0; i < m_patternPageItem->dataBandCount() && !m_renderCanceled; i++) {
|
2017-04-20 23:34:32 +03:00
|
|
|
|
lastRenderedBand = m_patternPageItem->dataBandAt(i);
|
|
|
|
|
initDatasource(lastRenderedBand->datasourceName());
|
|
|
|
|
renderDataBand(lastRenderedBand);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (i < m_patternPageItem->dataBandCount() - 1)
|
|
|
|
|
closeFooterGroup(lastRenderedBand);
|
2017-04-20 23:34:32 +03:00
|
|
|
|
}
|
2016-09-16 01:59:56 +03:00
|
|
|
|
|
2017-04-20 23:34:32 +03:00
|
|
|
|
if (reportFooter)
|
|
|
|
|
renderBand(reportFooter, 0, StartNewPageAsNeeded);
|
|
|
|
|
if (lastRenderedBand && lastRenderedBand->keepFooterTogether())
|
|
|
|
|
closeFooterGroup(lastRenderedBand);
|
2017-04-09 01:41:42 +03:00
|
|
|
|
|
2017-04-20 23:34:32 +03:00
|
|
|
|
BandDesignIntf* tearOffBand = m_patternPageItem->bandByType(BandDesignIntf::TearOffBand);
|
|
|
|
|
if (tearOffBand)
|
|
|
|
|
renderBand(tearOffBand, 0, StartNewPageAsNeeded);
|
2016-09-16 01:59:56 +03:00
|
|
|
|
|
2017-04-20 23:34:32 +03:00
|
|
|
|
savePage(true);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
int ReportRender::pageCount() { return m_renderedPages.count(); }
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
|
|
PageItemDesignIntf::Ptr ReportRender::pageAt(int index)
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if ((index > m_renderedPages.count() - 1) || (index < 0))
|
|
|
|
|
throw ReportError(tr("page index out of range"));
|
|
|
|
|
else
|
|
|
|
|
return m_renderedPages.at(index);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
QString ReportRender::renderPageToString(PageItemDesignIntf* patternPage)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
renderPage(patternPage);
|
|
|
|
|
return toString();
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
ReportPages ReportRender::renderPageToPages(PageItemDesignIntf* patternPage)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
renderPage(patternPage);
|
|
|
|
|
return m_renderedPages;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
ReportPages ReportRender::renderTOC(PageItemDesignIntf* patternPage, bool first, bool resetPages)
|
|
|
|
|
{
|
2017-08-31 02:53:34 +03:00
|
|
|
|
renderPage(patternPage, true, first, resetPages);
|
|
|
|
|
return m_renderedPages;
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
void ReportRender::initRenderPage()
|
|
|
|
|
{
|
|
|
|
|
if (!m_renderPageItem) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_renderPageItem
|
|
|
|
|
= new PageItemDesignIntf(m_patternPageItem->pageSize(), m_patternPageItem->pageRect());
|
2016-02-17 10:11:00 +03:00
|
|
|
|
m_renderPageItem->initFromItem(m_patternPageItem);
|
2016-02-17 10:19:50 +03:00
|
|
|
|
m_renderPageItem->setItemMode(PreviewMode);
|
2017-02-04 22:15:44 +03:00
|
|
|
|
m_renderPageItem->setPatternName(m_patternPageItem->objectName());
|
2017-03-21 18:01:35 +03:00
|
|
|
|
m_renderPageItem->setPatternItem(m_patternPageItem);
|
2018-03-14 11:22:03 +03:00
|
|
|
|
|
|
|
|
|
ScriptValueType svCurrentPage;
|
|
|
|
|
ScriptEngineType* se = ScriptEngineManager::instance().scriptEngine();
|
|
|
|
|
|
|
|
|
|
#ifdef USE_QJSENGINE
|
2018-05-08 10:52:23 +03:00
|
|
|
|
svCurrentPage = getJSValue(*se, m_renderPageItem);
|
2018-03-14 11:22:03 +03:00
|
|
|
|
se->globalObject().setProperty("currentPage", svCurrentPage);
|
|
|
|
|
#else
|
|
|
|
|
svCurrentPage = se->globalObject().property("currentPage");
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (svCurrentPage.isValid()) {
|
2018-03-14 11:22:03 +03:00
|
|
|
|
se->newQObject(svCurrentPage, m_renderPageItem);
|
|
|
|
|
} else {
|
2018-03-22 02:38:42 +03:00
|
|
|
|
svCurrentPage = se->newQObject(m_renderPageItem);
|
2018-03-14 11:22:03 +03:00
|
|
|
|
se->globalObject().setProperty("currentPage", svCurrentPage);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ReportRender::initVariables()
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_datasources->setReportVariable("#PAGE", 1);
|
|
|
|
|
m_datasources->setReportVariable("#PAGE_COUNT", 0);
|
|
|
|
|
m_datasources->setReportVariable("#IS_LAST_PAGEFOOTER", false);
|
|
|
|
|
m_datasources->setReportVariable("#IS_FIRST_PAGEFOOTER", false);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::clearPageMap() { m_renderedPages.clear(); }
|
2021-09-16 02:48:07 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
bool checkContentItem(ContentItemDesignIntf* item, DataSourceManager* datasources)
|
|
|
|
|
{
|
2021-09-16 02:48:07 +03:00
|
|
|
|
QString content = item->content();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (QString functionName, datasources->groupFunctionNames()) {
|
2022-07-16 02:33:39 +03:00
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 1)
|
|
|
|
|
QRegularExpression rx = getGroupFunctionRegEx(functionName);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (content.indexOf(rx) >= 0) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
#else
|
2021-09-16 02:48:07 +03:00
|
|
|
|
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (rx.indexIn(content) >= 0) {
|
2021-09-16 02:48:07 +03:00
|
|
|
|
return true;
|
|
|
|
|
}
|
2021-08-24 10:22:30 +03:00
|
|
|
|
#endif
|
2021-09-16 02:48:07 +03:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
bool ReportRender::containsGroupFunctions(BaseDesignIntf* container)
|
|
|
|
|
{
|
|
|
|
|
if (container) {
|
2021-09-16 02:48:07 +03:00
|
|
|
|
foreach (BaseDesignIntf* item, container->childBaseItems()) {
|
|
|
|
|
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (contentItem) {
|
|
|
|
|
if (checkContentItem(contentItem, m_datasources))
|
|
|
|
|
return true;
|
2021-09-16 02:48:07 +03:00
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (containsGroupFunctions(item))
|
|
|
|
|
return true;
|
2017-06-13 19:05:15 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::extractGroupFuntionsFromItem(ContentItemDesignIntf* contentItem,
|
|
|
|
|
BandDesignIntf* band)
|
|
|
|
|
{
|
2022-07-16 02:33:39 +03:00
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 1)
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (contentItem && contentItem->content().contains(getScriptRegEx())) {
|
|
|
|
|
foreach (const QString& functionName, m_datasources->groupFunctionNames()) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
|
2022-07-16 02:33:39 +03:00
|
|
|
|
QRegularExpression rx = getGroupFunctionRegEx(functionName);
|
|
|
|
|
QRegularExpression rxName = getGroupFunctionNameRegEx(functionName);
|
2021-11-02 22:30:29 +03:00
|
|
|
|
QRegularExpressionMatch match = rx.match(contentItem->content());
|
2022-07-16 02:33:39 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (match.hasMatch()) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
|
|
|
|
|
QRegularExpressionMatchIterator iter = rx.globalMatch(contentItem->content());
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while (iter.hasNext()) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
match = iter.next();
|
|
|
|
|
QVector<QString> captures = normalizeCaptures(match);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (captures.size() >= 3) {
|
|
|
|
|
int dsIndex = captures.size() == 3 ? Const::DATASOURCE_INDEX - 1
|
|
|
|
|
: Const::DATASOURCE_INDEX;
|
|
|
|
|
BandDesignIntf* dataBand
|
|
|
|
|
= m_patternPageItem->bandByName(captures.at(dsIndex));
|
|
|
|
|
if (dataBand) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
GroupFunction* gf = datasources()->addGroupFunction(
|
2024-09-04 17:31:16 +03:00
|
|
|
|
functionName, captures.at(Const::VALUE_INDEX), band->objectName(),
|
|
|
|
|
dataBand->objectName());
|
|
|
|
|
if (gf) {
|
|
|
|
|
connect(dataBand, SIGNAL(bandRendered(BandDesignIntf*)), gf,
|
|
|
|
|
SLOT(slotBandRendered(BandDesignIntf*)));
|
|
|
|
|
connect(dataBand,
|
|
|
|
|
SIGNAL(bandReRendered(BandDesignIntf*, BandDesignIntf*)),
|
|
|
|
|
gf,
|
|
|
|
|
SLOT(slotBandReRendered(BandDesignIntf*, BandDesignIntf*)));
|
2021-11-02 22:30:29 +03:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
GroupFunction* gf = datasources()->addGroupFunction(
|
2024-09-04 17:31:16 +03:00
|
|
|
|
functionName, captures.at(Const::VALUE_INDEX), band->objectName(),
|
|
|
|
|
captures.at(dsIndex));
|
|
|
|
|
gf->setInvalid(
|
|
|
|
|
tr("Databand \"%1\" not found").arg(captures.at(dsIndex)));
|
2021-11-02 22:30:29 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-07-16 02:33:39 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else if (contentItem->content().indexOf(rxName) >= 0) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
match = rxName.match(contentItem->content());
|
2024-09-04 17:31:16 +03:00
|
|
|
|
GroupFunction* gf = datasources()->addGroupFunction(functionName, match.captured(1),
|
|
|
|
|
band->objectName(), "");
|
2021-11-02 22:30:29 +03:00
|
|
|
|
gf->setInvalid(tr("Wrong using function %1").arg(functionName));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (contentItem && contentItem->content().contains(QRegExp("\\$S\\s*\\{.*\\}"))) {
|
|
|
|
|
foreach (const QString& functionName, m_datasources->groupFunctionNames()) {
|
2017-06-13 17:48:22 +03:00
|
|
|
|
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
|
2019-04-04 18:53:29 +03:00
|
|
|
|
rx.setMinimal(true);
|
2017-06-13 17:48:22 +03:00
|
|
|
|
QRegExp rxName(QString(Const::GROUP_FUNCTION_NAME_RX).arg(functionName));
|
2019-04-04 18:53:29 +03:00
|
|
|
|
rxName.setMinimal(true);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (rx.indexIn(contentItem->content()) >= 0) {
|
2017-06-13 17:48:22 +03:00
|
|
|
|
int pos = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while ((pos = rx.indexIn(contentItem->content(), pos)) != -1) {
|
2017-06-13 17:48:22 +03:00
|
|
|
|
QVector<QString> captures = normalizeCaptures(rx);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (captures.size() >= 3) {
|
|
|
|
|
int dsIndex = captures.size() == 3 ? Const::DATASOURCE_INDEX - 1
|
|
|
|
|
: Const::DATASOURCE_INDEX;
|
|
|
|
|
BandDesignIntf* dataBand
|
|
|
|
|
= m_patternPageItem->bandByName(captures.at(dsIndex));
|
|
|
|
|
if (dataBand) {
|
|
|
|
|
GroupFunction* gf = datasources()->addGroupFunction(
|
|
|
|
|
functionName, captures.at(Const::VALUE_INDEX), band->objectName(),
|
|
|
|
|
dataBand->objectName());
|
|
|
|
|
if (gf) {
|
|
|
|
|
connect(dataBand, SIGNAL(bandRendered(BandDesignIntf*)), gf,
|
|
|
|
|
SLOT(slotBandRendered(BandDesignIntf*)));
|
|
|
|
|
connect(dataBand,
|
|
|
|
|
SIGNAL(bandReRendered(BandDesignIntf*, BandDesignIntf*)),
|
|
|
|
|
gf,
|
|
|
|
|
SLOT(slotBandReRendered(BandDesignIntf*, BandDesignIntf*)));
|
2016-09-05 20:11:23 +03:00
|
|
|
|
}
|
2017-06-13 17:48:22 +03:00
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
GroupFunction* gf = datasources()->addGroupFunction(
|
|
|
|
|
functionName, captures.at(Const::VALUE_INDEX), band->objectName(),
|
|
|
|
|
captures.at(dsIndex));
|
|
|
|
|
gf->setInvalid(
|
|
|
|
|
tr("Databand \"%1\" not found").arg(captures.at(dsIndex)));
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-06-13 17:48:22 +03:00
|
|
|
|
pos += rx.matchedLength();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else if (rxName.indexIn(contentItem->content()) >= 0) {
|
|
|
|
|
GroupFunction* gf = datasources()->addGroupFunction(functionName, rxName.cap(1),
|
|
|
|
|
band->objectName(), "");
|
2017-06-13 17:48:22 +03:00
|
|
|
|
gf->setInvalid(tr("Wrong using function %1").arg(functionName));
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
}
|
2021-08-24 10:22:30 +03:00
|
|
|
|
#endif
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::extractGroupFunctionsFromContainer(BaseDesignIntf* baseItem,
|
|
|
|
|
BandDesignIntf* band)
|
|
|
|
|
{
|
|
|
|
|
if (baseItem) {
|
2021-04-12 20:22:34 +03:00
|
|
|
|
foreach (BaseDesignIntf* item, baseItem->childBaseItems()) {
|
|
|
|
|
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (contentItem)
|
|
|
|
|
extractGroupFuntionsFromItem(contentItem, band);
|
|
|
|
|
else
|
|
|
|
|
extractGroupFunctionsFromContainer(item, band);
|
2021-04-12 20:22:34 +03:00
|
|
|
|
}
|
2017-03-21 18:01:35 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2017-03-07 19:09:13 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::extractGroupFunctions(BandDesignIntf* band)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2017-06-13 17:48:22 +03:00
|
|
|
|
extractGroupFunctionsFromContainer(band, band);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::replaceGroupFunctionsInItem(ContentItemDesignIntf* contentItem,
|
|
|
|
|
BandDesignIntf* band)
|
|
|
|
|
{
|
|
|
|
|
if (contentItem) {
|
|
|
|
|
if (m_groupfunctionItems.contains(contentItem->patternName())) {
|
2019-10-08 13:51:10 +03:00
|
|
|
|
QString content = contentItem->content();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (QString functionName, m_groupfunctionItems.value(contentItem->patternName())) {
|
2022-07-16 02:33:39 +03:00
|
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 1)
|
|
|
|
|
QRegularExpression rx = getGroupFunctionRegEx(functionName);
|
2021-11-02 22:30:29 +03:00
|
|
|
|
QRegularExpressionMatch match = rx.match(content);
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (match.capturedStart() != -1) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
int pos = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while ((pos = match.capturedStart()) != -1) {
|
2021-11-02 22:30:29 +03:00
|
|
|
|
QVector<QString> captures = normalizeCaptures(match);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (captures.size() >= 3) {
|
|
|
|
|
QString expressionIndex = datasources()->putGroupFunctionsExpressions(
|
|
|
|
|
captures.at(Const::VALUE_INDEX));
|
|
|
|
|
if (captures.size() < 5) {
|
|
|
|
|
content.replace(captures.at(0),
|
|
|
|
|
QString("%1(%2,%3)")
|
|
|
|
|
.arg(functionName)
|
|
|
|
|
.arg('"' + expressionIndex + '"')
|
|
|
|
|
.arg('"' + band->objectName() + '"'));
|
2021-11-02 22:30:29 +03:00
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
content.replace(captures.at(0),
|
|
|
|
|
QString("%1(%2,%3,%4)")
|
|
|
|
|
.arg(functionName, '"' + expressionIndex + '"',
|
|
|
|
|
'"' + band->objectName() + '"',
|
|
|
|
|
captures.at(4)));
|
2021-11-02 22:30:29 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
match = rx.match(content, pos + match.capturedLength());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#else
|
2019-10-08 13:51:10 +03:00
|
|
|
|
QRegExp rx(QString(Const::GROUP_FUNCTION_RX).arg(functionName));
|
|
|
|
|
rx.setMinimal(true);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (rx.indexIn(content) >= 0) {
|
2019-10-08 13:51:10 +03:00
|
|
|
|
int pos = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while ((pos = rx.indexIn(content, pos)) != -1) {
|
2019-10-08 13:51:10 +03:00
|
|
|
|
QVector<QString> captures = normalizeCaptures(rx);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (captures.size() >= 3) {
|
|
|
|
|
QString expressionIndex = datasources()->putGroupFunctionsExpressions(
|
|
|
|
|
captures.at(Const::VALUE_INDEX));
|
|
|
|
|
if (captures.size() < 5) {
|
|
|
|
|
content.replace(captures.at(0),
|
|
|
|
|
QString("%1(%2,%3)")
|
|
|
|
|
.arg(functionName)
|
|
|
|
|
.arg('"' + expressionIndex + '"')
|
|
|
|
|
.arg('"' + band->objectName() + '"'));
|
2019-10-08 13:51:10 +03:00
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
content.replace(captures.at(0),
|
|
|
|
|
QString("%1(%2,%3,%4)")
|
|
|
|
|
.arg(functionName, '"' + expressionIndex + '"',
|
|
|
|
|
'"' + band->objectName() + '"',
|
|
|
|
|
captures.at(4)));
|
2019-10-08 13:51:10 +03:00
|
|
|
|
}
|
2018-03-14 11:22:03 +03:00
|
|
|
|
}
|
2022-01-20 03:45:23 +03:00
|
|
|
|
pos += rx.matchedLength();
|
2016-09-05 20:11:23 +03:00
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2021-11-02 22:30:29 +03:00
|
|
|
|
|
2021-08-24 10:22:30 +03:00
|
|
|
|
#endif
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2019-10-08 13:51:10 +03:00
|
|
|
|
contentItem->setContent(content);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-13 17:48:22 +03:00
|
|
|
|
void ReportRender::replaceGroupFunctionsInContainer(BaseDesignIntf* baseItem, BandDesignIntf* band)
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (baseItem) {
|
|
|
|
|
foreach (BaseDesignIntf* item, baseItem->childBaseItems()) {
|
2021-04-12 20:22:34 +03:00
|
|
|
|
ContentItemDesignIntf* contentItem = dynamic_cast<ContentItemDesignIntf*>(item);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (contentItem)
|
|
|
|
|
replaceGroupFunctionsInItem(contentItem, band);
|
|
|
|
|
else
|
|
|
|
|
replaceGroupFunctionsInContainer(item, band);
|
2021-04-12 20:22:34 +03:00
|
|
|
|
}
|
2017-06-13 17:48:22 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::replaceGroupsFunction(BandDesignIntf* band)
|
2017-06-13 17:48:22 +03:00
|
|
|
|
{
|
|
|
|
|
replaceGroupFunctionsInContainer(band, band);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
QColor ReportRender::makeBackgroundColor(BandDesignIntf* band)
|
|
|
|
|
{
|
|
|
|
|
if (band->useAlternateBackgroundColor()) {
|
|
|
|
|
return datasources()
|
|
|
|
|
->variable(QLatin1String("line_") + band->objectName().toLower())
|
|
|
|
|
.toInt()
|
|
|
|
|
% 2
|
|
|
|
|
== 0
|
|
|
|
|
? band->backgroundColor()
|
|
|
|
|
: band->alternateBackgroundColor();
|
2020-08-12 16:45:05 +03:00
|
|
|
|
}
|
|
|
|
|
return band->backgroundColor();
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
BandDesignIntf* ReportRender::renderBand(BandDesignIntf* patternBand, BandDesignIntf* bandData,
|
|
|
|
|
ReportRender::DataRenderMode mode, bool isLast)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2017-11-30 21:23:11 +03:00
|
|
|
|
QCoreApplication::processEvents();
|
2019-04-16 16:59:35 +03:00
|
|
|
|
bool bandIsSliced = false;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (patternBand) {
|
2016-02-17 10:28:27 +03:00
|
|
|
|
|
2018-07-20 14:04:53 +03:00
|
|
|
|
if (patternBand->isHeader())
|
|
|
|
|
m_lastRenderedHeader = patternBand;
|
|
|
|
|
|
2016-12-20 01:33:58 +03:00
|
|
|
|
BandDesignIntf* bandClone = 0;
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (bandData) {
|
|
|
|
|
bandClone = bandData;
|
2016-12-20 01:33:58 +03:00
|
|
|
|
} else {
|
2020-02-03 21:50:28 +03:00
|
|
|
|
bandClone = renderData(patternBand);
|
2016-12-20 01:33:58 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (isLast)
|
|
|
|
|
bandClone->setBottomSpace(1);
|
2018-08-07 23:30:40 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (mode == ForcedStartPage) {
|
2016-02-17 10:28:27 +03:00
|
|
|
|
savePage();
|
|
|
|
|
startNewPage();
|
|
|
|
|
}
|
|
|
|
|
|
2016-04-12 19:37:47 +03:00
|
|
|
|
if (patternBand->isFooter())
|
|
|
|
|
m_lastRenderedFooter = patternBand;
|
|
|
|
|
|
2024-06-06 22:44:02 +03:00
|
|
|
|
bandClone->setBackgroundColor(makeBackgroundColor(bandClone));
|
2016-02-17 10:11:00 +03:00
|
|
|
|
patternBand->emitBandRendered(bandClone);
|
2017-08-25 18:01:59 +03:00
|
|
|
|
m_scriptEngineContext->setCurrentBand(bandClone);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (isLast && bandClone->keepFooterTogether() && bandClone->sliceLastRow()) {
|
|
|
|
|
if (m_maxHeightByColumn[m_currentColumn] < (bandClone->height() + m_reportFooterHeight))
|
|
|
|
|
m_maxHeightByColumn[m_currentColumn]
|
|
|
|
|
-= ((m_maxHeightByColumn[m_currentColumn] - bandClone->height())
|
|
|
|
|
+ (bandClone->height() * calcSlicePercent(bandClone->height())));
|
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!bandClone->isEmpty() || patternBand->printIfEmpty()) {
|
|
|
|
|
if (!registerBand(bandClone)) {
|
2018-01-11 02:20:40 +03:00
|
|
|
|
if (patternBand && patternBand->isHeader() && patternBand->reprintOnEachPage())
|
|
|
|
|
m_reprintableBands.removeOne(patternBand);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (bandClone->canBeSplitted(m_maxHeightByColumn[m_currentColumn])) {
|
2019-04-16 16:59:35 +03:00
|
|
|
|
bandClone = sliceBand(bandClone, patternBand, isLast);
|
|
|
|
|
bandIsSliced = true;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
qreal percent = (bandClone->height() - m_maxHeightByColumn[m_currentColumn])
|
|
|
|
|
/ (bandClone->height() / 100);
|
|
|
|
|
if (bandClone->maxScalePercent() >= percent) {
|
|
|
|
|
if (percent < bandClone->maxScalePercent()) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
percent += 2;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
bandClone->setScale((100 - percent) / 100);
|
|
|
|
|
BandDesignIntf* upperPart = dynamic_cast<BandDesignIntf*>(
|
|
|
|
|
bandClone->cloneUpperPart(m_maxHeightByColumn[m_currentColumn]));
|
2016-08-02 20:32:52 +03:00
|
|
|
|
registerBand(upperPart);
|
|
|
|
|
delete bandClone;
|
2017-04-08 16:42:08 +03:00
|
|
|
|
bandClone = NULL;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (mode == StartNewPageAsNeeded) {
|
|
|
|
|
if (bandClone->columnsCount() > 1
|
|
|
|
|
&& (bandClone->columnsFillDirection() == BandDesignIntf::Vertical
|
|
|
|
|
|| bandClone->columnsFillDirection()
|
|
|
|
|
== BandDesignIntf::VerticalUniform)) {
|
2016-02-17 10:28:27 +03:00
|
|
|
|
startNewColumn();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (patternBand->bandHeader()
|
|
|
|
|
&& patternBand->bandHeader()->columnsCount() > 1
|
|
|
|
|
&& !m_lostHeadersMoved
|
|
|
|
|
&& patternBand->bandNestingLevel() == 0) {
|
2018-07-20 14:04:53 +03:00
|
|
|
|
renderBand(patternBand->bandHeader(), 0, mode);
|
|
|
|
|
}
|
2016-02-17 10:28:27 +03:00
|
|
|
|
} else {
|
|
|
|
|
savePage();
|
|
|
|
|
startNewPage();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!bandIsSliced) {
|
2021-01-10 23:28:16 +03:00
|
|
|
|
BandDesignIntf* t = renderData(patternBand, false);
|
2020-08-12 16:45:05 +03:00
|
|
|
|
t->copyBandAttributes(bandClone);
|
2020-07-14 19:57:29 +03:00
|
|
|
|
patternBand->emitBandReRendered(bandClone, t);
|
2019-04-16 16:59:35 +03:00
|
|
|
|
delete bandClone;
|
2020-02-03 21:50:28 +03:00
|
|
|
|
bandClone = t;
|
2019-04-16 16:59:35 +03:00
|
|
|
|
}
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
if (!registerBand(bandClone)) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
BandDesignIntf* upperPart
|
|
|
|
|
= dynamic_cast<BandDesignIntf*>(bandClone->cloneUpperPart(
|
|
|
|
|
m_maxHeightByColumn[m_currentColumn]));
|
2016-08-02 20:32:52 +03:00
|
|
|
|
registerBand(upperPart);
|
2020-07-14 19:57:29 +03:00
|
|
|
|
patternBand->emitBandReRendered(bandClone, upperPart);
|
2016-08-02 20:32:52 +03:00
|
|
|
|
delete bandClone;
|
2017-04-08 16:42:08 +03:00
|
|
|
|
bandClone = NULL;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
};
|
2016-02-17 10:28:27 +03:00
|
|
|
|
} else {
|
|
|
|
|
bandClone->setHeight(m_maxHeightByColumn[m_currentColumn]);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
registerBand(bandClone);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-12-07 23:04:15 +03:00
|
|
|
|
} else {
|
|
|
|
|
delete bandClone;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (patternBand->isFooter()) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
datasources()->clearGroupFunctionValues(patternBand->objectName());
|
2021-04-12 20:22:34 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-01-10 23:28:16 +03:00
|
|
|
|
emit(patternBand->afterRender());
|
2016-12-07 23:04:15 +03:00
|
|
|
|
return bandClone;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2016-12-07 23:04:15 +03:00
|
|
|
|
return 0;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderDataBand(BandDesignIntf* dataBand)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (dataBand == NULL)
|
2017-04-08 16:35:09 +03:00
|
|
|
|
return;
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
IDataSource* bandDatasource = 0;
|
2016-04-12 19:37:47 +03:00
|
|
|
|
m_lastRenderedFooter = 0;
|
2017-06-30 13:22:41 +03:00
|
|
|
|
|
2017-04-08 16:35:09 +03:00
|
|
|
|
if (!dataBand->datasourceName().isEmpty())
|
2024-09-04 17:31:16 +03:00
|
|
|
|
bandDatasource = datasources()->dataSource(dataBand->datasourceName());
|
2016-02-17 10:18:19 +03:00
|
|
|
|
|
2016-07-21 00:14:39 +03:00
|
|
|
|
BandDesignIntf* header = dataBand->bandHeader();
|
|
|
|
|
BandDesignIntf* footer = dataBand->bandFooter();
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (header && header->printAlways())
|
|
|
|
|
renderDataHeader(header);
|
2016-07-21 00:14:39 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (bandDatasource && !bandDatasource->eof() && !m_renderCanceled) {
|
2016-02-17 10:18:19 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
QString varName = QLatin1String("line_") + dataBand->objectName().toLower();
|
|
|
|
|
datasources()->setReportVariable(varName, 1);
|
2016-02-17 10:18:19 +03:00
|
|
|
|
|
2017-03-21 18:01:35 +03:00
|
|
|
|
if (header && header->reprintOnEachPage())
|
2016-02-17 10:39:17 +03:00
|
|
|
|
m_reprintableBands.append(dataBand->bandHeader());
|
|
|
|
|
|
2017-03-21 18:01:35 +03:00
|
|
|
|
if (header && !header->printAlways())
|
|
|
|
|
renderDataHeader(header);
|
|
|
|
|
|
2016-02-17 10:28:27 +03:00
|
|
|
|
renderGroupHeader(dataBand, bandDatasource, true);
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
|
|
|
|
bool firstTime = true;
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while (!bandDatasource->eof() && !m_renderCanceled) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2020-04-06 19:48:16 +03:00
|
|
|
|
datasources()->updateChildrenData(dataBand->datasourceName());
|
|
|
|
|
|
2016-12-07 23:04:15 +03:00
|
|
|
|
BandDesignIntf* rawData = renderData(dataBand);
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!rawData->isEmpty() || dataBand->printIfEmpty()) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if ((firstTime && dataBand->startFromNewPage())
|
|
|
|
|
|| (!firstTime && dataBand->startNewPage())) {
|
2016-12-07 23:04:15 +03:00
|
|
|
|
savePage();
|
|
|
|
|
startNewPage();
|
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (dataBand->tryToKeepTogether())
|
|
|
|
|
openDataGroup(dataBand);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2016-12-07 23:04:15 +03:00
|
|
|
|
if (dataBand->keepFooterTogether() && !bandDatasource->hasNext())
|
|
|
|
|
openFooterGroup(dataBand);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2016-12-07 23:04:15 +03:00
|
|
|
|
m_lastDataBand = dataBand;
|
2016-02-17 10:18:19 +03:00
|
|
|
|
|
2016-12-07 23:04:15 +03:00
|
|
|
|
if (header && !firstTime && header->repeatOnEachRow())
|
|
|
|
|
renderBand(header, 0, StartNewPageAsNeeded);
|
2016-07-27 00:41:24 +03:00
|
|
|
|
|
2016-12-12 23:41:38 +03:00
|
|
|
|
renderBand(dataBand, rawData, StartNewPageAsNeeded, !bandDatasource->hasNext());
|
2018-01-18 21:44:11 +03:00
|
|
|
|
m_newPageStarted = false;
|
2016-12-12 23:41:38 +03:00
|
|
|
|
renderChildBands(dataBand);
|
2016-12-07 23:04:15 +03:00
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
|
|
|
|
bandDatasource->next();
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
datasources()->setReportVariable(varName, datasources()->variable(varName).toInt() + 1);
|
2019-12-15 09:23:27 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
QList<BandDesignIntf*> bandList;
|
|
|
|
|
QList<BandDesignIntf*> childList;
|
2019-12-15 09:23:27 +03:00
|
|
|
|
|
|
|
|
|
bandList = dataBand->childrenByType(BandDesignIntf::GroupHeader);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while (bandList.size() > 0) {
|
2019-12-15 09:23:27 +03:00
|
|
|
|
childList.clear();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, bandList) {
|
2019-12-15 09:23:27 +03:00
|
|
|
|
childList.append(band->childrenByType(BandDesignIntf::GroupHeader));
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
QString groupLineVar = QLatin1String("line_") + band->objectName().toLower();
|
2019-12-15 09:23:27 +03:00
|
|
|
|
if (datasources()->containsVariable(groupLineVar))
|
2024-09-04 17:31:16 +03:00
|
|
|
|
datasources()->setReportVariable(
|
|
|
|
|
groupLineVar, datasources()->variable(groupLineVar).toInt() + 1);
|
2019-12-15 09:23:27 +03:00
|
|
|
|
}
|
|
|
|
|
bandList = childList;
|
2016-02-17 10:18:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:28:27 +03:00
|
|
|
|
renderGroupHeader(dataBand, bandDatasource, false);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (dataBand->tryToKeepTogether())
|
|
|
|
|
closeDataGroup(dataBand);
|
2016-02-17 10:39:17 +03:00
|
|
|
|
firstTime = false;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2018-06-20 16:23:52 +03:00
|
|
|
|
if (!dataBand->keepFooterTogether())
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_reprintableBands.removeOne(header);
|
|
|
|
|
if (header)
|
|
|
|
|
recalcIfNeeded(header);
|
2016-04-12 19:37:47 +03:00
|
|
|
|
|
2022-01-26 20:15:21 +03:00
|
|
|
|
bool didGoBack = !bandDatasource->eof() && bandDatasource->prior();
|
|
|
|
|
renderGroupFooterByHeader(dataBand);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (didGoBack) {
|
2017-06-20 05:59:39 +03:00
|
|
|
|
bandDatasource->next();
|
|
|
|
|
}
|
2016-04-12 19:37:47 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (footer && !footer->printAlways()) {
|
2016-12-07 23:04:15 +03:00
|
|
|
|
renderBand(footer, 0, StartNewPageAsNeeded);
|
2018-06-20 16:23:52 +03:00
|
|
|
|
if (dataBand->keepFooterTogether())
|
|
|
|
|
m_reprintableBands.removeOne(dataBand);
|
|
|
|
|
}
|
2016-07-21 00:14:39 +03:00
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
datasources()->deleteVariable(varName);
|
2016-07-21 00:14:39 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else if (bandDatasource == 0) {
|
2016-12-07 23:04:15 +03:00
|
|
|
|
renderBand(dataBand, 0, StartNewPageAsNeeded);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2016-07-21 00:14:39 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (footer && footer->printAlways()) {
|
2016-12-07 23:04:15 +03:00
|
|
|
|
renderBand(footer, 0, StartNewPageAsNeeded);
|
2018-06-20 16:23:52 +03:00
|
|
|
|
if (dataBand->keepFooterTogether())
|
|
|
|
|
m_reprintableBands.removeOne(dataBand);
|
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderPageHeader(PageItemDesignIntf* patternPage)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageHeader);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band) {
|
|
|
|
|
if (m_datasources->variable("#PAGE").toInt() != 1
|
|
|
|
|
|| band->property("printOnFirstPage").toBool())
|
2016-12-07 23:04:15 +03:00
|
|
|
|
renderBand(band, 0);
|
2016-10-04 03:21:22 +03:00
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderReportHeader(PageItemDesignIntf* patternPage, PageRenderStage stage)
|
2017-03-19 14:03:13 +03:00
|
|
|
|
{
|
|
|
|
|
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::ReportHeader);
|
2021-11-02 22:30:29 +03:00
|
|
|
|
BandDesignIntf* resBand = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band) {
|
|
|
|
|
if (band->property("printBeforePageHeader").toBool() && stage == BeforePageHeader)
|
2021-11-02 22:30:29 +03:00
|
|
|
|
resBand = renderBand(band, 0, StartNewPageAsNeeded);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!band->property("printBeforePageHeader").toBool() && stage == AfterPageHeader)
|
2021-11-02 22:30:29 +03:00
|
|
|
|
resBand = renderBand(band, 0, StartNewPageAsNeeded);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (resBand && containsGroupFunctions(band))
|
|
|
|
|
m_recalcBands.append(resBand);
|
2017-03-19 14:03:13 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderPageFooter(PageItemDesignIntf* patternPage)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageFooter);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band) {
|
|
|
|
|
BandDesignIntf* bandClone = dynamic_cast<BandDesignIntf*>(
|
|
|
|
|
band->cloneItem(PreviewMode, m_renderPageItem, m_renderPageItem));
|
2016-02-17 10:11:00 +03:00
|
|
|
|
replaceGroupsFunction(bandClone);
|
2016-02-17 10:28:27 +03:00
|
|
|
|
bandClone->updateItemSize(m_datasources);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
bandClone->setItemPos(m_renderPageItem->pageRect().x(),
|
|
|
|
|
m_renderPageItem->pageRect().bottom() - bandClone->height());
|
2016-02-17 10:11:00 +03:00
|
|
|
|
bandClone->setHeight(m_pageFooterHeight);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
for (int i = 0; i < m_maxHeightByColumn.size(); ++i)
|
|
|
|
|
m_maxHeightByColumn[i] += m_pageFooterHeight;
|
2019-04-16 00:23:12 +03:00
|
|
|
|
m_renderPageItem->setPageFooter(bandClone);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
registerBand(bandClone);
|
|
|
|
|
datasources()->clearGroupFunctionValues(band->objectName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ReportRender::renderPageItems(PageItemDesignIntf* patternPage)
|
|
|
|
|
{
|
2016-11-04 01:11:45 +03:00
|
|
|
|
QList<BaseDesignIntf*> pageItems;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
foreach (BaseDesignIntf* item, patternPage->childBaseItems()) {
|
|
|
|
|
ItemDesignIntf* id = dynamic_cast<ItemDesignIntf*>(item);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (id && id->itemLocation() == ItemDesignIntf::Page) {
|
|
|
|
|
BaseDesignIntf* cloneItem
|
|
|
|
|
= item->cloneItem(m_renderPageItem->itemMode(), m_renderPageItem, m_renderPageItem);
|
2016-11-04 01:11:45 +03:00
|
|
|
|
pageItems.append(cloneItem);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-04 01:11:45 +03:00
|
|
|
|
m_renderPageItem->restoreLinks();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_renderPageItem->updateSubItemsSize(FirstPass, m_datasources);
|
|
|
|
|
foreach (BaseDesignIntf* item, pageItems) {
|
2018-03-22 17:17:04 +03:00
|
|
|
|
if (!item->isWatermark())
|
2024-09-04 17:31:16 +03:00
|
|
|
|
item->setZValue(item->zValue() - 100000);
|
2018-03-22 17:17:04 +03:00
|
|
|
|
else
|
2024-09-04 17:31:16 +03:00
|
|
|
|
item->setZValue(item->zValue() + 100000);
|
2017-07-14 17:39:47 +03:00
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
qreal ReportRender::calcPageFooterHeight(PageItemDesignIntf* patternPage)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
BandDesignIntf* band = patternPage->bandByType(BandDesignIntf::PageFooter);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band) {
|
|
|
|
|
if (m_datasources->variable("#PAGE") != 1)
|
2016-10-04 03:21:22 +03:00
|
|
|
|
return band->height();
|
|
|
|
|
else if (band->property("printOnFirstPage").toBool())
|
|
|
|
|
return band->height();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderChildHeader(BandDesignIntf* parent, BandPrintMode printMode)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, parent->childrenByType(BandDesignIntf::SubDetailHeader)) {
|
|
|
|
|
bool printAlways = false;
|
|
|
|
|
if (band->metaObject()->indexOfProperty("printAlways") > 0) {
|
|
|
|
|
printAlways = band->property("printAlways").toBool();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2017-06-30 13:52:17 +03:00
|
|
|
|
if (printAlways == (printMode == PrintAlwaysPrintable))
|
2017-06-30 13:22:41 +03:00
|
|
|
|
renderBand(band, 0, StartNewPageAsNeeded);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderChildFooter(BandDesignIntf* parent, BandPrintMode printMode)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, parent->childrenByType(BandDesignIntf::SubDetailFooter)) {
|
|
|
|
|
bool printAlways = false;
|
|
|
|
|
if (band->metaObject()->indexOfProperty("printAlways") > 0) {
|
|
|
|
|
printAlways = band->property("printAlways").toBool();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2016-04-12 19:37:47 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if ((band != m_lastRenderedFooter) && (printAlways == (printMode == PrintAlwaysPrintable)))
|
2016-12-07 23:04:15 +03:00
|
|
|
|
renderBand(band, 0, StartNewPageAsNeeded);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderChildBands(BandDesignIntf* parentBand)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, parentBand->childrenByType(BandDesignIntf::SubDetailBand)) {
|
2017-01-09 18:29:56 +03:00
|
|
|
|
IDataSource* ds = 0;
|
|
|
|
|
if (!band->datasourceName().isEmpty())
|
|
|
|
|
ds = m_datasources->dataSource(band->datasourceName());
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (ds)
|
|
|
|
|
ds->first();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
renderDataBand(band);
|
|
|
|
|
closeFooterGroup(band);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
BandDesignIntf* ReportRender::findRecalcableBand(BandDesignIntf* patternBand)
|
|
|
|
|
{
|
2017-03-21 18:01:35 +03:00
|
|
|
|
|
|
|
|
|
QList<BandDesignIntf*>::iterator it = m_recalcBands.begin();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
for (; it != m_recalcBands.end(); ++it) {
|
|
|
|
|
if ((*it)->patternItem() == patternBand) {
|
2017-03-21 18:01:35 +03:00
|
|
|
|
BandDesignIntf* result = (*it);
|
|
|
|
|
m_recalcBands.erase(it);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void restoreItemsWithGroupFunctions(BaseDesignIntf* container, DataSourceManager* datasources)
|
|
|
|
|
{
|
|
|
|
|
foreach (BaseDesignIntf* bi, container->childBaseItems()) {
|
2021-09-16 02:48:07 +03:00
|
|
|
|
ContentItemDesignIntf* pci = dynamic_cast<ContentItemDesignIntf*>(bi->patternItem());
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (pci && checkContentItem(pci, datasources)) {
|
2021-09-16 02:48:07 +03:00
|
|
|
|
ContentItemDesignIntf* ci = dynamic_cast<ContentItemDesignIntf*>(bi);
|
|
|
|
|
ci->setContent(pci->content());
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else
|
|
|
|
|
restoreItemsWithGroupFunctions(bi, datasources);
|
2021-09-16 02:48:07 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::recalcIfNeeded(BandDesignIntf* band)
|
|
|
|
|
{
|
2017-03-21 18:01:35 +03:00
|
|
|
|
BandDesignIntf* recalcBand = findRecalcableBand(band);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (recalcBand) {
|
2017-03-21 18:01:35 +03:00
|
|
|
|
QString bandName = recalcBand->objectName();
|
2021-09-16 02:48:07 +03:00
|
|
|
|
restoreItemsWithGroupFunctions(recalcBand, m_datasources);
|
2017-03-21 18:01:35 +03:00
|
|
|
|
recalcBand->setObjectName(recalcBand->patternItem()->objectName());
|
|
|
|
|
replaceGroupsFunction(recalcBand);
|
|
|
|
|
recalcBand->updateItemSize(datasources());
|
|
|
|
|
recalcBand->setObjectName(bandName);
|
|
|
|
|
datasources()->clearGroupFunctionValues(recalcBand->patternItem()->objectName());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderDataHeader(BandDesignIntf* header)
|
2017-03-21 18:01:35 +03:00
|
|
|
|
{
|
|
|
|
|
recalcIfNeeded(header);
|
2020-09-19 16:02:05 +03:00
|
|
|
|
BandDesignIntf* renderedHeader = renderBand(header, 0, StartNewPageAsNeeded);
|
2017-06-13 19:05:15 +03:00
|
|
|
|
if (containsGroupFunctions(header))
|
2017-03-21 18:01:35 +03:00
|
|
|
|
m_recalcBands.append(renderedHeader);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderGroupHeader(BandDesignIntf* parentBand, IDataSource* dataSource,
|
|
|
|
|
bool firstTime)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, parentBand->childrenByType(BandDesignIntf::GroupHeader)) {
|
2016-02-17 10:18:19 +03:00
|
|
|
|
IGroupBand* gb = dynamic_cast<IGroupBand*>(band);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (gb && gb->isNeedToClose(datasources())) {
|
|
|
|
|
if (band->childBands().count() > 0) {
|
2022-01-26 20:15:21 +03:00
|
|
|
|
bool didGoBack = !dataSource->eof() && dataSource->prior();
|
2018-12-21 19:04:57 +03:00
|
|
|
|
renderGroupFooterByHeader(band);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (didGoBack) {
|
2017-06-20 05:59:39 +03:00
|
|
|
|
dataSource->next();
|
2017-06-12 13:36:30 +03:00
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2018-12-21 19:43:16 +03:00
|
|
|
|
closeDataGroup(band);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2016-09-28 01:24:55 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (gb && !gb->isStarted()) {
|
|
|
|
|
if (band->reprintOnEachPage()) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
m_reprintableBands.append(band);
|
2018-01-18 20:28:56 +03:00
|
|
|
|
}
|
2016-02-17 10:28:27 +03:00
|
|
|
|
gb->startGroup(m_datasources);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
openDataGroup(band);
|
2017-03-21 18:01:35 +03:00
|
|
|
|
BandDesignIntf* renderedHeader = 0;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!firstTime && gb->startNewPage() && !m_newPageStarted) {
|
|
|
|
|
if (gb->resetPageNumber())
|
|
|
|
|
resetPageNumber(BandReset);
|
|
|
|
|
if (band->reprintOnEachPage()) {
|
2018-01-18 20:28:56 +03:00
|
|
|
|
savePage();
|
|
|
|
|
startNewPage();
|
|
|
|
|
} else {
|
2018-01-18 20:34:27 +03:00
|
|
|
|
renderedHeader = renderBand(band, 0, ForcedStartPage);
|
2018-01-18 20:28:56 +03:00
|
|
|
|
}
|
2016-02-17 10:28:27 +03:00
|
|
|
|
} else {
|
2017-03-21 18:01:35 +03:00
|
|
|
|
renderedHeader = renderBand(band, 0, StartNewPageAsNeeded);
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
2017-06-13 19:05:15 +03:00
|
|
|
|
if (containsGroupFunctions(band))
|
2017-03-21 18:01:35 +03:00
|
|
|
|
m_recalcBands.append(renderedHeader);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2016-09-28 01:24:55 +03:00
|
|
|
|
|
|
|
|
|
renderGroupHeader(band, dataSource, firstTime);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderGroupFooterByHeader(BandDesignIntf* groupHeader)
|
|
|
|
|
{
|
|
|
|
|
if (groupHeader->reprintOnEachPage())
|
|
|
|
|
m_reprintableBands.removeOne(groupHeader);
|
|
|
|
|
foreach (BandDesignIntf* header, groupHeader->childrenByType(BandDesignIntf::GroupHeader)) {
|
2017-03-06 18:46:16 +03:00
|
|
|
|
renderGroupFooterByHeader(header);
|
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* footer, groupHeader->childrenByType(BandDesignIntf::GroupFooter)) {
|
2017-03-06 18:46:16 +03:00
|
|
|
|
renderBand(footer, 0, StartNewPageAsNeeded);
|
|
|
|
|
}
|
2018-12-21 19:04:57 +03:00
|
|
|
|
closeDataGroup(groupHeader);
|
2017-03-06 18:46:16 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::renderGroupFooter(BandDesignIntf* parentBand)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, parentBand->childrenByType(BandDesignIntf::GroupHeader)) {
|
2016-02-17 10:18:19 +03:00
|
|
|
|
IGroupBand* gb = dynamic_cast<IGroupBand*>(band);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (gb && gb->isStarted()) {
|
2018-12-21 19:04:57 +03:00
|
|
|
|
renderGroupFooterByHeader(band);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-28 01:24:55 +03:00
|
|
|
|
void ReportRender::initGroups()
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
m_datasources->clearGroupFunction();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, m_patternPageItem->childBands()) {
|
|
|
|
|
if (band->isFooter())
|
|
|
|
|
extractGroupFunctions(band);
|
|
|
|
|
if (band->isHeader()) {
|
2016-10-03 19:56:05 +03:00
|
|
|
|
IGroupBand* gb = dynamic_cast<IGroupBand*>(band);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (gb)
|
|
|
|
|
gb->closeGroup();
|
2017-06-13 19:05:15 +03:00
|
|
|
|
extractGroupFunctions(band);
|
2016-10-03 19:56:05 +03:00
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::popPageFooterGroupValues(BandDesignIntf* dataBand)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
BandDesignIntf* pageFooter = m_patternPageItem->bandByType(BandDesignIntf::PageFooter);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (pageFooter) {
|
|
|
|
|
foreach (GroupFunction* gf, datasources()->groupFunctionsByBand(pageFooter->objectName())) {
|
|
|
|
|
if ((gf->dataBandName() == dataBand->objectName())) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
// FIXME Probably coincidence Field and Variables
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if ((!m_popupedExpression.contains(dataBand))
|
|
|
|
|
|| (!m_popupedExpression.values(dataBand).contains(gf->data()))) {
|
|
|
|
|
m_popupedExpression.insert(dataBand, gf->data());
|
|
|
|
|
m_popupedValues.insert(QString("%1").arg((quintptr)dataBand) + '|' + gf->data(),
|
|
|
|
|
gf->values()[gf->values().count() - 1]);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
gf->values().pop_back();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::pushPageFooterGroupValues(BandDesignIntf* dataBand)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
BandDesignIntf* pageFooter = m_patternPageItem->bandByType(BandDesignIntf::PageFooter);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (pageFooter) {
|
|
|
|
|
foreach (GroupFunction* gf, datasources()->groupFunctionsByBand(pageFooter->objectName())) {
|
|
|
|
|
if ((gf->dataBandName() == dataBand->objectName())) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
// FIXME Probably coincidence Field and Variables
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if ((m_popupedExpression.contains(dataBand))
|
|
|
|
|
&& (m_popupedExpression.values(dataBand).contains(gf->data()))) {
|
|
|
|
|
gf->values().push_back(m_popupedValues.value(
|
|
|
|
|
QString("%1").arg((quintptr)dataBand) + '|' + gf->data()));
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::closeGroup(BandDesignIntf* band)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
QMultiMap<BandDesignIntf*, GroupBandsHolder*>::iterator it;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
it = m_childBands.find(band);
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while (it != m_childBands.end() && it.key() == band) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
GroupBandsHolder* bl = it.value();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (bl) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
bl->clear();
|
|
|
|
|
delete bl;
|
|
|
|
|
}
|
2019-06-27 10:45:26 +03:00
|
|
|
|
++it;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_childBands.remove(band);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::openDataGroup(BandDesignIntf* band)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_childBands.insert(band, new GroupBandsHolder(band->tryToKeepTogether()));
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::openFooterGroup(BandDesignIntf* band)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
GroupBandsHolder* holder = new GroupBandsHolder(true);
|
|
|
|
|
holder->setIsFooterGroup();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_childBands.insert(band, holder);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::closeDataGroup(BandDesignIntf* band)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2016-02-17 10:18:19 +03:00
|
|
|
|
IGroupBand* groupBand = dynamic_cast<IGroupBand*>(band);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (groupBand) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
groupBand->closeGroup();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->reprintOnEachPage())
|
|
|
|
|
m_reprintableBands.removeOne(band);
|
2018-01-18 20:28:56 +03:00
|
|
|
|
|
|
|
|
|
QList<BandDesignIntf*>::Iterator it = m_reprintableBands.begin();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while (it != m_reprintableBands.end()) {
|
|
|
|
|
if ((*it)->bandIndex() > band->bandIndex())
|
2018-01-18 20:28:56 +03:00
|
|
|
|
it = m_reprintableBands.erase(it);
|
|
|
|
|
else
|
2019-06-27 10:45:26 +03:00
|
|
|
|
++it;
|
2018-01-18 20:28:56 +03:00
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
2017-03-21 18:01:35 +03:00
|
|
|
|
recalcIfNeeded(band);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
closeGroup(band);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::closeFooterGroup(BandDesignIntf* band) { closeGroup(band); }
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
qreal maxVectorValue(QVector<qreal> vector)
|
|
|
|
|
{
|
2016-02-17 10:28:27 +03:00
|
|
|
|
qreal curValue = 0;
|
|
|
|
|
foreach (qreal value, vector) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (curValue < value)
|
|
|
|
|
curValue = value;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
|
|
|
|
return curValue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
qreal minVectorValue(QVector<qreal> vector)
|
|
|
|
|
{
|
2016-02-17 10:28:27 +03:00
|
|
|
|
qreal curValue = vector[0];
|
|
|
|
|
foreach (qreal value, vector) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (curValue > value)
|
|
|
|
|
curValue = value;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
|
|
|
|
return curValue;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::placeBandOnPage(BandDesignIntf* band, int columnIndex)
|
|
|
|
|
{
|
2018-06-07 20:43:05 +03:00
|
|
|
|
|
|
|
|
|
qreal bandPos = m_currentStartDataPos[columnIndex];
|
|
|
|
|
|
|
|
|
|
m_currentStartDataPos[columnIndex] += band->height();
|
|
|
|
|
m_maxHeightByColumn[columnIndex] -= band->height();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
band->setPos(m_renderPageItem->pageRect().x() + band->width() * columnIndex, bandPos);
|
2018-06-07 20:43:05 +03:00
|
|
|
|
band->setBandIndex(++m_currentIndex);
|
|
|
|
|
band->setColumnIndex(columnIndex);
|
|
|
|
|
|
|
|
|
|
m_renderPageItem->registerBand(band);
|
|
|
|
|
m_currentColumn = columnIndex;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
bool isMultiColumnHeader(BandDesignIntf* band)
|
|
|
|
|
{
|
|
|
|
|
return ((band->columnsCount() > 1)
|
|
|
|
|
&& (band->isHeader()
|
|
|
|
|
&& ((band->bandNestingLevel() == 0)
|
|
|
|
|
|| (band->columnsFillDirection() == BandDesignIntf::Horizontal))));
|
2018-06-07 20:43:05 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
bool ReportRender::registerBand(BandDesignIntf* band, bool registerInChildren)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2018-06-07 20:43:05 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->columnsCount() == 1 && m_maxHeightByColumn.size() > 1) {
|
|
|
|
|
if (band->bandType() != BandDesignIntf::PageFooter) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
rearrangeColumnsItems();
|
|
|
|
|
m_currentColumn = 0;
|
|
|
|
|
qreal minValue = minVectorValue(m_maxHeightByColumn);
|
|
|
|
|
m_maxHeightByColumn.clear();
|
|
|
|
|
m_maxHeightByColumn.append(minValue);
|
|
|
|
|
qreal maxValue = maxVectorValue(m_currentStartDataPos);
|
|
|
|
|
m_currentStartDataPos.clear();
|
|
|
|
|
m_currentStartDataPos.append(maxValue);
|
|
|
|
|
}
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->columnsCount() != m_maxHeightByColumn.size()) {
|
|
|
|
|
for (int i = 1; i < band->columnsCount(); ++i) {
|
2018-06-07 20:43:05 +03:00
|
|
|
|
m_maxHeightByColumn.append(m_maxHeightByColumn[0]);
|
|
|
|
|
m_currentStartDataPos.append(m_currentStartDataPos[0]);
|
|
|
|
|
}
|
2018-07-16 16:12:54 +03:00
|
|
|
|
m_currentColumn = -1;
|
2018-06-07 20:43:05 +03:00
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if ((band->columnsCount() > 1)
|
|
|
|
|
&& (!band->isHeader()
|
|
|
|
|
|| (band->bandNestingLevel() > 0
|
|
|
|
|
&& band->columnsFillDirection() != BandDesignIntf::Horizontal))) {
|
2018-06-07 20:43:05 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->columnsFillDirection() == BandDesignIntf::Horizontal) {
|
|
|
|
|
if (m_currentColumn < band->columnsCount() - 1)
|
|
|
|
|
m_currentColumn = m_currentColumn + 1;
|
2018-06-07 20:43:05 +03:00
|
|
|
|
else
|
|
|
|
|
m_currentColumn = 0;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_currentColumn = m_currentColumn == -1 ? 0 : m_currentColumn;
|
|
|
|
|
if ((m_currentColumn != 0)
|
|
|
|
|
&& (m_maxHeightByColumn[0] == m_maxHeightByColumn[m_currentColumn])
|
|
|
|
|
&& (m_maxHeightByColumn[0] >= band->height())) {
|
2018-06-07 20:43:05 +03:00
|
|
|
|
m_currentColumn = 0;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_currentColumn = m_currentColumn == -1 ? 0 : m_currentColumn;
|
2018-07-18 19:48:05 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if ((band->height() <= m_maxHeightByColumn[m_currentColumn])
|
|
|
|
|
|| m_patternPageItem->endlessHeight()
|
|
|
|
|
|| (isMultiColumnHeader(band) && (band->height() <= m_maxHeightByColumn[0]))) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if ((band->bandType() == BandDesignIntf::PageFooter)) {
|
|
|
|
|
for (int i = 0; i < m_maxHeightByColumn.size(); ++i)
|
|
|
|
|
m_maxHeightByColumn[i] += band->height();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (isMultiColumnHeader(band)) {
|
2018-06-07 20:43:05 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!band->parent()) {
|
|
|
|
|
for (int i = 0; i < band->columnsCount(); ++i) {
|
2018-06-07 20:43:05 +03:00
|
|
|
|
m_currentColumn = i;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (i != 0)
|
|
|
|
|
band = dynamic_cast<BandDesignIntf*>(band->cloneItem(PreviewMode));
|
2018-06-07 20:43:05 +03:00
|
|
|
|
placeBandOnPage(band, i);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
placeBandOnPage(band, band->columnIndex());
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->bandType() != BandDesignIntf::PageFooter) {
|
2018-06-07 20:43:05 +03:00
|
|
|
|
placeBandOnPage(band, m_currentColumn);
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->columnsCount() > 1) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
m_columnedBandItems.append(band);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (QList<BandDesignIntf*>* list, m_childBands.values()) {
|
|
|
|
|
if (registerInChildren && band->bandType() != BandDesignIntf::PageHeader
|
|
|
|
|
&& band->bandType() != BandDesignIntf::PageFooter
|
|
|
|
|
&& band->bandType() != BandDesignIntf::ReportHeader
|
|
|
|
|
&& band->bandType() != BandDesignIntf::ReportFooter && !list->contains(band)
|
|
|
|
|
&& !band->reprintOnEachPage())
|
2016-02-17 10:11:00 +03:00
|
|
|
|
list->append(band);
|
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->isData())
|
|
|
|
|
m_renderedDataBandCount++;
|
|
|
|
|
band->setObjectName(band->objectName() + QString::number(++m_currentNameIndex));
|
2016-05-26 22:21:42 +03:00
|
|
|
|
renameChildItems(band);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_lastDataBand) {
|
2021-08-23 08:07:08 +03:00
|
|
|
|
#if QT_VERSION < 0x050000
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_lastDataBand->metaObject()->invokeMethod(m_lastDataBand, "bandRegistred");
|
2021-08-23 08:07:08 +03:00
|
|
|
|
#else
|
2017-08-18 22:55:29 +03:00
|
|
|
|
emit m_lastDataBand->bandRegistred();
|
2017-10-26 12:24:06 +03:00
|
|
|
|
#endif
|
|
|
|
|
}
|
2020-04-17 12:28:59 +03:00
|
|
|
|
if (band->bandType() != BandDesignIntf::PageFooter)
|
|
|
|
|
m_lastRenderedBand = band;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
return true;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else
|
|
|
|
|
return false;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
qreal ReportRender::calcSlicePercent(qreal height) { return (height * 3 / (m_dataAreaSize)) / 100; }
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
BandDesignIntf* ReportRender::sliceBand(BandDesignIntf* band, BandDesignIntf* patternBand,
|
|
|
|
|
bool isLast)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while (band->height() > m_maxHeightByColumn[m_currentColumn]) {
|
|
|
|
|
band = saveUppperPartReturnBottom(band, m_maxHeightByColumn[m_currentColumn], patternBand);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
if (!band->isEmpty()) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->autoHeight()) {
|
|
|
|
|
if (band->isNeedUpdateSize(FirstPass)) {
|
2016-08-02 00:38:10 +03:00
|
|
|
|
band->setHeight(0);
|
|
|
|
|
}
|
2016-05-17 21:52:53 +03:00
|
|
|
|
band->updateItemSize(m_datasources);
|
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
DataBandDesignIntf* data = dynamic_cast<DataBandDesignIntf*>(band);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (isLast && data && data->keepFooterTogether()
|
|
|
|
|
&& band->height() < m_maxHeightByColumn[m_currentColumn] && band->sliceLastRow()) {
|
|
|
|
|
if (band->height()
|
|
|
|
|
> (m_maxHeightByColumn[m_currentColumn] - m_reportFooterHeight)) {
|
|
|
|
|
m_maxHeightByColumn[m_currentColumn]
|
|
|
|
|
-= ((m_maxHeightByColumn[m_currentColumn] - band->height())
|
|
|
|
|
+ (band->height() * calcSlicePercent(band->height())));
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (registerBand(band))
|
|
|
|
|
break;
|
|
|
|
|
} else
|
|
|
|
|
break;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (band->isEmpty()) {
|
|
|
|
|
delete band;
|
|
|
|
|
band = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return band;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber)
|
|
|
|
|
{
|
|
|
|
|
BookmarkContainerDesignIntf* bookmarkContainer
|
|
|
|
|
= dynamic_cast<BookmarkContainerDesignIntf*>(item);
|
|
|
|
|
if (bookmarkContainer) {
|
2017-11-04 21:17:49 +03:00
|
|
|
|
TableOfContents* toc = m_scriptEngineContext->tableOfContents();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (QString key, bookmarkContainer->bookmarks()) {
|
2019-02-12 22:45:35 +03:00
|
|
|
|
toc->setItem(key, bookmarkContainer->getBookMark(key).toString(), pageNumber);
|
2017-08-25 18:01:59 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 01:59:56 +03:00
|
|
|
|
void ReportRender::secondRenderPass(ReportPages renderedPages)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!m_scriptEngineContext->tableOfContents()->isEmpty()) {
|
|
|
|
|
for (int i = 0; i < renderedPages.count(); ++i) {
|
2017-08-31 02:53:34 +03:00
|
|
|
|
PageItemDesignIntf::Ptr page = renderedPages.at(i);
|
2019-02-12 22:45:35 +03:00
|
|
|
|
updateTOC(page.data(), m_pagesRanges.findPageNumber(i));
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BaseDesignIntf* item, page->childBaseItems()) {
|
2019-01-17 00:26:27 +03:00
|
|
|
|
updateTOC(item, m_pagesRanges.findPageNumber(i));
|
2017-08-31 02:53:34 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
for (int i = 0; i < renderedPages.count(); ++i) {
|
2016-09-16 01:59:56 +03:00
|
|
|
|
PageItemDesignIntf::Ptr page = renderedPages.at(i);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_datasources->setReportVariable("#PAGE", m_pagesRanges.findPageNumber(i));
|
|
|
|
|
m_datasources->setReportVariable("#PAGE_COUNT", m_pagesRanges.findLastPageNumber(i));
|
|
|
|
|
foreach (BaseDesignIntf* item, page->childBaseItems()) {
|
2019-12-18 23:13:33 +03:00
|
|
|
|
if (item->isNeedUpdateSize(SecondPass))
|
|
|
|
|
item->updateItemSize(m_datasources, SecondPass);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-16 03:58:54 +03:00
|
|
|
|
void ReportRender::createTOCMarker(bool startNewRange)
|
|
|
|
|
{
|
|
|
|
|
m_pagesRanges.addTOCMarker(startNewRange);
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
BandDesignIntf* ReportRender::saveUppperPartReturnBottom(BandDesignIntf* band, int height,
|
|
|
|
|
BandDesignIntf* patternBand)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
// int sliceHeight = height;
|
2023-04-11 13:39:54 +03:00
|
|
|
|
BandDesignIntf* upperBandPart = dynamic_cast<BandDesignIntf*>(band->cloneUpperPart(height));
|
|
|
|
|
BandDesignIntf* bottomBandPart = dynamic_cast<BandDesignIntf*>(band->cloneBottomPart(height));
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!bottomBandPart->isEmpty()) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
if (patternBand->keepFooterTogether())
|
|
|
|
|
closeFooterGroup(patternBand);
|
2017-08-25 18:01:59 +03:00
|
|
|
|
if (upperBandPart->isEmpty())
|
|
|
|
|
bottomBandPart->copyBookmarks(band);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!upperBandPart->isEmpty()) {
|
2023-04-11 13:39:54 +03:00
|
|
|
|
upperBandPart->setBottomSpace(0);
|
2016-02-17 10:28:27 +03:00
|
|
|
|
upperBandPart->updateItemSize(m_datasources, FirstPass, height);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
registerBand(upperBandPart);
|
2017-08-25 18:01:59 +03:00
|
|
|
|
upperBandPart->copyBookmarks(band);
|
2021-09-11 19:03:03 +03:00
|
|
|
|
if (patternBand->isFooter())
|
|
|
|
|
closeFooterGroup(m_lastDataBand);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else
|
|
|
|
|
delete upperBandPart;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (band->columnsCount() > 1
|
|
|
|
|
&& (band->columnsFillDirection() == BandDesignIntf::Vertical
|
|
|
|
|
|| band->columnsFillDirection() == BandDesignIntf::VerticalUniform)) {
|
2019-02-22 20:30:09 +03:00
|
|
|
|
startNewColumn();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (patternBand->bandHeader() && patternBand->bandHeader()->columnsCount() > 1
|
|
|
|
|
&& !m_lostHeadersMoved && patternBand->bandNestingLevel() == 0) {
|
2019-02-22 20:30:09 +03:00
|
|
|
|
renderBand(patternBand->bandHeader(), 0, StartNewPageAsNeeded);
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:28:27 +03:00
|
|
|
|
} else {
|
|
|
|
|
savePage();
|
|
|
|
|
startNewPage();
|
|
|
|
|
}
|
2017-04-20 23:34:32 +03:00
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
delete band;
|
|
|
|
|
return bottomBandPart;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
BandDesignIntf* ReportRender::renderData(BandDesignIntf* patternBand, bool emitBeforeRender)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
|
|
|
|
BandDesignIntf* bandClone = dynamic_cast<BandDesignIntf*>(patternBand->cloneItem(PreviewMode));
|
2016-12-20 01:33:58 +03:00
|
|
|
|
|
2018-03-07 19:54:57 +03:00
|
|
|
|
m_scriptEngineContext->baseDesignIntfToScript(patternBand->parent()->objectName(), bandClone);
|
2017-08-25 18:01:59 +03:00
|
|
|
|
m_scriptEngineContext->setCurrentBand(bandClone);
|
2021-01-10 23:28:16 +03:00
|
|
|
|
if (emitBeforeRender)
|
|
|
|
|
emit(patternBand->beforeRender());
|
2016-12-20 01:33:58 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (patternBand->isFooter()) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
replaceGroupsFunction(bandClone);
|
|
|
|
|
}
|
2017-03-21 18:01:35 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (patternBand->isHeader()) {
|
2017-03-21 18:01:35 +03:00
|
|
|
|
replaceGroupsFunction(bandClone);
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-18 02:03:05 +03:00
|
|
|
|
emit(patternBand->preparedForRender());
|
2023-04-11 13:39:54 +03:00
|
|
|
|
bandClone->setBottomSpace(patternBand->height() - patternBand->findMaxBottom());
|
2016-02-17 10:28:27 +03:00
|
|
|
|
bandClone->updateItemSize(m_datasources);
|
2016-12-20 01:33:58 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
// m_scriptEngineContext->baseDesignIntfToScript(bandClone);
|
2016-12-20 01:33:58 +03:00
|
|
|
|
emit(patternBand->afterData());
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
return bandClone;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::startNewColumn()
|
|
|
|
|
{
|
|
|
|
|
if (m_currentColumn < m_maxHeightByColumn.size() - 1) {
|
2016-02-17 10:28:27 +03:00
|
|
|
|
m_currentColumn++;
|
2019-02-19 15:44:23 +03:00
|
|
|
|
checkLostHeadersInPrevColumn();
|
2016-02-17 10:28:27 +03:00
|
|
|
|
} else {
|
|
|
|
|
savePage();
|
|
|
|
|
startNewPage();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-19 14:03:13 +03:00
|
|
|
|
void ReportRender::startNewPage(bool isFirst)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2018-01-18 21:44:11 +03:00
|
|
|
|
m_renderPageItem = 0;
|
|
|
|
|
m_newPageStarted = true;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
initColumns();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
initRenderPage();
|
2021-04-12 20:22:34 +03:00
|
|
|
|
m_scriptEngineContext->setCurrentPage(m_renderPageItem);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_scriptEngineContext->baseDesignIntfToScript(m_renderPageItem->patternName(),
|
|
|
|
|
m_renderPageItem);
|
2019-05-31 20:49:50 +03:00
|
|
|
|
emit m_patternPageItem->beforeRender();
|
2017-02-04 22:15:44 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_renderPageItem->setObjectName(QLatin1String("ReportPage") + QString::number(m_pageCount));
|
2019-06-21 20:18:23 +03:00
|
|
|
|
m_maxHeightByColumn[m_currentColumn] = m_renderPageItem->pageRect().height();
|
|
|
|
|
m_currentStartDataPos[m_currentColumn] = m_patternPageItem->topMargin() * Const::mmFACTOR;
|
|
|
|
|
m_currentIndex = 0;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2017-08-18 22:55:29 +03:00
|
|
|
|
if (isFirst) {
|
|
|
|
|
renderReportHeader(m_patternPageItem, BeforePageHeader);
|
|
|
|
|
emit m_patternPageItem->beforeFirstPageRendered();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
renderPageHeader(m_patternPageItem);
|
2016-12-07 23:04:15 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_pageFooterHeight = calcPageFooterHeight(m_patternPageItem) + 2;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
m_maxHeightByColumn[m_currentColumn] -= m_pageFooterHeight;
|
2019-06-21 20:18:23 +03:00
|
|
|
|
m_currentIndex = 10;
|
2016-02-17 10:28:27 +03:00
|
|
|
|
m_dataAreaSize = m_maxHeightByColumn[m_currentColumn];
|
2016-02-17 10:11:00 +03:00
|
|
|
|
m_renderedDataBandCount = 0;
|
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
|
foreach (BandDesignIntf* band, m_reprintableBands) {
|
2016-12-07 23:04:15 +03:00
|
|
|
|
renderBand(band, 0);
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkLostHeadersOnPrevPage();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
pasteGroups();
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-16 01:59:56 +03:00
|
|
|
|
void ReportRender::resetPageNumber(ResetPageNuberType resetType)
|
2016-02-17 10:28:27 +03:00
|
|
|
|
{
|
2019-01-16 03:58:54 +03:00
|
|
|
|
m_pagesRanges.startNewRange();
|
2016-09-16 01:59:56 +03:00
|
|
|
|
if (resetType == PageReset)
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_datasources->setReportVariable("#PAGE", 1);
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
void ReportRender::cutGroups()
|
|
|
|
|
{
|
|
|
|
|
m_popupedExpression.clear();
|
|
|
|
|
m_popupedValues.clear();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
// foreach(BandDesignIntf* groupBand,m_childBands.keys()){
|
|
|
|
|
foreach (BandDesignIntf* groupBand, m_childBands.keys()) {
|
|
|
|
|
if (m_childBands.value(groupBand)->tryToKeepTogether()) {
|
|
|
|
|
foreach (BandDesignIntf* band, *m_childBands.value(groupBand)) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
m_renderPageItem->removeBand(band);
|
|
|
|
|
popPageFooterGroupValues(band);
|
|
|
|
|
band->setParent(0);
|
|
|
|
|
band->setParentItem(0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::checkFooterGroup(BandDesignIntf* groupBand)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_childBands.contains(groupBand)) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
GroupBandsHolder* holder = m_childBands.value(groupBand);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* band, *holder) {
|
|
|
|
|
qreal percent = band->height() * 100 / m_dataAreaSize;
|
|
|
|
|
if (m_renderedDataBandCount <= 1 || percent > 20) {
|
|
|
|
|
holder->removeAll(band);
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ReportRender::pasteGroups()
|
|
|
|
|
{
|
|
|
|
|
BandDesignIntf* groupBand = findEnclosingGroup();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (groupBand) {
|
|
|
|
|
foreach (BandDesignIntf* band, *m_childBands.value(groupBand)) {
|
|
|
|
|
registerBand(band, false);
|
|
|
|
|
if (band->isData())
|
|
|
|
|
m_renderedDataBandCount++;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
pushPageFooterGroupValues(band);
|
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (GroupBandsHolder* holder, m_childBands.values())
|
2016-02-17 10:11:00 +03:00
|
|
|
|
holder->setTryToKeepTogether(false);
|
|
|
|
|
}
|
|
|
|
|
m_popupedExpression.clear();
|
|
|
|
|
m_popupedValues.clear();
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
bool bandLessThen(BandDesignIntf* b1, BandDesignIntf* b2)
|
|
|
|
|
{
|
2018-06-07 20:43:05 +03:00
|
|
|
|
return b1->bandIndex() < b2->bandIndex();
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:39:17 +03:00
|
|
|
|
void ReportRender::checkLostHeadersOnPrevPage()
|
|
|
|
|
{
|
2018-06-07 20:43:05 +03:00
|
|
|
|
QVector<BandDesignIntf*> lostHeaders;
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_renderedPages.isEmpty())
|
|
|
|
|
return;
|
2016-02-17 10:39:17 +03:00
|
|
|
|
PageItemDesignIntf::Ptr page = m_renderedPages.last();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (page->bands().isEmpty())
|
|
|
|
|
return;
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
QMutableListIterator<BandDesignIntf*> it(page->bands());
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
|
|
|
|
it.toBack();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (it.hasPrevious()) {
|
|
|
|
|
if (it.previous()->isFooter()) {
|
|
|
|
|
if (it.hasPrevious())
|
|
|
|
|
it.previous();
|
|
|
|
|
else
|
|
|
|
|
return;
|
2016-10-04 03:21:22 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while (it.hasPrevious()) {
|
|
|
|
|
if (it.value()->isHeader()) {
|
|
|
|
|
if (it.value()->reprintOnEachPage()) {
|
2016-02-17 10:39:17 +03:00
|
|
|
|
delete it.value();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else {
|
|
|
|
|
lostHeaders.append(it.value());
|
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
it.remove();
|
|
|
|
|
it.previous();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else
|
|
|
|
|
break;
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (lostHeaders.size() > 0) {
|
2019-02-22 20:30:09 +03:00
|
|
|
|
m_lostHeadersMoved = true;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
// std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
2021-04-12 20:22:34 +03:00
|
|
|
|
std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* header, lostHeaders) {
|
2018-06-07 20:43:05 +03:00
|
|
|
|
registerBand(header);
|
|
|
|
|
}
|
2019-02-22 20:30:09 +03:00
|
|
|
|
} else {
|
|
|
|
|
m_lostHeadersMoved = false;
|
2018-06-07 20:43:05 +03:00
|
|
|
|
}
|
2016-02-17 10:39:17 +03:00
|
|
|
|
}
|
|
|
|
|
|
2019-02-19 15:44:23 +03:00
|
|
|
|
void ReportRender::checkLostHeadersInPrevColumn()
|
|
|
|
|
{
|
|
|
|
|
QVector<BandDesignIntf*> lostHeaders;
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
QMutableListIterator<BandDesignIntf*> it(m_renderPageItem->bands());
|
2019-02-19 15:44:23 +03:00
|
|
|
|
|
|
|
|
|
it.toBack();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (it.hasPrevious()) {
|
|
|
|
|
if (it.previous()->isFooter()) {
|
|
|
|
|
if (it.hasPrevious())
|
|
|
|
|
it.previous();
|
|
|
|
|
else
|
|
|
|
|
return;
|
2019-02-19 15:44:23 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
while (it.hasPrevious()) {
|
|
|
|
|
if (it.value()->isHeader()) {
|
|
|
|
|
if (it.value()->reprintOnEachPage()) {
|
2019-02-19 15:44:23 +03:00
|
|
|
|
delete it.value();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else {
|
|
|
|
|
lostHeaders.append(it.value());
|
|
|
|
|
}
|
2019-02-19 15:44:23 +03:00
|
|
|
|
it.remove();
|
|
|
|
|
it.previous();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else
|
|
|
|
|
break;
|
2019-02-19 15:44:23 +03:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (lostHeaders.size() > 0) {
|
2019-02-22 20:30:09 +03:00
|
|
|
|
m_lostHeadersMoved = true;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
// std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
2021-04-12 20:22:34 +03:00
|
|
|
|
std::sort(lostHeaders.begin(), lostHeaders.end(), bandLessThen);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (BandDesignIntf* header, lostHeaders) {
|
2019-02-19 15:44:23 +03:00
|
|
|
|
registerBand(header);
|
|
|
|
|
}
|
2019-02-22 20:30:09 +03:00
|
|
|
|
} else {
|
|
|
|
|
m_lostHeadersMoved = false;
|
2019-02-19 15:44:23 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
BandDesignIntf* ReportRender::findEnclosingGroup()
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
BandDesignIntf* result = 0;
|
2016-02-17 10:11:00 +03:00
|
|
|
|
int groupIndex = -1;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!m_childBands.isEmpty()) {
|
|
|
|
|
foreach (BandDesignIntf* gb, m_childBands.keys()) {
|
|
|
|
|
if (m_childBands.value(gb)->tryToKeepTogether()
|
|
|
|
|
&& ((gb->bandIndex() < groupIndex) || (groupIndex == -1))) {
|
|
|
|
|
result = gb;
|
|
|
|
|
groupIndex = result->bandIndex();
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-04 03:21:22 +03:00
|
|
|
|
void ReportRender::savePage(bool isLast)
|
2016-02-17 10:11:00 +03:00
|
|
|
|
{
|
2017-07-21 20:35:33 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_datasources->setReportVariable("#IS_LAST_PAGEFOOTER", isLast);
|
|
|
|
|
m_datasources->setReportVariable("#IS_FIRST_PAGEFOOTER",
|
|
|
|
|
m_datasources->variable("#PAGE").toInt() == 1);
|
2017-07-21 20:35:33 +03:00
|
|
|
|
|
2017-06-23 09:57:02 +03:00
|
|
|
|
renderPageItems(m_patternPageItem);
|
2020-10-01 02:13:28 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_renderPageItem->isEmpty() && m_renderPageItem->notPrintIfEmpty())
|
|
|
|
|
return;
|
2020-10-01 02:13:28 +03:00
|
|
|
|
|
|
|
|
|
if (m_renderPageItem->isTOC())
|
|
|
|
|
m_pagesRanges.addTOCPage();
|
|
|
|
|
else
|
|
|
|
|
m_pagesRanges.addPage();
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
checkFooterGroup(m_lastDataBand);
|
|
|
|
|
cutGroups();
|
2016-02-17 10:39:17 +03:00
|
|
|
|
rearrangeColumnsItems();
|
|
|
|
|
m_columnedBandItems.clear();
|
2016-10-04 03:21:22 +03:00
|
|
|
|
|
|
|
|
|
BandDesignIntf* pf = m_patternPageItem->bandByType(BandDesignIntf::PageFooter);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (pf && m_datasources->variable("#PAGE").toInt() != 1 && !isLast) {
|
2016-10-04 03:21:22 +03:00
|
|
|
|
renderPageFooter(m_patternPageItem);
|
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (pf && pf->property("printOnFirstPage").toBool()
|
|
|
|
|
&& m_datasources->variable("#PAGE").toInt() == 1) {
|
2016-10-04 03:21:22 +03:00
|
|
|
|
renderPageFooter(m_patternPageItem);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
} else if (pf && pf->property("printOnLastPage").toBool() && isLast) {
|
2016-10-04 03:21:22 +03:00
|
|
|
|
renderPageFooter(m_patternPageItem);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-02-17 10:28:27 +03:00
|
|
|
|
|
2019-01-17 00:26:27 +03:00
|
|
|
|
if (m_pagesRanges.currentRange(m_patternPageItem->isTOC()).firstPage == 0) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_datasources->setReportVariable("#PAGE", 1);
|
2016-02-17 10:28:27 +03:00
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_datasources->setReportVariable("#PAGE", m_datasources->variable("#PAGE").toInt() + 1);
|
2016-02-17 10:28:27 +03:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-17 10:11:00 +03:00
|
|
|
|
m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem));
|
2016-04-07 18:57:27 +03:00
|
|
|
|
m_pageCount++;
|
2016-09-16 01:59:56 +03:00
|
|
|
|
emit pageRendered(m_pageCount);
|
2017-04-09 01:41:42 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (isLast) {
|
2016-10-04 03:21:22 +03:00
|
|
|
|
BandDesignIntf* ph = m_renderPageItem->bandByType(BandDesignIntf::PageHeader);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (ph && !ph->property("printOnLastPage").toBool()) {
|
2016-10-04 03:21:22 +03:00
|
|
|
|
delete ph;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_renderPageItem->pageFooter()) {
|
2020-04-17 12:28:59 +03:00
|
|
|
|
m_renderPageItem->pageFooter()->setBandIndex(++m_currentIndex);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_renderPageItem->pageFooter()->property("removeGap").toBool()) {
|
2020-04-17 12:28:59 +03:00
|
|
|
|
m_renderPageItem->pageFooter()->setPos(m_lastRenderedBand->geometry().bottomLeft());
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-04-16 00:23:12 +03:00
|
|
|
|
m_renderPageItem->placeTearOffBand();
|
2020-04-17 12:28:59 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
// m_scriptEngineContext->setCurrentPage(m_renderPageItem);
|
2017-02-04 22:15:44 +03:00
|
|
|
|
emit m_patternPageItem->afterRender();
|
2019-02-19 02:23:53 +03:00
|
|
|
|
if (isLast)
|
|
|
|
|
emit m_patternPageItem->afterLastPageRendered();
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (isLast && m_patternPageItem->endlessHeight()) {
|
2017-10-28 01:19:39 +03:00
|
|
|
|
qreal pageHeight = 0;
|
|
|
|
|
foreach (BandDesignIntf* band, m_renderPageItem->bands()) {
|
|
|
|
|
pageHeight += band->height();
|
|
|
|
|
}
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_renderPageItem->setHeight(
|
|
|
|
|
pageHeight + 10
|
|
|
|
|
+ (m_patternPageItem->topMargin() + m_patternPageItem->bottomMargin())
|
|
|
|
|
* Const::mmFACTOR);
|
2017-10-28 01:19:39 +03:00
|
|
|
|
}
|
2016-02-17 10:11:00 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString ReportRender::toString()
|
|
|
|
|
{
|
|
|
|
|
QScopedPointer<ItemsWriterIntf> writer(new XMLWriter());
|
2024-09-04 17:31:16 +03:00
|
|
|
|
foreach (PageItemDesignIntf::Ptr page, m_renderedPages) {
|
2016-02-17 10:11:00 +03:00
|
|
|
|
writer->putItem(page.data());
|
|
|
|
|
}
|
|
|
|
|
return writer->saveToString();
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
ReportRender::~ReportRender() { m_renderedPages.clear(); }
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void ReportRender::cancelRender() { m_renderCanceled = true; }
|
2016-02-17 10:11:00 +03:00
|
|
|
|
|
2019-01-16 03:58:54 +03:00
|
|
|
|
int PagesRanges::findLastPageNumber(int index)
|
|
|
|
|
{
|
2019-01-17 00:26:27 +03:00
|
|
|
|
index++;
|
2019-01-16 03:58:54 +03:00
|
|
|
|
foreach (PagesRange range, m_ranges) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (range.firstPage <= (index) && range.lastPage >= (index))
|
|
|
|
|
return (range.lastPage - (range.firstPage)) + 1;
|
2019-01-16 03:58:54 +03:00
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int PagesRanges::findPageNumber(int index)
|
|
|
|
|
{
|
2019-01-17 00:26:27 +03:00
|
|
|
|
index++;
|
2019-01-16 03:58:54 +03:00
|
|
|
|
foreach (PagesRange range, m_ranges) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (range.firstPage <= (index) && range.lastPage >= (index))
|
|
|
|
|
return (index - range.firstPage) + 1;
|
2019-01-16 03:58:54 +03:00
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
PagesRange& PagesRanges::currentRange(bool isTOC)
|
2019-01-17 00:26:27 +03:00
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
Q_ASSERT((isTOC && m_TOCRangeIndex != -1) || !isTOC);
|
|
|
|
|
if (isTOC && m_TOCRangeIndex != -1)
|
|
|
|
|
return m_ranges[m_TOCRangeIndex];
|
2019-01-17 00:26:27 +03:00
|
|
|
|
return m_ranges.last();
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-16 03:58:54 +03:00
|
|
|
|
void PagesRanges::startNewRange(bool isTOC)
|
|
|
|
|
{
|
|
|
|
|
PagesRange range;
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (!m_ranges.isEmpty()) {
|
2019-01-16 03:58:54 +03:00
|
|
|
|
range.firstPage = 0;
|
|
|
|
|
range.lastPage = m_ranges.last().lastPage + 1;
|
|
|
|
|
} else {
|
|
|
|
|
range.firstPage = 0;
|
|
|
|
|
range.lastPage = 0;
|
|
|
|
|
}
|
|
|
|
|
range.isTOC = isTOC;
|
|
|
|
|
m_ranges.append(range);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (isTOC)
|
|
|
|
|
m_TOCRangeIndex = m_ranges.size() - 1;
|
2019-01-16 03:58:54 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PagesRanges::addTOCMarker(bool addNewRange)
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (addNewRange || m_ranges.isEmpty()) {
|
2019-01-16 03:58:54 +03:00
|
|
|
|
startNewRange(true);
|
|
|
|
|
} else {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
m_TOCRangeIndex = m_ranges.size() - 1;
|
2019-01-16 03:58:54 +03:00
|
|
|
|
m_ranges.last().isTOC = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PagesRanges::addPage()
|
|
|
|
|
{
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_ranges.isEmpty())
|
|
|
|
|
startNewRange();
|
|
|
|
|
if (m_ranges.last().firstPage == 0) {
|
2019-01-16 03:58:54 +03:00
|
|
|
|
m_ranges.last().firstPage = m_ranges.last().lastPage == 0 ? 1 : m_ranges.last().lastPage;
|
|
|
|
|
m_ranges.last().lastPage = m_ranges.last().lastPage == 0 ? 1 : m_ranges.last().lastPage;
|
|
|
|
|
} else {
|
|
|
|
|
m_ranges.last().lastPage++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void PagesRanges::shiftRangesNextToTOC()
|
|
|
|
|
{
|
|
|
|
|
for (int i = m_TOCRangeIndex + 1; i < m_ranges.size(); ++i) {
|
2019-01-16 03:58:54 +03:00
|
|
|
|
m_ranges[i].firstPage++;
|
|
|
|
|
m_ranges[i].lastPage++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PagesRanges::addTOCPage()
|
|
|
|
|
{
|
|
|
|
|
Q_ASSERT(m_TOCRangeIndex != -1);
|
2024-09-04 17:31:16 +03:00
|
|
|
|
if (m_TOCRangeIndex != -1) {
|
2019-01-16 03:58:54 +03:00
|
|
|
|
PagesRange& tocRange = m_ranges[m_TOCRangeIndex];
|
|
|
|
|
if (tocRange.firstPage == 0) {
|
2024-09-04 17:31:16 +03:00
|
|
|
|
tocRange.firstPage = tocRange.lastPage == 0 ? 1 : tocRange.lastPage;
|
|
|
|
|
tocRange.lastPage = tocRange.lastPage == 0 ? 1 : tocRange.lastPage;
|
2019-06-27 10:45:26 +03:00
|
|
|
|
if (tocRange.firstPage == 1 && tocRange.lastPage == 1)
|
2019-01-16 03:58:54 +03:00
|
|
|
|
shiftRangesNextToTOC();
|
|
|
|
|
} else {
|
|
|
|
|
tocRange.lastPage++;
|
|
|
|
|
shiftRangesNextToTOC();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-04 17:31:16 +03:00
|
|
|
|
void PagesRanges::clear() { m_ranges.clear(); }
|
2019-01-16 03:58:54 +03:00
|
|
|
|
|
2017-04-20 23:34:32 +03:00
|
|
|
|
} // namespace LimeReport
|