Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportPreRenderer.cpp
Show First 20 Lines • Show All 391 Lines • ▼ Show 20 Line(s) | 385 | { | |||
---|---|---|---|---|---|
392 | 392 | | |||
393 | connect(this, SIGNAL(renderingSection(KReportSectionData*,OROPage*,QPointF)), m_scriptHandler, SLOT(slotEnteredSection(KReportSectionData*,OROPage*,QPointF))); | 393 | connect(this, SIGNAL(renderingSection(KReportSectionData*,OROPage*,QPointF)), m_scriptHandler, SLOT(slotEnteredSection(KReportSectionData*,OROPage*,QPointF))); | ||
394 | } | 394 | } | ||
395 | #endif | 395 | #endif | ||
396 | 396 | | |||
397 | void KReportPreRendererPrivate::asyncItemsFinished() | 397 | void KReportPreRendererPrivate::asyncItemsFinished() | ||
398 | { | 398 | { | ||
399 | //kreportDebug() << "Finished rendering async items"; | 399 | //kreportDebug() << "Finished rendering async items"; | ||
400 | delete asyncManager; | 400 | asyncManager->deleteLater(); | ||
401 | emit finishedAllASyncItems(); | ||||
401 | } | 402 | } | ||
402 | 403 | | |||
403 | bool KReportPreRendererPrivate::generateDocument() | 404 | bool KReportPreRendererPrivate::generateDocument() | ||
404 | { | 405 | { | ||
405 | if (!m_kodata) { | 406 | if (!m_kodata) { | ||
406 | m_kodata = m_oneRecord; | 407 | m_kodata = m_oneRecord; | ||
407 | } | 408 | } | ||
408 | 409 | | |||
409 | if (!m_valid || !m_reportDocument) { | 410 | if (!m_valid || !m_reportDocument) { | ||
410 | return false; | 411 | return false; | ||
411 | } | 412 | } | ||
412 | 413 | | |||
413 | // Do this check now so we don't have to undo a lot of work later if it fails | 414 | // Do this check now so we don't have to undo a lot of work later if it fails | ||
414 | KReportLabelSizeInfo label; | 415 | KReportLabelSizeInfo label; | ||
415 | if (m_reportDocument->page.getPageSize() == QLatin1String("Labels")) { | 416 | if (m_reportDocument->pageOptions().getPageSize() == QLatin1String("Labels")) { | ||
416 | label = KReportLabelSizeInfo::find(m_reportDocument->page.getLabelType()); | 417 | label = KReportLabelSizeInfo::find(m_reportDocument->pageOptions().getLabelType()); | ||
417 | if (label.isNull()) { | 418 | if (label.isNull()) { | ||
418 | return false; | 419 | return false; | ||
419 | } | 420 | } | ||
420 | } | 421 | } | ||
421 | 422 | | |||
422 | //kreportDebug() << "Creating Document"; | 423 | //kreportDebug() << "Creating Document"; | ||
423 | m_document = new ORODocument(m_reportDocument->m_title); | 424 | m_document = new ORODocument(m_reportDocument->title()); | ||
424 | 425 | | |||
425 | m_pageCounter = 0; | 426 | m_pageCounter = 0; | ||
426 | m_yOffset = 0.0; | 427 | m_yOffset = 0.0; | ||
427 | 428 | | |||
428 | //kreportDebug() << "Calculating Margins"; | 429 | //kreportDebug() << "Calculating Margins"; | ||
429 | if (!label.isNull()) { | 430 | if (!label.isNull()) { | ||
430 | if (m_reportDocument->page.isPortrait()) { | 431 | if (m_reportDocument->pageOptions().isPortrait()) { | ||
431 | m_topMargin = (label.startY() / 100.0); | 432 | m_topMargin = (label.startY() / 100.0); | ||
432 | m_bottomMargin = 0; | 433 | m_bottomMargin = 0; | ||
433 | m_rightMargin = 0; | 434 | m_rightMargin = 0; | ||
434 | m_leftMargin = (label.startX() / 100.0); | 435 | m_leftMargin = (label.startX() / 100.0); | ||
435 | } else { | 436 | } else { | ||
436 | m_topMargin = (label.startX() / 100.0); | 437 | m_topMargin = (label.startX() / 100.0); | ||
437 | m_bottomMargin = 0; | 438 | m_bottomMargin = 0; | ||
438 | m_rightMargin = 0; | 439 | m_rightMargin = 0; | ||
439 | m_leftMargin = (label.startY() / 100.0); | 440 | m_leftMargin = (label.startY() / 100.0); | ||
440 | } | 441 | } | ||
441 | } else { | 442 | } else { | ||
442 | m_topMargin = m_reportDocument->page.getMarginTop(); | 443 | m_topMargin = m_reportDocument->pageOptions().getMarginTop(); | ||
443 | m_bottomMargin = m_reportDocument->page.getMarginBottom(); | 444 | m_bottomMargin = m_reportDocument->pageOptions().getMarginBottom(); | ||
444 | m_rightMargin = m_reportDocument->page.getMarginRight(); | 445 | m_rightMargin = m_reportDocument->pageOptions().getMarginRight(); | ||
445 | m_leftMargin = m_reportDocument->page.getMarginLeft(); | 446 | m_leftMargin = m_reportDocument->pageOptions().getMarginLeft(); | ||
446 | //kreportDebug() << "Margins:" << m_topMargin << m_bottomMargin << m_rightMargin << m_leftMargin; | 447 | //kreportDebug() << "Margins:" << m_topMargin << m_bottomMargin << m_rightMargin << m_leftMargin; | ||
447 | } | 448 | } | ||
448 | 449 | | |||
449 | //kreportDebug() << "Calculating Page Size"; | 450 | //kreportDebug() << "Calculating Page Size"; | ||
450 | KReportPageOptions rpo(m_reportDocument->page); | 451 | KReportPageOptions rpo(m_reportDocument->pageOptions()); | ||
451 | // This should reflect the information of the report page size | 452 | // This should reflect the information of the report page size | ||
452 | if (m_reportDocument->page.getPageSize() == QLatin1String("Custom")) { | 453 | if (m_reportDocument->pageOptions().getPageSize() == QLatin1String("Custom")) { | ||
453 | m_maxWidth = m_reportDocument->page.getCustomWidth(); | 454 | m_maxWidth = m_reportDocument->pageOptions().getCustomWidth(); | ||
454 | m_maxHeight = m_reportDocument->page.getCustomHeight(); | 455 | m_maxHeight = m_reportDocument->pageOptions().getCustomHeight(); | ||
455 | } else { | 456 | } else { | ||
456 | if (!label.isNull()) { | 457 | if (!label.isNull()) { | ||
457 | m_maxWidth = label.width(); | 458 | m_maxWidth = label.width(); | ||
458 | m_maxHeight = label.height(); | 459 | m_maxHeight = label.height(); | ||
459 | rpo.setPageSize(label.paper()); | 460 | rpo.setPageSize(label.paper()); | ||
460 | } else { | 461 | } else { | ||
461 | // lookup the correct size information for the specified size paper | 462 | // lookup the correct size information for the specified size paper | ||
462 | QSizeF pageSizePx = m_reportDocument->page.pixelSize(); | 463 | QSizeF pageSizePx = m_reportDocument->pageOptions().pixelSize(); | ||
463 | 464 | | |||
464 | m_maxWidth = pageSizePx.width(); | 465 | m_maxWidth = pageSizePx.width(); | ||
465 | m_maxHeight = pageSizePx.height(); | 466 | m_maxHeight = pageSizePx.height(); | ||
466 | } | 467 | } | ||
467 | } | 468 | } | ||
468 | 469 | | |||
469 | if (!m_reportDocument->page.isPortrait()) { | 470 | if (!m_reportDocument->pageOptions().isPortrait()) { | ||
470 | qreal tmp = m_maxWidth; | 471 | qreal tmp = m_maxWidth; | ||
471 | m_maxWidth = m_maxHeight; | 472 | m_maxWidth = m_maxHeight; | ||
472 | m_maxHeight = tmp; | 473 | m_maxHeight = tmp; | ||
473 | } | 474 | } | ||
474 | 475 | | |||
475 | //kreportDebug() << "Page Size:" << m_maxWidth << m_maxHeight; | 476 | //kreportDebug() << "Page Size:" << m_maxWidth << m_maxHeight; | ||
476 | 477 | | |||
477 | m_document->setPageOptions(rpo); | 478 | m_document->setPageOptions(rpo); | ||
Show All 35 Lines | 505 | if (!label.isNull()) { | |||
513 | qreal wg = (label.xGap() / 100.0); | 514 | qreal wg = (label.xGap() / 100.0); | ||
514 | qreal h = (label.height() / 100.0); | 515 | qreal h = (label.height() / 100.0); | ||
515 | qreal hg = (label.yGap() / 100.0); | 516 | qreal hg = (label.yGap() / 100.0); | ||
516 | int numCols = label.columns(); | 517 | int numCols = label.columns(); | ||
517 | int numRows = label.rows(); | 518 | int numRows = label.rows(); | ||
518 | qreal tmp; | 519 | qreal tmp; | ||
519 | 520 | | |||
520 | // flip the value around if we are printing landscape | 521 | // flip the value around if we are printing landscape | ||
521 | if (!m_reportDocument->page.isPortrait()) { | 522 | if (!m_reportDocument->pageOptions().isPortrait()) { | ||
522 | w = (label.height() / 100.0); | 523 | w = (label.height() / 100.0); | ||
523 | wg = (label.yGap() / 100.0); | 524 | wg = (label.yGap() / 100.0); | ||
524 | h = (label.width() / 100.0); | 525 | h = (label.width() / 100.0); | ||
525 | hg = (label.xGap() / 100.0); | 526 | hg = (label.xGap() / 100.0); | ||
526 | numCols = label.rows(); | 527 | numCols = label.rows(); | ||
527 | numRows = label.columns(); | 528 | numRows = label.columns(); | ||
528 | } | 529 | } | ||
529 | 530 | | |||
▲ Show 20 Lines • Show All 86 Lines • ▼ Show 20 Line(s) | |||||
616 | } | 617 | } | ||
617 | 618 | | |||
618 | //===========================KReportPreRenderer=============================== | 619 | //===========================KReportPreRenderer=============================== | ||
619 | 620 | | |||
620 | KReportPreRenderer::KReportPreRenderer(const QDomElement & document) | 621 | KReportPreRenderer::KReportPreRenderer(const QDomElement & document) | ||
621 | : d(new KReportPreRendererPrivate(this)) | 622 | : d(new KReportPreRendererPrivate(this)) | ||
622 | { | 623 | { | ||
623 | setDocument(document); | 624 | setDocument(document); | ||
625 | connect(d, &KReportPreRendererPrivate::finishedAllASyncItems, this, &KReportPreRenderer::finishedAllASyncItems); | ||||
626 | | ||||
624 | } | 627 | } | ||
625 | 628 | | |||
626 | KReportPreRenderer::~KReportPreRenderer() | 629 | KReportPreRenderer::~KReportPreRenderer() | ||
627 | { | 630 | { | ||
628 | delete d; | 631 | delete d; | ||
629 | } | 632 | } | ||
630 | 633 | | |||
631 | void KReportPreRenderer::setName(const QString &n) | 634 | void KReportPreRenderer::setName(const QString &n) | ||
▲ Show 20 Lines • Show All 66 Lines • Show Last 20 Lines |