Rev 5273 | Rev 5372 | 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(); |
||
422 | if (hl->ZFo->CharWidth.contains(chr)) |
||
423 | { |
||
424 | QWMatrix chma, chma2, chma3, chma4, chma5, chma6; |
||
425 | chma.scale(csi, csi); |
||
426 | chma5.scale(painter->zoomFactor(), painter->zoomFactor()); |
||
427 | FPointArray gly = hl->ZFo->GlyphArray[chr].Outlines.copy(); |
||
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); |
||
446 | if ((hl->ZFo->isStroked) && ((hl->Siz * hl->outline / 10000.0) != 0)) |
||
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) |
||
482 | st = (hl->strikepos / 1000.0) * (hl->ZFo->numAscent * (hl->realSiz / 10.0)); |
||
483 | else |
||
484 | st = hl->ZFo->strikeout_pos * (hl->realSiz / 10.0); |
||
485 | if (hl->strikewidth != -1) |
||
486 | lw = (hl->strikewidth / 1000.0) * (hl->realSiz / 10.0); |
||
487 | else |
||
488 | lw = QMAX(hl->ZFo->strokeWidth * (hl->realSiz / 10.0), 1); |
||
489 | } |
||
490 | else |
||
491 | { |
||
492 | st = hl->ZFo->strikeout_pos * (hl->realSiz / 10.0); |
||
493 | lw = QMAX(hl->ZFo->strokeWidth * (hl->realSiz / 10.0), 1); |
||
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) |
||
507 | st = (hl->underpos / 1000.0) * (hl->ZFo->numDescender * (hl->realSiz / 10.0)); |
||
508 | else |
||
509 | st = hl->ZFo->underline_pos * (hl->realSiz / 10.0); |
||
510 | if (hl->underwidth != -1) |
||
511 | lw = (hl->underwidth / 1000.0) * (hl->realSiz / 10.0); |
||
512 | else |
||
513 | lw = QMAX(hl->ZFo->strokeWidth * (hl->realSiz / 10.0), 1); |
||
514 | } |
||
515 | else |
||
516 | { |
||
517 | st = hl->ZFo->underline_pos * (hl->realSiz / 10.0); |
||
518 | lw = QMAX(hl->ZFo->strokeWidth * (hl->realSiz / 10.0), 1); |
||
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->Redrawn = true; |
||
547 | hl->embedded->Tinput = false; |
||
548 | hl->embedded->FrameOnly = false; |
||
549 | return; |
||
550 | } |
||
551 | emG.append(hl->embedded); |
||
552 | if (hl->embedded->Groups.count() != 0) |
||
553 | { |
||
554 | for (uint ga=0; ga<m_doc->FrameItems.count(); ++ga) |
||
555 | { |
||
556 | if (m_doc->FrameItems.at(ga)->Groups.count() != 0) |
||
557 | { |
||
558 | if (m_doc->FrameItems.at(ga)->Groups.top() == hl->embedded->Groups.top()) |
||
559 | { |
||
560 | if (m_doc->FrameItems.at(ga)->ItemNr != hl->embedded->ItemNr) |
||
561 | { |
||
562 | if (emG.find(m_doc->FrameItems.at(ga)) == -1) |
||
563 | emG.append(m_doc->FrameItems.at(ga)); |
||
564 | } |
||
565 | } |
||
566 | } |
||
567 | } |
||
568 | } |
||
569 | for (uint em = 0; em < emG.count(); ++em) |
||
570 | { |
||
571 | PageItem* embedded = emG.at(em); |
||
5212 | mrdocs | 572 | ParagraphStyle vg; |
4360 | cbradney | 573 | QValueList<ParagraphStyle> savedParagraphStyles; |
574 | for (int xxx=0; xxx<5; ++xxx) |
||
575 | { |
||
5212 | mrdocs | 576 | vg.setLineSpacingMode( (ParagraphStyle::LineSpacingMode) m_doc->docParagraphStyles[xxx].lineSpacingMode() ); |
577 | vg.setUseBaselineGrid( m_doc->docParagraphStyles[xxx].useBaselineGrid() ); |
||
578 | vg.setLineSpacing( m_doc->docParagraphStyles[xxx].lineSpacing() ); |
||
579 | vg.charStyle().csize = m_doc->docParagraphStyles[xxx].charStyle().csize; |
||
580 | vg.setLeftMargin( m_doc->docParagraphStyles[xxx].leftMargin() ); |
||
581 | vg.setFirstIndent( m_doc->docParagraphStyles[xxx].firstIndent()); |
||
582 | vg.setGapBefore( m_doc->docParagraphStyles[xxx].gapBefore() ); |
||
583 | vg.setGapAfter( m_doc->docParagraphStyles[xxx].gapAfter() ); |
||
4360 | cbradney | 584 | savedParagraphStyles.append(vg); |
585 | } |
||
586 | p->save(); |
||
587 | embedded->setXPos(embedded->xPos() + hl->xco + embedded->gXpos); |
||
588 | embedded->setYPos(embedded->yPos() + (hl->yco - (embedded->gHeight * (hl->scalev / 1000.0))) + embedded->gYpos); |
||
589 | 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()); |
||
590 | if (hl->base != 0) |
||
591 | { |
||
592 | p->translate(0, -embedded->gHeight * (hl->base / 1000.0) * p->zoomFactor()); |
||
593 | embedded->setYPos(embedded->yPos() - embedded->gHeight * (hl->base / 1000.0)); |
||
594 | } |
||
595 | p->scale(hl->scale / 1000.0, hl->scalev / 1000.0); |
||
596 | //embedded->Dirty = Dirty; |
||
597 | double sc = 1; |
||
4617 | avox | 598 | double pws = embedded->lineWidth(); |
4360 | cbradney | 599 | DrawItem_Pre(embedded, p, sc); |
600 | switch(embedded->itemType()) |
||
601 | { |
||
602 | case PageItem::ImageFrame: |
||
603 | DrawItem_ImageFrame((PageItem_ImageFrame*) embedded, p, sc); |
||
604 | break; |
||
605 | case PageItem::TextFrame: |
||
606 | DrawItem_TextFrame((PageItem_TextFrame*) embedded, p, e, sc); |
||
607 | break; |
||
608 | case PageItem::Line: |
||
4617 | avox | 609 | embedded->setLineWidth(pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0)); |
4360 | cbradney | 610 | DrawItem_Line((PageItem_Line*) embedded, p); |
611 | break; |
||
612 | case PageItem::Polygon: |
||
613 | DrawItem_Polygon((PageItem_Polygon*) embedded, p); |
||
614 | break; |
||
615 | case PageItem::PolyLine: |
||
4617 | avox | 616 | embedded->setLineWidth(pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0)); |
4360 | cbradney | 617 | DrawItem_PolyLine((PageItem_PolyLine*) embedded, p); |
618 | break; |
||
619 | case PageItem::PathText: |
||
620 | DrawItem_PathText( (PageItem_PathText*) embedded, p, sc); |
||
621 | break; |
||
622 | default: |
||
623 | break; |
||
624 | } |
||
4617 | avox | 625 | embedded->setLineWidth(pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0)); |
4360 | cbradney | 626 | DrawItem_Post(embedded, p); |
627 | p->restore(); |
||
4617 | avox | 628 | embedded->setLineWidth(pws); |
4360 | cbradney | 629 | for (int xxx=0; xxx<5; ++xxx) |
630 | { |
||
5212 | mrdocs | 631 | m_doc->docParagraphStyles[xxx].setLineSpacingMode( (ParagraphStyle::LineSpacingMode) savedParagraphStyles[xxx].lineSpacingMode() ); |
632 | m_doc->docParagraphStyles[xxx].setUseBaselineGrid( savedParagraphStyles[xxx].useBaselineGrid() ); |
||
633 | m_doc->docParagraphStyles[xxx].setLineSpacing( savedParagraphStyles[xxx].lineSpacing() ); |
||
634 | m_doc->docParagraphStyles[xxx].charStyle().csize = savedParagraphStyles[xxx].charStyle().csize; |
||
635 | m_doc->docParagraphStyles[xxx].setLeftMargin( savedParagraphStyles[xxx].leftMargin() ); |
||
636 | m_doc->docParagraphStyles[xxx].setFirstIndent( savedParagraphStyles[xxx].firstIndent() ); |
||
637 | m_doc->docParagraphStyles[xxx].setGapBefore( savedParagraphStyles[xxx].gapBefore() ); |
||
638 | m_doc->docParagraphStyles[xxx].setGapAfter( savedParagraphStyles[xxx].gapAfter() ); |
||
4360 | cbradney | 639 | } |
640 | savedParagraphStyles.clear(); |
||
641 | } |
||
642 | } |
||
643 | } |
||
644 | |||
645 | void ScPageOutput::DrawItem_ImageFrame( PageItem_ImageFrame* item, ScPainterExBase* painter, double scale ) |
||
646 | { |
||
4989 | cbradney | 647 | ScPainterExBase::ImageMode mode = ScPainterExBase::rgbImages; |
4546 | subik | 648 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
4360 | cbradney | 649 | { |
650 | painter->setupPolygon(&item->PoLine); |
||
651 | painter->fillPath(); |
||
652 | } |
||
653 | if (item->Pfile.isEmpty()) |
||
654 | { |
||
655 | if ((item->Frame) && (m_doc->guidesSettings.framesShown)) |
||
656 | { |
||
657 | painter->setPen( ScColorShade(Qt::black, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
658 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height())); |
||
659 | painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0)); |
||
660 | } |
||
661 | } |
||
662 | else |
||
663 | { |
||
4506 | cbradney | 664 | if ((!item->imageShown()) || (!item->PicAvail)) |
4360 | cbradney | 665 | { |
666 | if ((item->Frame) && (m_doc->guidesSettings.framesShown)) |
||
667 | { |
||
668 | painter->setPen( ScColorShade(Qt::red, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
669 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height())); |
||
670 | painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0)); |
||
671 | } |
||
672 | } |
||
673 | else |
||
674 | { |
||
675 | ScImage scImg; |
||
676 | ScImage* pImage = NULL; |
||
677 | double imScaleX = item->imageXScale(); |
||
678 | double imScaleY = item->imageYScale(); |
||
679 | if( m_reloadImages ) |
||
680 | { |
||
681 | bool dummy; |
||
4617 | avox | 682 | bool useCmyk = false; |
4751 | cbradney | 683 | ScPainterExBase::ImageMode imageMode = painter->imageMode(); |
684 | if ( imageMode == ScPainterExBase::cmykImages ) |
||
4617 | avox | 685 | useCmyk = true; |
4360 | cbradney | 686 | QFileInfo fInfo(item->Pfile); |
687 | QString ext = fInfo.extension(false); |
||
688 | scImg.imgInfo.valid = false; |
||
689 | scImg.imgInfo.clipPath = ""; |
||
690 | scImg.imgInfo.PDSpathData.clear(); |
||
691 | scImg.imgInfo.layerInfo.clear(); |
||
692 | scImg.imgInfo.RequestProps = item->pixm.imgInfo.RequestProps; |
||
693 | scImg.imgInfo.isRequest = item->pixm.imgInfo.isRequest; |
||
5345 | mrdocs | 694 | scImg.LoadPicture(item->Pfile, item->IProfile, 0, item->UseEmbedded, m_useProfiles, translateImageModeToRequest(imageMode), m_imageRes, &dummy); |
4360 | cbradney | 695 | if( ext == "eps" || ext == "pdf" || ext == "ps" ) |
696 | { |
||
697 | imScaleX *= (72.0 / (double) m_imageRes); |
||
698 | imScaleY *= (72.0 / (double) m_imageRes); |
||
699 | } |
||
4617 | avox | 700 | scImg.applyEffect(item->effectsInUse, m_doc->PageColors, useCmyk); |
4989 | cbradney | 701 | mode = imageMode; |
4360 | cbradney | 702 | pImage = &scImg; |
703 | } |
||
704 | else |
||
705 | pImage = &item->pixm; |
||
706 | |||
707 | painter->save(); |
||
708 | if (item->imageClip.size() != 0) |
||
4751 | cbradney | 709 | { |
4360 | cbradney | 710 | painter->setupPolygon(&item->imageClip); |
4751 | cbradney | 711 | painter->setClipPath(); |
712 | } |
||
713 | painter->setupPolygon(&item->PoLine); |
||
4360 | cbradney | 714 | painter->setClipPath(); |
715 | if (item->imageFlippedH()) |
||
716 | { |
||
717 | painter->translate(item->width() * scale, 0); |
||
718 | painter->scale(-1, 1); |
||
719 | } |
||
720 | if (item->imageFlippedV()) |
||
721 | { |
||
722 | painter->translate(0, item->height() * scale); |
||
723 | painter->scale(1, -1); |
||
724 | } |
||
725 | painter->translate(item->imageXOffset() * item->imageXScale() * scale, item->imageYOffset() * item->imageYScale() * scale); |
||
726 | //painter->translate(item->LocalX * imScaleX * scale, item->LocalY * imScaleY * scale); ?? |
||
727 | painter->scale( imScaleX, imScaleY ); |
||
728 | if (pImage->imgInfo.lowResType != 0) |
||
729 | painter->scale(pImage->imgInfo.lowResScale, pImage->imgInfo.lowResScale); |
||
4989 | cbradney | 730 | painter->drawImage(pImage, mode); |
4360 | cbradney | 731 | painter->restore(); |
732 | } |
||
733 | } |
||
734 | } |
||
735 | |||
736 | void ScPageOutput::DrawItem_Line( PageItem_Line* item, ScPainterExBase* painter ) |
||
737 | { |
||
738 | int startArrowIndex; |
||
739 | int endArrowIndex; |
||
4546 | subik | 740 | |
4360 | cbradney | 741 | startArrowIndex = item->startArrowIndex(); |
742 | endArrowIndex = item->endArrowIndex(); |
||
743 | |||
744 | if (item->NamedLStyle.isEmpty()) |
||
745 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
746 | else |
||
747 | { |
||
748 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
749 | for (int it = ml.size()-1; it > -1; it--) |
||
750 | { |
||
751 | ScColorShade colorShade(m_doc->PageColors[ml[it].Color], ml[it].Shade); |
||
752 | painter->setPen(colorShade, ml[it].Width, |
||
753 | static_cast<Qt::PenStyle>(ml[it].Dash), |
||
754 | static_cast<Qt::PenCapStyle>(ml[it].LineEnd), |
||
755 | static_cast<Qt::PenJoinStyle>(ml[it].LineJoin)); |
||
756 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
757 | } |
||
758 | } |
||
759 | if (startArrowIndex != 0) |
||
760 | { |
||
761 | QWMatrix arrowTrans; |
||
762 | FPointArray arrow = ( *m_doc->arrowStyles.at(startArrowIndex - 1) ).points.copy(); |
||
763 | arrowTrans.translate( 0, 0 ); |
||
764 | arrowTrans.scale( item->lineWidth(), item->lineWidth()); |
||
765 | arrowTrans.scale( -1 , 1 ); |
||
766 | arrow.map( arrowTrans ); |
||
767 | painter->setBrush( painter->pen() ); |
||
768 | painter->setBrushOpacity( 1.0 - item->lineTransparency() ); |
||
769 | painter->setLineWidth( 0 ); |
||
770 | painter->setFillMode(ScPainterExBase::Solid); |
||
771 | painter->setupPolygon( &arrow ); |
||
772 | painter->fillPath(); |
||
773 | } |
||
774 | if (endArrowIndex != 0) |
||
775 | { |
||
776 | QWMatrix arrowTrans; |
||
777 | FPointArray arrow = (*m_doc->arrowStyles.at(endArrowIndex-1) ).points.copy(); |
||
778 | arrowTrans.translate( item->width(), 0 ); |
||
779 | arrowTrans.scale( item->lineWidth(), item->lineWidth()); |
||
780 | arrow.map( arrowTrans ); |
||
781 | painter->setBrush( painter->pen() ); |
||
782 | painter->setBrushOpacity( 1.0 - item->lineTransparency() ); |
||
783 | painter->setLineWidth( 0 ); |
||
784 | painter->setFillMode( ScPainterExBase::Solid ); |
||
785 | painter->setupPolygon( &arrow ); |
||
786 | painter->fillPath(); |
||
787 | } |
||
788 | } |
||
789 | |||
790 | void ScPageOutput::DrawItem_PathText( PageItem_PathText* item, ScPainterExBase* painter, double scale ) |
||
791 | { |
||
792 | uint a; |
||
793 | int chs; |
||
794 | double wide; |
||
795 | QString chx, chx2, chx3; |
||
4689 | mrdocs | 796 | ScText *hl; |
4360 | cbradney | 797 | struct PageItem::ZZ *Zli; |
798 | double dx; |
||
799 | double sp = 0; |
||
800 | double oldSp = 0; |
||
801 | double oCurX = 0; |
||
802 | FPoint point = FPoint(0, 0); |
||
803 | FPoint normal = FPoint(0, 0); |
||
804 | FPoint tangent = FPoint(0, 0); |
||
805 | FPoint extPoint = FPoint(0, 0); |
||
806 | bool ext = false; |
||
807 | bool first = true; |
||
808 | double fsx = 0; |
||
809 | uint seg = 0; |
||
810 | double segLen = 0; |
||
811 | double distCurX; |
||
812 | double CurX = item->textToFrameDistLeft(); // item->CurX = item->textToFrameDistLeft() |
||
813 | double CurY = 0; |
||
4546 | subik | 814 | if (item->lineColor() != CommonStrings::None && item->PoShow) |
4360 | cbradney | 815 | { |
816 | painter->setupPolygon(&item->PoLine, false); |
||
817 | painter->strokePath(); |
||
818 | } |
||
819 | if (item->itemText.count() != 0) |
||
820 | CurX += item->itemText.at(0)->csize * item->itemText.at(0)->cextra / 10000.0; |
||
821 | segLen = item->PoLine.lenPathSeg(seg); |
||
822 | for (a = 0; a < item->itemText.count(); ++a) |
||
823 | { |
||
824 | CurY = 0; |
||
825 | hl = item->itemText.at(a); |
||
826 | chx = hl->ch; |
||
827 | if ((chx == QChar(30)) || (chx == QChar(13)) || (chx == QChar(9)) || (chx == QChar(28))) |
||
828 | continue; |
||
829 | chs = hl->csize; |
||
5345 | mrdocs | 830 | item->SetZeichAttr(*hl, &chs, &chx); |
4360 | cbradney | 831 | if (chx == QChar(29)) |
832 | chx2 = " "; |
||
833 | else if (chx == QChar(24)) |
||
834 | chx2 = "-"; |
||
835 | else |
||
836 | chx2 = chx; |
||
837 | if (a < item->itemText.count()-1) |
||
838 | { |
||
839 | if (item->itemText.at(a+1)->ch == QChar(29)) |
||
840 | chx3 = " "; |
||
841 | else if (item->itemText.at(a+1)->ch == QChar(24)) |
||
842 | chx3 = "-"; |
||
843 | else |
||
844 | chx3 = item->itemText.at(a+1)->ch; |
||
845 | wide = Cwidth(m_doc, hl->cfont, chx2, chs, chx3); |
||
846 | } |
||
847 | else |
||
848 | wide = Cwidth(m_doc, hl->cfont, chx2, chs); |
||
849 | wide = wide * (hl->cscale / 1000.0); |
||
850 | dx = wide / 2.0; |
||
851 | CurX += dx; |
||
852 | ext = false; |
||
853 | while ( (seg < item->PoLine.size()-3) && (CurX > fsx + segLen)) |
||
854 | { |
||
855 | fsx += segLen; |
||
856 | seg += 4; |
||
857 | if (seg > item->PoLine.size()-3) |
||
858 | break; |
||
859 | segLen = item->PoLine.lenPathSeg(seg); |
||
860 | ext = true; |
||
861 | } |
||
862 | if (seg > item->PoLine.size()-3) |
||
863 | break; |
||
864 | if (CurX > fsx + segLen) |
||
865 | break; |
||
866 | if (ext) |
||
867 | { |
||
868 | sp = 0; |
||
869 | distCurX = item->PoLine.lenPathDist(seg, 0, sp); |
||
870 | while (distCurX <= ((CurX - oCurX) - (fsx - oCurX))) |
||
871 | { |
||
872 | sp += 0.001; |
||
873 | distCurX = item->PoLine.lenPathDist(seg, 0, sp); |
||
874 | } |
||
875 | item->PoLine.pointTangentNormalAt(seg, sp, &point, &tangent, &normal ); |
||
876 | CurX = (CurX - (CurX - fsx)) + distCurX; |
||
877 | oldSp = sp; |
||
878 | ext = false; |
||
879 | } |
||
880 | else |
||
881 | { |
||
882 | if( seg < item->PoLine.size()-3 ) |
||
883 | { |
||
884 | if (CurX > fsx + segLen) |
||
885 | break; |
||
886 | distCurX = item->PoLine.lenPathDist(seg, oldSp, sp); |
||
887 | while (distCurX <= (CurX - oCurX)) |
||
888 | { |
||
889 | sp += 0.001; |
||
890 | if (sp >= 1.0) |
||
891 | { |
||
892 | sp = 0.9999; |
||
893 | break; |
||
894 | } |
||
895 | distCurX = item->PoLine.lenPathDist(seg, oldSp, sp); |
||
896 | } |
||
897 | item->PoLine.pointTangentNormalAt(seg, sp, &point, &tangent, &normal ); |
||
898 | CurX = oCurX + distCurX; |
||
899 | oldSp = sp; |
||
900 | } |
||
901 | else |
||
902 | break; |
||
903 | } |
||
904 | hl->xp = point.x(); |
||
905 | hl->yp = point.y(); |
||
906 | hl->PtransX = tangent.x(); |
||
907 | hl->PtransY = tangent.y(); |
||
908 | hl->PRot = dx; |
||
909 | QWMatrix trafo = QWMatrix( 1, 0, 0, -1, -dx * scale, 0 ); |
||
910 | trafo *= QWMatrix( tangent.x(), tangent.y(), tangent.y(), -tangent.x(), point.x() * scale, point.y() * scale); |
||
911 | QWMatrix sca = painter->worldMatrix(); |
||
912 | trafo *= sca; |
||
913 | painter->save(); |
||
914 | QWMatrix savWM = painter->worldMatrix(); |
||
915 | painter->setWorldMatrix(trafo); |
||
916 | Zli = new PageItem::ZZ; |
||
917 | Zli->Zeich = chx; |
||
4546 | subik | 918 | if (hl->ccolor != CommonStrings::None) |
4360 | cbradney | 919 | { |
920 | ScColorShade tmp(m_doc->PageColors[hl->ccolor], hl->cshade); |
||
921 | painter->setBrush(tmp); |
||
922 | } |
||
4546 | subik | 923 | if (hl->cstroke != CommonStrings::None) |
4360 | cbradney | 924 | { |
925 | ScColorShade tmp(m_doc->PageColors[hl->cstroke], hl->cshade2); |
||
926 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
927 | } |
||
928 | Zli->Farb = hl->ccolor; |
||
929 | Zli->Farb2 = hl->cstroke; |
||
930 | Zli->shade = hl->cshade; |
||
931 | Zli->shade2 = hl->cshade2; |
||
932 | Zli->xco = 0; |
||
933 | Zli->yco = item->BaseOffs; |
||
934 | Zli->Sele = hl->cselect; |
||
935 | Zli->Siz = chs; |
||
936 | Zli->realSiz = hl->csize; |
||
937 | Zli->Style = hl->cstyle; |
||
938 | Zli->ZFo = hl->cfont; |
||
939 | Zli->wide = wide; |
||
940 | Zli->kern = hl->csize * hl->cextra / 10000.0; |
||
941 | Zli->scale = hl->cscale; |
||
942 | Zli->scalev = hl->cscalev; |
||
943 | Zli->base = hl->cbase; |
||
944 | Zli->shadowX = hl->cshadowx; |
||
945 | Zli->shadowY = hl->cshadowx; |
||
946 | Zli->outline = hl->coutline; |
||
947 | Zli->underpos = hl->cunderpos; |
||
948 | Zli->underwidth = hl->cunderwidth; |
||
949 | Zli->strikepos = hl->cstrikepos; |
||
950 | Zli->strikewidth = hl->cstrikewidth; |
||
951 | Zli->embedded = 0; |
||
952 | DrawCharacters(item, painter, Zli); |
||
953 | delete Zli; |
||
954 | painter->setWorldMatrix(savWM); |
||
955 | painter->restore(); |
||
956 | painter->setZoomFactor(scale); |
||
957 | item->MaxChars = a+1; |
||
958 | oCurX = CurX; |
||
959 | CurX -= dx; |
||
960 | CurX += wide+hl->csize * hl->cextra / 10000.0; |
||
961 | first = false; |
||
962 | } |
||
963 | } |
||
964 | |||
965 | void ScPageOutput::DrawItem_Polygon ( PageItem_Polygon* item , ScPainterExBase* painter ) |
||
966 | { |
||
967 | painter->setupPolygon(&item->PoLine); |
||
968 | painter->fillPath(); |
||
969 | } |
||
970 | |||
971 | void ScPageOutput::DrawItem_PolyLine( PageItem_PolyLine* item, ScPainterExBase* painter ) |
||
972 | { |
||
973 | int startArrowIndex; |
||
974 | int endArrowIndex; |
||
4546 | subik | 975 | |
4360 | cbradney | 976 | startArrowIndex = item->startArrowIndex(); |
977 | endArrowIndex = item->endArrowIndex(); |
||
978 | |||
979 | if (item->PoLine.size()>=4) |
||
980 | { |
||
4546 | subik | 981 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
4360 | cbradney | 982 | { |
983 | FPointArray cli; |
||
984 | FPoint Start; |
||
985 | bool firstp = true; |
||
986 | for (uint n = 0; n < item->PoLine.size()-3; n += 4) |
||
987 | { |
||
988 | if (firstp) |
||
989 | { |
||
990 | Start = item->PoLine.point(n); |
||
991 | firstp = false; |
||
992 | } |
||
993 | if (item->PoLine.point(n).x() > 900000) |
||
994 | { |
||
995 | cli.addPoint(item->PoLine.point(n-2)); |
||
996 | cli.addPoint(item->PoLine.point(n-2)); |
||
997 | cli.addPoint(Start); |
||
998 | cli.addPoint(Start); |
||
999 | cli.setMarker(); |
||
1000 | firstp = true; |
||
1001 | continue; |
||
1002 | } |
||
1003 | cli.addPoint(item->PoLine.point(n)); |
||
1004 | cli.addPoint(item->PoLine.point(n+1)); |
||
1005 | cli.addPoint(item->PoLine.point(n+2)); |
||
1006 | cli.addPoint(item->PoLine.point(n+3)); |
||
1007 | } |
||
1008 | if (cli.size() > 2) |
||
1009 | { |
||
1010 | FPoint l1 = cli.point(cli.size()-2); |
||
1011 | cli.addPoint(l1); |
||
1012 | cli.addPoint(l1); |
||
1013 | cli.addPoint(Start); |
||
1014 | cli.addPoint(Start); |
||
1015 | } |
||
1016 | painter->setupPolygon(&cli); |
||
1017 | painter->fillPath(); |
||
1018 | } |
||
1019 | painter->setupPolygon(&item->PoLine, false); |
||
1020 | if (item->NamedLStyle.isEmpty()) |
||
1021 | painter->strokePath(); |
||
1022 | else |
||
1023 | { |
||
1024 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
1025 | for (int it = ml.size()-1; it > -1; it--) |
||
1026 | { |
||
1027 | ScColorShade tmp(m_doc->PageColors[ml[it].Color], ml[it].Shade); |
||
1028 | painter->setPen(tmp, ml[it].Width, |
||
1029 | static_cast<Qt::PenStyle>(ml[it].Dash), |
||
1030 | static_cast<Qt::PenCapStyle>(ml[it].LineEnd), |
||
1031 | static_cast<Qt::PenJoinStyle>(ml[it].LineJoin)); |
||
1032 | painter->strokePath(); |
||
1033 | } |
||
1034 | } |
||
1035 | if (startArrowIndex != 0) |
||
1036 | { |
||
1037 | FPoint Start = item->PoLine.point(0); |
||
1038 | for (uint xx = 1; xx < item->PoLine.size(); xx += 2) |
||
1039 | { |
||
1040 | FPoint Vector = item->PoLine.point(xx); |
||
1041 | if ((Start.x() != Vector.x()) || (Start.y() != Vector.y())) |
||
1042 | { |
||
1043 | double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI); |
||
1044 | QWMatrix arrowTrans; |
||
1045 | FPointArray arrow = (*m_doc->arrowStyles.at(startArrowIndex-1)).points.copy(); |
||
1046 | arrowTrans.translate(Start.x(), Start.y()); |
||
1047 | arrowTrans.rotate(r); |
||
1048 | arrowTrans.scale(item->lineWidth(), item->lineWidth()); |
||
1049 | arrow.map(arrowTrans); |
||
1050 | painter->setBrush(painter->pen()); |
||
1051 | painter->setBrushOpacity(1.0 - item->lineTransparency()); |
||
1052 | painter->setLineWidth(0); |
||
1053 | painter->setFillMode(ScPainterExBase::Solid); |
||
1054 | painter->setupPolygon(&arrow); |
||
1055 | painter->fillPath(); |
||
1056 | break; |
||
1057 | } |
||
1058 | } |
||
1059 | } |
||
1060 | if (endArrowIndex != 0) |
||
1061 | { |
||
1062 | FPoint End = item->PoLine.point(item->PoLine.size()-2); |
||
1063 | for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2) |
||
1064 | { |
||
1065 | FPoint Vector = item->PoLine.point(xx); |
||
1066 | if ((End.x() != Vector.x()) || (End.y() != Vector.y())) |
||
1067 | { |
||
1068 | double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI); |
||
1069 | QWMatrix arrowTrans; |
||
1070 | FPointArray arrow = (*m_doc->arrowStyles.at(endArrowIndex-1)).points.copy(); |
||
1071 | arrowTrans.translate(End.x(), End.y()); |
||
1072 | arrowTrans.rotate(r); |
||
1073 | arrowTrans.scale( item->lineWidth(), item->lineWidth() ); |
||
1074 | arrow.map(arrowTrans); |
||
1075 | painter->setBrush(painter->pen()); |
||
1076 | painter->setBrushOpacity(1.0 - item->lineTransparency()); |
||
1077 | painter->setLineWidth(0); |
||
1078 | painter->setFillMode(ScPainterExBase::Solid); |
||
1079 | painter->setupPolygon(&arrow); |
||
1080 | painter->fillPath(); |
||
1081 | break; |
||
1082 | } |
||
1083 | } |
||
1084 | } |
||
1085 | } |
||
1086 | } |
||
1087 | |||
1088 | void ScPageOutput::DrawItem_TextFrame( PageItem_TextFrame* item, ScPainterExBase* painter, QRect e, double scale ) |
||
1089 | { |
||
1090 | switch (item->itemType()) |
||
1091 | { |
||
1092 | case PageItem::TextFrame: |
||
1093 | { |
||
5273 | mrdocs | 1094 | QWMatrix wm; |
4360 | cbradney | 1095 | QPoint pt1, pt2; |
1096 | FPoint ColBound; |
||
1097 | QRegion cm; |
||
5212 | mrdocs | 1098 | uint a; |
1099 | int chs, CurrCol; |
||
1100 | double oldCurY, wide, lineCorr, ColWidth; |
||
4360 | cbradney | 1101 | QString chx, chx2, chx3; |
4689 | mrdocs | 1102 | ScText *hl; |
4360 | cbradney | 1103 | |
1104 | bool outs = false; |
||
1105 | bool fBorder = false; |
||
1106 | bool RTab = false; |
||
1107 | bool goNoRoom = false; |
||
1108 | bool goNextColumn = false; |
||
1109 | int TabCode = 0; |
||
1110 | int HyphenCount = 0; |
||
5212 | mrdocs | 1111 | QValueList<ParagraphStyle::TabRecord> tTabValues; |
4360 | cbradney | 1112 | bool DropCmode = false; |
1113 | bool AbsHasDrop = false; |
||
5212 | mrdocs | 1114 | double desc, asce, tabDist; |
4360 | cbradney | 1115 | bool StartOfCol = true; |
1116 | tTabValues.clear(); |
||
1117 | |||
1118 | for (int xxx=0; xxx<5; ++xxx) |
||
1119 | { |
||
5212 | mrdocs | 1120 | m_doc->docParagraphStyles[xxx].setLineSpacingMode( (ParagraphStyle::LineSpacingMode) item->lineSpacingMode() ); |
4617 | avox | 1121 | if (item->lineSpacingMode() == 2) |
5212 | mrdocs | 1122 | m_doc->docParagraphStyles[xxx].setUseBaselineGrid( true ); |
4360 | cbradney | 1123 | else |
5212 | mrdocs | 1124 | m_doc->docParagraphStyles[xxx].setUseBaselineGrid( false ); |
1125 | m_doc->docParagraphStyles[xxx].setLineSpacing( item->lineSpacing() ); |
||
1126 | m_doc->docParagraphStyles[xxx].charStyle().csize = item->fontSize(); |
||
1127 | m_doc->docParagraphStyles[xxx].setLeftMargin( 0 ); |
||
1128 | m_doc->docParagraphStyles[xxx].setFirstIndent( 0 ); |
||
1129 | m_doc->docParagraphStyles[xxx].setGapBefore( 0 ); |
||
1130 | m_doc->docParagraphStyles[xxx].setGapAfter( 0 ); |
||
1131 | m_doc->docParagraphStyles[xxx].setAlignment( xxx ); |
||
4360 | cbradney | 1132 | } |
1133 | |||
1134 | QPtrList<PageItem::ZZ> LiList; |
||
1135 | LiList.setAutoDelete(true); |
||
1136 | 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)); |
||
1137 | painter->save(); |
||
5273 | mrdocs | 1138 | wm.translate(item->xPos(), item->yPos()); |
1139 | wm.rotate(item->rotation()); |
||
4546 | subik | 1140 | if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0)) |
4360 | cbradney | 1141 | { |
1142 | painter->setupPolygon(&item->PoLine); |
||
1143 | painter->fillPath(); |
||
1144 | } |
||
4546 | subik | 1145 | if (item->lineColor() != CommonStrings::None) |
4360 | cbradney | 1146 | lineCorr = item->lineWidth() / 2.0; |
1147 | else |
||
1148 | lineCorr = 0; |
||
4506 | cbradney | 1149 | if ((item->isAnnotation()) && (item->annotation().Type() == 2) && (!item->Pfile.isEmpty()) && (item->PicAvail) && (item->imageShown()) && (item->annotation().UseIcons())) |
4360 | cbradney | 1150 | { |
1151 | painter->setupPolygon(&item->PoLine); |
||
1152 | painter->setClipPath(); |
||
1153 | painter->save(); |
||
1154 | painter->scale(item->imageXScale(), item->imageYScale()); |
||
1155 | painter->translate(static_cast<int>(item->imageXOffset() * item->imageXScale()), static_cast<int>(item->imageYOffset() * item->imageYScale())); |
||
1156 | if (!item->pixm.isNull()) |
||
4989 | cbradney | 1157 | painter->drawImage(&item->pixm, ScPainterExBase::rgbImages); |
4360 | cbradney | 1158 | painter->restore(); |
1159 | } |
||
1160 | if ((item->itemText.count() != 0)) |
||
1161 | { |
||
1162 | if (item->imageFlippedH()) |
||
1163 | { |
||
1164 | painter->translate(item->width() * scale, 0); |
||
1165 | painter->scale(-1, 1); |
||
1166 | } |
||
1167 | if (item->imageFlippedV()) |
||
1168 | { |
||
1169 | painter->translate(0, item->height() * scale); |
||
1170 | painter->scale(1, -1); |
||
1171 | } |
||
1172 | struct PageItem::ZZ Zli3; |
||
1173 | CurrCol = 0; |
||
1174 | ColWidth = item->columnWidth(); |
||
1175 | ColBound = FPoint((ColWidth + item->ColGap) * CurrCol + item->textToFrameDistLeft() + lineCorr, ColWidth * (CurrCol+1) + item->ColGap * CurrCol + item->textToFrameDistLeft()+lineCorr); |
||
1176 | ColBound = FPoint(ColBound.x(), ColBound.y() + item->textToFrameDistRight() + lineCorr); |
||
1177 | tabDist = ColBound.x(); |
||
1178 | uint tabCc = 0; |
||
1179 | for (a = 0; a < item->itemText.count(); ++a) |
||
1180 | { |
||
1181 | if (a >= item->MaxChars) |
||
1182 | break; |
||
1183 | hl = item->itemText.at(a); |
||
1184 | if (hl->cab < 5) |
||
1185 | tTabValues = item->TabValues; |
||
1186 | else |
||
5212 | mrdocs | 1187 | tTabValues = m_doc->docParagraphStyles[hl->cab].tabValues(); |
4360 | cbradney | 1188 | if (hl->cstyle & 16384) |
1189 | tabCc = 0; |
||
1190 | chx = hl->ch; |
||
1191 | if (hl->yp == 0) |
||
1192 | continue; |
||
1193 | if (hl->ch == QChar(30)) |
||
1194 | chx = item->ExpandToken(a); |
||
4546 | subik | 1195 | if (hl->ccolor != CommonStrings::None) |
4360 | cbradney | 1196 | { |
1197 | ScColorShade tmp(m_doc->PageColors[hl->ccolor], hl->cshade); |
||
1198 | painter->setBrush(tmp); |
||
1199 | } |
||
4546 | subik | 1200 | if (hl->cstroke != CommonStrings::None) |
4360 | cbradney | 1201 | { |
1202 | ScColorShade tmp(m_doc->PageColors[hl->cstroke], hl->cshade2); |
||
1203 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
1204 | } |
||
1205 | chs = hl->csize; |
||
1206 | if (hl->cstyle & 2048) |
||
1207 | { |
||
5212 | mrdocs | 1208 | if (m_doc->docParagraphStyles[hl->cab].useBaselineGrid()) |
1209 | chs = qRound(10 * ((m_doc->typographicSettings.valueBaseGrid * (m_doc->docParagraphStyles[hl->cab].dropCapLines()-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].charStyle().csize / 10.0))) / (RealCHeight(m_doc, hl->cfont, chx, 10)))); |
||
4360 | cbradney | 1210 | else |
1211 | { |
||
5212 | mrdocs | 1212 | if (m_doc->docParagraphStyles[hl->cab].lineSpacingMode() == 0) |
1213 | chs = qRound(10 * ((m_doc->docParagraphStyles[hl->cab].lineSpacing() * (m_doc->docParagraphStyles[hl->cab].dropCapLines()-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].charStyle().csize / 10.0))) / (RealCHeight(m_doc, hl->cfont, chx, 10)))); |
||
4360 | cbradney | 1214 | else |
1215 | { |
||
5212 | mrdocs | 1216 | double currasce = RealFHeight(m_doc, hl->cfont, m_doc->docParagraphStyles[hl->cab].charStyle().csize); |
1217 | chs = qRound(10 * ((currasce * (m_doc->docParagraphStyles[hl->cab].dropCapLines()-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].charStyle().csize / 10.0))) / RealCHeight(m_doc, hl->cfont, chx, 10))); |
||
4360 | cbradney | 1218 | } |
1219 | } |
||
1220 | } |
||
5345 | mrdocs | 1221 | oldCurY = item->SetZeichAttr(*hl, &chs, &chx); |
4360 | cbradney | 1222 | if ((chx == QChar(9)) && (tTabValues.count() != 0) && (tabCc < tTabValues.count()) && (!tTabValues[tabCc].tabFillChar.isNull())) |
1223 | { |
||
1224 | QString tabFillCharQStr(tTabValues[tabCc].tabFillChar); |
||
1225 | double wt = Cwidth(m_doc, hl->cfont, tabFillCharQStr, chs); |
||
1226 | int coun = static_cast<int>((hl->xp - tabDist) / wt); |
||
1227 | double sPos = hl->xp - (hl->xp - tabDist) + 1; |
||
1228 | desc = hl->cfont->numDescender * (-chs / 10.0); |
||
1229 | asce = hl->cfont->numAscent * (chs / 10.0); |
||
1230 | Zli3.Zeich = tabFillCharQStr; |
||
1231 | Zli3.Farb = hl->ccolor; |
||
1232 | Zli3.Farb2 = hl->cstroke; |
||
1233 | Zli3.shade = hl->cshade; |
||
1234 | Zli3.shade2 = hl->cshade2; |
||
1235 | Zli3.yco = hl->yp; |
||
1236 | Zli3.Sele = hl->cselect; |
||
1237 | Zli3.Siz = chs; |
||
1238 | Zli3.realSiz = hl->csize; |
||
1239 | Zli3.Style = hl->cstyle; |
||
1240 | Zli3.ZFo = hl->cfont; |
||
1241 | Zli3.wide = wt; |
||
1242 | Zli3.kern = 0; |
||
1243 | Zli3.scale = 1000; |
||
1244 | Zli3.scalev = 1000; |
||
1245 | Zli3.shadowX = hl->cshadowx; |
||
1246 | Zli3.shadowY = hl->cshadowy; |
||
1247 | Zli3.outline = hl->coutline; |
||
1248 | Zli3.base = hl->cbase; |
||
1249 | Zli3.underpos = hl->cunderpos; |
||
1250 | Zli3.underwidth = hl->cunderwidth; |
||
1251 | Zli3.strikepos = hl->cstrikepos; |
||
1252 | Zli3.strikewidth = hl->cstrikewidth; |
||
1253 | for (int cx = 0; cx < coun; ++cx) |
||
1254 | { |
||
1255 | Zli3.xco = sPos + wt * cx; |
||
5273 | mrdocs | 1256 | if (e2.intersects(wm.mapRect(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc))))) |
4360 | cbradney | 1257 | DrawCharacters(item, painter, &Zli3); |
1258 | } |
||
1259 | } |
||
1260 | if (chx == QChar(9)) |
||
1261 | tabCc++; |
||
1262 | Zli3.Zeich = chx; |
||
1263 | Zli3.Farb = hl->ccolor; |
||
1264 | Zli3.Farb2 = hl->cstroke; |
||
1265 | Zli3.shade = hl->cshade; |
||
1266 | Zli3.shade2 = hl->cshade2; |
||
1267 | Zli3.xco = hl->xp; |
||
1268 | Zli3.yco = hl->yp; |
||
1269 | Zli3.Sele = hl->cselect; |
||
1270 | Zli3.Siz = chs; |
||
1271 | Zli3.realSiz = hl->csize; |
||
1272 | Zli3.Style = hl->cstyle; |
||
1273 | Zli3.ZFo = hl->cfont; |
||
1274 | if ((hl->ch == QChar(25)) && (hl->cembedded != 0)) |
||
4617 | avox | 1275 | Zli3.wide = (hl->cembedded->gWidth + hl->cembedded->lineWidth()) * (hl->cscale / 1000.0); |
4360 | cbradney | 1276 | else |
1277 | Zli3.wide = Cwidth(m_doc, hl->cfont, chx, hl->csize) * (hl->cscale / 1000.0); |
||
1278 | if (hl->cstyle & 16384) |
||
1279 | Zli3.kern = 0; |
||
1280 | else |
||
1281 | Zli3.kern = chs * hl->cextra / 10000.0; |
||
1282 | Zli3.scale = hl->cscale; |
||
1283 | Zli3.scalev = hl->cscalev; |
||
1284 | Zli3.base = hl->cbase; |
||
1285 | Zli3.shadowX = hl->cshadowx; |
||
1286 | Zli3.shadowY = hl->cshadowy; |
||
1287 | Zli3.outline = hl->coutline; |
||
1288 | Zli3.underpos = hl->cunderpos; |
||
1289 | Zli3.underwidth = hl->cunderwidth; |
||
1290 | Zli3.strikepos = hl->cstrikepos; |
||
1291 | Zli3.strikewidth = hl->cstrikewidth; |
||
1292 | Zli3.embedded = hl->cembedded; |
||
5117 | cbradney | 1293 | //if (!m_doc->RePos) |
4360 | cbradney | 1294 | { |
1295 | double xcoZli = Zli3.xco; |
||
1296 | desc = Zli3.ZFo->numDescender * (-Zli3.Siz / 10.0); |
||
1297 | asce = Zli3.ZFo->numAscent * (Zli3.Siz / 10.0); |
||
1298 | if ((((Zli3.Sele) && (item->isSelected())) || (((item->NextBox != 0) || (item->BackBox != 0)) && (Zli3.Sele))) && (m_doc->appMode == modeEdit)) |
||
1299 | { |
||
1300 | wide = Zli3.wide; |
||
1301 | painter->setFillMode(1); |
||
4506 | cbradney | 1302 | //paintersetBrush( ScColorShade( Qt::darkBlue, 100) ); |
1303 | painter->setBrush( ScColorShade(qApp->palette().color(QPalette::Active, QColorGroup::Highlight), 100) ); |
||
4360 | cbradney | 1304 | painter->setLineWidth(0); |
1305 | if ((a > 0) && (Zli3.Zeich == QChar(9))) |
||
1306 | { |
||
1307 | 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); |
||
1308 | wide = Zli3.xco - xcoZli + Zli3.wide; |
||
1309 | } |
||
1310 | //if (!m_doc->RePos) |
||
1311 | painter->drawRect(xcoZli, qRound(Zli3.yco-asce * (Zli3.scalev / 1000.0)), wide+1, qRound((asce+desc) * (Zli3.scalev / 1000.0))); |
||
4506 | cbradney | 1312 | //painter->setBrush(ScColorShade(Qt::white, 100)); |
1313 | painter->setBrush(ScColorShade(qApp->palette().color(QPalette::Active, QColorGroup::HighlightedText), 100)); |
||
4360 | cbradney | 1314 | } |
4546 | subik | 1315 | if (Zli3.Farb2 != CommonStrings::None) |
4360 | cbradney | 1316 | { |
1317 | ScColorShade tmp(m_doc->PageColors[Zli3.Farb2], Zli3.shade2); |
||
1318 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
1319 | } |
||
1320 | if (((chx == QChar(13)) || (chx == QChar(28))) && (m_doc->guidesSettings.showControls)) |
||
1321 | { |
||
5273 | mrdocs | 1322 | if (e2.intersects(wm.mapRect(QRect(qRound(Zli3.xco+Zli3.wide),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc))))) |
4360 | cbradney | 1323 | { |
1324 | FPointArray points; |
||
1325 | QWMatrix chma, chma2, chma4, chma5; |
||
1326 | double ytrans, xtrans; |
||
1327 | if (chx == QChar(13)) |
||
1328 | { |
||
1329 | points = m_doc->symReturn.copy(); |
||
1330 | if (a > 0) |
||
1331 | ytrans = item->itemText.at(a-1)->yp-((Zli3.Siz / 10.0) * 0.8); |
||
1332 | else |
||
5212 | mrdocs | 1333 | ytrans = Zli3.yco-m_doc->docParagraphStyles[hl->cab].lineSpacing()-((Zli3.Siz / 10.0) * 0.8); |
4360 | cbradney | 1334 | } |
1335 | else |
||
1336 | { |
||
1337 | points = m_doc->symNewLine.copy(); |
||
1338 | if (a > 0) |
||
1339 | ytrans = item->itemText.at(a-1)->yp-((Zli3.Siz / 10.0) * 0.4); |
||
1340 | else |
||
5212 | mrdocs | 1341 | ytrans = Zli3.yco-m_doc->docParagraphStyles[hl->cab].lineSpacing()-((Zli3.Siz / 10.0) * 0.4); |
4360 | cbradney | 1342 | } |
1343 | if (hl->cstyle & 16384) |
||
1344 | xtrans = Zli3.xco; |
||
1345 | else |
||
1346 | { |
||
1347 | if (a > 0) |
||
1348 | 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); |
||
1349 | else |
||
1350 | xtrans = Zli3.xco; |
||
1351 | } |
||
1352 | chma4.translate(xtrans, ytrans); |
||
1353 | chma.scale(Zli3.Siz / 100.0, Zli3.Siz / 100.0); |
||
1354 | chma2.scale(Zli3.scale / 1000.0, Zli3.scalev / 1000.0); |
||
1355 | chma5.scale(painter->zoomFactor(), painter->zoomFactor()); |
||
1356 | points.map(chma * chma2 * chma4 * chma5); |
||
1357 | painter->setupTextPolygon(&points); |
||
1358 | painter->setFillMode(1); |
||
1359 | painter->fillPath(); |
||
1360 | } |
||
1361 | } |
||
5273 | mrdocs | 1362 | if (e2.intersects(wm.mapRect(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc))))) |
4360 | cbradney | 1363 | { |
1364 | if (Zli3.Zeich == QChar(25)) |
||
1365 | DrawItem_Embedded(item, painter, e, &Zli3); |
||
1366 | else |
||
1367 | DrawCharacters(item, painter, &Zli3); |
||
1368 | } |
||
1369 | if (hl->cstyle & 8192) |
||
1370 | { |
||
1371 | Zli3.Zeich = "-"; |
||
1372 | Zli3.xco = Zli3.xco + Zli3.wide; |
||
5273 | mrdocs | 1373 | if (e2.intersects(wm.mapRect(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc))))) |
4360 | cbradney | 1374 | DrawCharacters(item, painter, &Zli3); |
1375 | } |
||
1376 | } |
||
1377 | tabDist = Zli3.xco+Zli3.wide; |
||
1378 | } |
||
1379 | painter->restore(); |
||
1380 | break; |
||
1381 | } |
||
1382 | painter->restore(); |
||
1383 | } |
||
1384 | break; |
||
1385 | default: |
||
1386 | break; |
||
1387 | } |
||
1388 | } |
||
1389 | |||
1390 |