Changeset View
Changeset View
Standalone View
Standalone View
filters/karbon/pdf/SvgOutputDev.cpp
Show All 33 Lines | |||||
34 | #include <QBrush> | 34 | #include <QBrush> | ||
35 | #include <QPen> | 35 | #include <QPen> | ||
36 | #include <QImage> | 36 | #include <QImage> | ||
37 | 37 | | |||
38 | class SvgOutputDev::Private | 38 | class SvgOutputDev::Private | ||
39 | { | 39 | { | ||
40 | public: | 40 | public: | ||
41 | Private(const QString &fname) | 41 | Private(const QString &fname) | ||
42 | : svgFile(fname), defs(0), body(0), state(gTrue) | 42 | : svgFile(fname), defs(0), body(0), state(true) | ||
43 | , brush(Qt::SolidPattern) {} | 43 | , brush(Qt::SolidPattern) {} | ||
44 | 44 | | |||
45 | ~Private() { | 45 | ~Private() { | ||
46 | delete defs; | 46 | delete defs; | ||
47 | delete body; | 47 | delete body; | ||
48 | } | 48 | } | ||
49 | 49 | | |||
50 | QFile svgFile; | 50 | QFile svgFile; | ||
51 | QString bodyData; | 51 | QString bodyData; | ||
52 | QString defsData; | 52 | QString defsData; | ||
53 | QTextStream * defs; | 53 | QTextStream * defs; | ||
54 | QTextStream * body; | 54 | QTextStream * body; | ||
55 | bool state; | 55 | bool state; | ||
56 | QSizeF pageSize; | 56 | QSizeF pageSize; | ||
57 | QPen pen; | 57 | QPen pen; | ||
58 | QBrush brush; | 58 | QBrush brush; | ||
59 | }; | 59 | }; | ||
60 | 60 | | |||
61 | SvgOutputDev::SvgOutputDev(const QString &fileName) | 61 | SvgOutputDev::SvgOutputDev(const QString &fileName) | ||
62 | : d(new Private(fileName)) | 62 | : d(new Private(fileName)) | ||
63 | { | 63 | { | ||
64 | if (! d->svgFile.open(QIODevice::WriteOnly)) { | 64 | if (! d->svgFile.open(QIODevice::WriteOnly)) { | ||
65 | d->state = gFalse; | 65 | d->state = false; | ||
66 | return; | 66 | return; | ||
67 | } | 67 | } | ||
68 | 68 | | |||
69 | d->body = new QTextStream(&d->bodyData, QIODevice::ReadWrite); | 69 | d->body = new QTextStream(&d->bodyData, QIODevice::ReadWrite); | ||
70 | d->defs = new QTextStream(&d->defsData, QIODevice::ReadWrite); | 70 | d->defs = new QTextStream(&d->defsData, QIODevice::ReadWrite); | ||
71 | } | 71 | } | ||
72 | 72 | | |||
73 | SvgOutputDev::~SvgOutputDev() | 73 | SvgOutputDev::~SvgOutputDev() | ||
74 | { | 74 | { | ||
75 | delete d; | 75 | delete d; | ||
76 | } | 76 | } | ||
77 | 77 | | |||
78 | bool SvgOutputDev::isOk() | 78 | bool SvgOutputDev::isOk() | ||
79 | { | 79 | { | ||
80 | return d->state; | 80 | return d->state; | ||
81 | } | 81 | } | ||
82 | 82 | | |||
83 | bool SvgOutputDev::upsideDown() | 83 | bool SvgOutputDev::upsideDown() | ||
84 | { | 84 | { | ||
85 | return gTrue; | 85 | return true; | ||
86 | } | 86 | } | ||
87 | 87 | | |||
88 | bool SvgOutputDev::useDrawChar() | 88 | bool SvgOutputDev::useDrawChar() | ||
89 | { | 89 | { | ||
90 | return gFalse; | 90 | return false; | ||
91 | } | 91 | } | ||
92 | 92 | | |||
93 | bool SvgOutputDev::interpretType3Chars() | 93 | bool SvgOutputDev::interpretType3Chars() | ||
94 | { | 94 | { | ||
95 | return gFalse; | 95 | return false; | ||
96 | } | 96 | } | ||
97 | 97 | | |||
98 | void SvgOutputDev::startPage(int pageNum, GfxState *state, XRef */*xref*/) | 98 | void SvgOutputDev::startPage(int pageNum, GfxState *state, XRef */*xref*/) | ||
99 | { | 99 | { | ||
100 | debugPdf << "starting page" << pageNum; | 100 | debugPdf << "starting page" << pageNum; | ||
101 | d->pageSize = QSizeF(state->getPageWidth(), state->getPageHeight()); | 101 | d->pageSize = QSizeF(state->getPageWidth(), state->getPageHeight()); | ||
102 | debugPdf << "page size =" << d->pageSize; | 102 | debugPdf << "page size =" << d->pageSize; | ||
103 | 103 | | |||
▲ Show 20 Lines • Show All 450 Lines • Show Last 20 Lines |