Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportPreRenderer.cpp
Show All 22 Lines | |||||
23 | 23 | | |||
24 | #include "KReportRenderObjects.h" | 24 | #include "KReportRenderObjects.h" | ||
25 | #include "KReportData.h" | 25 | #include "KReportData.h" | ||
26 | #include "KReportItemBase.h" | 26 | #include "KReportItemBase.h" | ||
27 | #include "KReportDocument.h" | 27 | #include "KReportDocument.h" | ||
28 | #include "KReportDetailSectionData.h" | 28 | #include "KReportDetailSectionData.h" | ||
29 | #include "KReportLabelSizeInfo.h" | 29 | #include "KReportLabelSizeInfo.h" | ||
30 | #include "KReportPageSize.h" | 30 | #include "KReportPageSize.h" | ||
31 | #include "KReportDpi.h" | 31 | #include "KReportUtils_p.h" | ||
32 | 32 | | |||
33 | #ifdef KREPORT_SCRIPTING | 33 | #ifdef KREPORT_SCRIPTING | ||
34 | #include "scripting/KReportScriptHandler.h" | 34 | #include "scripting/KReportScriptHandler.h" | ||
35 | #include "scripting/KReportGroupTracker.h" | 35 | #include "scripting/KReportGroupTracker.h" | ||
36 | #endif | 36 | #endif | ||
37 | 37 | | |||
38 | #include <QDomElement> | 38 | #include <QDomElement> | ||
39 | #include <QApplication> | 39 | #include <QApplication> | ||
▲ Show 20 Lines • Show All 247 Lines • ▼ Show 20 Line(s) | 159 | if (detailData->m_detailSection) { | |||
287 | } | 287 | } | ||
288 | if (KReportDetailSectionData::BreakAtEnd == detailData->m_pageBreak) | 288 | if (KReportDetailSectionData::BreakAtEnd == detailData->m_pageBreak) | ||
289 | createNewPage(); | 289 | createNewPage(); | ||
290 | } | 290 | } | ||
291 | } | 291 | } | ||
292 | 292 | | |||
293 | qreal KReportPreRendererPrivate::renderSectionSize(const KReportSectionData & sectionData) | 293 | qreal KReportPreRendererPrivate::renderSectionSize(const KReportSectionData & sectionData) | ||
294 | { | 294 | { | ||
295 | qreal intHeight = POINT_TO_INCH(sectionData.height()) * KReportDpi::dpiX(); | 295 | qreal intHeight = POINT_TO_INCH(sectionData.height()) * KReportPrivate::dpiX(); | ||
296 | 296 | | |||
297 | int itemHeight = 0; | 297 | int itemHeight = 0; | ||
298 | 298 | | |||
299 | if (sectionData.objects().count() == 0) | 299 | if (sectionData.objects().count() == 0) | ||
300 | return intHeight; | 300 | return intHeight; | ||
301 | 301 | | |||
302 | QList<KReportItemBase*> objects = sectionData.objects(); | 302 | QList<KReportItemBase*> objects = sectionData.objects(); | ||
303 | foreach(KReportItemBase *ob, objects) { | 303 | foreach(KReportItemBase *ob, objects) { | ||
Show All 12 Lines | |||||
316 | } | 316 | } | ||
317 | } | 317 | } | ||
318 | 318 | | |||
319 | return intHeight; | 319 | return intHeight; | ||
320 | } | 320 | } | ||
321 | 321 | | |||
322 | qreal KReportPreRendererPrivate::renderSection(const KReportSectionData & sectionData) | 322 | qreal KReportPreRendererPrivate::renderSection(const KReportSectionData & sectionData) | ||
323 | { | 323 | { | ||
324 | qreal sectionHeight = POINT_TO_INCH(sectionData.height()) * KReportDpi::dpiX(); | 324 | qreal sectionHeight = POINT_TO_INCH(sectionData.height()) * KReportPrivate::dpiX(); | ||
325 | 325 | | |||
326 | int itemHeight = 0; | 326 | int itemHeight = 0; | ||
327 | //kreportDebug() << "Name: " << sectionData.name() << " Height: " << sectionHeight | 327 | //kreportDebug() << "Name: " << sectionData.name() << " Height: " << sectionHeight | ||
328 | // << "Objects: " << sectionData.objects().count(); | 328 | // << "Objects: " << sectionData.objects().count(); | ||
329 | emit(renderingSection(const_cast<KReportSectionData*>(§ionData), m_page, QPointF(m_leftMargin, m_yOffset))); | 329 | emit(renderingSection(const_cast<KReportSectionData*>(§ionData), m_page, QPointF(m_leftMargin, m_yOffset))); | ||
330 | 330 | | |||
331 | //Create a pre-rendered section for this section and add it to the document | 331 | //Create a pre-rendered section for this section and add it to the document | ||
332 | OROSection *sec = new OROSection(m_document); | 332 | OROSection *sec = new OROSection(m_document); | ||
333 | sec->setHeight(sectionData.height()); | 333 | sec->setHeight(sectionData.height()); | ||
334 | sec->setBackgroundColor(sectionData.backgroundColor()); | 334 | sec->setBackgroundColor(sectionData.backgroundColor()); | ||
335 | sec->setType(sectionData.type()); | 335 | sec->setType(sectionData.type()); | ||
336 | m_document->addSection(sec); | 336 | m_document->addSection(sec); | ||
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(KReportPrivate::dpiX()).width() - m_page->document()->pageLayout().marginsPixels(KReportPrivate::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->insertPrimitive(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()); | ||
▲ Show 20 Lines • Show All 104 Lines • ▼ Show 20 Line(s) | 453 | if (m_reportDocument->pageSize() == QLatin1String("Custom")) { | |||
455 | m_maxHeight = m_reportDocument->pageLayout().fullRectPoints().height(); | 455 | m_maxHeight = m_reportDocument->pageLayout().fullRectPoints().height(); | ||
456 | } else { | 456 | } else { | ||
457 | if (!label.isNull()) { | 457 | if (!label.isNull()) { | ||
458 | m_maxWidth = label.width(); | 458 | m_maxWidth = label.width(); | ||
459 | m_maxHeight = label.height(); | 459 | m_maxHeight = label.height(); | ||
460 | m_reportDocument->pageLayout().setPageSize(QPageSize(KReportPageSize::pageSize(label.paper()))); | 460 | m_reportDocument->pageLayout().setPageSize(QPageSize(KReportPageSize::pageSize(label.paper()))); | ||
461 | } else { | 461 | } else { | ||
462 | // lookup the correct size information for the specified size paper | 462 | // lookup the correct size information for the specified size paper | ||
463 | QSizeF pageSizePx = m_reportDocument->pageLayout().fullRectPixels(KReportDpi::dpiX()).size(); | 463 | QSizeF pageSizePx = m_reportDocument->pageLayout().fullRectPixels(KReportPrivate::dpiX()).size(); | ||
464 | 464 | | |||
465 | m_maxWidth = pageSizePx.width(); | 465 | m_maxWidth = pageSizePx.width(); | ||
466 | m_maxHeight = pageSizePx.height(); | 466 | m_maxHeight = pageSizePx.height(); | ||
467 | } | 467 | } | ||
468 | } | 468 | } | ||
469 | 469 | | |||
470 | if (m_reportDocument->pageLayout().orientation() == QPageLayout::Landscape) { | 470 | if (m_reportDocument->pageLayout().orientation() == QPageLayout::Landscape) { | ||
471 | qreal tmp = m_maxWidth; | 471 | qreal tmp = m_maxWidth; | ||
▲ Show 20 Lines • Show All 227 Lines • Show Last 20 Lines |