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(KReportSection::Detail) | 46 | , sections(KReportSection::Detail) | ||
38 | { | 47 | { | ||
▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Line(s) | 343 | } else if (name == "report:script") { | |||
335 | script = el.firstChildElement().text(); | 344 | script = el.firstChildElement().text(); | ||
336 | originalInterpreter = KReportUtils::attr(el, "report:script-interpreter", QString()); | 345 | originalInterpreter = KReportUtils::attr(el, "report:script-interpreter", QString()); | ||
337 | #endif | 346 | #endif | ||
338 | } else if (name == "report:grid") { | 347 | } else if (name == "report:grid") { | ||
339 | showGrid = KReportUtils::attr(el, "report:grid-visible", DEFAULT_SHOW_GRID); | 348 | showGrid = KReportUtils::attr(el, "report:grid-visible", DEFAULT_SHOW_GRID); | ||
340 | snapToGrid = KReportUtils::attr(el, "report:grid-snap", DEFAULT_SNAP_TO_GRID); | 349 | snapToGrid = KReportUtils::attr(el, "report:grid-snap", DEFAULT_SNAP_TO_GRID); | ||
341 | gridDivisions = KReportUtils::attr(el, "report:grid-divisions", DEFAULT_GRID_DIVISIONS); | 350 | gridDivisions = KReportUtils::attr(el, "report:grid-divisions", DEFAULT_GRID_DIVISIONS); | ||
342 | const QString pageUnitString = KReportUtils::attr(el, "report:page-unit", QString()); | 351 | const QString pageUnitString = KReportUtils::attr(el, "report:page-unit", QString()); | ||
343 | bool found; | 352 | pageUnit = KReportUnit(KReportUnit::symbolToType(pageUnitString)); | ||
344 | pageUnit = KReportUnit::fromSymbol(pageUnitString, &found); | 353 | if (!pageUnit.isValid()) { | ||
345 | if (!found) { | | |||
346 | pageUnit = DEFAULT_UNIT; | 354 | pageUnit = DEFAULT_UNIT; | ||
347 | if (!pageUnitString.isEmpty()) { | 355 | if (!pageUnitString.isEmpty()) { | ||
348 | qWarning() << "Invalid page unit" << pageUnitString << "specified in" << name | 356 | qWarning() << "Invalid page unit" << pageUnitString << "specified in" << name | ||
349 | << "element, defaulting to" << pageUnit.symbol(); | 357 | << "element, defaulting to" << pageUnit.symbol(); | ||
350 | } | 358 | } | ||
351 | } | 359 | } | ||
352 | } | 360 | } | ||
353 | else if (name == "report:page-style") { // see https://git.reviewboard.kde.org/r/115314 | 361 | 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 |