Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportPreRenderer.cpp
Show First 20 Lines • Show All 407 Lines • ▼ Show 20 Line(s) | 405 | { | |||
---|---|---|---|---|---|
408 | } | 408 | } | ||
409 | 409 | | |||
410 | if (!m_valid || !m_reportDocument) { | 410 | if (!m_valid || !m_reportDocument) { | ||
411 | return false; | 411 | return false; | ||
412 | } | 412 | } | ||
413 | 413 | | |||
414 | // 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 | ||
415 | KReportLabelSizeInfo label; | 415 | KReportLabelSizeInfo label; | ||
416 | if (m_reportDocument->page.getPageSize() == QLatin1String("Labels")) { | 416 | if (m_reportDocument->pageOptions().getPageSize() == QLatin1String("Labels")) { | ||
417 | label = KReportLabelSizeInfo::find(m_reportDocument->page.getLabelType()); | 417 | label = KReportLabelSizeInfo::find(m_reportDocument->pageOptions().getLabelType()); | ||
418 | if (label.isNull()) { | 418 | if (label.isNull()) { | ||
419 | return false; | 419 | return false; | ||
420 | } | 420 | } | ||
421 | } | 421 | } | ||
422 | 422 | | |||
423 | //kreportDebug() << "Creating Document"; | 423 | //kreportDebug() << "Creating Document"; | ||
424 | m_document = new ORODocument(m_reportDocument->m_title); | 424 | m_document = new ORODocument(m_reportDocument->title()); | ||
425 | 425 | | |||
426 | m_pageCounter = 0; | 426 | m_pageCounter = 0; | ||
427 | m_yOffset = 0.0; | 427 | m_yOffset = 0.0; | ||
428 | 428 | | |||
429 | //kreportDebug() << "Calculating Margins"; | 429 | //kreportDebug() << "Calculating Margins"; | ||
430 | if (!label.isNull()) { | 430 | if (!label.isNull()) { | ||
431 | if (m_reportDocument->page.isPortrait()) { | 431 | if (m_reportDocument->pageOptions().isPortrait()) { | ||
432 | m_topMargin = (label.startY() / 100.0); | 432 | m_topMargin = (label.startY() / 100.0); | ||
433 | m_bottomMargin = 0; | 433 | m_bottomMargin = 0; | ||
434 | m_rightMargin = 0; | 434 | m_rightMargin = 0; | ||
435 | m_leftMargin = (label.startX() / 100.0); | 435 | m_leftMargin = (label.startX() / 100.0); | ||
436 | } else { | 436 | } else { | ||
437 | m_topMargin = (label.startX() / 100.0); | 437 | m_topMargin = (label.startX() / 100.0); | ||
438 | m_bottomMargin = 0; | 438 | m_bottomMargin = 0; | ||
439 | m_rightMargin = 0; | 439 | m_rightMargin = 0; | ||
440 | m_leftMargin = (label.startY() / 100.0); | 440 | m_leftMargin = (label.startY() / 100.0); | ||
441 | } | 441 | } | ||
442 | } else { | 442 | } else { | ||
443 | m_topMargin = m_reportDocument->page.getMarginTop(); | 443 | m_topMargin = m_reportDocument->pageOptions().getMarginTop(); | ||
444 | m_bottomMargin = m_reportDocument->page.getMarginBottom(); | 444 | m_bottomMargin = m_reportDocument->pageOptions().getMarginBottom(); | ||
445 | m_rightMargin = m_reportDocument->page.getMarginRight(); | 445 | m_rightMargin = m_reportDocument->pageOptions().getMarginRight(); | ||
446 | m_leftMargin = m_reportDocument->page.getMarginLeft(); | 446 | m_leftMargin = m_reportDocument->pageOptions().getMarginLeft(); | ||
447 | //kreportDebug() << "Margins:" << m_topMargin << m_bottomMargin << m_rightMargin << m_leftMargin; | 447 | //kreportDebug() << "Margins:" << m_topMargin << m_bottomMargin << m_rightMargin << m_leftMargin; | ||
448 | } | 448 | } | ||
449 | 449 | | |||
450 | //kreportDebug() << "Calculating Page Size"; | 450 | //kreportDebug() << "Calculating Page Size"; | ||
451 | KReportPageOptions rpo(m_reportDocument->page); | 451 | KReportPageOptions rpo(m_reportDocument->pageOptions()); | ||
452 | // This should reflect the information of the report page size | 452 | // This should reflect the information of the report page size | ||
453 | if (m_reportDocument->page.getPageSize() == QLatin1String("Custom")) { | 453 | if (m_reportDocument->pageOptions().getPageSize() == QLatin1String("Custom")) { | ||
454 | m_maxWidth = m_reportDocument->page.getCustomWidth(); | 454 | m_maxWidth = m_reportDocument->pageOptions().getCustomWidth(); | ||
455 | m_maxHeight = m_reportDocument->page.getCustomHeight(); | 455 | m_maxHeight = m_reportDocument->pageOptions().getCustomHeight(); | ||
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 | rpo.setPageSize(label.paper()); | 460 | rpo.setPageSize(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->page.pixelSize(); | 463 | QSizeF pageSizePx = m_reportDocument->pageOptions().pixelSize(); | ||
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->page.isPortrait()) { | 470 | if (!m_reportDocument->pageOptions().isPortrait()) { | ||
471 | qreal tmp = m_maxWidth; | 471 | qreal tmp = m_maxWidth; | ||
472 | m_maxWidth = m_maxHeight; | 472 | m_maxWidth = m_maxHeight; | ||
473 | m_maxHeight = tmp; | 473 | m_maxHeight = tmp; | ||
474 | } | 474 | } | ||
475 | 475 | | |||
476 | //kreportDebug() << "Page Size:" << m_maxWidth << m_maxHeight; | 476 | //kreportDebug() << "Page Size:" << m_maxWidth << m_maxHeight; | ||
477 | 477 | | |||
478 | m_document->setPageOptions(rpo); | 478 | m_document->setPageOptions(rpo); | ||
Show All 35 Lines | 505 | if (!label.isNull()) { | |||
514 | qreal wg = (label.xGap() / 100.0); | 514 | qreal wg = (label.xGap() / 100.0); | ||
515 | qreal h = (label.height() / 100.0); | 515 | qreal h = (label.height() / 100.0); | ||
516 | qreal hg = (label.yGap() / 100.0); | 516 | qreal hg = (label.yGap() / 100.0); | ||
517 | int numCols = label.columns(); | 517 | int numCols = label.columns(); | ||
518 | int numRows = label.rows(); | 518 | int numRows = label.rows(); | ||
519 | qreal tmp; | 519 | qreal tmp; | ||
520 | 520 | | |||
521 | // flip the value around if we are printing landscape | 521 | // flip the value around if we are printing landscape | ||
522 | if (!m_reportDocument->page.isPortrait()) { | 522 | if (!m_reportDocument->pageOptions().isPortrait()) { | ||
523 | w = (label.height() / 100.0); | 523 | w = (label.height() / 100.0); | ||
524 | wg = (label.yGap() / 100.0); | 524 | wg = (label.yGap() / 100.0); | ||
525 | h = (label.width() / 100.0); | 525 | h = (label.width() / 100.0); | ||
526 | hg = (label.xGap() / 100.0); | 526 | hg = (label.xGap() / 100.0); | ||
527 | numCols = label.rows(); | 527 | numCols = label.rows(); | ||
528 | numRows = label.columns(); | 528 | numRows = label.columns(); | ||
529 | } | 529 | } | ||
530 | 530 | | |||
▲ Show 20 Lines • Show All 170 Lines • Show Last 20 Lines |