0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-11-07 00:21:24 +03:00

TOC Refactored

This commit is contained in:
Arin Alexander
2019-02-12 22:45:35 +03:00
parent 9be042819b
commit 3aee2b62d7
8 changed files with 42 additions and 28 deletions

View File

@@ -1112,21 +1112,21 @@ BandDesignIntf* ReportRender::sliceBand(BandDesignIntf *band, BandDesignIntf* pa
}
void ReportRender::updateTOC(BaseDesignIntf* item, int pageNumber){
BandDesignIntf* band = dynamic_cast<BandDesignIntf*>(item);
if (band){
BookmarkContainerDesignIntf* bookmarkContainer = dynamic_cast<BookmarkContainerDesignIntf*>(item);
if (bookmarkContainer){
TableOfContents* toc = m_scriptEngineContext->tableOfContents();
foreach (QString key, band->bookmarks()){
toc->setItem(key, band->getBookMark(key).toString(), pageNumber);
foreach (QString key, bookmarkContainer->bookmarks()){
toc->setItem(key, bookmarkContainer->getBookMark(key).toString(), pageNumber);
}
}
}
void ReportRender::secondRenderPass(ReportPages renderedPages)
{
if (!m_scriptEngineContext->tableOfContents()->isEmpty()){
for(int i=0; i<renderedPages.count(); ++i){
PageItemDesignIntf::Ptr page = renderedPages.at(i);
updateTOC(page.data(), m_pagesRanges.findPageNumber(i));
foreach(BaseDesignIntf* item, page->childBaseItems()){
updateTOC(item, m_pagesRanges.findPageNumber(i));
}