Rev 16602 | Rev 16736 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4430 | cbradney | 1 | /* |
2 | For general Scribus (>=1.3.2) copyright and licensing information please refer |
||
3 | to the COPYING file provided with the program. Following this notice may exist |
||
4 | a copyright and/or license notice that predates the release of Scribus 1.3.2 |
||
5 | for which a new license (GPL+exception) is in place. |
||
6 | */ |
||
4360 | cbradney | 7 | #include "scpageoutput.h" |
8 | |||
10212 | cbradney | 9 | #include <QList> |
10227 | jghali | 10 | #include <QPointF> |
11 | #include <QRectF> |
||
9922 | fschmid | 12 | #include <QStack> |
10212 | cbradney | 13 | |
5784 | jghali | 14 | #include "cmsettings.h" |
4617 | avox | 15 | #include "commonstrings.h" |
16729 | fschmid | 16 | #include "scpage.h" |
10212 | cbradney | 17 | #include "pageitem.h" |
4360 | cbradney | 18 | #include "pageitem_imageframe.h" |
19 | #include "pageitem_line.h" |
||
20 | #include "pageitem_pathtext.h" |
||
21 | #include "pageitem_polygon.h" |
||
22 | #include "pageitem_polyline.h" |
||
23 | #include "pageitem_textframe.h" |
||
10212 | cbradney | 24 | #include "prefsmanager.h" |
5993 | avox | 25 | #include "scfonts.h" |
10212 | cbradney | 26 | #include "scimage.h" |
10601 | mrdocs | 27 | #include "scpattern.h" |
4360 | cbradney | 28 | #include "scribus.h" |
10212 | cbradney | 29 | #include "scribusdoc.h" |
4360 | cbradney | 30 | #include "util.h" |
10212 | cbradney | 31 | #include "util_formats.h" |
10992 | jghali | 32 | #include "util_math.h" |
4360 | cbradney | 33 | |
10212 | cbradney | 34 | |
7108 | jghali | 35 | MarksOptions::MarksOptions(void) |
4360 | cbradney | 36 | { |
7108 | jghali | 37 | markOffset = 0.0; |
38 | BleedTop = 0.0; |
||
39 | BleedLeft = 0.0; |
||
40 | BleedRight = 0.0; |
||
41 | BleedBottom = 0.0; |
||
42 | cropMarks = false; |
||
43 | bleedMarks = false; |
||
44 | registrationMarks = false; |
||
45 | colorMarks = false; |
||
46 | docInfoMarks = false; |
||
47 | } |
||
48 | |||
49 | MarksOptions::MarksOptions(struct PrintOptions& opt) |
||
50 | { |
||
51 | markOffset = opt.markOffset; |
||
7252 | jghali | 52 | BleedTop = opt.bleeds.Top; |
53 | BleedLeft = opt.bleeds.Left; |
||
54 | BleedRight = opt.bleeds.Right; |
||
55 | BleedBottom = opt.bleeds.Bottom; |
||
7108 | jghali | 56 | cropMarks = opt.cropMarks; |
57 | bleedMarks = opt.bleedMarks; |
||
58 | registrationMarks = opt.registrationMarks; |
||
59 | colorMarks = opt.colorMarks; |
||
60 | docInfoMarks = true; |
||
61 | } |
||
62 | |||
63 | ScPageOutput::ScPageOutput(ScribusDoc* doc, bool reloadImages, int resolution, bool useProfiles) |
||
64 | : m_marksOptions() |
||
65 | { |
||
4360 | cbradney | 66 | m_doc = doc; |
67 | m_reloadImages = reloadImages; |
||
68 | m_imageRes = resolution; |
||
69 | m_useProfiles = useProfiles; |
||
70 | } |
||
71 | |||
5345 | mrdocs | 72 | ScImage::RequestType ScPageOutput::translateImageModeToRequest( ScPainterExBase::ImageMode mode ) |
73 | { |
||
74 | ScImage::RequestType value = ScImage::RGBData; |
||
75 | if ( mode == ScPainterExBase::cmykImages ) |
||
76 | value = ScImage::CMYKData; |
||
77 | else if ( mode == ScPainterExBase::rgbImages ) |
||
78 | value = ScImage::RGBData; |
||
79 | else if ( mode == ScPainterExBase::rawImages ) |
||
80 | value = ScImage::RawData; |
||
81 | return value; |
||
82 | } |
||
83 | |||
16729 | fschmid | 84 | void ScPageOutput::drawPage( ScPage* page, ScPainterExBase* painter) |
4360 | cbradney | 85 | { |
86 | int clipx = static_cast<int>(page->xOffset()); |
||
87 | int clipy = static_cast<int>(page->yOffset()); |
||
88 | int clipw = qRound(page->width()); |
||
89 | int cliph = qRound(page->height()); |
||
13873 | jghali | 90 | ScLayer layer; |
91 | layer.isViewable = false; |
||
92 | uint layerCount = m_doc->layerCount(); |
||
93 | for (uint la = 0; la < layerCount; ++la) |
||
94 | { |
||
95 | m_doc->Layers.levelToLayer(layer, la); |
||
96 | drawMasterItems(painter, page, layer, QRect(clipx, clipy, clipw, cliph)); |
||
97 | drawPageItems(painter, page, layer, QRect(clipx, clipy, clipw, cliph)); |
||
98 | } |
||
11905 | jghali | 99 | drawMarks(page, painter, m_marksOptions); |
4360 | cbradney | 100 | } |
101 | |||
16729 | fschmid | 102 | void ScPageOutput::drawMasterItems(ScPainterExBase *painter, ScPage *page, ScLayer& layer, const QRect& clip) |
4360 | cbradney | 103 | { |
13873 | jghali | 104 | PageItem* currItem; |
105 | if (page->MPageNam.isEmpty()) |
||
106 | return; |
||
107 | if (page->FromMaster.count() <= 0) |
||
108 | return; |
||
109 | if (!layer.isViewable || !layer.isPrintable) |
||
110 | return; |
||
16729 | fschmid | 111 | ScPage* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]); |
13873 | jghali | 112 | uint pageFromMasterCount = page->FromMaster.count(); |
113 | for (uint a = 0; a < pageFromMasterCount; ++a) |
||
4360 | cbradney | 114 | { |
13873 | jghali | 115 | currItem = page->FromMaster.at(a); |
13875 | jghali | 116 | if (currItem->LayerID != layer.ID) |
13873 | jghali | 117 | continue; |
118 | if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr()))) |
||
119 | continue; |
||
120 | if (!currItem->printEnabled()) |
||
121 | continue; |
||
122 | int savedOwnPage = currItem->OwnPage; |
||
123 | double OldX = currItem->xPos(); |
||
124 | double OldY = currItem->yPos(); |
||
125 | double OldBX = currItem->BoundingX; |
||
126 | double OldBY = currItem->BoundingY; |
||
127 | currItem->OwnPage = page->pageNr(); |
||
128 | if (!currItem->ChangedMasterItem) |
||
129 | { |
||
130 | currItem->moveBy(-Mp->xOffset() + page->xOffset(), -Mp->yOffset() + page->yOffset(), true); |
||
131 | currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset(); |
||
132 | currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset(); |
||
133 | } |
||
134 | /*if (evSpon) |
||
135 | currItem->Dirty = true;*/ |
||
136 | QRect oldR(currItem->getRedrawBounding(1.0)); |
||
137 | if (clip.intersects(oldR)) |
||
138 | { |
||
139 | // relayout necessary to get page number ok |
||
140 | currItem->invalidateLayout(); |
||
141 | currItem->layout(); |
||
142 | drawItem(currItem, painter, clip); |
||
143 | } |
||
144 | currItem->OwnPage = savedOwnPage; |
||
145 | if (!currItem->ChangedMasterItem) |
||
146 | { |
||
147 | currItem->setXYPos(OldX, OldY, true); |
||
148 | currItem->BoundingX = OldBX; |
||
149 | currItem->BoundingY = OldBY; |
||
150 | } |
||
151 | } |
||
152 | for (uint a = 0; a < pageFromMasterCount; ++a) |
||
153 | { |
||
154 | currItem = page->FromMaster.at(a); |
||
13875 | jghali | 155 | if (currItem->LayerID != layer.ID) |
13873 | jghali | 156 | continue; |
157 | if (!currItem->isTableItem) |
||
158 | continue; |
||
159 | if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr()))) |
||
160 | continue; |
||
161 | double OldX = currItem->xPos(); |
||
162 | double OldY = currItem->yPos(); |
||
163 | double OldBX = currItem->BoundingX; |
||
164 | double OldBY = currItem->BoundingY; |
||
165 | if (!currItem->ChangedMasterItem) |
||
166 | { |
||
167 | currItem->setXPos(OldX - Mp->xOffset() + page->xOffset(), true); |
||
168 | currItem->setYPos(OldY - Mp->yOffset() + page->yOffset(), true); |
||
169 | currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset(); |
||
170 | currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset(); |
||
171 | } |
||
172 | QRect oldR(currItem->getRedrawBounding(1.0)); |
||
173 | if (clip.intersects(oldR)) |
||
174 | { |
||
175 | painter->save(); |
||
176 | painter->translate(currItem->xPos(), currItem->yPos()); |
||
177 | painter->rotate(currItem->rotation()); |
||
178 | if (currItem->lineColor() != CommonStrings::None) |
||
179 | { |
||
180 | ScColorShade tmp( m_doc->PageColors[currItem->lineColor()], (int) currItem->lineShade()); |
||
181 | if ((currItem->TopLine) || (currItem->RightLine) || (currItem->BottomLine) || (currItem->LeftLine)) |
||
4360 | cbradney | 182 | { |
13873 | jghali | 183 | painter->setPen(tmp, currItem->lineWidth(), currItem->PLineArt, Qt::SquareCap, currItem->PLineJoin); |
184 | if (currItem->TopLine) |
||
185 | painter->drawLine(FPoint(0.0, 0.0), FPoint(currItem->width(), 0.0)); |
||
186 | if (currItem->RightLine) |
||
187 | painter->drawLine(FPoint(currItem->width(), 0.0), FPoint(currItem->width(), currItem->height())); |
||
188 | if (currItem->BottomLine) |
||
189 | painter->drawLine(FPoint(currItem->width(), currItem->height()), FPoint(0.0, currItem->height())); |
||
190 | if (currItem->LeftLine) |
||
191 | painter->drawLine(FPoint(0.0, currItem->height()), FPoint(0.0, 0.0)); |
||
4360 | cbradney | 192 | } |
193 | } |
||
13873 | jghali | 194 | painter->restore(); |
4360 | cbradney | 195 | } |
13873 | jghali | 196 | if (!currItem->ChangedMasterItem) |
197 | { |
||
198 | currItem->setXPos(OldX, true); |
||
199 | currItem->setYPos(OldY, true); |
||
200 | currItem->BoundingX = OldBX; |
||
201 | currItem->BoundingY = OldBY; |
||
202 | } |
||
4360 | cbradney | 203 | } |
204 | } |
||
205 | |||
16729 | fschmid | 206 | void ScPageOutput::drawPageItems(ScPainterExBase *painter, ScPage *page, ScLayer& layer, const QRect& clip) |
4360 | cbradney | 207 | { |
13873 | jghali | 208 | PageItem *currItem; |
209 | if (m_doc->Items->count() <= 0) |
||
210 | return; |
||
211 | if (!layer.isViewable || !layer.isPrintable) |
||
212 | return; |
||
213 | int docCurrPageNo = static_cast<int>(page->pageNr()); |
||
214 | for (int it = 0; it < m_doc->Items->count(); ++it) |
||
4360 | cbradney | 215 | { |
13873 | jghali | 216 | currItem = m_doc->Items->at(it); |
13875 | jghali | 217 | if (currItem->LayerID != layer.ID) |
13873 | jghali | 218 | continue; |
219 | if (!currItem->printEnabled()) |
||
220 | continue; |
||
221 | if ((m_doc->masterPageMode()) && ((currItem->OwnPage != -1) && (currItem->OwnPage != docCurrPageNo))) |
||
222 | continue; |
||
223 | if (!m_doc->masterPageMode() && !currItem->OnMasterPage.isEmpty()) |
||
4360 | cbradney | 224 | { |
13873 | jghali | 225 | if (currItem->OnMasterPage != page->pageName()) |
226 | continue; |
||
227 | } |
||
228 | QRect oldR(currItem->getRedrawBounding(1.0)); |
||
229 | if (clip.intersects(oldR)) |
||
230 | { |
||
231 | drawItem( currItem, painter, clip ); |
||
232 | if ((currItem->asTextFrame()) && ((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0))) |
||
4360 | cbradney | 233 | { |
13873 | jghali | 234 | PageItem *nextItem = currItem; |
235 | while (nextItem != 0) |
||
4360 | cbradney | 236 | { |
13873 | jghali | 237 | if (nextItem->prevInChain() != 0) |
238 | nextItem = nextItem->prevInChain(); |
||
239 | else |
||
240 | break; |
||
4360 | cbradney | 241 | } |
13873 | jghali | 242 | } |
243 | } |
||
244 | } |
||
245 | for (int it = 0; it < m_doc->Items->count(); ++it) |
||
246 | { |
||
247 | currItem = m_doc->Items->at(it); |
||
13875 | jghali | 248 | if (currItem->LayerID != layer.ID) |
13873 | jghali | 249 | continue; |
250 | if (!currItem->isTableItem) |
||
251 | continue; |
||
252 | QRect oldR(currItem->getRedrawBounding(1.0)); |
||
253 | if (clip.intersects(oldR)) |
||
254 | { |
||
255 | painter->save(); |
||
256 | painter->translate(currItem->xPos(), currItem->yPos()); |
||
257 | painter->rotate(currItem->rotation()); |
||
258 | if (currItem->lineColor() != CommonStrings::None) |
||
259 | { |
||
260 | ScColorShade tmp( m_doc->PageColors[currItem->lineColor()], (int) currItem->lineShade() ); |
||
261 | if ((currItem->TopLine) || (currItem->RightLine) || (currItem->BottomLine) || (currItem->LeftLine)) |
||
4360 | cbradney | 262 | { |
13873 | jghali | 263 | painter->setPen(tmp, currItem->lineWidth(), currItem->PLineArt, Qt::SquareCap, currItem->PLineJoin); |
264 | if (currItem->TopLine) |
||
265 | painter->drawLine(FPoint(0.0, 0.0), FPoint(currItem->width(), 0.0)); |
||
266 | if (currItem->RightLine) |
||
267 | painter->drawLine(FPoint(currItem->width(), 0.0), FPoint(currItem->width(), currItem->height())); |
||
268 | if (currItem->BottomLine) |
||
269 | painter->drawLine(FPoint(currItem->width(), currItem->height()), FPoint(0.0, currItem->height())); |
||
270 | if (currItem->LeftLine) |
||
271 | painter->drawLine(FPoint(0.0, currItem->height()), FPoint(0.0, 0.0)); |
||
4360 | cbradney | 272 | } |
273 | } |
||
13873 | jghali | 274 | painter->restore(); |
4360 | cbradney | 275 | } |
276 | } |
||
277 | } |
||
278 | |||
11905 | jghali | 279 | void ScPageOutput::drawItem( PageItem* item, ScPainterExBase* painter, const QRect& clip ) |
4360 | cbradney | 280 | { |
11905 | jghali | 281 | drawItem_Pre(item, painter); |
4360 | cbradney | 282 | PageItem::ItemType itemType = item->itemType(); |
283 | if( itemType == PageItem::ImageFrame ) |
||
11905 | jghali | 284 | drawItem_ImageFrame( (PageItem_ImageFrame*) item, painter, clip); |
4360 | cbradney | 285 | else if( itemType == PageItem::Line ) |
11905 | jghali | 286 | drawItem_Line( (PageItem_Line*) item, painter, clip); |
4360 | cbradney | 287 | else if( itemType == PageItem::PathText ) |
11905 | jghali | 288 | drawItem_PathText( (PageItem_PathText*) item, painter, clip); |
4360 | cbradney | 289 | else if( itemType == PageItem::Polygon ) |
11905 | jghali | 290 | drawItem_Polygon( (PageItem_Polygon*) item, painter, clip); |
4360 | cbradney | 291 | else if( itemType == PageItem::PolyLine ) |
11905 | jghali | 292 | drawItem_PolyLine( (PageItem_PolyLine*) item, painter, clip); |
4360 | cbradney | 293 | else if( itemType == PageItem::TextFrame ) |
11905 | jghali | 294 | drawItem_TextFrame( (PageItem_TextFrame*) item, painter, clip); |
295 | drawItem_Post(item, painter); |
||
4360 | cbradney | 296 | } |
297 | |||
11905 | jghali | 298 | void ScPageOutput::drawItem_Pre( PageItem* item, ScPainterExBase* painter) |
4360 | cbradney | 299 | { |
300 | painter->save(); |
||
301 | if (!item->isEmbedded) |
||
302 | { |
||
6987 | jghali | 303 | painter->translate( item->xPos(), item->yPos()); |
4360 | cbradney | 304 | // painter->rotate(item->rotation()); |
305 | } |
||
306 | painter->rotate(item->rotation()); |
||
4617 | avox | 307 | painter->setLineWidth(item->lineWidth()); |
6987 | jghali | 308 | if (item->GrType == 8) |
4360 | cbradney | 309 | { |
6987 | jghali | 310 | QString pat = item->pattern(); |
311 | if ((pat.isEmpty()) || (!m_doc->docPatterns.contains(pat))) |
||
312 | { |
||
313 | painter->m_fillGradient = VGradientEx(VGradientEx::linear); |
||
314 | if (item->fillColor() != CommonStrings::None) |
||
315 | { |
||
10227 | jghali | 316 | painter->setBrush(ScColorShade(m_doc->PageColors[item->fillColor()], (int) item->fillShade())); |
7108 | jghali | 317 | painter->setFillMode(ScPainterExBase::Solid); |
6987 | jghali | 318 | } |
319 | else |
||
7108 | jghali | 320 | painter->setFillMode(ScPainterExBase::None); |
6987 | jghali | 321 | } |
322 | else |
||
323 | { |
||
13951 | fschmid | 324 | QTransform patternTransform; |
6987 | jghali | 325 | ScPattern& pattern = m_doc->docPatterns[item->pattern()]; |
14260 | fschmid | 326 | double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY; |
327 | item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY); |
||
6987 | jghali | 328 | patternTransform.translate(patternOffsetX, patternOffsetY); |
329 | patternTransform.rotate(patternRotation); |
||
14260 | fschmid | 330 | patternTransform.shear(patternSkewX, patternSkewY); |
6987 | jghali | 331 | patternTransform.scale(pattern.scaleX, pattern.scaleY); |
332 | patternTransform.scale(patternScaleX / 100.0 , patternScaleY / 100.0); |
||
333 | painter->setPattern(&pattern, patternTransform); |
||
334 | painter->setFillMode(ScPainterExBase::Pattern); |
||
335 | } |
||
336 | } |
||
337 | else if (item->GrType != 0) |
||
338 | { |
||
4360 | cbradney | 339 | painter->setFillMode(ScPainterExBase::Gradient); |
6987 | jghali | 340 | painter->m_fillGradient = VGradientEx(item->fill_gradient, *m_doc); |
13951 | fschmid | 341 | QTransform grm; |
4360 | cbradney | 342 | grm.rotate(item->rotation()); |
343 | FPointArray gra; |
||
344 | switch (item->GrType) |
||
345 | { |
||
346 | case 1: |
||
347 | case 2: |
||
348 | case 3: |
||
349 | case 4: |
||
350 | case 6: |
||
351 | gra.setPoints(2, item->GrStartX, item->GrStartY, item->GrEndX, item->GrEndY); |
||
352 | gra.map(grm); |
||
353 | painter->setGradient(VGradientEx::linear, gra.point(0), gra.point(1)); |
||
354 | break; |
||
355 | case 5: |
||
356 | case 7: |
||
357 | gra.setPoints(2, item->GrStartX, item->GrStartY, item->GrEndX, item->GrEndY); |
||
358 | painter->setGradient(VGradientEx::radial, gra.point(0), gra.point(1), gra.point(0)); |
||
359 | break; |
||
360 | } |
||
361 | } |
||
362 | else |
||
363 | { |
||
6987 | jghali | 364 | painter->m_fillGradient = VGradientEx(VGradientEx::linear); |
4546 | subik | 365 | if (item->fillColor() != CommonStrings::None) |
4360 | cbradney | 366 | { |
10227 | jghali | 367 | painter->setBrush( ScColorShade(m_doc->PageColors[item->fillColor()], (int) item->fillShade()) ); |
4360 | cbradney | 368 | painter->setFillMode(ScPainterExBase::Solid); |
369 | } |
||
370 | else |
||
371 | painter->setFillMode(ScPainterExBase::None); |
||
372 | } |
||
4546 | subik | 373 | if (item->lineColor() != CommonStrings::None) |
4360 | cbradney | 374 | { |
4617 | avox | 375 | if ((item->lineWidth() == 0) && !item->asLine()) |
4360 | cbradney | 376 | painter->setLineWidth(0); |
377 | else |
||
378 | { |
||
10227 | jghali | 379 | ScColorShade tmp(m_doc->PageColors[item->lineColor()], (int) item->lineShade()); |
4617 | avox | 380 | painter->setPen( tmp , item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin); |
4360 | cbradney | 381 | if (item->DashValues.count() != 0) |
382 | painter->setDash(item->DashValues, item->DashOffset); |
||
383 | } |
||
384 | } |
||
385 | else |
||
386 | painter->setLineWidth(0); |
||
387 | painter->setBrushOpacity(1.0 - item->fillTransparency()); |
||
388 | painter->setPenOpacity(1.0 - item->lineTransparency()); |
||
4480 | cbradney | 389 | painter->setFillRule(item->fillRule); |
4360 | cbradney | 390 | } |
391 | |||
11905 | jghali | 392 | void ScPageOutput::drawItem_Post( PageItem* item, ScPainterExBase* painter ) |
4360 | cbradney | 393 | { |
394 | bool doStroke=true; |
||
395 | if ( item->itemType() == PageItem::PathText || item->itemType() == PageItem::PolyLine || item->itemType() == PageItem::Line ) |
||
396 | doStroke=false; |
||
397 | if ((doStroke)) |
||
398 | { |
||
4546 | subik | 399 | if (item->lineColor() != CommonStrings::None) |
4360 | cbradney | 400 | { |
10227 | jghali | 401 | ScColorShade tmp(m_doc->PageColors[item->lineColor()], (int) item->lineShade()); |
4617 | avox | 402 | painter->setPen(tmp, item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin); |
4360 | cbradney | 403 | if (item->DashValues.count() != 0) |
404 | painter->setDash(item->DashValues, item->DashOffset); |
||
405 | } |
||
406 | else |
||
407 | painter->setLineWidth(0); |
||
408 | if (!item->isTableItem) |
||
409 | { |
||
410 | painter->setupPolygon(&item->PoLine); |
||
411 | if (item->NamedLStyle.isEmpty()) |
||
412 | painter->strokePath(); |
||
413 | else |
||
414 | { |
||
415 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
416 | for (int it = ml.size()-1; it > -1; it--) |
||
417 | { |
||
7143 | jghali | 418 | const SingleLine& sl = ml[it]; |
419 | if ((sl.Color != CommonStrings::None) && (sl.Width != 0)) |
||
420 | { |
||
421 | ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade); |
||
422 | painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash), |
||
423 | static_cast<Qt::PenCapStyle>(sl.LineEnd), |
||
424 | static_cast<Qt::PenJoinStyle>(sl.LineJoin)); |
||
425 | painter->strokePath(); |
||
426 | } |
||
4360 | cbradney | 427 | } |
428 | } |
||
429 | } |
||
430 | } |
||
8177 | avox | 431 | // item->Tinput = false; |
4360 | cbradney | 432 | painter->restore(); |
433 | } |
||
434 | |||
11905 | jghali | 435 | void ScPageOutput::drawGlyphs(PageItem* item, ScPainterExBase *painter, const CharStyle& style, GlyphLayout& glyphs, const QRect& clip) |
4360 | cbradney | 436 | { |
6824 | jghali | 437 | uint glyph = glyphs.glyph; |
8728 | jghali | 438 | if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBSPACE.unicode())) // NBSPACE |
6824 | jghali | 439 | glyph = style.font().char2CMap(QChar(' ')); |
8728 | jghali | 440 | else if (glyph == (ScFace::CONTROL_GLYPHS + SpecialChars::NBHYPHEN.unicode())) // NBHYPHEN |
6824 | jghali | 441 | glyph = style.font().char2CMap(QChar('-')); |
442 | |||
443 | if (glyph >= ScFace::CONTROL_GLYPHS) |
||
8728 | jghali | 444 | { |
445 | if (glyphs.more) |
||
446 | { |
||
447 | painter->translate(glyphs.xadvance, 0); |
||
11905 | jghali | 448 | drawGlyphs(item, painter, style, *glyphs.more, clip); |
8728 | jghali | 449 | } |
4360 | cbradney | 450 | return; |
8728 | jghali | 451 | } |
5988 | jghali | 452 | |
6824 | jghali | 453 | //if (style.font().canRender(QChar(glyph))) |
4360 | cbradney | 454 | { |
13951 | fschmid | 455 | QTransform chma, chma2, chma3, chma4, chma5, chma6; |
5988 | jghali | 456 | chma.scale(glyphs.scaleH * style.fontSize() / 100.00, glyphs.scaleV * style.fontSize() / 100.0); |
6824 | jghali | 457 | FPointArray gly = style.font().glyphOutline(glyph); |
5988 | jghali | 458 | // Do underlining first so you can get typographically correct |
459 | // underlines when drawing a white outline |
||
6824 | jghali | 460 | if ((style.effects() & ScStyle_Underline) || ((style.effects() & ScStyle_UnderlineWords) && (glyph != style.font().char2CMap(QChar(' '))))) |
5988 | jghali | 461 | { |
462 | double st, lw; |
||
6824 | jghali | 463 | if ((style.underlineOffset() != -1) || (style.underlineWidth() != -1)) |
5988 | jghali | 464 | { |
6824 | jghali | 465 | if (style.underlineOffset() != -1) |
466 | st = (style.underlineOffset() / 1000.0) * (style.font().descent(style.fontSize() / 10.0)); |
||
5988 | jghali | 467 | else |
468 | st = style.font().underlinePos(style.fontSize() / 10.0); |
||
469 | if (style.underlineWidth() != -1) |
||
470 | lw = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0); |
||
471 | else |
||
8578 | jghali | 472 | lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0); |
5988 | jghali | 473 | } |
474 | else |
||
475 | { |
||
476 | st = style.font().underlinePos(style.fontSize() / 10.0); |
||
8578 | jghali | 477 | lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0); |
5988 | jghali | 478 | } |
479 | if (style.baselineOffset() != 0) |
||
480 | st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0); |
||
6824 | jghali | 481 | ScColorShade tmpPen = painter->pen(); |
5988 | jghali | 482 | painter->setPen(painter->brush()); |
483 | painter->setLineWidth(lw); |
||
8728 | jghali | 484 | if (style.effects() & ScStyle_Subscript) |
485 | painter->drawLine(FPoint(glyphs.xoffset, glyphs.yoffset - st), FPoint(glyphs.xoffset + glyphs.xadvance, glyphs.yoffset - st)); |
||
486 | else |
||
487 | painter->drawLine(FPoint(glyphs.xoffset, -st), FPoint(glyphs.xoffset + glyphs.xadvance, -st)); |
||
6824 | jghali | 488 | painter->setPen(tmpPen); |
5988 | jghali | 489 | } |
4360 | cbradney | 490 | if (gly.size() > 3) |
491 | { |
||
8728 | jghali | 492 | painter->save(); |
493 | painter->translate(glyphs.xoffset, glyphs.yoffset - ((style.fontSize() / 10.0) * glyphs.scaleV)); |
||
4360 | cbradney | 494 | if (item->reversed()) |
495 | { |
||
8728 | jghali | 496 | painter->scale(-1, 1); |
497 | painter->translate(-glyphs.xadvance, 0); |
||
4360 | cbradney | 498 | } |
5988 | jghali | 499 | if (style.baselineOffset() != 0) |
8728 | jghali | 500 | painter->translate(0, -(style.fontSize() / 10.0) * (style.baselineOffset() / 1000.0)); |
501 | double glxSc = glyphs.scaleH * style.fontSize() / 100.00; |
||
502 | double glySc = glyphs.scaleV * style.fontSize() / 100.0; |
||
503 | painter->scale(glxSc, glySc); |
||
6987 | jghali | 504 | painter->setFillMode(ScPainterExBase::Solid); |
4360 | cbradney | 505 | bool fr = painter->fillRule(); |
506 | painter->setFillRule(false); |
||
11869 | jghali | 507 | painter->setupPolygon(&gly, true); |
8728 | jghali | 508 | if (glyph == 0) |
5988 | jghali | 509 | { |
13974 | cbradney | 510 | ScColorShade tmp(PrefsManager::instance()->appPrefs.displayPrefs.controlCharColor, 100); |
8728 | jghali | 511 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
512 | painter->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() * 2 / 10000.0); |
||
513 | painter->strokePath(); |
||
514 | } |
||
515 | else if ((style.font().isStroked()) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0)) |
||
516 | { |
||
5988 | jghali | 517 | ScColorShade tmp = painter->brush(); |
518 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
519 | painter->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0); |
||
520 | painter->strokePath(); |
||
521 | } |
||
4360 | cbradney | 522 | else |
523 | { |
||
5988 | jghali | 524 | if ((style.effects() & ScStyle_Shadowed) && (style.strokeColor() != CommonStrings::None)) |
4360 | cbradney | 525 | { |
526 | painter->save(); |
||
8728 | jghali | 527 | painter->translate((style.fontSize() * glyphs.scaleH * style.shadowXOffset() / 10000.0) / glxSc, -(style.fontSize() * glyphs.scaleV * style.shadowYOffset() / 10000.0) / glySc); |
4360 | cbradney | 528 | ScColorShade tmp = painter->brush(); |
529 | painter->setBrush(painter->pen()); |
||
11869 | jghali | 530 | painter->setupPolygon(&gly, true); |
11905 | jghali | 531 | fillPath(item, painter, clip); |
4360 | cbradney | 532 | painter->setBrush(tmp); |
533 | painter->restore(); |
||
11869 | jghali | 534 | painter->setupPolygon(&gly, true); |
4360 | cbradney | 535 | } |
5988 | jghali | 536 | if (style.fillColor() != CommonStrings::None) |
11905 | jghali | 537 | fillPath(item, painter, clip); |
5988 | jghali | 538 | if ((style.effects() & ScStyle_Outline) && (style.strokeColor() != CommonStrings::None) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0)) |
4360 | cbradney | 539 | { |
8728 | jghali | 540 | painter->setLineWidth((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) / glySc); |
4360 | cbradney | 541 | painter->strokePath(); |
542 | } |
||
543 | } |
||
544 | painter->setFillRule(fr); |
||
8728 | jghali | 545 | painter->restore(); |
4360 | cbradney | 546 | } |
5988 | jghali | 547 | if (style.effects() & ScStyle_Strikethrough) |
4360 | cbradney | 548 | { |
549 | double st, lw; |
||
5988 | jghali | 550 | if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1)) |
4360 | cbradney | 551 | { |
5988 | jghali | 552 | if (style.strikethruOffset() != -1) |
553 | st = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0)); |
||
4360 | cbradney | 554 | else |
5988 | jghali | 555 | st = style.font().strikeoutPos(style.fontSize() / 10.0); |
556 | if (style.strikethruWidth() != -1) |
||
557 | lw = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0); |
||
4360 | cbradney | 558 | else |
8578 | jghali | 559 | lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0); |
4360 | cbradney | 560 | } |
561 | else |
||
562 | { |
||
5988 | jghali | 563 | st = style.font().strikeoutPos(style.fontSize() / 10.0); |
8578 | jghali | 564 | lw = qMax(style.font().strokeWidth(style.fontSize() / 10.0), 1.0); |
4360 | cbradney | 565 | } |
5988 | jghali | 566 | if (style.baselineOffset() != 0) |
567 | st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0); |
||
4360 | cbradney | 568 | painter->setPen(painter->brush()); |
569 | painter->setLineWidth(lw); |
||
5988 | jghali | 570 | painter->drawLine(FPoint(glyphs.xoffset, glyphs.yoffset - st), FPoint(glyphs.xoffset + glyphs.xadvance, glyphs.yoffset - st)); |
4360 | cbradney | 571 | } |
572 | } |
||
6824 | jghali | 573 | /*else |
4360 | cbradney | 574 | { |
575 | painter->setLineWidth(1); |
||
5988 | jghali | 576 | painter->setPen(ScColorShade(Qt::red, 100)); |
577 | painter->setBrush(ScColorShade(Qt::red, 100)); |
||
4360 | cbradney | 578 | painter->setFillMode(1); |
5988 | jghali | 579 | painter->drawRect(glyphs.xoffset, glyphs.yoffset - (style.fontSize() / 10.0) * glyphs.scaleV , (style.fontSize() / 10.0) * glyphs.scaleH, (style.fontSize() / 10.0) * glyphs.scaleV); |
6824 | jghali | 580 | }*/ |
5988 | jghali | 581 | if (glyphs.more) |
6824 | jghali | 582 | { |
6987 | jghali | 583 | painter->translate(glyphs.xadvance, 0); |
11905 | jghali | 584 | drawGlyphs(item, painter, style, *glyphs.more, clip); |
6824 | jghali | 585 | } |
4360 | cbradney | 586 | } |
587 | |||
11905 | jghali | 588 | void ScPageOutput::drawItem_Embedded( PageItem* item, ScPainterExBase *p, const QRect& clip, const CharStyle& style, PageItem* cembedded) |
4360 | cbradney | 589 | { |
8728 | jghali | 590 | if (!cembedded) |
591 | return; |
||
9856 | fschmid | 592 | QList<PageItem*> emG; |
8728 | jghali | 593 | emG.append(cembedded); |
9856 | fschmid | 594 | for (int em = 0; em < emG.count(); ++em) |
8728 | jghali | 595 | { |
596 | PageItem* embedded = emG.at(em); |
||
12302 | jghali | 597 | p->save(); |
598 | double x = embedded->xPos(); |
||
599 | double y = embedded->yPos(); |
||
600 | embedded->setXPos( embedded->gXpos, true ); |
||
601 | embedded->setYPos((embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos, true ); |
||
602 | p->translate((embedded->gXpos * (style.scaleH() / 1000.0)), ( - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos * (style.scaleV() / 1000.0))); |
||
603 | if (style.baselineOffset() != 0) |
||
604 | { |
||
605 | p->translate(0, -embedded->gHeight * (style.baselineOffset() / 1000.0)); |
||
606 | embedded->setYPos( embedded->yPos() - embedded->gHeight * (style.baselineOffset() / 1000.0) ); |
||
607 | } |
||
608 | p->scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
||
8728 | jghali | 609 | double pws = embedded->m_lineWidth; |
11905 | jghali | 610 | drawItem_Pre(embedded, p); |
8728 | jghali | 611 | switch(embedded->itemType()) |
612 | { |
||
613 | case PageItem::ImageFrame: |
||
10321 | mrdocs | 614 | case PageItem::LatexFrame: |
8728 | jghali | 615 | case PageItem::TextFrame: |
616 | case PageItem::Polygon: |
||
617 | case PageItem::PathText: |
||
16105 | fschmid | 618 | case PageItem::Symbol: |
619 | case PageItem::Group: |
||
16191 | fschmid | 620 | case PageItem::RegularPolygon: |
16215 | fschmid | 621 | case PageItem::Arc: |
11905 | jghali | 622 | drawItem(embedded, p, clip); |
8728 | jghali | 623 | break; |
624 | case PageItem::Line: |
||
625 | case PageItem::PolyLine: |
||
626 | embedded->m_lineWidth = pws * qMin(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
||
11905 | jghali | 627 | drawItem(embedded, p, clip); |
8728 | jghali | 628 | break; |
629 | default: |
||
630 | break; |
||
631 | } |
||
632 | embedded->m_lineWidth = pws * qMin(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
||
11905 | jghali | 633 | drawItem_Post(embedded, p); |
12302 | jghali | 634 | embedded->setXPos(x, true); |
635 | embedded->setYPos(y, true); |
||
8728 | jghali | 636 | p->restore(); |
637 | embedded->m_lineWidth = pws; |
||
4360 | cbradney | 638 | } |
12302 | jghali | 639 | for (int em = 0; em < emG.count(); ++em) |
640 | { |
||
641 | PageItem* embedded = emG.at(em); |
||
642 | if (!embedded->isTableItem) |
||
643 | continue; |
||
644 | p->save(); |
||
645 | double x = embedded->xPos(); |
||
646 | double y = embedded->yPos(); |
||
647 | embedded->setXPos(embedded->gXpos, true); |
||
648 | embedded->setYPos ((embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos, true); |
||
649 | p->translate((embedded->gXpos * (style.scaleH() / 1000.0)), ( - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos * (style.scaleV() / 1000.0))); |
||
650 | if (style.baselineOffset() != 0) |
||
651 | { |
||
652 | p->translate(0, -embedded->gHeight * (style.baselineOffset() / 1000.0)); |
||
653 | embedded->setYPos(embedded->yPos() - embedded->gHeight * (style.baselineOffset() / 1000.0)); |
||
654 | } |
||
655 | p->scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
||
656 | p->rotate(embedded->rotation()); |
||
657 | double pws = embedded->m_lineWidth; |
||
658 | embedded->m_lineWidth = pws * qMin(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
||
659 | if ((embedded->lineColor() != CommonStrings::None) && (embedded->lineWidth() != 0.0)) |
||
660 | { |
||
661 | ScColorShade colorShade(m_doc->PageColors[embedded->lineColor()], embedded->lineShade()); |
||
662 | if ((embedded->TopLine) || (embedded->RightLine) || (embedded->BottomLine) || (embedded->LeftLine)) |
||
663 | { |
||
664 | p->setPen(colorShade, embedded->lineWidth(), embedded->PLineArt, Qt::SquareCap, embedded->PLineJoin); |
||
665 | if (embedded->TopLine) |
||
666 | p->drawLine(FPoint(0.0, 0.0), FPoint(embedded->width(), 0.0)); |
||
667 | if (embedded->RightLine) |
||
668 | p->drawLine(FPoint(embedded->width(), 0.0), FPoint(embedded->width(), embedded->height())); |
||
669 | if (embedded->BottomLine) |
||
670 | p->drawLine(FPoint(embedded->width(), embedded->height()), FPoint(0.0, embedded->height())); |
||
671 | if (embedded->LeftLine) |
||
672 | p->drawLine(FPoint(0.0, embedded->height()), FPoint(0.0, 0.0)); |
||
673 | } |
||
674 | } |
||
675 | embedded->m_lineWidth = pws; |
||
676 | embedded->setXPos(x, true); |
||
677 | embedded->setYPos(y, true); |
||
678 | p->restore(); |
||
679 | } |
||
4360 | cbradney | 680 | } |
681 | |||
11905 | jghali | 682 | void ScPageOutput::drawPattern( PageItem* item, ScPainterExBase* painter, const QRect& clip) |
4360 | cbradney | 683 | { |
6987 | jghali | 684 | double x1, x2, y1, y2; |
685 | ScPattern& pattern = m_doc->docPatterns[item->pattern()]; |
||
14260 | fschmid | 686 | double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY; |
687 | item->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY); |
||
6987 | jghali | 688 | |
689 | // Compute pattern tansformation matrix and its inverse for converting pattern coordinates |
||
690 | // to pageitem coordinates |
||
13951 | fschmid | 691 | QTransform matrix, invMat; |
6987 | jghali | 692 | matrix.translate(patternOffsetX, patternOffsetY); |
693 | matrix.rotate(patternRotation); |
||
14260 | fschmid | 694 | matrix.shear(patternSkewX, patternSkewY); |
6987 | jghali | 695 | matrix.scale(pattern.scaleX, pattern.scaleY); |
696 | matrix.scale(patternScaleX / 100.0 , patternScaleY / 100.0); |
||
697 | invMat.scale((patternScaleX != 0) ? (100 /patternScaleX) : 1.0, (patternScaleY != 0) ? (100 /patternScaleY) : 1.0); |
||
698 | invMat.scale((pattern.scaleX != 0) ? (1 /pattern.scaleX) : 1.0, (pattern.scaleY != 0) ? (1 /pattern.scaleY) : 1.0); |
||
699 | invMat.rotate(-patternRotation); |
||
700 | invMat.translate(-patternOffsetX, -patternOffsetY); |
||
701 | |||
702 | // Compute bounding box in which pattern item will be drawn |
||
703 | double width = item->width(); |
||
704 | double height = item->height(); |
||
705 | double rot = patternRotation - floor(patternRotation / 90) * 90; |
||
706 | double ctheta = cos(rot * M_PI / 180); |
||
707 | double stheta = sin(rot * M_PI / 180); |
||
10227 | jghali | 708 | QRectF itemRect(0.0, 0.0, item->width(), item->height()); |
709 | QPointF pa( width * stheta * stheta, -width * stheta * ctheta ); |
||
710 | QPointF pb( width + height * ctheta * stheta, height * stheta * stheta ); |
||
711 | QPointF pc( -height * ctheta * stheta, height * ctheta * ctheta ); |
||
712 | QPointF pd( width * ctheta * ctheta, height + width * ctheta * stheta ); |
||
713 | QPointF ipa = invMat.map(pa), ipb = invMat.map(pb); |
||
714 | QPointF ipc = invMat.map(pc), ipd = invMat.map(pd); |
||
6987 | jghali | 715 | |
716 | painter->save(); |
||
717 | if (item->imageClip.size() != 0) |
||
718 | { |
||
719 | painter->setupPolygon(&item->imageClip); |
||
720 | painter->setClipPath(); |
||
721 | } |
||
722 | painter->setupPolygon(&item->PoLine); |
||
723 | painter->setClipPath(); |
||
9859 | jghali | 724 | for (int index = 0; index < pattern.items.count(); index++) |
6987 | jghali | 725 | { |
10227 | jghali | 726 | QRectF itRect; |
6987 | jghali | 727 | PageItem* it = pattern.items.at(index); |
728 | |||
729 | painter->save(); |
||
730 | painter->translate(patternOffsetX, patternOffsetY); |
||
731 | painter->rotate(patternRotation); |
||
732 | painter->scale(pattern.scaleX, pattern.scaleY); |
||
733 | painter->scale(patternScaleX / 100.0, patternScaleY / 100.0); |
||
734 | |||
735 | double patWidth = (pattern.width != 0.0) ? pattern.width : 1.0; |
||
736 | double patHeight = (pattern.height != 0.0) ? pattern.height : 1.0; |
||
737 | double kxa = (ipa.x() - it->gXpos) / patWidth; |
||
738 | double kxb = (ipb.x() - it->gXpos) / patWidth; |
||
739 | double kxc = (ipc.x() - it->gXpos) / patWidth; |
||
740 | double kxd = (ipd.x() - it->gXpos) / patWidth; |
||
741 | double kya = (ipa.y() - it->gYpos) / patHeight; |
||
742 | double kyb = (ipb.y() - it->gYpos) / patHeight; |
||
743 | double kyc = (ipc.y() - it->gYpos) / patHeight; |
||
744 | double kyd = (ipd.y() - it->gYpos) / patHeight; |
||
10227 | jghali | 745 | int kxMin = (int) floor( qMin(qMin(kxa, kxb), qMin(kxc, kxd)) ); |
746 | int kxMax = (int) ceil ( qMax(qMax(kxa, kxb), qMax(kxc, kxd)) ); |
||
747 | int kyMin = (int) floor( qMin(qMin(kya, kyb), qMin(kyc, kyd)) ); |
||
748 | int kyMax = (int) ceil ( qMax(qMax(kya, kyb), qMax(kyc, kyd)) ); |
||
6987 | jghali | 749 | |
750 | double itx = it->xPos(); |
||
751 | double ity = it->yPos(); |
||
752 | double itPosX = it->gXpos, itPosY = it->gYpos; |
||
753 | for ( int kx = kxMin; kx <= kxMax; kx++ ) |
||
754 | { |
||
755 | for ( int ky = kyMin; ky <= kyMax; ky++ ) |
||
756 | { |
||
757 | itPosX = it->gXpos + kx * pattern.width; |
||
758 | itPosY = it->gYpos + ky * pattern.height; |
||
759 | it->setXYPos(itPosX, itPosY); |
||
760 | it->getBoundingRect(&x1, &y1, &x2, &y2); |
||
761 | itRect.setCoords(x1, y1, x2, y2); |
||
762 | itRect = matrix.mapRect( itRect ); |
||
763 | if ( itRect.intersects(itemRect) ) |
||
11905 | jghali | 764 | drawItem(it, painter, clip); |
6987 | jghali | 765 | } |
766 | } |
||
767 | it->setXYPos(itx, ity); |
||
768 | painter->restore(); |
||
769 | } |
||
770 | painter->restore(); |
||
771 | } |
||
772 | |||
11905 | jghali | 773 | void ScPageOutput::drawItem_ImageFrame( PageItem_ImageFrame* item, ScPainterExBase* painter, const QRect& clip ) |
6987 | jghali | 774 | { |
4989 | cbradney | 775 | ScPainterExBase::ImageMode mode = ScPainterExBase::rgbImages; |
4546 | subik | 776 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
4360 | cbradney | 777 | { |
778 | painter->setupPolygon(&item->PoLine); |
||
11905 | jghali | 779 | fillPath(item, painter, clip); |
4360 | cbradney | 780 | } |
781 | if (item->Pfile.isEmpty()) |
||
782 | { |
||
9849 | jghali | 783 | /*painter->setPen( ScColorShade(Qt::black, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
6987 | jghali | 784 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height())); |
9849 | jghali | 785 | painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0));*/ |
4360 | cbradney | 786 | } |
787 | else |
||
788 | { |
||
13097 | subik | 789 | if ((!item->imageShown()) || (!item->PictureIsAvailable)) |
4360 | cbradney | 790 | { |
9849 | jghali | 791 | /*painter->setPen( ScColorShade(Qt::red, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
6987 | jghali | 792 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height())); |
9849 | jghali | 793 | painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0));*/ |
4360 | cbradney | 794 | } |
795 | else |
||
796 | { |
||
797 | ScImage scImg; |
||
798 | ScImage* pImage = NULL; |
||
799 | double imScaleX = item->imageXScale(); |
||
800 | double imScaleY = item->imageYScale(); |
||
801 | if( m_reloadImages ) |
||
802 | { |
||
803 | bool dummy; |
||
4617 | avox | 804 | bool useCmyk = false; |
4751 | cbradney | 805 | ScPainterExBase::ImageMode imageMode = painter->imageMode(); |
806 | if ( imageMode == ScPainterExBase::cmykImages ) |
||
4617 | avox | 807 | useCmyk = true; |
4360 | cbradney | 808 | QFileInfo fInfo(item->Pfile); |
10508 | cbradney | 809 | QString ext = fInfo.suffix(); |
5959 | jghali | 810 | CMSettings cmsSettings(item->doc(), item->IProfile, item->IRender); |
14467 | jghali | 811 | cmsSettings.allowColorManagement(m_useProfiles); |
812 | cmsSettings.setUseEmbeddedProfile(item->UseEmbedded); |
||
4360 | cbradney | 813 | scImg.imgInfo.valid = false; |
814 | scImg.imgInfo.clipPath = ""; |
||
815 | scImg.imgInfo.PDSpathData.clear(); |
||
816 | scImg.imgInfo.layerInfo.clear(); |
||
817 | scImg.imgInfo.RequestProps = item->pixm.imgInfo.RequestProps; |
||
818 | scImg.imgInfo.isRequest = item->pixm.imgInfo.isRequest; |
||
14467 | jghali | 819 | scImg.loadPicture(item->Pfile, item->pixm.imgInfo.actualPageNumber, cmsSettings, translateImageModeToRequest(imageMode), m_imageRes, &dummy); |
10136 | cbradney | 820 | if( extensionIndicatesEPSorPS(ext) || extensionIndicatesPDF(ext) ) |
4360 | cbradney | 821 | { |
822 | imScaleX *= (72.0 / (double) m_imageRes); |
||
823 | imScaleY *= (72.0 / (double) m_imageRes); |
||
824 | } |
||
4617 | avox | 825 | scImg.applyEffect(item->effectsInUse, m_doc->PageColors, useCmyk); |
4989 | cbradney | 826 | mode = imageMode; |
4360 | cbradney | 827 | pImage = &scImg; |
828 | } |
||
829 | else |
||
830 | pImage = &item->pixm; |
||
831 | |||
832 | painter->save(); |
||
833 | if (item->imageClip.size() != 0) |
||
4751 | cbradney | 834 | { |
4360 | cbradney | 835 | painter->setupPolygon(&item->imageClip); |
4751 | cbradney | 836 | painter->setClipPath(); |
837 | } |
||
838 | painter->setupPolygon(&item->PoLine); |
||
4360 | cbradney | 839 | painter->setClipPath(); |
840 | if (item->imageFlippedH()) |
||
841 | { |
||
6987 | jghali | 842 | painter->translate(item->width(), 0); |
4360 | cbradney | 843 | painter->scale(-1, 1); |
844 | } |
||
845 | if (item->imageFlippedV()) |
||
846 | { |
||
6987 | jghali | 847 | painter->translate(0, item->height()); |
4360 | cbradney | 848 | painter->scale(1, -1); |
849 | } |
||
6987 | jghali | 850 | painter->translate(item->imageXOffset() * item->imageXScale(), item->imageYOffset() * item->imageYScale()); |
4360 | cbradney | 851 | //painter->translate(item->LocalX * imScaleX * scale, item->LocalY * imScaleY * scale); ?? |
852 | painter->scale( imScaleX, imScaleY ); |
||
853 | if (pImage->imgInfo.lowResType != 0) |
||
854 | painter->scale(pImage->imgInfo.lowResScale, pImage->imgInfo.lowResScale); |
||
4989 | cbradney | 855 | painter->drawImage(pImage, mode); |
4360 | cbradney | 856 | painter->restore(); |
857 | } |
||
858 | } |
||
859 | } |
||
860 | |||
11905 | jghali | 861 | void ScPageOutput::drawItem_Line( PageItem_Line* item, ScPainterExBase* painter, const QRect& clip ) |
4360 | cbradney | 862 | { |
13310 | jghali | 863 | int startArrowIndex = item->startArrowIndex(); |
864 | int endArrowIndex = item->endArrowIndex(); |
||
4546 | subik | 865 | |
4360 | cbradney | 866 | if (item->NamedLStyle.isEmpty()) |
867 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
868 | else |
||
869 | { |
||
870 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
871 | for (int it = ml.size()-1; it > -1; it--) |
||
872 | { |
||
7143 | jghali | 873 | const SingleLine& sl = ml[it]; |
13303 | jghali | 874 | if (sl.Color != CommonStrings::None) |
7143 | jghali | 875 | { |
876 | ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade); |
||
877 | painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash), |
||
878 | static_cast<Qt::PenCapStyle>(sl.LineEnd), |
||
879 | static_cast<Qt::PenJoinStyle>(sl.LineJoin)); |
||
880 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
881 | } |
||
4360 | cbradney | 882 | } |
883 | } |
||
884 | if (startArrowIndex != 0) |
||
885 | { |
||
13951 | fschmid | 886 | QTransform arrowTrans; |
13303 | jghali | 887 | arrowTrans.translate(0, 0); |
888 | arrowTrans.scale(-1,1); |
||
13310 | jghali | 889 | drawArrow(painter, item, arrowTrans, startArrowIndex); |
4360 | cbradney | 890 | } |
891 | if (endArrowIndex != 0) |
||
892 | { |
||
13951 | fschmid | 893 | QTransform arrowTrans; |
13303 | jghali | 894 | arrowTrans.translate(item->width(), 0); |
13310 | jghali | 895 | drawArrow(painter, item, arrowTrans, endArrowIndex); |
4360 | cbradney | 896 | } |
897 | } |
||
898 | |||
11905 | jghali | 899 | void ScPageOutput::drawItem_PathText( PageItem_PathText* item, ScPainterExBase* painter, const QRect& clip ) |
4360 | cbradney | 900 | { |
5721 | avox | 901 | QString chstr, chstr2, chstr3; |
4689 | mrdocs | 902 | ScText *hl; |
4360 | cbradney | 903 | FPoint point = FPoint(0, 0); |
904 | FPoint tangent = FPoint(0, 0); |
||
905 | uint seg = 0; |
||
10992 | jghali | 906 | double chs, dx, segLen = 0; |
4360 | cbradney | 907 | double CurX = item->textToFrameDistLeft(); // item->CurX = item->textToFrameDistLeft() |
908 | double CurY = 0; |
||
10992 | jghali | 909 | QString actFill, actStroke; |
910 | double actFillShade, actStrokeShade; |
||
911 | StoryText& itemText = item->itemText; |
||
12217 | jghali | 912 | if (item->pathTextShowFrame()) |
4360 | cbradney | 913 | { |
12996 | jghali | 914 | painter->setupPolygon(&item->PoLine, false); |
915 | if (item->NamedLStyle.isEmpty()) |
||
7143 | jghali | 916 | { |
12996 | jghali | 917 | if (item->lineColor() != CommonStrings::None) |
918 | painter->strokePath(); |
||
12217 | jghali | 919 | } |
920 | else |
||
921 | { |
||
922 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
923 | for (int it = ml.size() - 1; it > -1; it--) |
||
7143 | jghali | 924 | { |
12217 | jghali | 925 | const SingleLine& sl = ml[it]; |
926 | if ((sl.Color != CommonStrings::None) && (sl.Width != 0)) |
||
927 | { |
||
928 | ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade); |
||
929 | painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash), |
||
930 | static_cast<Qt::PenCapStyle>(sl.LineEnd), |
||
931 | static_cast<Qt::PenJoinStyle>(sl.LineJoin)); |
||
932 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
933 | } |
||
7143 | jghali | 934 | } |
935 | } |
||
936 | } |
||
10992 | jghali | 937 | double totalTextLen = 0.0; |
938 | double totalCurveLen = 0.0; |
||
939 | double extraOffset = 0.0; |
||
940 | if (itemText.length() != 0) |
||
941 | { |
||
942 | CurX += itemText.item(0)->fontSize() * itemText.charStyle(0).tracking() / 10000.0; |
||
943 | totalTextLen += itemText.charStyle(0).fontSize() * itemText.charStyle(0).tracking() / 10000.0; |
||
944 | } |
||
4360 | cbradney | 945 | segLen = item->PoLine.lenPathSeg(seg); |
10992 | jghali | 946 | for (int a = 0; a < itemText.length(); ++a) |
4360 | cbradney | 947 | { |
10992 | jghali | 948 | hl = itemText.item(a); |
5721 | avox | 949 | chstr = hl->ch; |
11713 | fschmid | 950 | if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT |
8089 | jghali | 951 | || chstr[0] == SpecialChars::TAB || chstr == SpecialChars::LINEBREAK) |
4360 | cbradney | 952 | continue; |
10992 | jghali | 953 | if (a < itemText.length()-1) |
954 | chstr += itemText.text(a+1, 1); |
||
8089 | jghali | 955 | hl->glyph.yadvance = 0; |
10992 | jghali | 956 | item->layoutGlyphs(itemText.charStyle(a), chstr, hl->glyph); |
8089 | jghali | 957 | hl->glyph.shrink(); |
16602 | jghali | 958 | if (hl->hasObject()) |
13251 | jghali | 959 | totalTextLen += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH; |
10992 | jghali | 960 | else |
961 | totalTextLen += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0; |
||
962 | } |
||
963 | for (uint segs = 0; segs < item->PoLine.size()-3; segs += 4) |
||
964 | { |
||
965 | totalCurveLen += item->PoLine.lenPathSeg(segs); |
||
966 | } |
||
967 | if ((itemText.defaultStyle().alignment() != 0) && (totalCurveLen >= totalTextLen + item->textToFrameDistLeft())) |
||
968 | { |
||
969 | if (itemText.defaultStyle().alignment() == 2) |
||
4360 | cbradney | 970 | { |
10992 | jghali | 971 | CurX = totalCurveLen - totalTextLen; |
972 | CurX -= item->textToFrameDistLeft(); |
||
4360 | cbradney | 973 | } |
10992 | jghali | 974 | if (itemText.defaultStyle().alignment() == 1) |
975 | CurX = (totalCurveLen - totalTextLen) / 2.0; |
||
976 | if ((itemText.defaultStyle().alignment() == 3) || (itemText.defaultStyle().alignment() == 4)) |
||
977 | extraOffset = (totalCurveLen - item->textToFrameDistLeft() - totalTextLen) / static_cast<double>(itemText.length()); |
||
978 | } |
||
979 | |||
980 | QPainterPath guidePath = item->PoLine.toQPainterPath(false); |
||
981 | QList<QPainterPath> pathList = decomposePath(guidePath); |
||
982 | QPainterPath currPath = pathList[0]; |
||
983 | int currPathIndex = 0; |
||
984 | for (int a = item->firstInFrame(); a < itemText.length(); ++a) |
||
985 | { |
||
986 | CurY = 0; |
||
987 | hl = itemText.item(a); |
||
988 | chstr = hl->ch; |
||
11750 | jghali | 989 | if (chstr[0] == SpecialChars::PAGENUMBER || chstr[0] == SpecialChars::PARSEP || chstr[0] == SpecialChars::PAGECOUNT |
10992 | jghali | 990 | || chstr[0] == SpecialChars::TAB || chstr[0] == SpecialChars::LINEBREAK) |
991 | continue; |
||
992 | chs = hl->fontSize(); |
||
993 | if (a < itemText.length()-1) |
||
994 | chstr += itemText.text(a+1, 1); |
||
995 | hl->glyph.yadvance = 0; |
||
996 | item->layoutGlyphs(itemText.charStyle(a), chstr, hl->glyph); |
||
997 | hl->glyph.shrink(); // HACK |
||
14443 | jghali | 998 | // Unneeded now that glyph xadvance is set appropriately for inline objects by PageItem_TextFrame::layout() - JG |
16602 | jghali | 999 | /*if (hl->hasObject()) |
13251 | jghali | 1000 | dx = (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH / 2.0; |
14443 | jghali | 1001 | else*/ |
1002 | dx = hl->glyph.wide() / 2.0; |
||
10992 | jghali | 1003 | |
1004 | CurX += dx; |
||
1005 | |||
1006 | double currPerc = currPath.percentAtLength(CurX); |
||
1007 | if (currPerc >= 0.9999999) |
||
4360 | cbradney | 1008 | { |
10992 | jghali | 1009 | currPathIndex++; |
1010 | if (currPathIndex == pathList.count()) |
||
4360 | cbradney | 1011 | break; |
10992 | jghali | 1012 | currPath = pathList[currPathIndex]; |
1013 | CurX = dx; |
||
1014 | currPerc = currPath.percentAtLength(CurX); |
||
4360 | cbradney | 1015 | } |
10992 | jghali | 1016 | double currAngle = currPath.angleAtPercent(currPerc); |
13251 | jghali | 1017 | if (currAngle <= 180.0) |
1018 | currAngle *= -1.0; |
||
1019 | else |
||
1020 | currAngle = 360.0 - currAngle; |
||
10992 | jghali | 1021 | QPointF currPoint = currPath.pointAtPercent(currPerc); |
1022 | tangent = FPoint(cos(currAngle * M_PI / 180.0), sin(currAngle * M_PI / 180.0)); |
||
1023 | point = FPoint(currPoint.x(), currPoint.y()); |
||
1024 | |||
1025 | hl->glyph.xoffset = 0; |
||
11750 | jghali | 1026 | hl->PtransX = point.x(); |
1027 | hl->PtransY = point.y(); |
||
1028 | hl->PRot = currAngle * M_PI / 180.0; |
||
1029 | hl->PDx = dx; |
||
13951 | fschmid | 1030 | QTransform trafo = QTransform( 1, 0, 0, -1, -dx, 0 ); |
8089 | jghali | 1031 | if (item->textPathFlipped) |
13951 | fschmid | 1032 | trafo *= QTransform(1, 0, 0, -1, 0, 0); |
8089 | jghali | 1033 | if (item->textPathType == 0) |
13951 | fschmid | 1034 | trafo *= QTransform( tangent.x(), tangent.y(), tangent.y(), -tangent.x(), point.x(), point.y() ); // ID's Rainbow mode |
8089 | jghali | 1035 | else if (item->textPathType == 1) |
13951 | fschmid | 1036 | trafo *= QTransform( 1, 0, 0, -1, point.x(), point.y() ); // ID's Stair Step mode |
8089 | jghali | 1037 | else if (item->textPathType == 2) |
1038 | { |
||
1039 | double a = 1; |
||
1040 | if (tangent.x() < 0) |
||
1041 | a = -1; |
||
1042 | if (fabs(tangent.x()) > 0.1) |
||
13951 | fschmid | 1043 | trafo *= QTransform( a, (tangent.y() / tangent.x()) * a, 0, -1, point.x(), point.y() ); // ID's Skew mode |
8089 | jghali | 1044 | else |
13951 | fschmid | 1045 | trafo *= QTransform( a, 4 * a, 0, -1, point.x(), point.y() ); |
8089 | jghali | 1046 | } |
13951 | fschmid | 1047 | QTransform sca = painter->worldMatrix(); |
4360 | cbradney | 1048 | trafo *= sca; |
1049 | painter->save(); |
||
13951 | fschmid | 1050 | QTransform savWM = painter->worldMatrix(); |
4360 | cbradney | 1051 | painter->setWorldMatrix(trafo); |
10992 | jghali | 1052 | |
1053 | actFill = itemText.charStyle(a).fillColor(); |
||
1054 | actFillShade = itemText.charStyle(a).fillShade(); |
||
1055 | if (actFill != CommonStrings::None) |
||
1056 | { |
||
11229 | fschmid | 1057 | ScColorShade tmp(m_doc->PageColors[actFill], qRound(actFillShade)); |
10992 | jghali | 1058 | painter->setBrush(tmp); |
1059 | } |
||
1060 | actStroke = itemText.charStyle(a).strokeColor(); |
||
1061 | actStrokeShade = itemText.charStyle(a).strokeShade(); |
||
1062 | if (actStroke != CommonStrings::None) |
||
1063 | { |
||
11229 | fschmid | 1064 | ScColorShade tmp(m_doc->PageColors[actStroke], qRound(actStrokeShade)); |
10992 | jghali | 1065 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
1066 | } |
||
13251 | jghali | 1067 | painter->translate(0.0, item->pathTextBaseOffset()); |
10992 | jghali | 1068 | if (hl->ch == SpecialChars::OBJECT) |
11905 | jghali | 1069 | drawItem_Embedded(hl->embedded.getItem(), painter, clip, itemText.charStyle(a), hl->embedded.getItem()); |
10992 | jghali | 1070 | else |
11905 | jghali | 1071 | drawGlyphs(item, painter, itemText.charStyle(a), hl->glyph, clip); |
10992 | jghali | 1072 | |
4360 | cbradney | 1073 | painter->setWorldMatrix(savWM); |
1074 | painter->restore(); |
||
1075 | CurX -= dx; |
||
16602 | jghali | 1076 | if (hl->hasObject()) |
13251 | jghali | 1077 | CurX += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()) * hl->glyph.scaleH; |
10992 | jghali | 1078 | else |
1079 | CurX += hl->glyph.wide()+hl->fontSize() * hl->tracking() / 10000.0 + extraOffset; |
||
4360 | cbradney | 1080 | } |
1081 | } |
||
1082 | |||
11905 | jghali | 1083 | void ScPageOutput::drawItem_Polygon ( PageItem_Polygon* item , ScPainterExBase* painter, const QRect& clip ) |
4360 | cbradney | 1084 | { |
1085 | painter->setupPolygon(&item->PoLine); |
||
11905 | jghali | 1086 | fillPath(item, painter, clip); |
4360 | cbradney | 1087 | } |
1088 | |||
11905 | jghali | 1089 | void ScPageOutput::drawItem_PolyLine( PageItem_PolyLine* item, ScPainterExBase* painter, const QRect& clip ) |
4360 | cbradney | 1090 | { |
13310 | jghali | 1091 | int startArrowIndex = item->startArrowIndex(); |
1092 | int endArrowIndex = item->endArrowIndex(); |
||
4546 | subik | 1093 | |
4360 | cbradney | 1094 | if (item->PoLine.size()>=4) |
1095 | { |
||
4546 | subik | 1096 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
4360 | cbradney | 1097 | { |
1098 | FPointArray cli; |
||
1099 | FPoint Start; |
||
1100 | bool firstp = true; |
||
1101 | for (uint n = 0; n < item->PoLine.size()-3; n += 4) |
||
1102 | { |
||
1103 | if (firstp) |
||
1104 | { |
||
1105 | Start = item->PoLine.point(n); |
||
1106 | firstp = false; |
||
1107 | } |
||
1108 | if (item->PoLine.point(n).x() > 900000) |
||
1109 | { |
||
1110 | cli.addPoint(item->PoLine.point(n-2)); |
||
1111 | cli.addPoint(item->PoLine.point(n-2)); |
||
1112 | cli.addPoint(Start); |
||
1113 | cli.addPoint(Start); |
||
1114 | cli.setMarker(); |
||
1115 | firstp = true; |
||
1116 | continue; |
||
1117 | } |
||
1118 | cli.addPoint(item->PoLine.point(n)); |
||
1119 | cli.addPoint(item->PoLine.point(n+1)); |
||
1120 | cli.addPoint(item->PoLine.point(n+2)); |
||
1121 | cli.addPoint(item->PoLine.point(n+3)); |
||
1122 | } |
||
1123 | if (cli.size() > 2) |
||
1124 | { |
||
1125 | FPoint l1 = cli.point(cli.size()-2); |
||
1126 | cli.addPoint(l1); |
||
1127 | cli.addPoint(l1); |
||
1128 | cli.addPoint(Start); |
||
1129 | cli.addPoint(Start); |
||
1130 | } |
||
1131 | painter->setupPolygon(&cli); |
||
11905 | jghali | 1132 | fillPath(item, painter, clip); |
4360 | cbradney | 1133 | } |
1134 | painter->setupPolygon(&item->PoLine, false); |
||
1135 | if (item->NamedLStyle.isEmpty()) |
||
13303 | jghali | 1136 | { |
1137 | if (item->lineColor() != CommonStrings::None) |
||
1138 | painter->strokePath(); |
||
1139 | } |
||
4360 | cbradney | 1140 | else |
1141 | { |
||
1142 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
1143 | for (int it = ml.size()-1; it > -1; it--) |
||
1144 | { |
||
7143 | jghali | 1145 | const SingleLine& sl = ml[it]; |
13303 | jghali | 1146 | if (sl.Color != CommonStrings::None) |
7143 | jghali | 1147 | { |
1148 | ScColorShade tmp(m_doc->PageColors[sl.Color], sl.Shade); |
||
1149 | painter->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash), |
||
1150 | static_cast<Qt::PenCapStyle>(sl.LineEnd), |
||
1151 | static_cast<Qt::PenJoinStyle>(sl.LineJoin)); |
||
1152 | painter->strokePath(); |
||
1153 | } |
||
4360 | cbradney | 1154 | } |
1155 | } |
||
1156 | if (startArrowIndex != 0) |
||
1157 | { |
||
1158 | FPoint Start = item->PoLine.point(0); |
||
1159 | for (uint xx = 1; xx < item->PoLine.size(); xx += 2) |
||
1160 | { |
||
1161 | FPoint Vector = item->PoLine.point(xx); |
||
1162 | if ((Start.x() != Vector.x()) || (Start.y() != Vector.y())) |
||
1163 | { |
||
1164 | double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI); |
||
13951 | fschmid | 1165 | QTransform arrowTrans; |
4360 | cbradney | 1166 | arrowTrans.translate(Start.x(), Start.y()); |
1167 | arrowTrans.rotate(r); |
||
13310 | jghali | 1168 | drawArrow(painter, item, arrowTrans, startArrowIndex); |
4360 | cbradney | 1169 | break; |
1170 | } |
||
1171 | } |
||
1172 | } |
||
1173 | if (endArrowIndex != 0) |
||
1174 | { |
||
1175 | FPoint End = item->PoLine.point(item->PoLine.size()-2); |
||
1176 | for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2) |
||
1177 | { |
||
1178 | FPoint Vector = item->PoLine.point(xx); |
||
1179 | if ((End.x() != Vector.x()) || (End.y() != Vector.y())) |
||
1180 | { |
||
1181 | double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI); |
||
13951 | fschmid | 1182 | QTransform arrowTrans; |
4360 | cbradney | 1183 | arrowTrans.translate(End.x(), End.y()); |
1184 | arrowTrans.rotate(r); |
||
13310 | jghali | 1185 | drawArrow(painter, item, arrowTrans, endArrowIndex); |
4360 | cbradney | 1186 | break; |
1187 | } |
||
1188 | } |
||
1189 | } |
||
1190 | } |
||
1191 | } |
||
1192 | |||
11905 | jghali | 1193 | void ScPageOutput::drawItem_TextFrame( PageItem_TextFrame* item, ScPainterExBase* painter, const QRect& clip ) |
4360 | cbradney | 1194 | { |
13951 | fschmid | 1195 | QTransform wm; |
5580 | jghali | 1196 | QPoint pt1, pt2; |
1197 | FPoint ColBound; |
||
1198 | QRegion cm; |
||
5753 | jghali | 1199 | int a; |
6824 | jghali | 1200 | double lineCorr; |
5721 | avox | 1201 | QString chstr, chstr2, chstr3; |
5580 | jghali | 1202 | ScText *hl; |
1203 | double desc, asce, tabDist; |
||
6824 | jghali | 1204 | |
1205 | QRect e2; |
||
5580 | jghali | 1206 | painter->save(); |
6824 | jghali | 1207 | if (item->isEmbedded) |
6987 | jghali | 1208 | e2 = clip; |
6824 | jghali | 1209 | else |
1210 | { |
||
6987 | jghali | 1211 | e2 = QRect(qRound(clip.x() + m_doc->minCanvasCoordinate.x()), qRound(clip.y() + m_doc->minCanvasCoordinate.y()), qRound(clip.width()), qRound(clip.height())); |
6824 | jghali | 1212 | wm.translate(item->xPos(), item->yPos()); |
1213 | } |
||
5580 | jghali | 1214 | wm.rotate(item->rotation()); |
1215 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
||
1216 | { |
||
1217 | painter->setupPolygon(&item->PoLine); |
||
11905 | jghali | 1218 | fillPath(item, painter, clip); |
5580 | jghali | 1219 | } |
1220 | if (item->lineColor() != CommonStrings::None) |
||
1221 | lineCorr = item->lineWidth() / 2.0; |
||
1222 | else |
||
1223 | lineCorr = 0; |
||
13097 | subik | 1224 | if ((item->isAnnotation()) && (item->annotation().Type() == 2) && (!item->Pfile.isEmpty()) && (item->PictureIsAvailable) && (item->imageShown()) && (item->annotation().UseIcons())) |
5580 | jghali | 1225 | { |
8728 | jghali | 1226 | painter->save(); |
5580 | jghali | 1227 | painter->setupPolygon(&item->PoLine); |
1228 | painter->setClipPath(); |
||
1229 | painter->scale(item->imageXScale(), item->imageYScale()); |
||
1230 | painter->translate(static_cast<int>(item->imageXOffset() * item->imageXScale()), static_cast<int>(item->imageYOffset() * item->imageYScale())); |
||
5599 | jghali | 1231 | if (!item->pixm.qImage().isNull()) |
5580 | jghali | 1232 | painter->drawImage(&item->pixm, ScPainterExBase::rgbImages); |
1233 | painter->restore(); |
||
1234 | } |
||
5729 | jghali | 1235 | if ((item->itemText.length() != 0)) |
5580 | jghali | 1236 | { |
1237 | if (item->imageFlippedH()) |
||
1238 | { |
||
6987 | jghali | 1239 | painter->translate(item->width(), 0); |
5580 | jghali | 1240 | painter->scale(-1, 1); |
1241 | } |
||
1242 | if (item->imageFlippedV()) |
||
1243 | { |
||
6987 | jghali | 1244 | painter->translate(0, item->height()); |
5580 | jghali | 1245 | painter->scale(1, -1); |
1246 | } |
||
8728 | jghali | 1247 | uint tabCc = 0; |
6824 | jghali | 1248 | for (uint ll=0; ll < item->itemText.lines(); ++ll) |
5580 | jghali | 1249 | { |
6824 | jghali | 1250 | LineSpec ls = item->itemText.line(ll); |
1251 | tabDist = ls.x; |
||
1252 | double CurX = ls.x; |
||
1253 | for (a = ls.firstItem; a <= ls.lastItem; ++a) |
||
4360 | cbradney | 1254 | { |
6824 | jghali | 1255 | hl = item->itemText.item(a); |
10227 | jghali | 1256 | const CharStyle& charStyle = item->itemText.charStyle(a); |
6824 | jghali | 1257 | double chs = charStyle.fontSize() * hl->glyph.scaleV; |
1258 | if (charStyle.effects() & ScStyle_StartOfLine) |
||
1259 | tabCc = 0; |
||
1260 | chstr = hl->ch; |
||
1261 | if (charStyle.fillColor() != CommonStrings::None) |
||
4360 | cbradney | 1262 | { |
10227 | jghali | 1263 | ScColorShade tmp(m_doc->PageColors[charStyle.fillColor()], (int) hl->fillShade()); |
6824 | jghali | 1264 | painter->setBrush(tmp); |
4360 | cbradney | 1265 | } |
6824 | jghali | 1266 | if (charStyle.strokeColor() != CommonStrings::None) |
4360 | cbradney | 1267 | { |
10227 | jghali | 1268 | ScColorShade tmp(m_doc->PageColors[charStyle.strokeColor()], (int) hl->strokeShade()); |
6824 | jghali | 1269 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
4360 | cbradney | 1270 | } |
6824 | jghali | 1271 | if (charStyle.effects() & ScStyle_DropCap) |
4360 | cbradney | 1272 | { |
8728 | jghali | 1273 | const ParagraphStyle& style(item->itemText.paragraphStyle(a)); |
1274 | if (style.lineSpacingMode() == ParagraphStyle::BaselineGridLineSpacing) |
||
14932 | cbradney | 1275 | chs = qRound(10 * ((m_doc->guidesPrefs().valueBaselineGrid * (style.dropCapLines()-1) + (charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10))); |
6824 | jghali | 1276 | else |
4360 | cbradney | 1277 | { |
6824 | jghali | 1278 | if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing) |
1279 | chs = qRound(10 * ((style.lineSpacing() * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10))); |
||
1280 | else |
||
1281 | { |
||
1282 | double currasce = charStyle.font().height(style.charStyle().fontSize() / 10.0); |
||
1283 | chs = qRound(10 * ((currasce * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10))); |
||
1284 | } |
||
4360 | cbradney | 1285 | } |
5580 | jghali | 1286 | } |
6824 | jghali | 1287 | if (chstr[0] == SpecialChars::TAB) |
1288 | tabCc++; |
||
1289 | //if (!m_doc->RePos) |
||
5580 | jghali | 1290 | { |
10227 | jghali | 1291 | //double xcoZli = CurX + hl->glyph.xoffset; |
6824 | jghali | 1292 | desc = - charStyle.font().descent(charStyle.fontSize() / 10.0); |
1293 | asce = charStyle.font().ascent(charStyle.fontSize() / 10.0); |
||
1294 | if (charStyle.strokeColor() != CommonStrings::None) |
||
1295 | { |
||
10227 | jghali | 1296 | ScColorShade tmp(m_doc->PageColors[charStyle.strokeColor()], (int) charStyle.strokeShade()); |
6824 | jghali | 1297 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
1298 | } |
||
1299 | if (e2.intersects(wm.mapRect(QRect(qRound(CurX + hl->glyph.xoffset),qRound(ls.y + hl->glyph.yoffset-asce), qRound(hl->glyph.xadvance+1), qRound(asce+desc))))) |
||
1300 | { |
||
1301 | painter->save(); |
||
6987 | jghali | 1302 | painter->translate(CurX, ls.y); |
9737 | jghali | 1303 | if (hl->ch == SpecialChars::OBJECT) |
11905 | jghali | 1304 | drawItem_Embedded(item, painter, clip, charStyle, hl->embedded.getItem()); |
6824 | jghali | 1305 | else |
11905 | jghali | 1306 | drawGlyphs(item, painter, charStyle, hl->glyph, clip); |
6824 | jghali | 1307 | painter->restore(); |
1308 | } |
||
14443 | jghali | 1309 | // Unneeded now that glyph xadvance is set appropriately for inline objects by PageItem_TextFrame::layout() - JG |
16602 | jghali | 1310 | /*if (hl->hasObject()) |
8728 | jghali | 1311 | CurX += (hl->embedded.getItem()->gWidth + hl->embedded.getItem()->lineWidth()); |
14443 | jghali | 1312 | else*/ |
1313 | CurX += hl->glyph.wide(); |
||
5580 | jghali | 1314 | } |
6824 | jghali | 1315 | tabDist = CurX; |
4360 | cbradney | 1316 | } |
1317 | } |
||
1318 | } |
||
5580 | jghali | 1319 | painter->restore(); |
4360 | cbradney | 1320 | } |
1321 | |||
13951 | fschmid | 1322 | void ScPageOutput::drawArrow(ScPainterExBase* painter, PageItem* item, QTransform &arrowTrans, int arrowIndex) |
13303 | jghali | 1323 | { |
14969 | cbradney | 1324 | FPointArray arrow = m_doc->arrowStyles().at(arrowIndex-1).points.copy(); |
13303 | jghali | 1325 | if (item->NamedLStyle.isEmpty()) |
1326 | { |
||
1327 | if (item->lineWidth() != 0.0) |
||
1328 | arrowTrans.scale(item->lineWidth(), item->lineWidth()); |
||
1329 | } |
||
1330 | else |
||
1331 | { |
||
1332 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
1333 | if (ml[ml.size()-1].Width != 0.0) |
||
1334 | arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width); |
||
1335 | } |
||
1336 | arrow.map(arrowTrans); |
||
1337 | painter->setupPolygon(&arrow); |
||
1338 | if (item->NamedLStyle.isEmpty()) |
||
1339 | { |
||
13310 | jghali | 1340 | if (item->lineColor() != CommonStrings::None) |
1341 | { |
||
1342 | ScColorShade tmp(m_doc->PageColors[item->lineColor()], item->lineShade()); |
||
1343 | painter->setBrush(tmp); |
||
1344 | painter->setBrushOpacity(1.0 - item->lineTransparency()); |
||
1345 | painter->setLineWidth(0); |
||
1346 | painter->setFillMode(ScPainterExBase::Solid); |
||
1347 | painter->fillPath(); |
||
1348 | } |
||
13303 | jghali | 1349 | } |
1350 | else |
||
1351 | { |
||
1352 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
1353 | QColor tmp; |
||
1354 | if (ml[0].Color != CommonStrings::None) |
||
1355 | { |
||
1356 | ScColorShade tmp(m_doc->PageColors[ml[0].Color], ml[0].Shade); |
||
1357 | painter->setBrush(tmp); |
||
1358 | painter->setLineWidth(0); |
||
1359 | painter->setFillMode(ScPainterExBase::Solid); |
||
1360 | painter->fillPath(); |
||
1361 | } |
||
1362 | for (int it = ml.size()-1; it > 0; it--) |
||
1363 | { |
||
1364 | if (ml[it].Color != CommonStrings::None) |
||
1365 | { |
||
1366 | ScColorShade tmp(m_doc->PageColors[ml[it].Color], ml[it].Shade); |
||
1367 | painter->setPen(tmp, ml[it].Width, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
1368 | painter->strokePath(); |
||
1369 | } |
||
1370 | } |
||
1371 | } |
||
1372 | } |
||
1373 | |||
16729 | fschmid | 1374 | void ScPageOutput::drawMarks( ScPage* page, ScPainterExBase* painter, const MarksOptions& options ) |
7108 | jghali | 1375 | { |
1376 | double markOffs = options.markOffset; |
||
1377 | double bleedLeft = 0.0, bleedRight = 0.0; |
||
1378 | double bleedBottom = options.BleedBottom; |
||
1379 | double bleedTop = options.BleedTop; |
||
1380 | if (!options.cropMarks && !options.bleedMarks && !options.registrationMarks && !options.colorMarks) |
||
1381 | return; |
||
1382 | if (m_doc->locationOfPage(page->pageNr()) == LeftPage) |
||
1383 | { |
||
1384 | bleedRight = options.BleedRight; |
||
1385 | bleedLeft = options.BleedLeft; |
||
1386 | } |
||
1387 | else if (m_doc->locationOfPage(page->pageNr()) == RightPage) |
||
1388 | { |
||
1389 | bleedRight = options.BleedLeft; |
||
1390 | bleedLeft = options.BleedRight; |
||
1391 | } |
||
1392 | else |
||
1393 | { |
||
1394 | bleedRight = options.BleedLeft; |
||
1395 | bleedLeft = options.BleedLeft; |
||
1396 | } |
||
1397 | double width = page->width(); |
||
1398 | double height = page->height(); |
||
1399 | double offsetX = page->xOffset(); |
||
1400 | double offsetY = page->yOffset(); |
||
11385 | jghali | 1401 | QPointF bleedTopLeft(offsetX - bleedLeft, offsetY - bleedTop); |
1402 | QPointF bleedBottomRight(offsetX + width + bleedRight, offsetY + height + bleedBottom); |
||
1403 | QRectF bleedBox(bleedTopLeft, bleedBottomRight); |
||
7108 | jghali | 1404 | painter->save(); |
1405 | painter->setLineWidth(0.5); |
||
1406 | painter->setPen(ScColorShade(Qt::black, 100), 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin ); |
||
1407 | if (options.cropMarks) |
||
1408 | { |
||
1409 | FPoint start, end; |
||
1410 | double left = offsetX, right = offsetX + width; |
||
1411 | double bottom = offsetY + height, top = offsetY; |
||
11905 | jghali | 1412 | drawBoxMarks( painter, QRectF(QPointF(left, top), QPointF(right, bottom)), bleedBox, markOffs ); |
7108 | jghali | 1413 | } |
1414 | if (options.bleedMarks) |
||
1415 | { |
||
1416 | FPoint start, end; |
||
1417 | double left = offsetX - bleedLeft, right = offsetX + width + bleedRight; |
||
1418 | double bottom = offsetY + height + bleedBottom, top = offsetY - bleedTop;; |
||
11905 | jghali | 1419 | drawBoxMarks( painter, QRectF(QPointF(left, top), QPointF(right, bottom)), bleedBox, markOffs ); |
7108 | jghali | 1420 | } |
1421 | if (options.registrationMarks) |
||
1422 | { |
||
1423 | double posX = (2* offsetX + width) / 2.0 - 7.0; |
||
1424 | double posY = (offsetY + height + bleedBottom + markOffs + 3.0); |
||
1425 | painter->save(); |
||
1426 | painter->translate(posX, posY); |
||
11905 | jghali | 1427 | drawRegistrationCross( painter ); |
7108 | jghali | 1428 | painter->restore(); |
1429 | posX = (2 * offsetX + width) / 2.0 - 7.0; |
||
1430 | posY = (offsetY - bleedTop - markOffs - 17); |
||
1431 | painter->save(); |
||
1432 | painter->translate(posX, posY); |
||
11905 | jghali | 1433 | drawRegistrationCross( painter ); |
7108 | jghali | 1434 | painter->restore(); |
1435 | |||
1436 | posX = (offsetX - bleedLeft - markOffs - 17); |
||
1437 | posY = (2 * offsetY + height) / 2.0 - 7.0; |
||
1438 | painter->save(); |
||
1439 | painter->translate(posX, posY); |
||
11905 | jghali | 1440 | drawRegistrationCross( painter ); |
7108 | jghali | 1441 | painter->restore(); |
1442 | posX = (offsetX + width + bleedRight + markOffs + 3.0); |
||
1443 | posY = (2 * offsetY + height) / 2.0 - 7.0; |
||
1444 | painter->save(); |
||
1445 | painter->translate(posX, posY); |
||
11905 | jghali | 1446 | drawRegistrationCross( painter ); |
7108 | jghali | 1447 | painter->restore(); |
1448 | } |
||
1449 | if (options.colorMarks) |
||
1450 | { |
||
1451 | int shade = 100; |
||
1452 | double startX = offsetX + 6.0; |
||
1453 | double startY = offsetY - bleedTop - markOffs - 16.0; |
||
1454 | ScColorShade strokecolor( ScColor(0, 0, 0, 255), 100 ); |
||
1455 | painter->setPen( strokecolor, 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin ); |
||
1456 | painter->setFillMode( ScPainterExBase::Solid ); |
||
1457 | for (int i = 0; i < 11; i++ ) |
||
1458 | { |
||
1459 | ScColorShade fillcolor( ScColor(0, 0, 0, 255), shade ); |
||
1460 | painter->setBrush( fillcolor ); |
||
1461 | painter->drawRect( startX + i * 14, startY, 14, 14 ); |
||
1462 | shade -= 10; |
||
1463 | } |
||
1464 | startX = offsetX + width - 20.0; |
||
1465 | painter->setBrush( ScColorShade(ScColor(0, 0, 0, 255), 50) ); |
||
1466 | painter->drawRect( startX, startY, 14, 14 ); |
||
1467 | startX -= 14; |
||
1468 | painter->setBrush( ScColorShade(ScColor(0, 0, 255, 0), 50) ); |
||
1469 | painter->drawRect( startX, startY, 14, 14 ); |
||
1470 | startX -= 14; |
||
1471 | painter->setBrush( ScColorShade(ScColor(0, 255, 0, 0), 50) ); |
||
1472 | painter->drawRect( startX, startY, 14, 14 ); |
||
1473 | startX -= 14; |
||
1474 | painter->setBrush( ScColorShade(ScColor(255, 0, 0, 0), 50) ); |
||
1475 | painter->drawRect( startX, startY, 14, 14 ); |
||
1476 | startX -= 14; |
||
1477 | painter->setBrush( ScColorShade(ScColor(255, 255, 0, 0), 100) ); |
||
1478 | painter->drawRect( startX, startY, 14, 14 ); |
||
1479 | startX -= 14; |
||
1480 | painter->setBrush( ScColorShade(ScColor(255, 0, 255, 0), 100) ); |
||
1481 | painter->drawRect( startX, startY, 14, 14 ); |
||
1482 | startX -= 14; |
||
1483 | painter->setBrush( ScColorShade(ScColor(0, 255, 255, 0), 100) ); |
||
1484 | painter->drawRect( startX, startY, 14, 14 ); |
||
1485 | startX -= 14; |
||
1486 | painter->setBrush( ScColorShade(ScColor(0, 0, 0, 255), 100) ); |
||
1487 | painter->drawRect( startX, startY, 14, 14 ); |
||
1488 | startX -= 14; |
||
1489 | painter->setBrush( ScColorShade(ScColor(0, 0, 255, 0), 100) ); |
||
1490 | painter->drawRect( startX, startY, 14, 14 ); |
||
1491 | startX -= 14; |
||
1492 | painter->setBrush( ScColorShade(ScColor(0, 255, 0, 0), 100) ); |
||
1493 | painter->drawRect( startX, startY, 14, 14 ); |
||
1494 | startX -= 14; |
||
1495 | painter->setBrush( ScColorShade(ScColor(255, 0, 0, 0), 100) ); |
||
1496 | painter->drawRect( startX, startY, 14, 14 ); |
||
1497 | } |
||
1498 | painter->restore(); |
||
1499 | } |
||
1500 | |||
11905 | jghali | 1501 | void ScPageOutput::drawBoxMarks( ScPainterExBase* painter, const QRectF& box, const QRectF& bleedBox, double offset ) |
7108 | jghali | 1502 | { |
1503 | FPoint start, end; |
||
11385 | jghali | 1504 | double left = box.left(), right = box.right(); |
1505 | double bottom = box.bottom(), top = box.top(); |
||
1506 | double bleedLeft = bleedBox.left(), bleedRight = bleedBox.right(); |
||
1507 | double bleedBottom = bleedBox.bottom(), bleedTop = bleedBox.top(); |
||
7108 | jghali | 1508 | // Top Left |
11385 | jghali | 1509 | start.setXY( bleedLeft - offset, top ); |
1510 | end.setXY ( bleedLeft - offset - 20, top ); |
||
7108 | jghali | 1511 | painter->drawLine(start, end); |
11385 | jghali | 1512 | start.setXY( left, bleedTop - offset ); |
1513 | end.setXY ( left, bleedTop - offset - 20); |
||
7108 | jghali | 1514 | painter->drawLine(start, end); |
1515 | // Top Right |
||
11385 | jghali | 1516 | start.setXY( bleedRight + offset, top ); |
1517 | end.setXY ( bleedRight + offset + 20, top ); |
||
7108 | jghali | 1518 | painter->drawLine(start, end); |
11385 | jghali | 1519 | start.setXY( right, bleedTop - offset ); |
1520 | end.setXY ( right, bleedTop - offset - 20); |
||
7108 | jghali | 1521 | painter->drawLine(start, end); |
1522 | // Bottom Left |
||
11385 | jghali | 1523 | start.setXY( bleedLeft - offset, bottom ); |
1524 | end.setXY ( bleedLeft - offset - 20, bottom ); |
||
7108 | jghali | 1525 | painter->drawLine(start, end); |
11385 | jghali | 1526 | start.setXY( left, bleedBottom + offset ); |
1527 | end.setXY ( left, bleedBottom + offset + 20); |
||
7108 | jghali | 1528 | painter->drawLine(start, end); |
1529 | // Bottom Right |
||
11385 | jghali | 1530 | start.setXY( bleedRight + offset, bottom ); |
1531 | end.setXY ( bleedRight + offset + 20, bottom ); |
||
7108 | jghali | 1532 | painter->drawLine(start, end); |
11385 | jghali | 1533 | start.setXY( right, bleedBottom + offset ); |
1534 | end.setXY ( right, bleedBottom + offset + 20); |
||
7108 | jghali | 1535 | painter->drawLine(start, end); |
1536 | } |
||
1537 | |||
11905 | jghali | 1538 | void ScPageOutput::drawRegistrationCross( ScPainterExBase* painter ) |
7108 | jghali | 1539 | { |
1540 | painter->save(); |
||
1541 | |||
1542 | painter->newPath(); |
||
1543 | painter->moveTo(0.0, 7.0); |
||
1544 | painter->lineTo(14.0, 7.0); |
||
1545 | painter->strokePath(); |
||
1546 | |||
1547 | painter->newPath(); |
||
1548 | painter->moveTo(7.0, 0.0); |
||
1549 | painter->lineTo(7.0, 14.0); |
||
1550 | painter->strokePath(); |
||
1551 | |||
1552 | painter->newPath(); |
||
1553 | painter->moveTo(13.0, 7.0); |
||
1554 | painter->curveTo( FPoint(13.0, 10.31383), FPoint(10.31383, 13.0), FPoint(7.0, 13.0) ); |
||
1555 | painter->curveTo( FPoint(3.68629, 13.0) , FPoint(1.0, 10.31383) , FPoint(1.0, 7.0) ); |
||
1556 | painter->curveTo( FPoint(1.0, 3.68629) , FPoint(3.68629, 1.0) , FPoint(7.0, 1.0) ); |
||
1557 | painter->curveTo( FPoint(10.31383, 1.0) , FPoint(13.0, 3.68629) , FPoint(13.0, 7.0) ); |
||
1558 | painter->strokePath(); |
||
1559 | |||
1560 | painter->newPath(); |
||
1561 | painter->moveTo(10.5, 7.0); |
||
1562 | painter->curveTo( FPoint(10.5, 8.93307), FPoint(8.93307, 10.5), FPoint(7.0, 10.5) ); |
||
1563 | painter->curveTo( FPoint(5.067, 10.5) , FPoint(3.5, 8.93307) , FPoint(3.5, 7.0) ); |
||
1564 | painter->curveTo( FPoint(3.5, 5.067) , FPoint(5.067, 3.5) , FPoint(7.0, 3.5) ); |
||
1565 | painter->curveTo( FPoint(8.93307, 3.5) , FPoint(10.5, 5.067) , FPoint(10.5, 7.0) ); |
||
1566 | painter->strokePath(); |
||
1567 | |||
1568 | painter->restore(); |
||
1569 | } |
||
1570 | |||
11905 | jghali | 1571 | void ScPageOutput::fillPath( PageItem* item, ScPainterExBase* painter, const QRect& clip ) |
6987 | jghali | 1572 | { |
1573 | if( painter->fillMode() == ScPainterExBase::Pattern && !painter->hasCapability(ScPainterExBase::patterns) ) |
||
11905 | jghali | 1574 | drawPattern( item, painter, clip ); |
6987 | jghali | 1575 | else |
1576 | painter->fillPath(); |
||
1577 | } |
||
4360 | cbradney | 1578 | |
11905 | jghali | 1579 | void ScPageOutput::strokePath( PageItem* item, ScPainterExBase* painter, const QRect& clip ) |
6987 | jghali | 1580 | { |
1581 | painter->strokePath(); |
||
1582 | } |
||
1583 | |||
10140 | jghali | 1584 | |
11385 | jghali | 1585 | |
12217 | jghali | 1586 | |
13805 | jghali | 1587 | |
1588 |