Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/KReportPrintRenderer_p.cpp
Show First 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | 88 | for (int page = fromPage; page < toPage; page++) { | |||
---|---|---|---|---|---|
96 | // Render Page Objects | 96 | // Render Page Objects | ||
97 | for (int i = 0; i < p->primitiveCount(); i++) { | 97 | for (int i = 0; i < p->primitiveCount(); i++) { | ||
98 | OROPrimitive * prim = p->primitive(i); | 98 | OROPrimitive * prim = p->primitive(i); | ||
99 | 99 | | |||
100 | 100 | | |||
101 | prim->setPosition(QPointF(prim->position().x() * scaleX, prim->position().y() * scaleY)); | 101 | prim->setPosition(QPointF(prim->position().x() * scaleX, prim->position().y() * scaleY)); | ||
102 | prim->setSize(QSizeF(prim->size().width() * scaleX, prim->size().height() * scaleY)); | 102 | prim->setSize(QSizeF(prim->size().width() * scaleX, prim->size().height() * scaleY)); | ||
103 | //kreportDebug() << "Rendering object" << i << "type" << prim->type(); | 103 | //kreportDebug() << "Rendering object" << i << "type" << prim->type(); | ||
104 | if (dynamic_cast<OROTextBox*>(prim)) { | 104 | if (OROTextBox *tb = dynamic_cast<OROTextBox*>(prim)) { | ||
105 | //kreportDebug() << "Text Box"; | | |||
106 | OROTextBox * tb = dynamic_cast<OROTextBox*>(prim); | | |||
107 | | ||||
108 | QPointF ps = tb->position(); | 105 | QPointF ps = tb->position(); | ||
109 | QSizeF sz = tb->size(); | 106 | QSizeF sz = tb->size(); | ||
110 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 107 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
111 | 108 | | |||
112 | context.painter()->save(); | 109 | context.painter()->save(); | ||
113 | //Background | 110 | //Background | ||
114 | 111 | | |||
115 | QColor bg = tb->textStyle().backgroundColor; | 112 | QColor bg = tb->textStyle().backgroundColor; | ||
Show All 10 Lines | |||||
126 | 123 | | |||
127 | //outer line | 124 | //outer line | ||
128 | context.painter()->setPen(QPen(tb->lineStyle().color(), tb->lineStyle().width() * scaleX, tb->lineStyle().penStyle())); | 125 | context.painter()->setPen(QPen(tb->lineStyle().color(), tb->lineStyle().width() * scaleX, tb->lineStyle().penStyle())); | ||
129 | context.painter()->drawRect(rc); | 126 | context.painter()->drawRect(rc); | ||
130 | 127 | | |||
131 | //Reset back to defaults for next element | 128 | //Reset back to defaults for next element | ||
132 | context.painter()->restore(); | 129 | context.painter()->restore(); | ||
133 | 130 | | |||
134 | } else if (dynamic_cast<OROLine*>(prim)) { | 131 | } else if (OROLine *ln = dynamic_cast<OROLine*>(prim)) { | ||
135 | //kreportDebug() << "Line"; | | |||
136 | OROLine * ln = dynamic_cast<OROLine*>(prim); | | |||
137 | QPointF s = ln->startPoint(); | 132 | QPointF s = ln->startPoint(); | ||
138 | QPointF e(ln->endPoint().x() * scaleX, ln->endPoint().y() * scaleY); | 133 | QPointF e(ln->endPoint().x() * scaleX, ln->endPoint().y() * scaleY); | ||
139 | //QPen pen ( _painter()->pen() ); | 134 | //QPen pen ( _painter()->pen() ); | ||
140 | QPen pen(ln->lineStyle().color(), ln->lineStyle().width() * scaleX, ln->lineStyle().penStyle()); | 135 | QPen pen(ln->lineStyle().color(), ln->lineStyle().width() * scaleX, ln->lineStyle().penStyle()); | ||
141 | 136 | | |||
142 | context.painter()->save(); | 137 | context.painter()->save(); | ||
143 | context.painter()->setRenderHint(QPainter::Antialiasing, true); | 138 | context.painter()->setRenderHint(QPainter::Antialiasing, true); | ||
144 | context.painter()->setPen(pen); | 139 | context.painter()->setPen(pen); | ||
145 | context.painter()->drawLine(QLineF(s.x(), s.y(), e.x(), e.y())); | 140 | context.painter()->drawLine(QLineF(s.x(), s.y(), e.x(), e.y())); | ||
146 | context.painter()->setRenderHint(QPainter::Antialiasing, false); | 141 | context.painter()->setRenderHint(QPainter::Antialiasing, false); | ||
147 | context.painter()->restore(); | 142 | context.painter()->restore(); | ||
148 | } else if (dynamic_cast<OROImage*>(prim)) { | 143 | } else if (OROImage *im = dynamic_cast<OROImage*>(prim)) { | ||
149 | //kreportDebug() << "Image"; | | |||
150 | OROImage * im = dynamic_cast<OROImage*>(prim); | | |||
151 | QPointF ps = im->position(); | 144 | QPointF ps = im->position(); | ||
152 | QSizeF sz = im->size(); | 145 | QSizeF sz = im->size(); | ||
153 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 146 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
154 | 147 | | |||
155 | QImage img = im->image(); | 148 | QImage img = im->image(); | ||
156 | if (im->isScaled()) | 149 | if (im->isScaled()) | ||
157 | img = img.scaled(rc.size().toSize(), (Qt::AspectRatioMode) im->aspectRatioMode(), (Qt::TransformationMode) im->transformationMode()); | 150 | img = img.scaled(rc.size().toSize(), (Qt::AspectRatioMode) im->aspectRatioMode(), (Qt::TransformationMode) im->transformationMode()); | ||
158 | 151 | | |||
159 | QRectF sr = QRectF(QPointF(0.0, 0.0), rc.size().boundedTo(img.size())); | 152 | QRectF sr = QRectF(QPointF(0.0, 0.0), rc.size().boundedTo(img.size())); | ||
160 | context.painter()->drawImage(rc.topLeft(), img, sr); | 153 | context.painter()->drawImage(rc.topLeft(), img, sr); | ||
161 | } else if (dynamic_cast<ORORect*>(prim)) { | 154 | } else if (ORORect *re = dynamic_cast<ORORect*>(prim)) { | ||
162 | //kreportDebug() << "Rect"; | | |||
163 | ORORect * re = dynamic_cast<ORORect*>(prim); | | |||
164 | | ||||
165 | QPointF ps = re->position(); | 155 | QPointF ps = re->position(); | ||
166 | QSizeF sz = re->size(); | 156 | QSizeF sz = re->size(); | ||
167 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 157 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
168 | 158 | | |||
169 | context.painter()->save(); | 159 | context.painter()->save(); | ||
170 | context.painter()->setPen(re->pen()); | 160 | context.painter()->setPen(re->pen()); | ||
171 | context.painter()->setBrush(re->brush()); | 161 | context.painter()->setBrush(re->brush()); | ||
172 | context.painter()->drawRect(rc); | 162 | context.painter()->drawRect(rc); | ||
173 | context.painter()->restore(); | 163 | context.painter()->restore(); | ||
174 | } else if (dynamic_cast<OROEllipse*>(prim)) { | 164 | } else if (OROEllipse *re = dynamic_cast<OROEllipse*>(prim)) { | ||
175 | OROEllipse * re = dynamic_cast<OROEllipse*>(prim); | | |||
176 | | ||||
177 | QPointF ps = re->position(); | 165 | QPointF ps = re->position(); | ||
178 | QSizeF sz = re->size(); | 166 | QSizeF sz = re->size(); | ||
179 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 167 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
180 | 168 | | |||
181 | context.painter()->save(); | 169 | context.painter()->save(); | ||
182 | context.painter()->setPen(re->pen()); | 170 | context.painter()->setPen(re->pen()); | ||
183 | context.painter()->setBrush(re->brush()); | 171 | context.painter()->setBrush(re->brush()); | ||
184 | context.painter()->drawEllipse(rc); | 172 | context.painter()->drawEllipse(rc); | ||
185 | context.painter()->restore(); | 173 | context.painter()->restore(); | ||
186 | } else if (dynamic_cast<OROPicture*>(prim)) { | 174 | } else if (OROPicture *im = dynamic_cast<OROPicture*>(prim)) { | ||
187 | OROPicture * im = dynamic_cast<OROPicture*>(prim); | | |||
188 | QPointF ps = im->position(); | 175 | QPointF ps = im->position(); | ||
189 | QSizeF sz = im->size(); | 176 | QSizeF sz = im->size(); | ||
190 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 177 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
191 | context.painter()->drawPicture(rc.topLeft(), *(im->picture())); | 178 | context.painter()->drawPicture(rc.topLeft(), *(im->picture())); | ||
192 | } else if (dynamic_cast<OROCheckBox*>(prim)) { | 179 | } else if (OROCheckBox *chk = dynamic_cast<OROCheckBox*>(prim)) { | ||
193 | OROCheckBox * chk = dynamic_cast<OROCheckBox*>(prim); | | |||
194 | QPointF ps = chk->position(); | 180 | QPointF ps = chk->position(); | ||
195 | QSizeF sz = chk->size(); | 181 | QSizeF sz = chk->size(); | ||
196 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | 182 | QRectF rc = QRectF(ps.x(), ps.y(), sz.width(), sz.height()); | ||
197 | 183 | | |||
198 | context.painter()->save(); | 184 | context.painter()->save(); | ||
199 | 185 | | |||
200 | context.painter()->setBackgroundMode(Qt::OpaqueMode); | 186 | context.painter()->setBackgroundMode(Qt::OpaqueMode); | ||
201 | context.painter()->setRenderHint(QPainter::Antialiasing); | 187 | context.painter()->setRenderHint(QPainter::Antialiasing); | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |