mirror of
https://github.com/fralx/LimeReport.git
synced 2024-12-25 00:54:39 +03:00
Old page ranges have been removed
This commit is contained in:
parent
83fd13589e
commit
ed05f5442e
@ -223,7 +223,10 @@ namespace LimeReport {
|
|||||||
void multiItemsSelected(QList<QObject*>* objectsList);
|
void multiItemsSelected(QList<QObject*>* objectsList);
|
||||||
void miltiItemsSelectionFinished();
|
void miltiItemsSelectionFinished();
|
||||||
void commandHistoryChanged();
|
void commandHistoryChanged();
|
||||||
void itemPropertyChanged(const QString& objectName, const QString& propertyName, const QVariant& oldValue, const QVariant& newValue);
|
void itemPropertyChanged(const QString& objectName,
|
||||||
|
const QString& propertyName,
|
||||||
|
const QVariant& oldValue,
|
||||||
|
const QVariant& newValue);
|
||||||
void itemAdded(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item);
|
void itemAdded(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item);
|
||||||
void itemRemoved(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item);
|
void itemRemoved(LimeReport::PageDesignIntf* page, LimeReport::BaseDesignIntf* item);
|
||||||
void bandAdded(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band);
|
void bandAdded(LimeReport::PageDesignIntf* page, LimeReport::BandDesignIntf* band);
|
||||||
@ -275,7 +278,9 @@ namespace LimeReport {
|
|||||||
void checkSizeOrPosChanges();
|
void checkSizeOrPosChanges();
|
||||||
CommandIf::Ptr createChangePosCommand();
|
CommandIf::Ptr createChangePosCommand();
|
||||||
CommandIf::Ptr createChangeSizeCommand();
|
CommandIf::Ptr createChangeSizeCommand();
|
||||||
void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName, const QVariant& oldPropertyValue, const QVariant& newPropertyValue);
|
void saveChangeProppertyCommand(const QString& objectName, const QString& propertyName,
|
||||||
|
const QVariant& oldPropertyValue,
|
||||||
|
const QVariant& newPropertyValue);
|
||||||
void changeSelectedGroupProperty(const QString& name,const QVariant& value);
|
void changeSelectedGroupProperty(const QString& name,const QVariant& value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -148,7 +148,7 @@ void ReportRender::renameChildItems(BaseDesignIntf *item){
|
|||||||
|
|
||||||
ReportRender::ReportRender(QObject *parent)
|
ReportRender::ReportRender(QObject *parent)
|
||||||
:QObject(parent), m_renderPageItem(0), m_pageCount(0),
|
:QObject(parent), m_renderPageItem(0), m_pageCount(0),
|
||||||
m_lastRenderedHeader(0), m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0), m_newPageStarted(false), m_renderingFirstTOC(false)
|
m_lastRenderedHeader(0), m_lastDataBand(0), m_lastRenderedFooter(0), m_currentColumn(0), m_newPageStarted(false)
|
||||||
{
|
{
|
||||||
initColumns();
|
initColumns();
|
||||||
}
|
}
|
||||||
@ -192,7 +192,7 @@ void ReportRender::renderPage(PageItemDesignIntf* patternPage, bool isTOC, bool
|
|||||||
{
|
{
|
||||||
m_currentNameIndex = 0;
|
m_currentNameIndex = 0;
|
||||||
m_patternPageItem = patternPage;
|
m_patternPageItem = patternPage;
|
||||||
m_renderingFirstTOC = isTOC && isFirst;
|
|
||||||
if (m_patternPageItem->resetPageNumber() && m_pageCount>0 && !isTOC) {
|
if (m_patternPageItem->resetPageNumber() && m_pageCount>0 && !isTOC) {
|
||||||
resetPageNumber(PageReset);
|
resetPageNumber(PageReset);
|
||||||
}
|
}
|
||||||
@ -201,14 +201,6 @@ void ReportRender::renderPage(PageItemDesignIntf* patternPage, bool isTOC, bool
|
|||||||
m_pagesRanges.startNewRange();
|
m_pagesRanges.startNewRange();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_renderingFirstTOC && resetPageNumbers){
|
|
||||||
PagesRange range;
|
|
||||||
range.firstPage = 0;
|
|
||||||
range.lastPage = 0;
|
|
||||||
m_ranges.insert(0,range);
|
|
||||||
m_pageCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_renderCanceled = false;
|
m_renderCanceled = false;
|
||||||
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
|
BandDesignIntf* reportFooter = m_patternPageItem->bandByType(BandDesignIntf::ReportFooter);
|
||||||
m_reportFooterHeight = 0;
|
m_reportFooterHeight = 0;
|
||||||
@ -251,11 +243,6 @@ void ReportRender::renderPage(PageItemDesignIntf* patternPage, bool isTOC, bool
|
|||||||
|
|
||||||
savePage(true);
|
savePage(true);
|
||||||
|
|
||||||
if (m_renderingFirstTOC && resetPageNumbers && m_ranges.count()>1){
|
|
||||||
m_ranges[1].firstPage = m_ranges.first().lastPage+1;
|
|
||||||
m_ranges[1].lastPage += m_ranges.first().lastPage+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef USE_QJSENGINE
|
#ifndef USE_QJSENGINE
|
||||||
ScriptEngineManager::instance().scriptEngine()->popContext();
|
ScriptEngineManager::instance().scriptEngine()->popContext();
|
||||||
#endif
|
#endif
|
||||||
@ -1141,15 +1128,15 @@ void ReportRender::secondRenderPass(ReportPages renderedPages)
|
|||||||
for(int i=0; i<renderedPages.count(); ++i){
|
for(int i=0; i<renderedPages.count(); ++i){
|
||||||
PageItemDesignIntf::Ptr page = renderedPages.at(i);
|
PageItemDesignIntf::Ptr page = renderedPages.at(i);
|
||||||
foreach(BaseDesignIntf* item, page->childBaseItems()){
|
foreach(BaseDesignIntf* item, page->childBaseItems()){
|
||||||
updateTOC(item, findPageNumber(i));
|
updateTOC(item, m_pagesRanges.findPageNumber(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i=0; i<renderedPages.count(); ++i){
|
for(int i=0; i<renderedPages.count(); ++i){
|
||||||
PageItemDesignIntf::Ptr page = renderedPages.at(i);
|
PageItemDesignIntf::Ptr page = renderedPages.at(i);
|
||||||
m_datasources->setReportVariable("#PAGE",findPageNumber(i));
|
m_datasources->setReportVariable("#PAGE",m_pagesRanges.findPageNumber(i));
|
||||||
m_datasources->setReportVariable("#PAGE_COUNT",findLastPageNumber(i));
|
m_datasources->setReportVariable("#PAGE_COUNT",m_pagesRanges.findLastPageNumber(i));
|
||||||
foreach(BaseDesignIntf* item, page->childBaseItems()){
|
foreach(BaseDesignIntf* item, page->childBaseItems()){
|
||||||
item->updateItemSize(m_datasources, SecondPass);
|
item->updateItemSize(m_datasources, SecondPass);
|
||||||
}
|
}
|
||||||
@ -1265,37 +1252,10 @@ void ReportRender::startNewPage(bool isFirst)
|
|||||||
void ReportRender::resetPageNumber(ResetPageNuberType resetType)
|
void ReportRender::resetPageNumber(ResetPageNuberType resetType)
|
||||||
{
|
{
|
||||||
m_pagesRanges.startNewRange();
|
m_pagesRanges.startNewRange();
|
||||||
PagesRange range;
|
|
||||||
if (!m_ranges.isEmpty()){
|
|
||||||
currentRange().lastPage = (resetType == BandReset)? m_pageCount : m_pageCount-1;
|
|
||||||
range.firstPage = m_pageCount+((resetType == BandReset)? 1 : 0);
|
|
||||||
} else {
|
|
||||||
range.firstPage = m_pageCount;
|
|
||||||
}
|
|
||||||
range.lastPage = (resetType == BandReset)? 0 : m_pageCount;
|
|
||||||
m_ranges.append(range);
|
|
||||||
if (resetType == PageReset)
|
if (resetType == PageReset)
|
||||||
m_datasources->setReportVariable("#PAGE",1);
|
m_datasources->setReportVariable("#PAGE",1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ReportRender::findLastPageNumber(int currentPage)
|
|
||||||
{
|
|
||||||
foreach (PagesRange range, m_ranges) {
|
|
||||||
if ( range.firstPage<= (currentPage) && range.lastPage>= (currentPage) )
|
|
||||||
return (range.lastPage-(range.firstPage))+1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ReportRender::findPageNumber(int currentPage)
|
|
||||||
{
|
|
||||||
foreach (PagesRange range, m_ranges) {
|
|
||||||
if ( range.firstPage<= (currentPage) && range.lastPage>= (currentPage) )
|
|
||||||
return (currentPage - range.firstPage)+1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReportRender::cutGroups()
|
void ReportRender::cutGroups()
|
||||||
{
|
{
|
||||||
m_popupedExpression.clear();
|
m_popupedExpression.clear();
|
||||||
@ -1440,14 +1400,12 @@ void ReportRender::savePage(bool isLast)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (currentRange(m_renderingFirstTOC).lastPage==0 && m_ranges.count()>1) {
|
if (m_pagesRanges.currentRange(m_patternPageItem->isTOC()).firstPage == 0) {
|
||||||
m_datasources->setReportVariable("#PAGE",1);
|
m_datasources->setReportVariable("#PAGE",1);
|
||||||
} else {
|
} else {
|
||||||
m_datasources->setReportVariable("#PAGE",m_datasources->variable("#PAGE").toInt()+1);
|
m_datasources->setReportVariable("#PAGE",m_datasources->variable("#PAGE").toInt()+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentRange(m_renderingFirstTOC).lastPage = m_pageCount;
|
|
||||||
|
|
||||||
BandDesignIntf* pageFooter = m_renderPageItem->bandByType(BandDesignIntf::PageFooter);
|
BandDesignIntf* pageFooter = m_renderPageItem->bandByType(BandDesignIntf::PageFooter);
|
||||||
if (pageFooter) pageFooter->setBandIndex(++m_currentIndex);
|
if (pageFooter) pageFooter->setBandIndex(++m_currentIndex);
|
||||||
m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem));
|
m_renderedPages.append(PageItemDesignIntf::Ptr(m_renderPageItem));
|
||||||
@ -1493,6 +1451,7 @@ void ReportRender::cancelRender(){
|
|||||||
|
|
||||||
int PagesRanges::findLastPageNumber(int index)
|
int PagesRanges::findLastPageNumber(int index)
|
||||||
{
|
{
|
||||||
|
index++;
|
||||||
foreach (PagesRange range, m_ranges) {
|
foreach (PagesRange range, m_ranges) {
|
||||||
if ( range.firstPage <= (index) && range.lastPage>= (index) )
|
if ( range.firstPage <= (index) && range.lastPage>= (index) )
|
||||||
return (range.lastPage-(range.firstPage))+1;
|
return (range.lastPage-(range.firstPage))+1;
|
||||||
@ -1502,6 +1461,7 @@ int PagesRanges::findLastPageNumber(int index)
|
|||||||
|
|
||||||
int PagesRanges::findPageNumber(int index)
|
int PagesRanges::findPageNumber(int index)
|
||||||
{
|
{
|
||||||
|
index++;
|
||||||
foreach (PagesRange range, m_ranges) {
|
foreach (PagesRange range, m_ranges) {
|
||||||
if ( range.firstPage <= (index) && range.lastPage >= (index) )
|
if ( range.firstPage <= (index) && range.lastPage >= (index) )
|
||||||
return (index - range.firstPage)+1;
|
return (index - range.firstPage)+1;
|
||||||
@ -1509,6 +1469,13 @@ int PagesRanges::findPageNumber(int index)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PagesRange&PagesRanges::currentRange(bool isTOC)
|
||||||
|
{
|
||||||
|
Q_ASSERT( (isTOC && m_TOCRangeIndex!=-1) || !isTOC);
|
||||||
|
if (isTOC && m_TOCRangeIndex !=-1) return m_ranges[m_TOCRangeIndex];
|
||||||
|
return m_ranges.last();
|
||||||
|
}
|
||||||
|
|
||||||
void PagesRanges::startNewRange(bool isTOC)
|
void PagesRanges::startNewRange(bool isTOC)
|
||||||
{
|
{
|
||||||
PagesRange range;
|
PagesRange range;
|
||||||
|
@ -69,6 +69,7 @@ public:
|
|||||||
PagesRanges(): m_TOCRangeIndex(-1) {}
|
PagesRanges(): m_TOCRangeIndex(-1) {}
|
||||||
int findLastPageNumber(int index);
|
int findLastPageNumber(int index);
|
||||||
int findPageNumber(int index);
|
int findPageNumber(int index);
|
||||||
|
PagesRange& currentRange(bool isTOC);
|
||||||
void startNewRange(bool isTOC = false);
|
void startNewRange(bool isTOC = false);
|
||||||
void addTOCMarker(bool addNewRange);
|
void addTOCMarker(bool addNewRange);
|
||||||
void addPage();
|
void addPage();
|
||||||
@ -166,8 +167,8 @@ private:
|
|||||||
void startNewColumn();
|
void startNewColumn();
|
||||||
void startNewPage(bool isFirst = false);
|
void startNewPage(bool isFirst = false);
|
||||||
void resetPageNumber(ResetPageNuberType resetType);
|
void resetPageNumber(ResetPageNuberType resetType);
|
||||||
int findLastPageNumber(int currentPage);
|
//int findLastPageNumber(int currentPage);
|
||||||
int findPageNumber(int currentPage);
|
//int findPageNumber(int currentPage);
|
||||||
void savePage(bool isLast = false);
|
void savePage(bool isLast = false);
|
||||||
QString toString();
|
QString toString();
|
||||||
void initColumns();
|
void initColumns();
|
||||||
@ -180,7 +181,7 @@ private:
|
|||||||
void renameChildItems(BaseDesignIntf *item);
|
void renameChildItems(BaseDesignIntf *item);
|
||||||
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
|
void renderGroupFooterByHeader(BandDesignIntf *groupHeader);
|
||||||
void updateTOC(BaseDesignIntf* item, int pageNumber);
|
void updateTOC(BaseDesignIntf* item, int pageNumber);
|
||||||
PagesRange& currentRange(bool isTOC = false){ return (isTOC) ? m_ranges.first(): m_ranges.last();}
|
//PagesRange& currentRange(bool isTOC = false){ return (isTOC) ? m_ranges.first(): m_ranges.last();}
|
||||||
void placeBandOnPage(BandDesignIntf *band, int columnIndex);
|
void placeBandOnPage(BandDesignIntf *band, int columnIndex);
|
||||||
private:
|
private:
|
||||||
DataSourceManager* m_datasources;
|
DataSourceManager* m_datasources;
|
||||||
@ -209,12 +210,10 @@ private:
|
|||||||
QVector<qreal> m_maxHeightByColumn;
|
QVector<qreal> m_maxHeightByColumn;
|
||||||
QVector<qreal> m_currentStartDataPos;
|
QVector<qreal> m_currentStartDataPos;
|
||||||
int m_currentColumn;
|
int m_currentColumn;
|
||||||
QList<PagesRange> m_ranges;
|
|
||||||
PagesRanges m_pagesRanges;
|
PagesRanges m_pagesRanges;
|
||||||
QVector<BandDesignIntf*> m_columnedBandItems;
|
QVector<BandDesignIntf*> m_columnedBandItems;
|
||||||
unsigned long long m_currentNameIndex;
|
unsigned long long m_currentNameIndex;
|
||||||
bool m_newPageStarted;
|
bool m_newPageStarted;
|
||||||
bool m_renderingFirstTOC;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
} // namespace LimeReport
|
} // namespace LimeReport
|
||||||
|
Loading…
Reference in New Issue
Block a user