Rev 5988 | Rev 6824 | 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 | |||
9 | #include "qpainter.h" |
||
10 | #include "pageitem.h" |
||
5784 | jghali | 11 | #include "cmsettings.h" |
4617 | avox | 12 | #include "commonstrings.h" |
4360 | cbradney | 13 | #include "pageitem_imageframe.h" |
14 | #include "pageitem_line.h" |
||
15 | #include "pageitem_pathtext.h" |
||
16 | #include "pageitem_polygon.h" |
||
17 | #include "pageitem_polyline.h" |
||
18 | #include "pageitem_textframe.h" |
||
5993 | avox | 19 | #include "scfonts.h" |
4360 | cbradney | 20 | #include "scribus.h" |
21 | #include "scimage.h" |
||
22 | #include "util.h" |
||
23 | |||
4751 | cbradney | 24 | ScPageOutput::ScPageOutput(ScribusDoc* doc, bool reloadImages, int resolution, bool useProfiles) |
4360 | cbradney | 25 | { |
26 | m_doc = doc; |
||
27 | m_reloadImages = reloadImages; |
||
28 | m_imageRes = resolution; |
||
29 | m_useProfiles = useProfiles; |
||
30 | } |
||
31 | |||
5345 | mrdocs | 32 | ScImage::RequestType ScPageOutput::translateImageModeToRequest( ScPainterExBase::ImageMode mode ) |
33 | { |
||
34 | ScImage::RequestType value = ScImage::RGBData; |
||
35 | if ( mode == ScPainterExBase::cmykImages ) |
||
36 | value = ScImage::CMYKData; |
||
37 | else if ( mode == ScPainterExBase::rgbImages ) |
||
38 | value = ScImage::RGBData; |
||
39 | else if ( mode == ScPainterExBase::rgbProofImages ) |
||
40 | value = ScImage::RGBProof; |
||
41 | else if ( mode == ScPainterExBase::rawImages ) |
||
42 | value = ScImage::RawData; |
||
43 | return value; |
||
44 | } |
||
45 | |||
4360 | cbradney | 46 | void ScPageOutput::DrawPage( Page* page, ScPainterExBase* painter) |
47 | { |
||
48 | int clipx = static_cast<int>(page->xOffset()); |
||
49 | int clipy = static_cast<int>(page->yOffset()); |
||
50 | int clipw = qRound(page->width()); |
||
51 | int cliph = qRound(page->height()); |
||
52 | DrawMasterItems(painter, page, QRect(clipx, clipy, clipw, cliph)); |
||
53 | DrawPageItems(painter, page, QRect(clipx, clipy, clipw, cliph)); |
||
54 | } |
||
55 | |||
56 | void ScPageOutput::DrawMasterItems(ScPainterExBase *painter, Page *page, QRect clip) |
||
57 | { |
||
58 | double z = painter->zoomFactor(); |
||
59 | if (!page->MPageNam.isEmpty()) |
||
60 | { |
||
61 | Page* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]); |
||
62 | if (page->FromMaster.count() != 0) |
||
63 | { |
||
64 | int Lnr; |
||
65 | struct Layer ll; |
||
66 | PageItem *currItem; |
||
67 | ll.isViewable = false; |
||
68 | ll.LNr = 0; |
||
69 | Lnr = 0; |
||
70 | uint layerCount = m_doc->layerCount(); |
||
71 | for (uint la = 0; la < layerCount; ++la) |
||
72 | { |
||
73 | Level2Layer(m_doc, &ll, Lnr); |
||
74 | bool pr = true; |
||
75 | if ( !ll.isPrintable ) |
||
76 | pr = false; |
||
77 | if ((ll.isViewable) && (pr)) |
||
78 | { |
||
79 | uint pageFromMasterCount=page->FromMaster.count(); |
||
80 | for (uint a = 0; a < pageFromMasterCount; ++a) |
||
81 | { |
||
82 | currItem = page->FromMaster.at(a); |
||
83 | if (currItem->LayerNr != ll.LNr) |
||
84 | continue; |
||
85 | if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr()))) |
||
86 | continue; |
||
4751 | cbradney | 87 | if (!currItem->printEnabled()) |
4360 | cbradney | 88 | continue; |
89 | int savedOwnPage = currItem->OwnPage; |
||
90 | double OldX = currItem->xPos(); |
||
91 | double OldY = currItem->yPos(); |
||
92 | double OldBX = currItem->BoundingX; |
||
93 | double OldBY = currItem->BoundingY; |
||
94 | currItem->OwnPage = page->pageNr(); |
||
95 | if (!currItem->ChangedMasterItem) |
||
96 | { |
||
97 | currItem->moveBy(-Mp->xOffset() + page->xOffset(), -Mp->yOffset() + page->yOffset()); |
||
98 | currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset(); |
||
99 | currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset(); |
||
100 | } |
||
101 | /*if (evSpon) |
||
102 | currItem->Dirty = true;*/ |
||
103 | QRect oldR(currItem->getRedrawBounding(m_scale)); |
||
104 | if (clip.intersects(oldR)) |
||
105 | DrawItem(currItem, painter, clip); |
||
106 | currItem->OwnPage = savedOwnPage; |
||
107 | if (!currItem->ChangedMasterItem) |
||
108 | { |
||
109 | currItem->setXPos(OldX); |
||
110 | currItem->setYPos(OldY); |
||
111 | currItem->BoundingX = OldBX; |
||
112 | currItem->BoundingY = OldBY; |
||
113 | } |
||
114 | } |
||
115 | for (uint a = 0; a < pageFromMasterCount; ++a) |
||
116 | { |
||
117 | currItem = page->FromMaster.at(a); |
||
118 | if (currItem->LayerNr != ll.LNr) |
||
119 | continue; |
||
120 | if (!currItem->isTableItem) |
||
121 | continue; |
||
122 | if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr()))) |
||
123 | continue; |
||
124 | double OldX = currItem->xPos(); |
||
125 | double OldY = currItem->yPos(); |
||
126 | double OldBX = currItem->BoundingX; |
||
127 | double OldBY = currItem->BoundingY; |
||
128 | if (!currItem->ChangedMasterItem) |
||
129 | { |
||
130 | currItem->setXPos(OldX - Mp->xOffset() + page->xOffset()); |
||
131 | currItem->setYPos(OldY - Mp->yOffset() + page->yOffset()); |
||
132 | currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset(); |
||
133 | currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset(); |
||
134 | } |
||
135 | QRect oldR(currItem->getRedrawBounding(m_scale)); |
||
136 | if (clip.intersects(oldR)) |
||
137 | { |
||
138 | painter->setZoomFactor(m_scale); |
||
139 | painter->save(); |
||
140 | painter->translate(currItem->xPos() * m_scale, currItem->yPos() * m_scale); |
||
141 | painter->rotate(currItem->rotation()); |
||
4546 | subik | 142 | if (currItem->lineColor() != CommonStrings::None) |
4360 | cbradney | 143 | { |
144 | ScColorShade tmp( m_doc->PageColors[currItem->lineColor()], currItem->lineShade()); |
||
145 | if ((currItem->TopLine) || (currItem->RightLine) || (currItem->BottomLine) || (currItem->LeftLine)) |
||
146 | { |
||
4617 | avox | 147 | painter->setPen(tmp, currItem->lineWidth(), currItem->PLineArt, Qt::SquareCap, currItem->PLineJoin); |
4360 | cbradney | 148 | if (currItem->TopLine) |
149 | painter->drawLine(FPoint(0.0, 0.0), FPoint(currItem->width(), 0.0)); |
||
150 | if (currItem->RightLine) |
||
151 | painter->drawLine(FPoint(currItem->width(), 0.0), FPoint(currItem->width(), currItem->height())); |
||
152 | if (currItem->BottomLine) |
||
153 | painter->drawLine(FPoint(currItem->width(), currItem->height()), FPoint(0.0, currItem->height())); |
||
154 | if (currItem->LeftLine) |
||
155 | painter->drawLine(FPoint(0.0, currItem->height()), FPoint(0.0, 0.0)); |
||
156 | } |
||
157 | } |
||
158 | painter->restore(); |
||
159 | } |
||
160 | if (!currItem->ChangedMasterItem) |
||
161 | { |
||
162 | currItem->setXPos(OldX); |
||
163 | currItem->setYPos(OldY); |
||
164 | currItem->BoundingX = OldBX; |
||
165 | currItem->BoundingY = OldBY; |
||
166 | } |
||
167 | } |
||
168 | } |
||
169 | Lnr++; |
||
170 | } |
||
171 | } |
||
172 | } |
||
173 | painter->setZoomFactor(z); |
||
174 | } |
||
175 | |||
176 | void ScPageOutput::DrawPageItems(ScPainterExBase *painter, Page *page, QRect clip) |
||
177 | { |
||
178 | //linkedFramesToShow.clear(); |
||
179 | double z = painter->zoomFactor(); |
||
180 | if (m_doc->Items->count() != 0) |
||
181 | { |
||
5273 | mrdocs | 182 | //QPainter p; |
4360 | cbradney | 183 | int Lnr=0; |
184 | struct Layer ll; |
||
185 | PageItem *currItem; |
||
186 | ll.isViewable = false; |
||
187 | ll.LNr = 0; |
||
188 | uint layerCount = m_doc->layerCount(); |
||
189 | //int docCurrPageNo=static_cast<int>(m_doc->currentPageNumber()); |
||
190 | int docCurrPageNo=static_cast<int>(page->pageNr()); |
||
191 | for (uint la2 = 0; la2 < layerCount; ++la2) |
||
192 | { |
||
193 | Level2Layer(m_doc, &ll, Lnr); |
||
194 | bool pr = true; |
||
195 | if (!ll.isPrintable) |
||
196 | pr = false; |
||
197 | if ((ll.isViewable) && (pr)) |
||
198 | { |
||
199 | QPtrListIterator<PageItem> docItem(*m_doc->Items); |
||
200 | while ( (currItem = docItem.current()) != 0) |
||
201 | { |
||
202 | ++docItem; |
||
203 | if (currItem->LayerNr != ll.LNr) |
||
204 | continue; |
||
4751 | cbradney | 205 | if (!currItem->printEnabled()) |
4360 | cbradney | 206 | continue; |
207 | if ((m_doc->masterPageMode()) && ((currItem->OwnPage != -1) && (currItem->OwnPage != docCurrPageNo))) |
||
208 | continue; |
||
209 | if (!m_doc->masterPageMode() && !currItem->OnMasterPage.isEmpty()) |
||
210 | { |
||
5687 | jghali | 211 | if (currItem->OnMasterPage != page->pageName()) |
4360 | cbradney | 212 | continue; |
213 | } |
||
214 | QRect oldR(currItem->getRedrawBounding(m_scale)); |
||
215 | if (clip.intersects(oldR)) |
||
216 | { |
||
217 | /*if (evSpon) |
||
218 | currItem->Dirty = true;*/ |
||
219 | /*if (forceRedraw) |
||
220 | currItem->Dirty = false;*/ |
||
221 | // if ((!Mpressed) || (m_doc->EditClip)) |
||
222 | DrawItem( currItem, painter, clip ); |
||
223 | //currItem->Redrawn = true; |
||
224 | if ((currItem->asTextFrame()) && ((currItem->NextBox != 0) || (currItem->BackBox != 0))) |
||
225 | { |
||
226 | PageItem *nextItem = currItem; |
||
227 | while (nextItem != 0) |
||
228 | { |
||
229 | if (nextItem->BackBox != 0) |
||
230 | nextItem = nextItem->BackBox; |
||
231 | else |
||
232 | break; |
||
233 | } |
||
234 | /*if (linkedFramesToShow.find(nextItem) == -1) |
||
235 | linkedFramesToShow.append(nextItem);*/ |
||
236 | } |
||
237 | } |
||
238 | } |
||
239 | QPtrListIterator<PageItem> docItem2(*m_doc->Items); |
||
240 | while ( (currItem = docItem2.current()) != 0 ) |
||
241 | { |
||
242 | ++docItem2; |
||
243 | if (currItem->LayerNr != ll.LNr) |
||
244 | continue; |
||
245 | if (!currItem->isTableItem) |
||
246 | continue; |
||
247 | QRect oldR(currItem->getRedrawBounding(m_scale)); |
||
248 | if (clip.intersects(oldR)) |
||
249 | { |
||
250 | painter->setZoomFactor(m_scale); |
||
251 | painter->save(); |
||
252 | painter->translate(currItem->xPos() * m_scale, currItem->yPos() * m_scale); |
||
253 | painter->rotate(currItem->rotation()); |
||
4546 | subik | 254 | if (currItem->lineColor() != CommonStrings::None) |
4360 | cbradney | 255 | { |
256 | ScColorShade tmp( m_doc->PageColors[currItem->lineColor()], currItem->lineShade() ); |
||
257 | if ((currItem->TopLine) || (currItem->RightLine) || (currItem->BottomLine) || (currItem->LeftLine)) |
||
258 | { |
||
4617 | avox | 259 | painter->setPen(tmp, currItem->lineWidth(), currItem->PLineArt, Qt::SquareCap, currItem->PLineJoin); |
4360 | cbradney | 260 | if (currItem->TopLine) |
261 | painter->drawLine(FPoint(0.0, 0.0), FPoint(currItem->width(), 0.0)); |
||
262 | if (currItem->RightLine) |
||
263 | painter->drawLine(FPoint(currItem->width(), 0.0), FPoint(currItem->width(), currItem->height())); |
||
264 | if (currItem->BottomLine) |
||
265 | painter->drawLine(FPoint(currItem->width(), currItem->height()), FPoint(0.0, currItem->height())); |
||
266 | if (currItem->LeftLine) |
||
267 | painter->drawLine(FPoint(0.0, currItem->height()), FPoint(0.0, 0.0)); |
||
268 | } |
||
269 | } |
||
270 | painter->restore(); |
||
271 | } |
||
272 | } |
||
273 | } |
||
274 | Lnr++; |
||
275 | } |
||
276 | } |
||
277 | painter->setZoomFactor(z); |
||
278 | } |
||
279 | |||
280 | void ScPageOutput::DrawItem( PageItem* item, ScPainterExBase* painter, QRect rect ) |
||
281 | { |
||
282 | double sc = m_scale; |
||
283 | DrawItem_Pre(item, painter, sc); |
||
284 | PageItem::ItemType itemType = item->itemType(); |
||
285 | if( itemType == PageItem::ImageFrame ) |
||
286 | DrawItem_ImageFrame( (PageItem_ImageFrame*) item, painter, sc ); |
||
287 | else if( itemType == PageItem::Line ) |
||
288 | DrawItem_Line( (PageItem_Line*) item, painter ); |
||
289 | else if( itemType == PageItem::PathText ) |
||
290 | DrawItem_PathText( (PageItem_PathText*) item, painter, sc ); |
||
291 | else if( itemType == PageItem::Polygon ) |
||
292 | DrawItem_Polygon( (PageItem_Polygon*) item, painter ); |
||
293 | else if( itemType == PageItem::PolyLine ) |
||
294 | DrawItem_PolyLine( (PageItem_PolyLine*) item, painter ); |
||
295 | else if( itemType == PageItem::TextFrame ) |
||
296 | DrawItem_TextFrame( (PageItem_TextFrame*) item, painter, rect, sc); |
||
297 | DrawItem_Post(item, painter); |
||
298 | } |
||
299 | |||
300 | void ScPageOutput::DrawItem_Pre( PageItem* item, ScPainterExBase* painter, double scale ) |
||
301 | { |
||
302 | double sc = scale; |
||
303 | painter->save(); |
||
304 | if (!item->isEmbedded) |
||
305 | { |
||
306 | painter->setZoomFactor(sc); |
||
307 | painter->translate( item->xPos() * sc, item->yPos() * sc); |
||
308 | // painter->rotate(item->rotation()); |
||
309 | } |
||
310 | painter->rotate(item->rotation()); |
||
4617 | avox | 311 | painter->setLineWidth(item->lineWidth()); |
4360 | cbradney | 312 | if (item->GrType != 0) |
313 | { |
||
314 | painter->setFillMode(ScPainterExBase::Gradient); |
||
315 | painter->fill_gradient = VGradientEx(item->fill_gradient, *m_doc); |
||
316 | QWMatrix grm; |
||
317 | grm.rotate(item->rotation()); |
||
318 | FPointArray gra; |
||
319 | switch (item->GrType) |
||
320 | { |
||
321 | case 1: |
||
322 | case 2: |
||
323 | case 3: |
||
324 | case 4: |
||
325 | case 6: |
||
326 | gra.setPoints(2, item->GrStartX, item->GrStartY, item->GrEndX, item->GrEndY); |
||
327 | gra.map(grm); |
||
328 | painter->setGradient(VGradientEx::linear, gra.point(0), gra.point(1)); |
||
329 | break; |
||
330 | case 5: |
||
331 | case 7: |
||
332 | gra.setPoints(2, item->GrStartX, item->GrStartY, item->GrEndX, item->GrEndY); |
||
333 | painter->setGradient(VGradientEx::radial, gra.point(0), gra.point(1), gra.point(0)); |
||
334 | break; |
||
335 | } |
||
336 | } |
||
337 | else |
||
338 | { |
||
339 | painter->fill_gradient = VGradientEx(VGradientEx::linear); |
||
4546 | subik | 340 | if (item->fillColor() != CommonStrings::None) |
4360 | cbradney | 341 | { |
342 | painter->setBrush( ScColorShade(m_doc->PageColors[item->fillColor()], item->fillShade()) ); |
||
343 | painter->setFillMode(ScPainterExBase::Solid); |
||
344 | } |
||
345 | else |
||
346 | painter->setFillMode(ScPainterExBase::None); |
||
347 | } |
||
4546 | subik | 348 | if (item->lineColor() != CommonStrings::None) |
4360 | cbradney | 349 | { |
4617 | avox | 350 | if ((item->lineWidth() == 0) && !item->asLine()) |
4360 | cbradney | 351 | painter->setLineWidth(0); |
352 | else |
||
353 | { |
||
354 | ScColorShade tmp(m_doc->PageColors[item->lineColor()], item->lineShade()); |
||
4617 | avox | 355 | painter->setPen( tmp , item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin); |
4360 | cbradney | 356 | if (item->DashValues.count() != 0) |
357 | painter->setDash(item->DashValues, item->DashOffset); |
||
358 | } |
||
359 | } |
||
360 | else |
||
361 | painter->setLineWidth(0); |
||
362 | painter->setBrushOpacity(1.0 - item->fillTransparency()); |
||
363 | painter->setPenOpacity(1.0 - item->lineTransparency()); |
||
4480 | cbradney | 364 | painter->setFillRule(item->fillRule); |
4360 | cbradney | 365 | } |
366 | |||
367 | void ScPageOutput::DrawItem_Post( PageItem* item, ScPainterExBase* painter ) |
||
368 | { |
||
369 | bool doStroke=true; |
||
370 | if ( item->itemType() == PageItem::PathText || item->itemType() == PageItem::PolyLine || item->itemType() == PageItem::Line ) |
||
371 | doStroke=false; |
||
372 | if ((doStroke)) |
||
373 | { |
||
4546 | subik | 374 | if (item->lineColor() != CommonStrings::None) |
4360 | cbradney | 375 | { |
376 | ScColorShade tmp(m_doc->PageColors[item->lineColor()], item->lineShade()); |
||
4617 | avox | 377 | painter->setPen(tmp, item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin); |
4360 | cbradney | 378 | if (item->DashValues.count() != 0) |
379 | painter->setDash(item->DashValues, item->DashOffset); |
||
380 | } |
||
381 | else |
||
382 | painter->setLineWidth(0); |
||
383 | if (!item->isTableItem) |
||
384 | { |
||
385 | painter->setupPolygon(&item->PoLine); |
||
386 | if (item->NamedLStyle.isEmpty()) |
||
387 | painter->strokePath(); |
||
388 | else |
||
389 | { |
||
390 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
391 | for (int it = ml.size()-1; it > -1; it--) |
||
392 | { |
||
393 | ScColorShade tmp( m_doc->PageColors[ml[it].Color], ml[it].Shade ); |
||
394 | painter->setPen(tmp, ml[it].Width, |
||
395 | static_cast<Qt::PenStyle>(ml[it].Dash), |
||
396 | static_cast<Qt::PenCapStyle>(ml[it].LineEnd), |
||
397 | static_cast<Qt::PenJoinStyle>(ml[it].LineJoin)); |
||
398 | painter->strokePath(); |
||
399 | } |
||
400 | } |
||
401 | } |
||
402 | } |
||
403 | if ((!item->isEmbedded)) |
||
404 | { |
||
405 | double scpInv = 1.0 / (QMAX(m_scale, 1)); |
||
406 | } |
||
407 | item->Tinput = false; |
||
408 | item->FrameOnly = false; |
||
409 | painter->restore(); |
||
410 | } |
||
411 | |||
5988 | jghali | 412 | void ScPageOutput::DrawGlyphs(PageItem* item, ScPainterExBase *painter, const CharStyle& style, GlyphLayout& glyphs) |
4360 | cbradney | 413 | { |
5988 | jghali | 414 | uint ccx = glyphs.glyph; |
415 | if ((m_doc->guidesSettings.showControls) && (ccx == 9 || ccx == 29 || (ccx == 26 && item->columns() > 1) || ccx == 27 || ccx == 32)) |
||
416 | { |
||
417 | QWMatrix chma, chma4, chma5; |
||
418 | FPointArray points; |
||
419 | if (ccx == (9)) |
||
420 | { |
||
421 | points = item->doc()->symTab.copy(); |
||
422 | chma4.translate(glyphs.xoffset - ((style.fontSize() / 10.0) * glyphs.scaleH * 0.7), glyphs.yoffset - ((style.fontSize() / 10.0) * glyphs.scaleV * 0.5)); |
||
423 | } |
||
424 | else if (ccx == (26)) |
||
425 | { |
||
426 | points = item->doc()->symNewCol.copy(); |
||
427 | chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.6)); |
||
428 | } |
||
429 | else if (ccx == (27)) |
||
430 | { |
||
431 | points = item->doc()->symNewFrame.copy(); |
||
432 | chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.6)); |
||
433 | } |
||
434 | else |
||
435 | { |
||
436 | points = item->doc()->symNonBreak.copy(); |
||
437 | chma4.translate(glyphs.xoffset, glyphs.yoffset-((style.fontSize() / 10.0) * glyphs.scaleV * 0.4)); |
||
438 | } |
||
439 | chma.scale(glyphs.scaleH * style.fontSize() / 100.0, glyphs.scaleV * style.fontSize() / 100.0); |
||
440 | chma5.scale(painter->zoomFactor(), painter->zoomFactor()); |
||
441 | points.map(chma * chma4 * chma5); |
||
442 | painter->setupTextPolygon(&points); |
||
443 | if (ccx == (32)) |
||
444 | { |
||
445 | ScColorShade tmp = painter->pen(); |
||
446 | painter->setPen(painter->brush(), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
447 | painter->setLineWidth(style.fontSize() * glyphs.scaleV / 200.0); |
||
448 | painter->strokePath(); |
||
449 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
450 | } |
||
451 | else |
||
452 | { |
||
453 | painter->setFillMode(1); |
||
454 | painter->fillPath(); |
||
455 | } |
||
456 | } |
||
457 | if ((ccx == (13)) || (ccx == (9)) || (ccx == (28)) || (ccx == (27)) || (ccx == (26))) |
||
4360 | cbradney | 458 | return; |
5988 | jghali | 459 | if (ccx == (29)) |
460 | ccx = 32; |
||
461 | if (ccx == (24)) |
||
462 | ccx = QChar('-').unicode(); |
||
463 | |||
464 | if (style.font().canRender(QChar(ccx))) |
||
4360 | cbradney | 465 | { |
466 | QWMatrix chma, chma2, chma3, chma4, chma5, chma6; |
||
5988 | jghali | 467 | chma.scale(glyphs.scaleH * style.fontSize() / 100.00, glyphs.scaleV * style.fontSize() / 100.0); |
468 | // qDebug(QString("glyphscale: %1 %2").arg(glyphs.scaleH).arg(glyphs.scaleV)); |
||
4360 | cbradney | 469 | chma5.scale(painter->zoomFactor(), painter->zoomFactor()); |
5988 | jghali | 470 | uint gl = style.font().char2CMap(QChar(ccx)); |
471 | FPointArray gly = style.font().glyphOutline(gl); |
||
472 | // Do underlining first so you can get typographically correct |
||
473 | // underlines when drawing a white outline |
||
474 | if ((style.effects() & ScStyle_Underline) || ((style.effects() & ScStyle_UnderlineWords) && (!QChar(ccx).isSpace()))) |
||
475 | { |
||
476 | double st, lw; |
||
477 | if ((style.font().underlinePos() != -1) || (style.underlineWidth() != -1)) |
||
478 | { |
||
479 | if (style.font().underlinePos() != -1) |
||
480 | st = (style.font().underlinePos() / 1000.0) * (style.font().descent(style.fontSize() / 10.0)); |
||
481 | else |
||
482 | st = style.font().underlinePos(style.fontSize() / 10.0); |
||
483 | if (style.underlineWidth() != -1) |
||
484 | lw = (style.underlineWidth() / 1000.0) * (style.fontSize() / 10.0); |
||
485 | else |
||
486 | lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1); |
||
487 | } |
||
488 | else |
||
489 | { |
||
490 | st = style.font().underlinePos(style.fontSize() / 10.0); |
||
491 | lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1); |
||
492 | } |
||
493 | if (style.baselineOffset() != 0) |
||
494 | st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0); |
||
495 | painter->setPen(painter->brush()); |
||
496 | painter->setLineWidth(lw); |
||
497 | painter->drawLine(FPoint(glyphs.xoffset, glyphs.yoffset - st), FPoint(glyphs.xoffset + glyphs.xadvance, glyphs.yoffset - st)); |
||
498 | } |
||
4360 | cbradney | 499 | if (gly.size() > 3) |
500 | { |
||
501 | if (item->reversed()) |
||
502 | { |
||
503 | chma3.scale(-1, 1); |
||
5988 | jghali | 504 | chma3.translate(-glyphs.xadvance, 0); |
4360 | cbradney | 505 | } |
5988 | jghali | 506 | chma4.translate(glyphs.xoffset, glyphs.yoffset - ((style.fontSize() / 10.0) * glyphs.scaleV)); |
507 | if (style.baselineOffset() != 0) |
||
508 | chma6.translate(0, -(style.fontSize() / 10.0) * (style.baselineOffset() / 1000.0) * painter->zoomFactor()); |
||
509 | gly.map(chma * chma3 * chma4 * chma5 * chma6); |
||
4360 | cbradney | 510 | painter->setFillMode(1); |
511 | bool fr = painter->fillRule(); |
||
512 | painter->setFillRule(false); |
||
513 | painter->setupTextPolygon(&gly); |
||
5988 | jghali | 514 | if (m_doc->layerOutline(item->LayerNr)) |
4360 | cbradney | 515 | { |
5988 | jghali | 516 | painter->save(); |
517 | ScColorShade colorShade(m_doc->layerMarker(item->LayerNr), 100); |
||
518 | painter->setPen(colorShade, 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
519 | painter->setFillMode(ScPainter::None); |
||
520 | painter->setBrushOpacity(1.0); |
||
521 | painter->setPenOpacity(1.0); |
||
4360 | cbradney | 522 | painter->strokePath(); |
5988 | jghali | 523 | painter->restore(); |
524 | painter->setFillRule(fr); |
||
525 | return; |
||
4360 | cbradney | 526 | } |
5988 | jghali | 527 | if ((style.font().isStroked()) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0)) |
528 | { |
||
529 | ScColorShade tmp = painter->brush(); |
||
530 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
531 | painter->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0); |
||
532 | painter->strokePath(); |
||
533 | } |
||
4360 | cbradney | 534 | else |
535 | { |
||
5988 | jghali | 536 | if ((style.effects() & ScStyle_Shadowed) && (style.strokeColor() != CommonStrings::None)) |
4360 | cbradney | 537 | { |
538 | painter->save(); |
||
5988 | jghali | 539 | painter->translate((style.fontSize() * glyphs.scaleH * style.shadowXOffset() / 10000.0) * painter->zoomFactor(), -(style.fontSize() * glyphs.scaleV * style.shadowYOffset() / 10000.0) * painter->zoomFactor()); |
4360 | cbradney | 540 | ScColorShade tmp = painter->brush(); |
541 | painter->setBrush(painter->pen()); |
||
5988 | jghali | 542 | painter->setupTextPolygon(&gly); |
4360 | cbradney | 543 | painter->fillPath(); |
544 | painter->setBrush(tmp); |
||
545 | painter->restore(); |
||
5988 | jghali | 546 | painter->setupTextPolygon(&gly); |
4360 | cbradney | 547 | } |
5988 | jghali | 548 | if (style.fillColor() != CommonStrings::None) |
4360 | cbradney | 549 | painter->fillPath(); |
5988 | jghali | 550 | if ((style.effects() & ScStyle_Outline) && (style.strokeColor() != CommonStrings::None) && ((style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0) != 0)) |
4360 | cbradney | 551 | { |
5988 | jghali | 552 | painter->setLineWidth(style.fontSize() * glyphs.scaleV * style.outlineWidth() / 10000.0); |
4360 | cbradney | 553 | painter->strokePath(); |
554 | } |
||
555 | } |
||
556 | painter->setFillRule(fr); |
||
557 | } |
||
5988 | jghali | 558 | if (style.effects() & ScStyle_Strikethrough) |
4360 | cbradney | 559 | { |
560 | double st, lw; |
||
5988 | jghali | 561 | if ((style.strikethruOffset() != -1) || (style.strikethruWidth() != -1)) |
4360 | cbradney | 562 | { |
5988 | jghali | 563 | if (style.strikethruOffset() != -1) |
564 | st = (style.strikethruOffset() / 1000.0) * (style.font().ascent(style.fontSize() / 10.0)); |
||
4360 | cbradney | 565 | else |
5988 | jghali | 566 | st = style.font().strikeoutPos(style.fontSize() / 10.0); |
567 | if (style.strikethruWidth() != -1) |
||
568 | lw = (style.strikethruWidth() / 1000.0) * (style.fontSize() / 10.0); |
||
4360 | cbradney | 569 | else |
5988 | jghali | 570 | lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1); |
4360 | cbradney | 571 | } |
572 | else |
||
573 | { |
||
5988 | jghali | 574 | st = style.font().strikeoutPos(style.fontSize() / 10.0); |
575 | lw = QMAX(style.font().strokeWidth(style.fontSize() / 10.0), 1); |
||
4360 | cbradney | 576 | } |
5988 | jghali | 577 | if (style.baselineOffset() != 0) |
578 | st += (style.fontSize() / 10.0) * glyphs.scaleV * (style.baselineOffset() / 1000.0); |
||
4360 | cbradney | 579 | painter->setPen(painter->brush()); |
580 | painter->setLineWidth(lw); |
||
5988 | jghali | 581 | painter->drawLine(FPoint(glyphs.xoffset, glyphs.yoffset - st), FPoint(glyphs.xoffset + glyphs.xadvance, glyphs.yoffset - st)); |
4360 | cbradney | 582 | } |
583 | } |
||
584 | else |
||
585 | { |
||
586 | painter->setLineWidth(1); |
||
5988 | jghali | 587 | painter->setPen(ScColorShade(Qt::red, 100)); |
588 | painter->setBrush(ScColorShade(Qt::red, 100)); |
||
4360 | cbradney | 589 | painter->setFillMode(1); |
5988 | jghali | 590 | painter->drawRect(glyphs.xoffset, glyphs.yoffset - (style.fontSize() / 10.0) * glyphs.scaleV , (style.fontSize() / 10.0) * glyphs.scaleH, (style.fontSize() / 10.0) * glyphs.scaleV); |
4360 | cbradney | 591 | } |
5988 | jghali | 592 | if (glyphs.more) |
593 | DrawGlyphs(item, painter, style, *glyphs.more); |
||
4360 | cbradney | 594 | } |
595 | |||
5988 | jghali | 596 | void ScPageOutput::DrawItem_Embedded( PageItem* item, ScPainterExBase *p, QRect e, const CharStyle& style, PageItem* cembedded) |
4360 | cbradney | 597 | { |
598 | QPtrList<PageItem> emG; |
||
599 | emG.clear(); |
||
5988 | jghali | 600 | if (cembedded != 0) |
4360 | cbradney | 601 | { |
5988 | jghali | 602 | if (!item->doc()->DoDrawing) |
4360 | cbradney | 603 | { |
5988 | jghali | 604 | cembedded->Tinput = false; |
605 | cembedded->FrameOnly = false; |
||
4360 | cbradney | 606 | return; |
607 | } |
||
5988 | jghali | 608 | emG.append(cembedded); |
609 | if (cembedded->Groups.count() != 0) |
||
4360 | cbradney | 610 | { |
5988 | jghali | 611 | for (uint ga=0; ga < m_doc->FrameItems.count(); ++ga) |
4360 | cbradney | 612 | { |
613 | if (m_doc->FrameItems.at(ga)->Groups.count() != 0) |
||
614 | { |
||
5988 | jghali | 615 | if (m_doc->FrameItems.at(ga)->Groups.top() == cembedded->Groups.top()) |
4360 | cbradney | 616 | { |
5988 | jghali | 617 | if (m_doc->FrameItems.at(ga)->ItemNr != cembedded->ItemNr) |
4360 | cbradney | 618 | { |
619 | if (emG.find(m_doc->FrameItems.at(ga)) == -1) |
||
620 | emG.append(m_doc->FrameItems.at(ga)); |
||
621 | } |
||
622 | } |
||
623 | } |
||
624 | } |
||
625 | } |
||
626 | for (uint em = 0; em < emG.count(); ++em) |
||
627 | { |
||
628 | PageItem* embedded = emG.at(em); |
||
5988 | jghali | 629 | /* |
630 | ParagraphStyle vg; |
||
4360 | cbradney | 631 | QValueList<ParagraphStyle> savedParagraphStyles; |
632 | for (int xxx=0; xxx<5; ++xxx) |
||
633 | { |
||
5988 | jghali | 634 | vg.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(m_Doc->docParagraphStyles[xxx].lineSpacingMode())); |
635 | vg.setUseBaselineGrid(m_Doc->docParagraphStyles[xxx].useBaselineGrid()); |
||
636 | vg.setLineSpacing(m_Doc->docParagraphStyles[xxx].lineSpacing()); |
||
637 | vg.charStyle().setFontSize(m_Doc->docParagraphStyles[xxx].charStyle().fontSize()); |
||
638 | vg.setLeftMargin(m_Doc->docParagraphStyles[xxx].leftMargin()); |
||
639 | vg.setFirstIndent(m_Doc->docParagraphStyles[xxx].firstIndent()); |
||
640 | vg.setGapBefore(m_Doc->docParagraphStyles[xxx].gapBefore()); |
||
641 | vg.setGapAfter(m_Doc->docParagraphStyles[xxx].gapAfter()); |
||
4360 | cbradney | 642 | savedParagraphStyles.append(vg); |
643 | } |
||
5988 | jghali | 644 | */ |
4360 | cbradney | 645 | p->save(); |
5988 | jghali | 646 | double pws=0; |
647 | /* FIXME |
||
648 | embedded->Xpos = Xpos + hl->xco + embedded->gXpos; |
||
649 | embedded->Ypos = Ypos + (hl->yco - (embedded->gHeight * (hl->scalev / 1000.0))) + embedded->gYpos; |
||
4360 | cbradney | 650 | p->translate((hl->xco + embedded->gXpos * (hl->scale / 1000.0)) * p->zoomFactor(), (hl->yco - (embedded->gHeight * (hl->scalev / 1000.0)) + embedded->gYpos * (hl->scalev / 1000.0)) * p->zoomFactor()); |
651 | if (hl->base != 0) |
||
652 | { |
||
653 | p->translate(0, -embedded->gHeight * (hl->base / 1000.0) * p->zoomFactor()); |
||
5988 | jghali | 654 | embedded->Ypos -= embedded->gHeight * (hl->base / 1000.0); |
4360 | cbradney | 655 | } |
656 | p->scale(hl->scale / 1000.0, hl->scalev / 1000.0); |
||
5988 | jghali | 657 | embedded->Dirty = Dirty; |
658 | embedded->invalid = invalid; |
||
659 | double sc; |
||
660 | double pws = embedded->m_lineWidth; |
||
661 | embedded->DrawObj_Pre(p, sc); |
||
4360 | cbradney | 662 | switch(embedded->itemType()) |
663 | { |
||
5988 | jghali | 664 | case ImageFrame: |
665 | case TextFrame: |
||
666 | case Polygon: |
||
667 | case PathText: |
||
668 | embedded->DrawObj_Item(p, e, sc); |
||
4360 | cbradney | 669 | break; |
5988 | jghali | 670 | case Line: |
671 | case PolyLine: |
||
672 | embedded->m_lineWidth = pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0); |
||
673 | embedded->DrawObj_Item(p, e, sc); |
||
4360 | cbradney | 674 | break; |
675 | default: |
||
676 | break; |
||
677 | } |
||
5988 | jghali | 678 | embedded->m_lineWidth = pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0); |
679 | embedded->DrawObj_Post(p); |
||
680 | */ |
||
4360 | cbradney | 681 | p->restore(); |
4617 | avox | 682 | embedded->setLineWidth(pws); |
5988 | jghali | 683 | /* |
684 | for (int xxx=0; xxx<5; ++xxx) |
||
4360 | cbradney | 685 | { |
5988 | jghali | 686 | m_Doc->docParagraphStyles[xxx].setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(savedParagraphStyles[xxx].lineSpacingMode())); |
687 | m_Doc->docParagraphStyles[xxx].setUseBaselineGrid(savedParagraphStyles[xxx].useBaselineGrid()); |
||
688 | m_Doc->docParagraphStyles[xxx].setLineSpacing(savedParagraphStyles[xxx].lineSpacing()); |
||
689 | m_Doc->docParagraphStyles[xxx].charStyle().setFontSize(savedParagraphStyles[xxx].charStyle().fontSize()); |
||
690 | m_Doc->docParagraphStyles[xxx].setLeftMargin(savedParagraphStyles[xxx].leftMargin()); |
||
691 | m_Doc->docParagraphStyles[xxx].setFirstIndent(savedParagraphStyles[xxx].firstIndent()); |
||
692 | m_Doc->docParagraphStyles[xxx].setGapBefore(savedParagraphStyles[xxx].gapBefore()); |
||
693 | m_Doc->docParagraphStyles[xxx].setGapAfter(savedParagraphStyles[xxx].gapAfter()); |
||
4360 | cbradney | 694 | } |
695 | savedParagraphStyles.clear(); |
||
5988 | jghali | 696 | */ |
4360 | cbradney | 697 | } |
698 | } |
||
699 | } |
||
700 | |||
701 | void ScPageOutput::DrawItem_ImageFrame( PageItem_ImageFrame* item, ScPainterExBase* painter, double scale ) |
||
702 | { |
||
4989 | cbradney | 703 | ScPainterExBase::ImageMode mode = ScPainterExBase::rgbImages; |
4546 | subik | 704 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
4360 | cbradney | 705 | { |
706 | painter->setupPolygon(&item->PoLine); |
||
707 | painter->fillPath(); |
||
708 | } |
||
709 | if (item->Pfile.isEmpty()) |
||
710 | { |
||
711 | if ((item->Frame) && (m_doc->guidesSettings.framesShown)) |
||
712 | { |
||
713 | painter->setPen( ScColorShade(Qt::black, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
714 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height())); |
||
715 | painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0)); |
||
716 | } |
||
717 | } |
||
718 | else |
||
719 | { |
||
4506 | cbradney | 720 | if ((!item->imageShown()) || (!item->PicAvail)) |
4360 | cbradney | 721 | { |
722 | if ((item->Frame) && (m_doc->guidesSettings.framesShown)) |
||
723 | { |
||
724 | painter->setPen( ScColorShade(Qt::red, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
725 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height())); |
||
726 | painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0)); |
||
727 | } |
||
728 | } |
||
729 | else |
||
730 | { |
||
731 | ScImage scImg; |
||
732 | ScImage* pImage = NULL; |
||
733 | double imScaleX = item->imageXScale(); |
||
734 | double imScaleY = item->imageYScale(); |
||
735 | if( m_reloadImages ) |
||
736 | { |
||
737 | bool dummy; |
||
4617 | avox | 738 | bool useCmyk = false; |
4751 | cbradney | 739 | ScPainterExBase::ImageMode imageMode = painter->imageMode(); |
740 | if ( imageMode == ScPainterExBase::cmykImages ) |
||
4617 | avox | 741 | useCmyk = true; |
4360 | cbradney | 742 | QFileInfo fInfo(item->Pfile); |
743 | QString ext = fInfo.extension(false); |
||
5959 | jghali | 744 | CMSettings cmsSettings(item->doc(), item->IProfile, item->IRender); |
4360 | cbradney | 745 | scImg.imgInfo.valid = false; |
746 | scImg.imgInfo.clipPath = ""; |
||
747 | scImg.imgInfo.PDSpathData.clear(); |
||
748 | scImg.imgInfo.layerInfo.clear(); |
||
749 | scImg.imgInfo.RequestProps = item->pixm.imgInfo.RequestProps; |
||
750 | scImg.imgInfo.isRequest = item->pixm.imgInfo.isRequest; |
||
5959 | jghali | 751 | scImg.LoadPicture(item->Pfile, cmsSettings, item->UseEmbedded, m_useProfiles, translateImageModeToRequest(imageMode), m_imageRes, &dummy); |
4360 | cbradney | 752 | if( ext == "eps" || ext == "pdf" || ext == "ps" ) |
753 | { |
||
754 | imScaleX *= (72.0 / (double) m_imageRes); |
||
755 | imScaleY *= (72.0 / (double) m_imageRes); |
||
756 | } |
||
4617 | avox | 757 | scImg.applyEffect(item->effectsInUse, m_doc->PageColors, useCmyk); |
4989 | cbradney | 758 | mode = imageMode; |
4360 | cbradney | 759 | pImage = &scImg; |
760 | } |
||
761 | else |
||
762 | pImage = &item->pixm; |
||
763 | |||
764 | painter->save(); |
||
765 | if (item->imageClip.size() != 0) |
||
4751 | cbradney | 766 | { |
4360 | cbradney | 767 | painter->setupPolygon(&item->imageClip); |
4751 | cbradney | 768 | painter->setClipPath(); |
769 | } |
||
770 | painter->setupPolygon(&item->PoLine); |
||
4360 | cbradney | 771 | painter->setClipPath(); |
772 | if (item->imageFlippedH()) |
||
773 | { |
||
774 | painter->translate(item->width() * scale, 0); |
||
775 | painter->scale(-1, 1); |
||
776 | } |
||
777 | if (item->imageFlippedV()) |
||
778 | { |
||
779 | painter->translate(0, item->height() * scale); |
||
780 | painter->scale(1, -1); |
||
781 | } |
||
782 | painter->translate(item->imageXOffset() * item->imageXScale() * scale, item->imageYOffset() * item->imageYScale() * scale); |
||
783 | //painter->translate(item->LocalX * imScaleX * scale, item->LocalY * imScaleY * scale); ?? |
||
784 | painter->scale( imScaleX, imScaleY ); |
||
785 | if (pImage->imgInfo.lowResType != 0) |
||
786 | painter->scale(pImage->imgInfo.lowResScale, pImage->imgInfo.lowResScale); |
||
4989 | cbradney | 787 | painter->drawImage(pImage, mode); |
4360 | cbradney | 788 | painter->restore(); |
789 | } |
||
790 | } |
||
791 | } |
||
792 | |||
793 | void ScPageOutput::DrawItem_Line( PageItem_Line* item, ScPainterExBase* painter ) |
||
794 | { |
||
795 | int startArrowIndex; |
||
796 | int endArrowIndex; |
||
4546 | subik | 797 | |
4360 | cbradney | 798 | startArrowIndex = item->startArrowIndex(); |
799 | endArrowIndex = item->endArrowIndex(); |
||
800 | |||
801 | if (item->NamedLStyle.isEmpty()) |
||
802 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
803 | else |
||
804 | { |
||
805 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
806 | for (int it = ml.size()-1; it > -1; it--) |
||
807 | { |
||
808 | ScColorShade colorShade(m_doc->PageColors[ml[it].Color], ml[it].Shade); |
||
809 | painter->setPen(colorShade, ml[it].Width, |
||
810 | static_cast<Qt::PenStyle>(ml[it].Dash), |
||
811 | static_cast<Qt::PenCapStyle>(ml[it].LineEnd), |
||
812 | static_cast<Qt::PenJoinStyle>(ml[it].LineJoin)); |
||
813 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
814 | } |
||
815 | } |
||
816 | if (startArrowIndex != 0) |
||
817 | { |
||
818 | QWMatrix arrowTrans; |
||
819 | FPointArray arrow = ( *m_doc->arrowStyles.at(startArrowIndex - 1) ).points.copy(); |
||
820 | arrowTrans.translate( 0, 0 ); |
||
821 | arrowTrans.scale( item->lineWidth(), item->lineWidth()); |
||
822 | arrowTrans.scale( -1 , 1 ); |
||
823 | arrow.map( arrowTrans ); |
||
824 | painter->setBrush( painter->pen() ); |
||
825 | painter->setBrushOpacity( 1.0 - item->lineTransparency() ); |
||
826 | painter->setLineWidth( 0 ); |
||
827 | painter->setFillMode(ScPainterExBase::Solid); |
||
828 | painter->setupPolygon( &arrow ); |
||
829 | painter->fillPath(); |
||
830 | } |
||
831 | if (endArrowIndex != 0) |
||
832 | { |
||
833 | QWMatrix arrowTrans; |
||
834 | FPointArray arrow = (*m_doc->arrowStyles.at(endArrowIndex-1) ).points.copy(); |
||
835 | arrowTrans.translate( item->width(), 0 ); |
||
836 | arrowTrans.scale( item->lineWidth(), item->lineWidth()); |
||
837 | arrow.map( arrowTrans ); |
||
838 | painter->setBrush( painter->pen() ); |
||
839 | painter->setBrushOpacity( 1.0 - item->lineTransparency() ); |
||
840 | painter->setLineWidth( 0 ); |
||
841 | painter->setFillMode( ScPainterExBase::Solid ); |
||
842 | painter->setupPolygon( &arrow ); |
||
843 | painter->fillPath(); |
||
844 | } |
||
845 | } |
||
846 | |||
847 | void ScPageOutput::DrawItem_PathText( PageItem_PathText* item, ScPainterExBase* painter, double scale ) |
||
848 | { |
||
5753 | jghali | 849 | int a; |
4360 | cbradney | 850 | int chs; |
851 | double wide; |
||
5721 | avox | 852 | QString chstr, chstr2, chstr3; |
4689 | mrdocs | 853 | ScText *hl; |
4360 | cbradney | 854 | double dx; |
855 | double sp = 0; |
||
856 | double oldSp = 0; |
||
857 | double oCurX = 0; |
||
858 | FPoint point = FPoint(0, 0); |
||
859 | FPoint normal = FPoint(0, 0); |
||
860 | FPoint tangent = FPoint(0, 0); |
||
861 | FPoint extPoint = FPoint(0, 0); |
||
862 | bool ext = false; |
||
863 | bool first = true; |
||
864 | double fsx = 0; |
||
865 | uint seg = 0; |
||
866 | double segLen = 0; |
||
867 | double distCurX; |
||
868 | double CurX = item->textToFrameDistLeft(); // item->CurX = item->textToFrameDistLeft() |
||
869 | double CurY = 0; |
||
4546 | subik | 870 | if (item->lineColor() != CommonStrings::None && item->PoShow) |
4360 | cbradney | 871 | { |
872 | painter->setupPolygon(&item->PoLine, false); |
||
873 | painter->strokePath(); |
||
874 | } |
||
5729 | jghali | 875 | if (item->itemText.length() != 0) |
876 | CurX += item->itemText.item(0)->fontSize() * item->itemText.item(0)->tracking() / 10000.0; |
||
4360 | cbradney | 877 | segLen = item->PoLine.lenPathSeg(seg); |
5729 | jghali | 878 | for (a = 0; a < item->itemText.length(); ++a) |
4360 | cbradney | 879 | { |
880 | CurY = 0; |
||
5729 | jghali | 881 | hl = item->itemText.item(a); |
5721 | avox | 882 | chstr = hl->ch; |
883 | if ((chstr == QChar(30)) || (chstr == QChar(13)) || (chstr == QChar(9)) || (chstr == QChar(28))) |
||
4360 | cbradney | 884 | continue; |
5692 | jghali | 885 | chs = hl->fontSize(); |
5988 | jghali | 886 | //item->SetZeichAttr(*hl, &chs, &chstr); //FIXME: layoutglyphs |
5721 | avox | 887 | if (chstr == QChar(29)) |
888 | chstr2 = " "; |
||
889 | else if (chstr == QChar(24)) |
||
890 | chstr2 = "-"; |
||
4360 | cbradney | 891 | else |
5721 | avox | 892 | chstr2 = chstr; |
5729 | jghali | 893 | if (a < item->itemText.length() - 1) |
4360 | cbradney | 894 | { |
5729 | jghali | 895 | if (item->itemText.item(a+1)->ch == QChar(29)) |
5721 | avox | 896 | chstr3 = " "; |
5729 | jghali | 897 | else if (item->itemText.item(a+1)->ch == QChar(24)) |
5721 | avox | 898 | chstr3 = "-"; |
4360 | cbradney | 899 | else |
5721 | avox | 900 | chstr3 = item->itemText.text(a+1, 1); |
5988 | jghali | 901 | wide = hl->font().charWidth(chstr2[0], chs, chstr3[0]); |
4360 | cbradney | 902 | } |
903 | else |
||
5988 | jghali | 904 | wide = hl->font().charWidth(chstr2[0], chs); |
5692 | jghali | 905 | wide = wide * (hl->scaleH() / 1000.0); |
4360 | cbradney | 906 | dx = wide / 2.0; |
907 | CurX += dx; |
||
908 | ext = false; |
||
909 | while ( (seg < item->PoLine.size()-3) && (CurX > fsx + segLen)) |
||
910 | { |
||
911 | fsx += segLen; |
||
912 | seg += 4; |
||
913 | if (seg > item->PoLine.size()-3) |
||
914 | break; |
||
915 | segLen = item->PoLine.lenPathSeg(seg); |
||
916 | ext = true; |
||
917 | } |
||
918 | if (seg > item->PoLine.size()-3) |
||
919 | break; |
||
920 | if (CurX > fsx + segLen) |
||
921 | break; |
||
922 | if (ext) |
||
923 | { |
||
924 | sp = 0; |
||
925 | distCurX = item->PoLine.lenPathDist(seg, 0, sp); |
||
926 | while (distCurX <= ((CurX - oCurX) - (fsx - oCurX))) |
||
927 | { |
||
928 | sp += 0.001; |
||
929 | distCurX = item->PoLine.lenPathDist(seg, 0, sp); |
||
930 | } |
||
931 | item->PoLine.pointTangentNormalAt(seg, sp, &point, &tangent, &normal ); |
||
932 | CurX = (CurX - (CurX - fsx)) + distCurX; |
||
933 | oldSp = sp; |
||
934 | ext = false; |
||
935 | } |
||
936 | else |
||
937 | { |
||
938 | if( seg < item->PoLine.size()-3 ) |
||
939 | { |
||
940 | if (CurX > fsx + segLen) |
||
941 | break; |
||
942 | distCurX = item->PoLine.lenPathDist(seg, oldSp, sp); |
||
943 | while (distCurX <= (CurX - oCurX)) |
||
944 | { |
||
945 | sp += 0.001; |
||
946 | if (sp >= 1.0) |
||
947 | { |
||
948 | sp = 0.9999; |
||
949 | break; |
||
950 | } |
||
951 | distCurX = item->PoLine.lenPathDist(seg, oldSp, sp); |
||
952 | } |
||
953 | item->PoLine.pointTangentNormalAt(seg, sp, &point, &tangent, &normal ); |
||
954 | CurX = oCurX + distCurX; |
||
955 | oldSp = sp; |
||
956 | } |
||
957 | else |
||
958 | break; |
||
959 | } |
||
5692 | jghali | 960 | hl->glyph.xoffset = point.x(); |
961 | hl->glyph.yoffset = point.y(); |
||
4360 | cbradney | 962 | hl->PtransX = tangent.x(); |
963 | hl->PtransY = tangent.y(); |
||
964 | hl->PRot = dx; |
||
965 | QWMatrix trafo = QWMatrix( 1, 0, 0, -1, -dx * scale, 0 ); |
||
966 | trafo *= QWMatrix( tangent.x(), tangent.y(), tangent.y(), -tangent.x(), point.x() * scale, point.y() * scale); |
||
967 | QWMatrix sca = painter->worldMatrix(); |
||
968 | trafo *= sca; |
||
969 | painter->save(); |
||
970 | QWMatrix savWM = painter->worldMatrix(); |
||
971 | painter->setWorldMatrix(trafo); |
||
5988 | jghali | 972 | //DrawCharacters(item, painter, Zli); |
4360 | cbradney | 973 | painter->setWorldMatrix(savWM); |
974 | painter->restore(); |
||
975 | painter->setZoomFactor(scale); |
||
5580 | jghali | 976 | //item->MaxChars = a+1; |
4360 | cbradney | 977 | oCurX = CurX; |
978 | CurX -= dx; |
||
5692 | jghali | 979 | CurX += wide+hl->fontSize() * hl->tracking() / 10000.0; |
4360 | cbradney | 980 | first = false; |
981 | } |
||
982 | } |
||
983 | |||
984 | void ScPageOutput::DrawItem_Polygon ( PageItem_Polygon* item , ScPainterExBase* painter ) |
||
985 | { |
||
986 | painter->setupPolygon(&item->PoLine); |
||
987 | painter->fillPath(); |
||
988 | } |
||
989 | |||
990 | void ScPageOutput::DrawItem_PolyLine( PageItem_PolyLine* item, ScPainterExBase* painter ) |
||
991 | { |
||
992 | int startArrowIndex; |
||
993 | int endArrowIndex; |
||
4546 | subik | 994 | |
4360 | cbradney | 995 | startArrowIndex = item->startArrowIndex(); |
996 | endArrowIndex = item->endArrowIndex(); |
||
997 | |||
998 | if (item->PoLine.size()>=4) |
||
999 | { |
||
4546 | subik | 1000 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
4360 | cbradney | 1001 | { |
1002 | FPointArray cli; |
||
1003 | FPoint Start; |
||
1004 | bool firstp = true; |
||
1005 | for (uint n = 0; n < item->PoLine.size()-3; n += 4) |
||
1006 | { |
||
1007 | if (firstp) |
||
1008 | { |
||
1009 | Start = item->PoLine.point(n); |
||
1010 | firstp = false; |
||
1011 | } |
||
1012 | if (item->PoLine.point(n).x() > 900000) |
||
1013 | { |
||
1014 | cli.addPoint(item->PoLine.point(n-2)); |
||
1015 | cli.addPoint(item->PoLine.point(n-2)); |
||
1016 | cli.addPoint(Start); |
||
1017 | cli.addPoint(Start); |
||
1018 | cli.setMarker(); |
||
1019 | firstp = true; |
||
1020 | continue; |
||
1021 | } |
||
1022 | cli.addPoint(item->PoLine.point(n)); |
||
1023 | cli.addPoint(item->PoLine.point(n+1)); |
||
1024 | cli.addPoint(item->PoLine.point(n+2)); |
||
1025 | cli.addPoint(item->PoLine.point(n+3)); |
||
1026 | } |
||
1027 | if (cli.size() > 2) |
||
1028 | { |
||
1029 | FPoint l1 = cli.point(cli.size()-2); |
||
1030 | cli.addPoint(l1); |
||
1031 | cli.addPoint(l1); |
||
1032 | cli.addPoint(Start); |
||
1033 | cli.addPoint(Start); |
||
1034 | } |
||
1035 | painter->setupPolygon(&cli); |
||
1036 | painter->fillPath(); |
||
1037 | } |
||
1038 | painter->setupPolygon(&item->PoLine, false); |
||
1039 | if (item->NamedLStyle.isEmpty()) |
||
1040 | painter->strokePath(); |
||
1041 | else |
||
1042 | { |
||
1043 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
1044 | for (int it = ml.size()-1; it > -1; it--) |
||
1045 | { |
||
1046 | ScColorShade tmp(m_doc->PageColors[ml[it].Color], ml[it].Shade); |
||
1047 | painter->setPen(tmp, ml[it].Width, |
||
1048 | static_cast<Qt::PenStyle>(ml[it].Dash), |
||
1049 | static_cast<Qt::PenCapStyle>(ml[it].LineEnd), |
||
1050 | static_cast<Qt::PenJoinStyle>(ml[it].LineJoin)); |
||
1051 | painter->strokePath(); |
||
1052 | } |
||
1053 | } |
||
1054 | if (startArrowIndex != 0) |
||
1055 | { |
||
1056 | FPoint Start = item->PoLine.point(0); |
||
1057 | for (uint xx = 1; xx < item->PoLine.size(); xx += 2) |
||
1058 | { |
||
1059 | FPoint Vector = item->PoLine.point(xx); |
||
1060 | if ((Start.x() != Vector.x()) || (Start.y() != Vector.y())) |
||
1061 | { |
||
1062 | double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI); |
||
1063 | QWMatrix arrowTrans; |
||
1064 | FPointArray arrow = (*m_doc->arrowStyles.at(startArrowIndex-1)).points.copy(); |
||
1065 | arrowTrans.translate(Start.x(), Start.y()); |
||
1066 | arrowTrans.rotate(r); |
||
1067 | arrowTrans.scale(item->lineWidth(), item->lineWidth()); |
||
1068 | arrow.map(arrowTrans); |
||
1069 | painter->setBrush(painter->pen()); |
||
1070 | painter->setBrushOpacity(1.0 - item->lineTransparency()); |
||
1071 | painter->setLineWidth(0); |
||
1072 | painter->setFillMode(ScPainterExBase::Solid); |
||
1073 | painter->setupPolygon(&arrow); |
||
1074 | painter->fillPath(); |
||
1075 | break; |
||
1076 | } |
||
1077 | } |
||
1078 | } |
||
1079 | if (endArrowIndex != 0) |
||
1080 | { |
||
1081 | FPoint End = item->PoLine.point(item->PoLine.size()-2); |
||
1082 | for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2) |
||
1083 | { |
||
1084 | FPoint Vector = item->PoLine.point(xx); |
||
1085 | if ((End.x() != Vector.x()) || (End.y() != Vector.y())) |
||
1086 | { |
||
1087 | double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI); |
||
1088 | QWMatrix arrowTrans; |
||
1089 | FPointArray arrow = (*m_doc->arrowStyles.at(endArrowIndex-1)).points.copy(); |
||
1090 | arrowTrans.translate(End.x(), End.y()); |
||
1091 | arrowTrans.rotate(r); |
||
1092 | arrowTrans.scale( item->lineWidth(), item->lineWidth() ); |
||
1093 | arrow.map(arrowTrans); |
||
1094 | painter->setBrush(painter->pen()); |
||
1095 | painter->setBrushOpacity(1.0 - item->lineTransparency()); |
||
1096 | painter->setLineWidth(0); |
||
1097 | painter->setFillMode(ScPainterExBase::Solid); |
||
1098 | painter->setupPolygon(&arrow); |
||
1099 | painter->fillPath(); |
||
1100 | break; |
||
1101 | } |
||
1102 | } |
||
1103 | } |
||
1104 | } |
||
1105 | } |
||
1106 | |||
1107 | void ScPageOutput::DrawItem_TextFrame( PageItem_TextFrame* item, ScPainterExBase* painter, QRect e, double scale ) |
||
1108 | { |
||
5580 | jghali | 1109 | QWMatrix wm; |
1110 | QPoint pt1, pt2; |
||
1111 | FPoint ColBound; |
||
1112 | QRegion cm; |
||
5753 | jghali | 1113 | int a; |
5988 | jghali | 1114 | int CurrCol; |
1115 | double wide, lineCorr, ColWidth; |
||
5721 | avox | 1116 | QString chstr, chstr2, chstr3; |
5580 | jghali | 1117 | ScText *hl; |
4360 | cbradney | 1118 | |
5580 | jghali | 1119 | bool outs = false; |
1120 | bool fBorder = false; |
||
1121 | bool RTab = false; |
||
1122 | bool goNoRoom = false; |
||
1123 | bool goNextColumn = false; |
||
1124 | int TabCode = 0; |
||
1125 | int HyphenCount = 0; |
||
1126 | QValueList<ParagraphStyle::TabRecord> tTabValues; |
||
1127 | bool DropCmode = false; |
||
1128 | bool AbsHasDrop = false; |
||
1129 | double desc, asce, tabDist; |
||
1130 | bool StartOfCol = true; |
||
1131 | tTabValues.clear(); |
||
4360 | cbradney | 1132 | |
5580 | jghali | 1133 | QRect e2 = QRect(qRound(e.x() / scale + m_doc->minCanvasCoordinate.x()), qRound(e.y() / scale + m_doc->minCanvasCoordinate.y()), qRound(e.width() / scale), qRound(e.height() / scale)); |
1134 | painter->save(); |
||
1135 | wm.translate(item->xPos(), item->yPos()); |
||
1136 | wm.rotate(item->rotation()); |
||
1137 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
||
1138 | { |
||
1139 | painter->setupPolygon(&item->PoLine); |
||
1140 | painter->fillPath(); |
||
1141 | } |
||
1142 | if (item->lineColor() != CommonStrings::None) |
||
1143 | lineCorr = item->lineWidth() / 2.0; |
||
1144 | else |
||
1145 | lineCorr = 0; |
||
1146 | if ((item->isAnnotation()) && (item->annotation().Type() == 2) && (!item->Pfile.isEmpty()) && (item->PicAvail) && (item->imageShown()) && (item->annotation().UseIcons())) |
||
1147 | { |
||
1148 | painter->setupPolygon(&item->PoLine); |
||
1149 | painter->setClipPath(); |
||
1150 | painter->save(); |
||
1151 | painter->scale(item->imageXScale(), item->imageYScale()); |
||
1152 | painter->translate(static_cast<int>(item->imageXOffset() * item->imageXScale()), static_cast<int>(item->imageYOffset() * item->imageYScale())); |
||
5599 | jghali | 1153 | if (!item->pixm.qImage().isNull()) |
5580 | jghali | 1154 | painter->drawImage(&item->pixm, ScPainterExBase::rgbImages); |
1155 | painter->restore(); |
||
1156 | } |
||
5729 | jghali | 1157 | if ((item->itemText.length() != 0)) |
5580 | jghali | 1158 | { |
1159 | if (item->imageFlippedH()) |
||
1160 | { |
||
1161 | painter->translate(item->width() * scale, 0); |
||
1162 | painter->scale(-1, 1); |
||
1163 | } |
||
1164 | if (item->imageFlippedV()) |
||
1165 | { |
||
1166 | painter->translate(0, item->height() * scale); |
||
1167 | painter->scale(1, -1); |
||
1168 | } |
||
1169 | CurrCol = 0; |
||
1170 | ColWidth = item->columnWidth(); |
||
1171 | ColBound = FPoint((ColWidth + item->ColGap) * CurrCol + item->textToFrameDistLeft() + lineCorr, ColWidth * (CurrCol+1) + item->ColGap * CurrCol + item->textToFrameDistLeft()+lineCorr); |
||
1172 | ColBound = FPoint(ColBound.x(), ColBound.y() + item->textToFrameDistRight() + lineCorr); |
||
1173 | tabDist = ColBound.x(); |
||
1174 | uint tabCc = 0; |
||
5729 | jghali | 1175 | for (a = 0; a <= item->lastInFrame(); ++a) |
5580 | jghali | 1176 | { |
5721 | avox | 1177 | hl = item->itemText.item(a); |
5729 | jghali | 1178 | const CharStyle& charStyle = item->itemText.charStyle(a); |
1179 | const ParagraphStyle& style = item->itemText.paragraphStyle(a); |
||
1180 | tTabValues = style.tabValues(); |
||
5988 | jghali | 1181 | double chs = charStyle.fontSize() * hl->glyph.scaleV; |
1182 | bool selected = item->itemText.selected(a); |
||
5729 | jghali | 1183 | if (charStyle.effects() & ScStyle_StartOfLine) |
5580 | jghali | 1184 | tabCc = 0; |
5721 | avox | 1185 | chstr = hl->ch; |
5692 | jghali | 1186 | if (hl->glyph.yoffset == 0) |
5580 | jghali | 1187 | continue; |
1188 | if (hl->ch == QChar(30)) |
||
5721 | avox | 1189 | chstr = item->ExpandToken(a); |
5729 | jghali | 1190 | if (charStyle.fillColor() != CommonStrings::None) |
4360 | cbradney | 1191 | { |
5692 | jghali | 1192 | ScColorShade tmp(m_doc->PageColors[hl->fillColor()], hl->fillShade()); |
5580 | jghali | 1193 | painter->setBrush(tmp); |
4360 | cbradney | 1194 | } |
5729 | jghali | 1195 | if (charStyle.strokeColor() != CommonStrings::None) |
4360 | cbradney | 1196 | { |
5692 | jghali | 1197 | ScColorShade tmp(m_doc->PageColors[hl->strokeColor()], hl->strokeShade()); |
5580 | jghali | 1198 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
4360 | cbradney | 1199 | } |
5692 | jghali | 1200 | chs = hl->fontSize(); |
5729 | jghali | 1201 | if (charStyle.effects() & ScStyle_DropCap) |
4360 | cbradney | 1202 | { |
5729 | jghali | 1203 | if (style.useBaselineGrid()) |
5988 | jghali | 1204 | chs = qRound(10 * ((m_doc->typographicSettings.valueBaseGrid * (style.dropCapLines()-1) + (charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10))); |
5580 | jghali | 1205 | else |
4360 | cbradney | 1206 | { |
5988 | jghali | 1207 | if (style.lineSpacingMode() == ParagraphStyle::FixedLineSpacing) |
1208 | chs = qRound(10 * ((style.lineSpacing() * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10))); |
||
5580 | jghali | 1209 | else |
1210 | { |
||
5988 | jghali | 1211 | double currasce = charStyle.font().height(style.charStyle().fontSize() / 10.0); |
1212 | chs = qRound(10 * ((currasce * (style.dropCapLines()-1)+(charStyle.font().ascent(style.charStyle().fontSize() / 10.0))) / charStyle.font().realCharHeight(chstr[0], 10))); |
||
5580 | jghali | 1213 | } |
4360 | cbradney | 1214 | } |
5580 | jghali | 1215 | } |
5721 | avox | 1216 | if ((chstr == SpecialChars::TAB) && (tTabValues.count() != 0) && (tabCc < tTabValues.count()) && (!tTabValues[tabCc].tabFillChar.isNull())) |
5580 | jghali | 1217 | { |
5988 | jghali | 1218 | QChar tabFillChar(tTabValues[tabCc].tabFillChar); |
1219 | double wt = charStyle.font().charWidth(tabFillChar, chs / 10.0); |
||
5692 | jghali | 1220 | int coun = static_cast<int>((hl->glyph.xoffset - tabDist) / wt); |
1221 | double sPos = hl->glyph.xoffset - (hl->glyph.xoffset - tabDist) + 1; |
||
5988 | jghali | 1222 | desc = -charStyle.font().descent(chs / 10.0); |
1223 | asce = charStyle.font().ascent(chs / 10.0); |
||
1224 | GlyphLayout tglyph; |
||
1225 | tglyph.glyph = tabFillChar.unicode(); |
||
1226 | tglyph.yoffset = hl->glyph.yoffset; |
||
1227 | tglyph.scaleV = tglyph.scaleH = chs / charStyle.fontSize(); |
||
1228 | tglyph.xadvance = wt; |
||
5580 | jghali | 1229 | for (int cx = 0; cx < coun; ++cx) |
4360 | cbradney | 1230 | { |
5988 | jghali | 1231 | tglyph.xoffset = sPos + wt * cx; |
1232 | if (e2.intersects(wm.mapRect(QRect(qRound(tglyph.xoffset),qRound(tglyph.yoffset-asce), qRound(tglyph.xadvance+1), qRound(asce+desc))))) |
||
1233 | DrawGlyphs(item, painter, charStyle, tglyph); |
||
4360 | cbradney | 1234 | } |
5580 | jghali | 1235 | } |
5721 | avox | 1236 | if (chstr == SpecialChars::TAB) |
5580 | jghali | 1237 | tabCc++; |
1238 | //if (!m_doc->RePos) |
||
1239 | { |
||
5988 | jghali | 1240 | double xcoZli = hl->glyph.xoffset; |
1241 | desc = - charStyle.font().descent(charStyle.fontSize() / 10.0); |
||
1242 | asce = charStyle.font().ascent(charStyle.fontSize() / 10.0); |
||
1243 | if (((selected && item->isSelected()) || (((item->NextBox != 0) || (item->BackBox != 0)) && selected)) && (m_doc->appMode == modeEdit)) |
||
4360 | cbradney | 1244 | { |
5988 | jghali | 1245 | wide = hl->glyph.xadvance; |
5580 | jghali | 1246 | painter->setFillMode(1); |
1247 | //paintersetBrush( ScColorShade( Qt::darkBlue, 100) ); |
||
1248 | painter->setBrush( ScColorShade(qApp->palette().color(QPalette::Active, QColorGroup::Highlight), 100) ); |
||
1249 | painter->setLineWidth(0); |
||
5988 | jghali | 1250 | if ((a > 0) && (QChar(hl->glyph.glyph) == SpecialChars::TAB)) |
4360 | cbradney | 1251 | { |
5988 | jghali | 1252 | xcoZli = item->itemText.item(a-1)->glyph.xoffset + item->itemText.charStyle(a-1).font().charWidth(item->itemText.text(a-1), item->itemText.charStyle(a-1).fontSize() / 10.0); |
1253 | wide = hl->glyph.xoffset - xcoZli + hl->glyph.xadvance; |
||
4360 | cbradney | 1254 | } |
5580 | jghali | 1255 | //if (!m_doc->RePos) |
5988 | jghali | 1256 | painter->drawRect(xcoZli, qRound(hl->glyph.yoffset - asce * hl->glyph.scaleV), wide+1, qRound((asce+desc) * (hl->glyph.scaleV))); |
5580 | jghali | 1257 | //painter->setBrush(ScColorShade(Qt::white, 100)); |
1258 | painter->setBrush(ScColorShade(qApp->palette().color(QPalette::Active, QColorGroup::HighlightedText), 100)); |
||
1259 | } |
||
5988 | jghali | 1260 | if (charStyle.strokeColor() != CommonStrings::None) |
5580 | jghali | 1261 | { |
5988 | jghali | 1262 | ScColorShade tmp(charStyle.strokeColor(), charStyle.strokeShade()); |
5580 | jghali | 1263 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
1264 | } |
||
5988 | jghali | 1265 | if (e2.intersects(wm.mapRect(QRect(qRound(hl->glyph.xoffset),qRound(hl->glyph.yoffset-asce), qRound(hl->glyph.xadvance+1), qRound(asce+desc))))) |
5580 | jghali | 1266 | { |
5988 | jghali | 1267 | if (hl->ch[0] == QChar(25)) |
1268 | DrawItem_Embedded(item, painter, e, charStyle, hl->cembedded); |
||
5580 | jghali | 1269 | else |
5988 | jghali | 1270 | DrawGlyphs(item, painter, charStyle, hl->glyph); |
5580 | jghali | 1271 | } |
4360 | cbradney | 1272 | } |
5988 | jghali | 1273 | tabDist = hl->glyph.xoffset + hl->glyph.xadvance; |
4360 | cbradney | 1274 | } |
5580 | jghali | 1275 | //painter->restore(); |
4360 | cbradney | 1276 | } |
5580 | jghali | 1277 | painter->restore(); |
4360 | cbradney | 1278 | } |
1279 | |||
1280 |