Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportPreRenderer.cpp
Show First 20 Lines • Show All 336 Lines • ▼ Show 20 Line(s) | 323 | { | |||
---|---|---|---|---|---|
337 | 337 | | |||
338 | //Render section background | 338 | //Render section background | ||
339 | ORORect* bg = new ORORect(); | 339 | ORORect* bg = new ORORect(); | ||
340 | bg->setPen(QPen(Qt::NoPen)); | 340 | bg->setPen(QPen(Qt::NoPen)); | ||
341 | bg->setBrush(sectionData.backgroundColor()); | 341 | bg->setBrush(sectionData.backgroundColor()); | ||
342 | qreal w = m_page->document()->pageLayout().fullRectPixels(KReportDpi::dpiX()).width() - m_page->document()->pageLayout().marginsPixels(KReportDpi::dpiX()).right() - m_leftMargin; | 342 | qreal w = m_page->document()->pageLayout().fullRectPixels(KReportDpi::dpiX()).width() - m_page->document()->pageLayout().marginsPixels(KReportDpi::dpiX()).right() - m_leftMargin; | ||
343 | 343 | | |||
344 | bg->setRect(QRectF(m_leftMargin, m_yOffset, w, sectionHeight)); | 344 | bg->setRect(QRectF(m_leftMargin, m_yOffset, w, sectionHeight)); | ||
345 | m_page->addPrimitive(bg, true); | 345 | m_page->insertPrimitive(bg, true); | ||
346 | 346 | | |||
347 | QList<KReportItemBase*> objects = sectionData.objects(); | 347 | QList<KReportItemBase*> objects = sectionData.objects(); | ||
348 | foreach(KReportItemBase *ob, objects) { | 348 | foreach(KReportItemBase *ob, objects) { | ||
349 | QPointF offset(m_leftMargin, m_yOffset); | 349 | QPointF offset(m_leftMargin, m_yOffset); | ||
350 | QVariant itemData = m_kodata->value(ob->itemDataSource()); | 350 | QVariant itemData = m_kodata->value(ob->itemDataSource()); | ||
351 | 351 | | |||
352 | if (ob->supportsSubQuery()) { | 352 | if (ob->supportsSubQuery()) { | ||
353 | itemHeight = ob->renderReportData(m_page, sec, offset, m_kodata, m_scriptHandler); | 353 | itemHeight = ob->renderReportData(m_page, sec, offset, m_kodata, m_scriptHandler); | ||
354 | } else { | 354 | } else { | ||
355 | KReportAsyncItemBase *async_ob = qobject_cast<KReportAsyncItemBase*>(ob); | 355 | KReportAsyncItemBase *async_ob = qobject_cast<KReportAsyncItemBase*>(ob); | ||
356 | if (async_ob){ | 356 | if (async_ob){ | ||
357 | //kreportDebug() << "async object"; | 357 | //kreportDebug() << "async object"; | ||
358 | asyncManager->addItem(async_ob, m_page, sec, offset, itemData, m_scriptHandler); | 358 | asyncManager->addItem(async_ob, m_page, sec, offset, itemData, m_scriptHandler); | ||
359 | } else { | 359 | } else { | ||
360 | //kreportDebug() << "sync object"; | 360 | //kreportDebug() << "sync object"; | ||
361 | itemHeight = ob->renderSimpleData(m_page, sec, offset, itemData, m_scriptHandler); | 361 | itemHeight = ob->renderSimpleData(m_page, sec, offset, itemData, m_scriptHandler); | ||
362 | } | 362 | } | ||
363 | } | 363 | } | ||
364 | 364 | | |||
365 | if (itemHeight > sectionHeight) { | 365 | if (itemHeight > sectionHeight) { | ||
366 | sectionHeight = itemHeight; | 366 | sectionHeight = itemHeight; | ||
367 | } | 367 | } | ||
368 | } | 368 | } | ||
369 | for (int i = 0; i < m_page->primitives(); ++i) { | 369 | for (int i = 0; i < m_page->primitiveCount(); ++i) { | ||
370 | OROPrimitive *prim = m_page->primitive(i); | 370 | OROPrimitive *prim = m_page->primitive(i); | ||
371 | if (prim->type() == OROTextBox::TextBox) { | 371 | if (dynamic_cast<OROTextBox*>(prim)) { | ||
372 | OROTextBox *text = static_cast<OROTextBox*>(prim); | 372 | OROTextBox *text = dynamic_cast<OROTextBox*>(prim); | ||
373 | if (text->requiresPostProcessing()) { | 373 | if (text->requiresPostProcessing()) { | ||
374 | m_postProcText.append(text); | 374 | m_postProcText.append(text); | ||
375 | } | 375 | } | ||
376 | } | 376 | } | ||
377 | } | 377 | } | ||
378 | m_yOffset += sectionHeight; | 378 | m_yOffset += sectionHeight; | ||
379 | 379 | | |||
380 | return sectionHeight; | 380 | return sectionHeight; | ||
▲ Show 20 Lines • Show All 196 Lines • ▼ Show 20 Line(s) | 573 | if (m_reportDocument->m_reportFooter) { | |||
577 | renderSection(*(m_reportDocument->m_reportFooter)); | 577 | renderSection(*(m_reportDocument->m_reportFooter)); | ||
578 | } | 578 | } | ||
579 | } | 579 | } | ||
580 | finishCurPage(true); | 580 | finishCurPage(true); | ||
581 | 581 | | |||
582 | #ifdef KREPORT_SCRIPTING | 582 | #ifdef KREPORT_SCRIPTING | ||
583 | // _postProcText contains those text boxes that need to be updated | 583 | // _postProcText contains those text boxes that need to be updated | ||
584 | // with information that wasn't available at the time it was added to the document | 584 | // with information that wasn't available at the time it was added to the document | ||
585 | m_scriptHandler->setPageTotal(m_document->pages()); | 585 | m_scriptHandler->setPageTotal(m_document->pageCount()); | ||
586 | 586 | | |||
587 | for (int i = 0; i < m_postProcText.size(); i++) { | 587 | for (int i = 0; i < m_postProcText.size(); i++) { | ||
588 | OROTextBox * tb = m_postProcText.at(i); | 588 | OROTextBox * tb = m_postProcText.at(i); | ||
589 | 589 | | |||
590 | m_scriptHandler->setPageNumber(tb->page()->page() + 1); | 590 | m_scriptHandler->setPageNumber(tb->page()->pageNumber() + 1); | ||
591 | 591 | | |||
592 | tb->setText(m_scriptHandler->evaluate(tb->text()).toString()); | 592 | tb->setText(m_scriptHandler->evaluate(tb->text()).toString()); | ||
593 | } | 593 | } | ||
594 | #endif | 594 | #endif | ||
595 | 595 | | |||
596 | asyncManager->startRendering(); | 596 | asyncManager->startRendering(); | ||
597 | 597 | | |||
598 | #ifdef KREPORT_SCRIPTING | 598 | #ifdef KREPORT_SCRIPTING | ||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |