Changeset View
Changeset View
Standalone View
Standalone View
src/common/KReportDesign_p.cpp
Show All 22 Lines | |||||
23 | #include "KReportPluginManager.h" | 23 | #include "KReportPluginManager.h" | ||
24 | #include "KReportPluginInterface.h" | 24 | #include "KReportPluginInterface.h" | ||
25 | 25 | | |||
26 | #include <QDebug> | 26 | #include <QDebug> | ||
27 | #include <QDomDocument> | 27 | #include <QDomDocument> | ||
28 | #include <QDomElement> | 28 | #include <QDomElement> | ||
29 | #include <QSizeF> | 29 | #include <QSizeF> | ||
30 | 30 | | |||
31 | const bool DEFAULT_SHOW_GRID = true; | ||||
32 | const bool DEFAULT_SNAP_TO_GRID = true; | ||||
33 | const int DEFAULT_GRID_DIVISIONS = 4; | ||||
34 | const KReportUnit::Type DEFAULT_UNIT_TYPE = KReportUnit::Type::Centimeter; | ||||
35 | const KReportUnit DEFAULT_UNIT(DEFAULT_UNIT_TYPE); | ||||
36 | const int DEFAULT_PAGE_MARGIN = CM_TO_POINT(1.0); | ||||
37 | const QPageSize::PageSizeId DEFAULT_PAGE_SIZE = QPageSize::A4; | ||||
38 | const QPageLayout::Orientation DEFAULT_PAGE_ORIENTATION = QPageLayout::Landscape; | ||||
39 | | ||||
31 | KReportDesign::Private::Private(KReportDesign *design) | 40 | KReportDesign::Private::Private(KReportDesign *design) | ||
32 | : q(design) | 41 | : q(design) | ||
33 | , showGrid(DEFAULT_SHOW_GRID) | 42 | , showGrid(DEFAULT_SHOW_GRID) | ||
34 | , snapToGrid(DEFAULT_SNAP_TO_GRID) | 43 | , snapToGrid(DEFAULT_SNAP_TO_GRID) | ||
35 | , gridDivisions(DEFAULT_GRID_DIVISIONS) | 44 | , gridDivisions(DEFAULT_GRID_DIVISIONS) | ||
36 | , pageUnit(DEFAULT_UNIT) | 45 | , pageUnit(DEFAULT_UNIT) | ||
37 | , sections(static_cast<int>(KReportSection::Type::Detail)) | 46 | , sections(static_cast<int>(KReportSection::Type::Detail)) | ||
38 | { | 47 | { | ||
▲ Show 20 Lines • Show All 301 Lines • ▼ Show 20 Line(s) | 348 | } else if (name == "report:script") { | |||
340 | script = el.firstChildElement().text(); | 349 | script = el.firstChildElement().text(); | ||
341 | originalInterpreter = KReportUtils::attr(el, "report:script-interpreter", QString()); | 350 | originalInterpreter = KReportUtils::attr(el, "report:script-interpreter", QString()); | ||
342 | #endif | 351 | #endif | ||
343 | } else if (name == "report:grid") { | 352 | } else if (name == "report:grid") { | ||
344 | showGrid = KReportUtils::attr(el, "report:grid-visible", DEFAULT_SHOW_GRID); | 353 | showGrid = KReportUtils::attr(el, "report:grid-visible", DEFAULT_SHOW_GRID); | ||
345 | snapToGrid = KReportUtils::attr(el, "report:grid-snap", DEFAULT_SNAP_TO_GRID); | 354 | snapToGrid = KReportUtils::attr(el, "report:grid-snap", DEFAULT_SNAP_TO_GRID); | ||
346 | gridDivisions = KReportUtils::attr(el, "report:grid-divisions", DEFAULT_GRID_DIVISIONS); | 355 | gridDivisions = KReportUtils::attr(el, "report:grid-divisions", DEFAULT_GRID_DIVISIONS); | ||
347 | const QString pageUnitString = KReportUtils::attr(el, "report:page-unit", QString()); | 356 | const QString pageUnitString = KReportUtils::attr(el, "report:page-unit", QString()); | ||
348 | bool found; | 357 | pageUnit = KReportUnit(KReportUnit::symbolToType(pageUnitString)); | ||
349 | pageUnit = KReportUnit::fromSymbol(pageUnitString, &found); | 358 | if (!pageUnit.isValid()) { | ||
350 | if (!found) { | | |||
351 | pageUnit = DEFAULT_UNIT; | 359 | pageUnit = DEFAULT_UNIT; | ||
352 | if (!pageUnitString.isEmpty()) { | 360 | if (!pageUnitString.isEmpty()) { | ||
353 | qWarning() << "Invalid page unit" << pageUnitString << "specified in" << name | 361 | qWarning() << "Invalid page unit" << pageUnitString << "specified in" << name | ||
354 | << "element, defaulting to" << pageUnit.symbol(); | 362 | << "element, defaulting to" << pageUnit.symbol(); | ||
355 | } | 363 | } | ||
356 | } | 364 | } | ||
357 | } | 365 | } | ||
358 | else if (name == "report:page-style") { // see https://git.reviewboard.kde.org/r/115314 | 366 | else if (name == "report:page-style") { // see https://git.reviewboard.kde.org/r/115314 | ||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |