Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportDesigner.cpp
Show All 22 Lines | |||||
23 | #include "KReportDesignerSectionView.h" | 23 | #include "KReportDesignerSectionView.h" | ||
24 | #include "KReportDesignerSectionDetailGroup.h" | 24 | #include "KReportDesignerSectionDetailGroup.h" | ||
25 | #include "KReportPropertiesButton.h" | 25 | #include "KReportPropertiesButton.h" | ||
26 | #include "KReportSectionEditor.h" | 26 | #include "KReportSectionEditor.h" | ||
27 | #include "KReportDesignerSectionDetail.h" | 27 | #include "KReportDesignerSectionDetail.h" | ||
28 | #include "KReportDesignerItemLine.h" | 28 | #include "KReportDesignerItemLine.h" | ||
29 | #include "KReportRuler_p.h" | 29 | #include "KReportRuler_p.h" | ||
30 | #include "KReportZoomHandler.h" | 30 | #include "KReportZoomHandler.h" | ||
31 | #include "KReportPageFormat.h" | 31 | #include "KReportPageSize.h" | ||
32 | #include "KReportDpi.h" | 32 | #include "KReportDpi.h" | ||
33 | #include "KReportUtils.h" | 33 | #include "KReportUtils.h" | ||
34 | #include "KReportPluginInterface.h" | 34 | #include "KReportPluginInterface.h" | ||
35 | #include "KReportPluginManager.h" | 35 | #include "KReportPluginManager.h" | ||
36 | #include "KReportSection.h" | 36 | #include "KReportSection.h" | ||
37 | #include "kreport_debug.h" | 37 | #include "kreport_debug.h" | ||
38 | 38 | | |||
39 | #include <KStandardShortcut> | 39 | #include <KStandardShortcut> | ||
▲ Show 20 Lines • Show All 680 Lines • ▼ Show 20 Line(s) | 718 | { | |||
720 | d->set = new KPropertySet(0, QLatin1String("Report")); | 720 | d->set = new KPropertySet(0, QLatin1String("Report")); | ||
721 | 721 | | |||
722 | connect(d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)), | 722 | connect(d->set, SIGNAL(propertyChanged(KPropertySet&,KProperty&)), | ||
723 | this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&))); | 723 | this, SLOT(slotPropertyChanged(KPropertySet&,KProperty&))); | ||
724 | 724 | | |||
725 | d->title = new KProperty("title", QLatin1String("Report"), tr("Title"), tr("Report Title")); | 725 | d->title = new KProperty("title", QLatin1String("Report"), tr("Title"), tr("Report Title")); | ||
726 | 726 | | |||
727 | keys.clear(); | 727 | keys.clear(); | ||
728 | keys = KReportPageFormat::pageFormatNames(); | 728 | keys = KReportPageSize::pageFormatKeys(); | ||
729 | strings = KReportPageFormat::localizedPageFormatNames(); | 729 | strings = KReportPageSize::pageFormatKeys(); | ||
730 | QString defaultKey = KReportPageFormat::formatString(KReportPageFormat::defaultFormat()); | 730 | QString defaultKey = KReportPageSize::pageSizeKey(KReportPageSize::defaultSize()); | ||
731 | d->pageSize = new KProperty("page-size", keys, strings, defaultKey, tr("Page Size")); | 731 | d->pageSize = new KProperty("page-size", keys, strings, defaultKey, tr("Page Size")); | ||
732 | 732 | | |||
733 | keys.clear(); strings.clear(); | 733 | keys.clear(); strings.clear(); | ||
734 | keys << QLatin1String("portrait") << QLatin1String("landscape"); | 734 | keys << QLatin1String("portrait") << QLatin1String("landscape"); | ||
735 | strings << tr("Portrait") << tr("Landscape"); | 735 | strings << tr("Portrait") << tr("Landscape"); | ||
736 | d->orientation = new KProperty("print-orientation", keys, strings, QLatin1String("portrait"), tr("Page Orientation")); | 736 | d->orientation = new KProperty("print-orientation", keys, strings, QLatin1String("portrait"), tr("Page Orientation")); | ||
737 | 737 | | |||
738 | keys.clear(); strings.clear(); | 738 | keys.clear(); strings.clear(); | ||
▲ Show 20 Lines • Show All 113 Lines • ▼ Show 20 Line(s) | 850 | if (d->detail) { | |||
852 | w += d->detail->sizeHint().width(); | 852 | w += d->detail->sizeHint().width(); | ||
853 | } | 853 | } | ||
854 | 854 | | |||
855 | h += d->hruler->height(); | 855 | h += d->hruler->height(); | ||
856 | 856 | | |||
857 | return QSize(w, h); | 857 | return QSize(w, h); | ||
858 | } | 858 | } | ||
859 | 859 | | |||
860 | int KReportDesigner::pageWidthPx() const | 860 | int KReportDesigner::pageWidthPx() const | ||
861 | { | 861 | { | ||
staniek: let's remove unused | |||||
staniek: let's remove unused | |||||
862 | int cw = 0; | 862 | KReportPageOptions po; | ||
863 | int ch = 0; | 863 | po.setPageSize(d->set->property("page-size").value().toString()); | ||
864 | int width = 0; | 864 | po.setPortrait(d->set->property("print-orientation").value().toString() == QLatin1String("portrait")); | ||
staniek: let's remove unused | |||||
865 | 865 | QSizeF pageSizePx = po.pixelSize(); | |||
866 | KReportPageFormat::Format pf = KReportPageFormat::formatFromString(d->set->property("page-size").value().toString()); | | |||
867 | | ||||
868 | cw = POINT_TO_INCH(MM_TO_POINT(KReportPageFormat::width(pf, KReportPageFormat::Portrait))) * KReportDpi::dpiX(); | | |||
869 | | ||||
870 | ch = POINT_TO_INCH(MM_TO_POINT(KReportPageFormat::height(pf, KReportPageFormat::Portrait))) * KReportDpi::dpiY(); | | |||
871 | | ||||
872 | width = (d->set->property("print-orientation").value().toString() == QLatin1String("portrait") ? cw : ch); | | |||
873 | 866 | | |||
867 | int width = pageSizePx.width(); | ||||
874 | width = width - POINT_TO_INCH(d->set->property("margin-left").value().toDouble()) * KReportDpi::dpiX(); | 868 | width = width - POINT_TO_INCH(d->set->property("margin-left").value().toDouble()) * KReportDpi::dpiX(); | ||
875 | width = width - POINT_TO_INCH(d->set->property("margin-right").value().toDouble()) * KReportDpi::dpiX(); | 869 | width = width - POINT_TO_INCH(d->set->property("margin-right").value().toDouble()) * KReportDpi::dpiX(); | ||
876 | 870 | | |||
877 | return width; | 871 | return width; | ||
staniek: Extra lines not needed... | |||||
878 | } | 872 | } | ||
879 | 873 | | |||
880 | void KReportDesigner::resizeEvent(QResizeEvent * event) | 874 | void KReportDesigner::resizeEvent(QResizeEvent * event) | ||
881 | { | 875 | { | ||
882 | Q_UNUSED(event); | 876 | Q_UNUSED(event); | ||
883 | //hruler->setRulerLength ( vboxlayout->geometry().width() ); | | |||
884 | d->hruler->setRulerLength(pageWidthPx()); | 877 | d->hruler->setRulerLength(pageWidthPx()); | ||
staniek: let's remove unused | |||||
885 | } | 878 | } | ||
886 | 879 | | |||
887 | void KReportDesigner::setDetail(KReportDesignerSectionDetail *rsd) | 880 | void KReportDesigner::setDetail(KReportDesignerSectionDetail *rsd) | ||
888 | { | 881 | { | ||
889 | if (!d->detail) { | 882 | if (!d->detail) { | ||
890 | int idx = 0; | 883 | int idx = 0; | ||
891 | if (d->pageHeaderFirst) idx++; | 884 | if (d->pageHeaderFirst) idx++; | ||
892 | if (d->pageHeaderOdd) idx++; | 885 | if (d->pageHeaderOdd) idx++; | ||
▲ Show 20 Lines • Show All 643 Lines • Show Last 20 Lines |
let's remove unused