diff --git a/autotests/format/FormatTest.cpp b/autotests/format/FormatTest.cpp --- a/autotests/format/FormatTest.cpp +++ b/autotests/format/FormatTest.cpp @@ -25,7 +25,6 @@ #include "KReportDesigner.h" #include "KReportLabelElement.h" #include "KReportDocument.h" -#include "KReportPageOptions.h" #include "KReportDesignerSectionDetail.h" #include "KReportSection.h" #include "KReportPosition.h" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,7 +15,6 @@ common/KReportAsyncItemBase.cpp common/KReportSectionData.cpp common/KReportLabelSizeInfo.cpp - common/KReportPageOptions.cpp common/KReportDocument.cpp common/KReportDetailSectionData.cpp common/KReportPluginInterface.cpp @@ -264,7 +263,6 @@ KReportPosition KReportDocument KReportSectionData - KReportPageOptions KReportRenderObjects KReportAsyncItemBase ) diff --git a/src/common/KReportDocument.h b/src/common/KReportDocument.h --- a/src/common/KReportDocument.h +++ b/src/common/KReportDocument.h @@ -16,13 +16,14 @@ * License along with this library. If not, see . */ -#ifndef KREPORTSCHEMADATA_H -#define KREPORTSCHEMADATA_H +#ifndef KREPORTDOCUMENT_H +#define KREPORTDOCUMENT_H #include "config-kreport.h" #include "kreport_export.h" #include "KReportSectionData.h" -#include "KReportPageOptions.h" + +#include class KReportDetailSectionData; @@ -88,8 +89,12 @@ QString name() const; QString title() const; - KReportPageOptions pageOptions() const; + QPageLayout pageLayout() const; + + QString pageSize(); + void setPageSize(const QString &size); + protected: @@ -119,6 +124,11 @@ friend class KReportScriptHandler; friend class Scripting::Report; #endif + + //! TODO add support for labels + QString labelType() const; + void setLabelType(const QString &label); + class Private; Private * const d; }; diff --git a/src/common/KReportDocument.cpp b/src/common/KReportDocument.cpp --- a/src/common/KReportDocument.cpp +++ b/src/common/KReportDocument.cpp @@ -20,6 +20,7 @@ #include "KReportDetailSectionData.h" #include "KReportItemBase.h" #include "KReportDpi.h" +#include "KReportPageSize.h" #include #include @@ -37,7 +38,9 @@ QString interpreter; #endif bool externalData; - KReportPageOptions page; + QPageLayout page; + QString pageSize; + QString labelType; }; void KReportDocument::init() @@ -84,26 +87,29 @@ d->script = elemThis.text(); d->interpreter = elemThis.attribute(QLatin1String("report:script-interpreter")); #endif - } else if (elemThis.tagName() == QLatin1String("report:page-style")) { + } else if (elemThis.tagName() == QLatin1String("report:page-style")) { QString pagetype = elemThis.firstChild().nodeValue(); + //Full page mode is required to allow margins to be set to whatever the user has specified + d->page.setMode(QPageLayout::FullPageMode); + if (pagetype == QLatin1String("predefined")) { - d->page.setPageSize(elemThis.attribute(QLatin1String("report:page-size"), QLatin1String("A4"))); + setPageSize(elemThis.attribute(QLatin1String("report:page-size"), QLatin1String("A4"))); + d->page.setPageSize(QPageSize(KReportPageSize::pageSize(pageSize()))); } else if (pagetype == QLatin1String("custom")) { - d->page.setCustomWidth(POINT_TO_INCH(KReportUnit::parseValue(elemThis.attribute(QLatin1String("report:custom-page-width"), QString()))) * dpiX); - d->page.setCustomHeight(POINT_TO_INCH(KReportUnit::parseValue(elemThis.attribute(QLatin1String("report:custom-page-height"), QString()))) * dpiY); - d->page.setPageSize(QLatin1String("Custom")); + QPageSize custom(QSize(elemThis.attribute(QLatin1String("report:custom-page-width"), QString()).toFloat() , elemThis.attribute(QLatin1String("report:custom-page-height"), QString()).toFloat()), QLatin1String("Custom")); + + d->page.setPageSize(custom); } else if (pagetype == QLatin1String("label")) { - d->page.setLabelType(elemThis.firstChild().nodeValue()); + setLabelType(elemThis.firstChild().nodeValue()); } //! @todo add config for default margins or add within templates support - d->page.setMarginBottom(POINT_TO_INCH(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-bottom"), QLatin1String("1.0cm")))) * dpiY); - d->page.setMarginTop(POINT_TO_INCH(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-top"), QLatin1String("1.0cm")))) * dpiY); - d->page.setMarginLeft(POINT_TO_INCH(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-left"), QLatin1String("1.0cm")))) * dpiX); - d->page.setMarginRight(POINT_TO_INCH(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-right"), QLatin1String("1.0cm")))) * dpiX); - - d->page.setPortrait(elemThis.attribute(QLatin1String("report:print-orientation"), QLatin1String("portrait")) == QLatin1String("portrait")); - + d->page.setUnits(QPageLayout::Point); + d->page.setLeftMargin(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-left"), QLatin1String("1.0cm")))); + d->page.setRightMargin(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-right"), QLatin1String("1.0cm")))); + d->page.setTopMargin(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-top"), QLatin1String("1.0cm")))); + d->page.setBottomMargin(KReportUnit::parseValue(elemThis.attribute(QLatin1String("fo:margin-bottom"), QLatin1String("1.0cm")))); + d->page.setOrientation(elemThis.attribute(QLatin1String("report:print-orientation"), QLatin1String("portrait")) == QLatin1String("portrait") ? QPageLayout::Portrait : QPageLayout::Landscape); } else if (elemThis.tagName() == QLatin1String("report:body")) { QDomNodeList sectionlist = elemThis.childNodes(); QDomNode sec; @@ -315,7 +321,7 @@ return sec; } -KReportPageOptions KReportDocument::pageOptions() const +QPageLayout KReportDocument::pageLayout() const { return d->page; } @@ -359,3 +365,24 @@ { return d->script; } + +QString KReportDocument::pageSize() +{ + return d->pageSize; +} + +void KReportDocument::setPageSize(const QString& size) +{ + d->pageSize = size; +} + +QString KReportDocument::labelType() const +{ + return d->labelType; +} + +void KReportDocument::setLabelType(const QString& label) +{ + d->labelType = label; +} + diff --git a/src/common/KReportPageOptions.h b/src/common/KReportPageOptions.h deleted file mode 100644 --- a/src/common/KReportPageOptions.h +++ /dev/null @@ -1,85 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com) - * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef KREPORTPAGEOPTIONS_H -#define KREPORTPAGEOPTIONS_H - -#include -#include - -#include "kreport_export.h" - -class KREPORT_EXPORT KReportPageOptions : public QObject -{ - Q_OBJECT -public: - KReportPageOptions(); - KReportPageOptions(const KReportPageOptions &); - - KReportPageOptions & operator=(const KReportPageOptions &); - - enum PageOrientation { - Landscape = 0, // essentially false - Portrait = 1 // and true - }; - - qreal getMarginTop() const; - void setMarginTop(qreal v); - qreal getMarginBottom() const; - void setMarginBottom(qreal v); - qreal getMarginLeft() const; - void setMarginLeft(qreal v); - qreal getMarginRight() const; - void setMarginRight(qreal v); - - QSizeF pixelSize() const; - - const QString & getPageSize() const; - void setPageSize(const QString & s); - qreal getCustomWidth() const; - void setCustomWidth(qreal v); - qreal getCustomHeight() const; - void setCustomHeight(qreal v); - - PageOrientation getOrientation() const; - bool isPortrait() const; - void setOrientation(PageOrientation o); - void setPortrait(bool yes); - - void setLabelType(const QString &); - const QString & getLabelType() const; - -Q_SIGNALS: - void pageOptionsChanged(); - -private: - qreal m_marginTop; - qreal m_marginBottom; - qreal m_marginLeft; - qreal m_marginRight; - - QString m_pageSize; - qreal m_customWidth; - qreal m_customHeight; - - PageOrientation m_orientation; - - QString m_labelType; -}; - -#endif diff --git a/src/common/KReportPageOptions.cpp b/src/common/KReportPageOptions.cpp deleted file mode 100644 --- a/src/common/KReportPageOptions.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com) - * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include "KReportPageOptions.h" -#include "KReportUnit.h" -#include "KReportPageSize.h" -#include "KReportDpi.h" - -#include - -KReportPageOptions::KReportPageOptions() - : QObject(), m_pageSize(QLatin1String("Letter")) -{ - m_marginTop = m_marginBottom = 1.0; - m_marginLeft = m_marginRight = 1.0; - - m_orientation = Portrait; - - m_customWidth = 8.5; - m_customHeight = 11.0; -} - -KReportPageOptions::KReportPageOptions(const KReportPageOptions & rpo) - : QObject() -{ - m_marginTop = rpo.m_marginTop; - m_marginBottom = rpo.m_marginBottom; - m_marginLeft = rpo.m_marginLeft; - m_marginRight = rpo.m_marginRight; - - m_pageSize = rpo.m_pageSize; - m_customWidth = rpo.m_customWidth; - m_customHeight = rpo.m_customHeight; - - m_orientation = rpo.m_orientation; - - m_labelType = rpo.m_labelType; -} - -KReportPageOptions & KReportPageOptions::operator=(const KReportPageOptions & rpo) -{ - m_marginTop = rpo.m_marginTop; - m_marginBottom = rpo.m_marginBottom; - m_marginLeft = rpo.m_marginLeft; - m_marginRight = rpo.m_marginRight; - - m_pageSize = rpo.m_pageSize; - m_customWidth = rpo.m_customWidth; - m_customHeight = rpo.m_customHeight; - - m_orientation = rpo.m_orientation; - - m_labelType = rpo.m_labelType; - - return *this; -} - -qreal KReportPageOptions::getMarginTop() const -{ - return m_marginTop; -} - -void KReportPageOptions::setMarginTop(qreal v) -{ - if (m_marginTop == v) - return; - - m_marginTop = v; - emit pageOptionsChanged(); -} - -qreal KReportPageOptions::getMarginBottom() const -{ - return m_marginBottom; -} - -void KReportPageOptions::setMarginBottom(qreal v) -{ - if (m_marginBottom == v) - return; - - m_marginBottom = v; - emit pageOptionsChanged(); -} - -qreal KReportPageOptions::getMarginLeft() const -{ - return m_marginLeft; -} - -void KReportPageOptions::setMarginLeft(qreal v) -{ - if (m_marginLeft == v) - return; - - m_marginLeft = v; - emit pageOptionsChanged(); -} - -qreal KReportPageOptions::getMarginRight() const -{ - return m_marginRight; -} - -void KReportPageOptions::setMarginRight(qreal v) -{ - if (m_marginRight == v) - return; - - m_marginRight = v; - emit pageOptionsChanged(); -} - -const QString & KReportPageOptions::getPageSize() const -{ - return m_pageSize; -} - -void KReportPageOptions::setPageSize(const QString & s) -{ - if (m_pageSize == s) - return; - - m_pageSize = s; - emit pageOptionsChanged(); -} -qreal KReportPageOptions::getCustomWidth() const -{ - return m_customWidth; -} -void KReportPageOptions::setCustomWidth(qreal v) -{ - if (m_customWidth == v) - return; - - m_customWidth = v; - emit pageOptionsChanged(); -} - -qreal KReportPageOptions::getCustomHeight() const -{ - return m_customHeight; -} - -void KReportPageOptions::setCustomHeight(qreal v) -{ - if (m_customHeight == v) - return; - - m_customHeight = v; - emit pageOptionsChanged(); -} - -KReportPageOptions::PageOrientation KReportPageOptions::getOrientation() const -{ - return m_orientation; -} - -bool KReportPageOptions::isPortrait() const -{ - return (m_orientation == Portrait); -} - -void KReportPageOptions::setOrientation(PageOrientation o) -{ - if (m_orientation == o) - return; - - m_orientation = o; - emit pageOptionsChanged(); -} - -void KReportPageOptions::setPortrait(bool yes) -{ - setOrientation((yes ? Portrait : Landscape)); -} - -const QString & KReportPageOptions::getLabelType() const -{ - return m_labelType; -} - -void KReportPageOptions::setLabelType(const QString & type) -{ - if (m_labelType == type) - return; - - m_labelType = type; - emit pageOptionsChanged(); -} - -//Convenience functions that return the page width/height in pixels based on the DPI -QSizeF KReportPageOptions::pixelSize() const -{ - QSizeF xDpiSize = QPageSize(KReportPageSize::pageSize(getPageSize())).sizePixels(KReportDpi::dpiX()); - QSizeF yDpiSize = QPageSize(KReportPageSize::pageSize(getPageSize())).sizePixels(KReportDpi::dpiY()); - - if (isPortrait()){ - return QSizeF(xDpiSize.width(), yDpiSize.height()); - } else { - return QSizeF(xDpiSize.height(), yDpiSize.width()); - } -} diff --git a/src/common/KReportRenderObjects.h b/src/common/KReportRenderObjects.h --- a/src/common/KReportRenderObjects.h +++ b/src/common/KReportRenderObjects.h @@ -27,8 +27,8 @@ #include #include #include +#include -#include "KReportPageOptions.h" #include "KReportData.h" #include "KReportItemBase.h" #include "KReportSectionData.h" @@ -74,18 +74,18 @@ OROSection* section(int); void addSection(OROSection*); - void setPageOptions(const KReportPageOptions &); - KReportPageOptions pageOptions() const { - return m_pageOptions; + void setPageLayout(const QPageLayout &); + QPageLayout pageLayout() const { + return m_pageLayout; }; void notifyChange(int pageNo); protected: QString m_title; QList m_pages; QList m_sections; - KReportPageOptions m_pageOptions; + QPageLayout m_pageLayout; Q_SIGNALS: void updated(int pageNo); diff --git a/src/common/KReportRenderObjects.cpp b/src/common/KReportRenderObjects.cpp --- a/src/common/KReportRenderObjects.cpp +++ b/src/common/KReportRenderObjects.cpp @@ -76,9 +76,9 @@ m_sections.append(s); } -void ORODocument::setPageOptions(const KReportPageOptions & options) +void ORODocument::setPageLayout(const QPageLayout & options) { - m_pageOptions = options; + m_pageLayout = options; } void ORODocument::notifyChange(int pageNo) diff --git a/src/renderer/KReportPage.cpp b/src/renderer/KReportPage.cpp --- a/src/renderer/KReportPage.cpp +++ b/src/renderer/KReportPage.cpp @@ -20,6 +20,7 @@ #include "KReportRendererBase.h" #include "KReportUnit.h" #include "KReportRenderObjects.h" +#include "KReportDpi.h" #include "kreport_debug.h" #include @@ -60,18 +61,23 @@ int pageWidth; int pageHeight; - QString pageSize = d->reportDocument->pageOptions().getPageSize(); + QString pageSize = d->reportDocument->pageLayout().pageSize().name(); + pageWidth = d->reportDocument->pageLayout().fullRectPixels(KReportDpi::dpiX()).width(); + pageHeight = d->reportDocument->pageLayout().fullRectPixels(KReportDpi::dpiX()).height(); + +//TODO remove after check +#if 0 if (pageSize == QLatin1String("Custom")) { // if this is custom sized sheet of paper we will just use those values - pageWidth = (int)(d->reportDocument->pageOptions().getCustomWidth()); - pageHeight = (int)(d->reportDocument->pageOptions().getCustomHeight()); + } else { // lookup the correct size information for the specified size paper pageWidth = d->reportDocument->pageOptions().pixelSize().width(); pageHeight = d->reportDocument->pageOptions().pixelSize().height(); } - +#endif + setRect(0, 0, pageWidth, pageHeight); //kreportDebug() << "PAGE IS " << pageWidth << "x" << pageHeight; d->pixmap = QPixmap(pageWidth, pageHeight); diff --git a/src/renderer/KReportPreRenderer.cpp b/src/renderer/KReportPreRenderer.cpp --- a/src/renderer/KReportPreRenderer.cpp +++ b/src/renderer/KReportPreRenderer.cpp @@ -339,7 +339,7 @@ ORORect* bg = new ORORect(); bg->setPen(QPen(Qt::NoPen)); bg->setBrush(sectionData.backgroundColor()); - qreal w = m_page->document()->pageOptions().pixelSize().width() - m_page->document()->pageOptions().getMarginRight() - m_leftMargin; + qreal w = m_page->document()->pageLayout().fullRectPixels(KReportDpi::dpiX()).width() - m_page->document()->pageLayout().marginsPixels(KReportDpi::dpiX()).right() - m_leftMargin; bg->setRect(QRectF(m_leftMargin, m_yOffset, w, sectionHeight)); m_page->addPrimitive(bg, true); @@ -413,22 +413,21 @@ // Do this check now so we don't have to undo a lot of work later if it fails KReportLabelSizeInfo label; - if (m_reportDocument->pageOptions().getPageSize() == QLatin1String("Labels")) { - label = KReportLabelSizeInfo::find(m_reportDocument->pageOptions().getLabelType()); + if (m_reportDocument->pageSize() == QLatin1String("Labels")) { + label = KReportLabelSizeInfo::find(m_reportDocument->labelType()); if (label.isNull()) { return false; } } - //kreportDebug() << "Creating Document"; m_document = new ORODocument(m_reportDocument->title()); m_pageCounter = 0; m_yOffset = 0.0; //kreportDebug() << "Calculating Margins"; if (!label.isNull()) { - if (m_reportDocument->pageOptions().isPortrait()) { + if (m_reportDocument->pageLayout().orientation() == QPageLayout::Portrait) { m_topMargin = (label.startY() / 100.0); m_bottomMargin = 0; m_rightMargin = 0; @@ -440,42 +439,43 @@ m_leftMargin = (label.startY() / 100.0); } } else { - m_topMargin = m_reportDocument->pageOptions().getMarginTop(); - m_bottomMargin = m_reportDocument->pageOptions().getMarginBottom(); - m_rightMargin = m_reportDocument->pageOptions().getMarginRight(); - m_leftMargin = m_reportDocument->pageOptions().getMarginLeft(); + + m_topMargin = m_reportDocument->pageLayout().marginsPoints().top(); + m_bottomMargin = m_reportDocument->pageLayout().marginsPoints().bottom(); + m_rightMargin = m_reportDocument->pageLayout().marginsPoints().right(); + m_leftMargin = m_reportDocument->pageLayout().marginsPoints().left(); //kreportDebug() << "Margins:" << m_topMargin << m_bottomMargin << m_rightMargin << m_leftMargin; - } + } //kreportDebug() << "Calculating Page Size"; - KReportPageOptions rpo(m_reportDocument->pageOptions()); + QPageLayout layout = m_reportDocument->pageLayout(); // This should reflect the information of the report page size - if (m_reportDocument->pageOptions().getPageSize() == QLatin1String("Custom")) { - m_maxWidth = m_reportDocument->pageOptions().getCustomWidth(); - m_maxHeight = m_reportDocument->pageOptions().getCustomHeight(); + if (m_reportDocument->pageSize() == QLatin1String("Custom")) { + m_maxWidth = m_reportDocument->pageLayout().fullRectPoints().width(); + m_maxHeight = m_reportDocument->pageLayout().fullRectPoints().height(); } else { if (!label.isNull()) { m_maxWidth = label.width(); m_maxHeight = label.height(); - rpo.setPageSize(label.paper()); + m_reportDocument->pageLayout().setPageSize(QPageSize(KReportPageSize::pageSize(label.paper()))); } else { // lookup the correct size information for the specified size paper - QSizeF pageSizePx = m_reportDocument->pageOptions().pixelSize(); + QSizeF pageSizePx = m_reportDocument->pageLayout().fullRectPixels(KReportDpi::dpiX()).size(); m_maxWidth = pageSizePx.width(); m_maxHeight = pageSizePx.height(); } } - if (!m_reportDocument->pageOptions().isPortrait()) { + if (m_reportDocument->pageLayout().orientation() == QPageLayout::Landscape) { qreal tmp = m_maxWidth; m_maxWidth = m_maxHeight; m_maxHeight = tmp; } //kreportDebug() << "Page Size:" << m_maxWidth << m_maxHeight; - m_document->setPageOptions(rpo); + m_document->setPageLayout(m_reportDocument->pageLayout()); m_kodata->setSorting(m_reportDocument->m_detailSection->m_sortedFields); if (!m_kodata->open()) { return false; @@ -519,7 +519,7 @@ qreal tmp; // flip the value around if we are printing landscape - if (!m_reportDocument->pageOptions().isPortrait()) { + if (!m_reportDocument->pageLayout().orientation() == QPageLayout::Portrait) { w = (label.height() / 100.0); wg = (label.yGap() / 100.0); h = (label.width() / 100.0); @@ -618,12 +618,10 @@ //===========================KReportPreRenderer=============================== -KReportPreRenderer::KReportPreRenderer(const QDomElement & document) - : d(new KReportPreRendererPrivate(this)) +KReportPreRenderer::KReportPreRenderer(const QDomElement &document) : d(new KReportPreRendererPrivate(this)) { setDocument(document); connect(d, &KReportPreRendererPrivate::finishedAllASyncItems, this, &KReportPreRenderer::finishedAllASyncItems); - } KReportPreRenderer::~KReportPreRenderer() diff --git a/src/renderer/KReportPrintRenderer_p.cpp b/src/renderer/KReportPrintRenderer_p.cpp --- a/src/renderer/KReportPrintRenderer_p.cpp +++ b/src/renderer/KReportPrintRenderer_p.cpp @@ -44,13 +44,13 @@ pPrinter->setCreator(QLatin1String("KReport Print Renderer")); pPrinter->setDocName(document->title()); pPrinter->setFullPage(true); - pPrinter->setOrientation((document->pageOptions().isPortrait() ? QPrinter::Portrait : QPrinter::Landscape)); + pPrinter->setOrientation((document->pageLayout().orientation() == QPageLayout::Portrait ? QPrinter::Portrait : QPrinter::Landscape)); pPrinter->setPageOrder(QPrinter::FirstPageFirst); - if (document->pageOptions().getPageSize().isEmpty()) { + if (!document->pageLayout().pageSize().isValid()) { pPrinter->setPageSize(QPrinter::Custom); } else { - pPrinter->setPageSize(QPageSize(KReportPageSize::pageSize(document->pageOptions().getPageSize()))); + pPrinter->setPageSize(QPageSize(document->pageLayout().pageSize())); } return true; diff --git a/src/wrtembed/KReportDesigner.cpp b/src/wrtembed/KReportDesigner.cpp --- a/src/wrtembed/KReportDesigner.cpp +++ b/src/wrtembed/KReportDesigner.cpp @@ -865,10 +865,10 @@ int KReportDesigner::pageWidthPx() const { - KReportPageOptions po; - po.setPageSize(d->set->property("page-size").value().toString()); - po.setPortrait(d->set->property("print-orientation").value().toString() == QLatin1String("portrait")); - QSizeF pageSizePx = po.pixelSize(); + QPageLayout layout; + layout.setPageSize(QPageSize(KReportPageSize::pageSize(d->set->property("page-size").value().toString()))); + layout.setOrientation(d->set->property("print-orientation").value().toString() == QLatin1String("portrait") ? QPageLayout::Portrait : QPageLayout::Landscape); + QSize pageSizePx = layout.fullRectPixels(KReportDpi::dpiX()).size(); int width = pageSizePx.width(); width = width - POINT_TO_INCH(d->set->property("margin-left").value().toDouble()) * KReportDpi::dpiX(); diff --git a/src/wrtembed/KReportDesignerSectionScene.cpp b/src/wrtembed/KReportDesignerSectionScene.cpp --- a/src/wrtembed/KReportDesignerSectionScene.cpp +++ b/src/wrtembed/KReportDesignerSectionScene.cpp @@ -17,7 +17,6 @@ */ #include "KReportDesignerSectionScene.h" -#include "KReportPageOptions.h" #include "KReportDesignerItemRectBase.h" #include "KReportDesigner.h" #include "KReportLabelSizeInfo.h"