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