Rev 4418 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4360 | cbradney | 1 | #include "scpageoutput.h" |
2 | |||
3 | #include "qpainter.h" |
||
4 | #include "pageitem.h" |
||
5 | #include "pageitem_imageframe.h" |
||
6 | #include "pageitem_line.h" |
||
7 | #include "pageitem_pathtext.h" |
||
8 | #include "pageitem_polygon.h" |
||
9 | #include "pageitem_polyline.h" |
||
10 | #include "pageitem_textframe.h" |
||
11 | #include "scfontmetrics.h" |
||
12 | #include "scribus.h" |
||
13 | #include "scimage.h" |
||
14 | #include "util.h" |
||
15 | |||
16 | //extern SCRIBUS_API ScribusMainWindow* ScMW; |
||
17 | |||
18 | ScPageOutput::ScPageOutput(ScribusDoc* doc, bool reloadImages, imageLoadMode loadMode, int resolution, bool useProfiles) |
||
19 | { |
||
20 | m_doc = doc; |
||
21 | m_reloadImages = reloadImages; |
||
22 | m_imageRes = resolution; |
||
23 | m_useProfiles = useProfiles; |
||
24 | m_imageMode = loadMode; |
||
25 | } |
||
26 | |||
27 | void ScPageOutput::DrawPage( Page* page, ScPainterExBase* painter) |
||
28 | { |
||
29 | int clipx = static_cast<int>(page->xOffset()); |
||
30 | int clipy = static_cast<int>(page->yOffset()); |
||
31 | int clipw = qRound(page->width()); |
||
32 | int cliph = qRound(page->height()); |
||
33 | DrawMasterItems(painter, page, QRect(clipx, clipy, clipw, cliph)); |
||
34 | DrawPageItems(painter, page, QRect(clipx, clipy, clipw, cliph)); |
||
35 | } |
||
36 | |||
37 | void ScPageOutput::DrawMasterItems(ScPainterExBase *painter, Page *page, QRect clip) |
||
38 | { |
||
39 | double z = painter->zoomFactor(); |
||
40 | if (!page->MPageNam.isEmpty()) |
||
41 | { |
||
42 | Page* Mp = m_doc->MasterPages.at(m_doc->MasterNames[page->MPageNam]); |
||
43 | if (page->FromMaster.count() != 0) |
||
44 | { |
||
45 | QPainter p; |
||
46 | int Lnr; |
||
47 | struct Layer ll; |
||
48 | PageItem *currItem; |
||
49 | ll.isViewable = false; |
||
50 | ll.LNr = 0; |
||
51 | Lnr = 0; |
||
52 | uint layerCount = m_doc->layerCount(); |
||
53 | for (uint la = 0; la < layerCount; ++la) |
||
54 | { |
||
55 | Level2Layer(m_doc, &ll, Lnr); |
||
56 | bool pr = true; |
||
57 | if ( !ll.isPrintable ) |
||
58 | pr = false; |
||
59 | if ((ll.isViewable) && (pr)) |
||
60 | { |
||
61 | uint pageFromMasterCount=page->FromMaster.count(); |
||
62 | for (uint a = 0; a < pageFromMasterCount; ++a) |
||
63 | { |
||
64 | currItem = page->FromMaster.at(a); |
||
65 | if (currItem->LayerNr != ll.LNr) |
||
66 | continue; |
||
67 | if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr()))) |
||
68 | continue; |
||
69 | if (!currItem->printable()) |
||
70 | continue; |
||
71 | int savedOwnPage = currItem->OwnPage; |
||
72 | double OldX = currItem->xPos(); |
||
73 | double OldY = currItem->yPos(); |
||
74 | double OldBX = currItem->BoundingX; |
||
75 | double OldBY = currItem->BoundingY; |
||
76 | currItem->OwnPage = page->pageNr(); |
||
77 | if (!currItem->ChangedMasterItem) |
||
78 | { |
||
79 | currItem->moveBy(-Mp->xOffset() + page->xOffset(), -Mp->yOffset() + page->yOffset()); |
||
80 | currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset(); |
||
81 | currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset(); |
||
82 | } |
||
83 | /*if (evSpon) |
||
84 | currItem->Dirty = true;*/ |
||
85 | QRect oldR(currItem->getRedrawBounding(m_scale)); |
||
86 | if (clip.intersects(oldR)) |
||
87 | DrawItem(currItem, painter, clip); |
||
88 | currItem->OwnPage = savedOwnPage; |
||
89 | if (!currItem->ChangedMasterItem) |
||
90 | { |
||
91 | currItem->setXPos(OldX); |
||
92 | currItem->setYPos(OldY); |
||
93 | currItem->BoundingX = OldBX; |
||
94 | currItem->BoundingY = OldBY; |
||
95 | } |
||
96 | } |
||
97 | for (uint a = 0; a < pageFromMasterCount; ++a) |
||
98 | { |
||
99 | currItem = page->FromMaster.at(a); |
||
100 | if (currItem->LayerNr != ll.LNr) |
||
101 | continue; |
||
102 | if (!currItem->isTableItem) |
||
103 | continue; |
||
104 | if ((currItem->OwnPage != -1) && (currItem->OwnPage != static_cast<int>(Mp->pageNr()))) |
||
105 | continue; |
||
106 | double OldX = currItem->xPos(); |
||
107 | double OldY = currItem->yPos(); |
||
108 | double OldBX = currItem->BoundingX; |
||
109 | double OldBY = currItem->BoundingY; |
||
110 | if (!currItem->ChangedMasterItem) |
||
111 | { |
||
112 | currItem->setXPos(OldX - Mp->xOffset() + page->xOffset()); |
||
113 | currItem->setYPos(OldY - Mp->yOffset() + page->yOffset()); |
||
114 | currItem->BoundingX = OldBX - Mp->xOffset() + page->xOffset(); |
||
115 | currItem->BoundingY = OldBY - Mp->yOffset() + page->yOffset(); |
||
116 | } |
||
117 | QRect oldR(currItem->getRedrawBounding(m_scale)); |
||
118 | if (clip.intersects(oldR)) |
||
119 | { |
||
120 | painter->setZoomFactor(m_scale); |
||
121 | painter->save(); |
||
122 | painter->translate(currItem->xPos() * m_scale, currItem->yPos() * m_scale); |
||
123 | painter->rotate(currItem->rotation()); |
||
124 | if (currItem->lineColor() != "None") |
||
125 | { |
||
126 | ScColorShade tmp( m_doc->PageColors[currItem->lineColor()], currItem->lineShade()); |
||
127 | if ((currItem->TopLine) || (currItem->RightLine) || (currItem->BottomLine) || (currItem->LeftLine)) |
||
128 | { |
||
129 | painter->setPen(tmp, currItem->Pwidth, currItem->PLineArt, Qt::SquareCap, currItem->PLineJoin); |
||
130 | if (currItem->TopLine) |
||
131 | painter->drawLine(FPoint(0.0, 0.0), FPoint(currItem->width(), 0.0)); |
||
132 | if (currItem->RightLine) |
||
133 | painter->drawLine(FPoint(currItem->width(), 0.0), FPoint(currItem->width(), currItem->height())); |
||
134 | if (currItem->BottomLine) |
||
135 | painter->drawLine(FPoint(currItem->width(), currItem->height()), FPoint(0.0, currItem->height())); |
||
136 | if (currItem->LeftLine) |
||
137 | painter->drawLine(FPoint(0.0, currItem->height()), FPoint(0.0, 0.0)); |
||
138 | } |
||
139 | } |
||
140 | painter->restore(); |
||
141 | } |
||
142 | if (!currItem->ChangedMasterItem) |
||
143 | { |
||
144 | currItem->setXPos(OldX); |
||
145 | currItem->setYPos(OldY); |
||
146 | currItem->BoundingX = OldBX; |
||
147 | currItem->BoundingY = OldBY; |
||
148 | } |
||
149 | } |
||
150 | } |
||
151 | Lnr++; |
||
152 | } |
||
153 | } |
||
154 | } |
||
155 | painter->setZoomFactor(z); |
||
156 | } |
||
157 | |||
158 | void ScPageOutput::DrawPageItems(ScPainterExBase *painter, Page *page, QRect clip) |
||
159 | { |
||
160 | //linkedFramesToShow.clear(); |
||
161 | double z = painter->zoomFactor(); |
||
162 | if (m_doc->Items->count() != 0) |
||
163 | { |
||
164 | QPainter p; |
||
165 | int Lnr=0; |
||
166 | struct Layer ll; |
||
167 | PageItem *currItem; |
||
168 | ll.isViewable = false; |
||
169 | ll.LNr = 0; |
||
170 | uint layerCount = m_doc->layerCount(); |
||
171 | //int docCurrPageNo=static_cast<int>(m_doc->currentPageNumber()); |
||
172 | int docCurrPageNo=static_cast<int>(page->pageNr()); |
||
173 | for (uint la2 = 0; la2 < layerCount; ++la2) |
||
174 | { |
||
175 | Level2Layer(m_doc, &ll, Lnr); |
||
176 | bool pr = true; |
||
177 | if (!ll.isPrintable) |
||
178 | pr = false; |
||
179 | if ((ll.isViewable) && (pr)) |
||
180 | { |
||
181 | QPtrListIterator<PageItem> docItem(*m_doc->Items); |
||
182 | while ( (currItem = docItem.current()) != 0) |
||
183 | { |
||
184 | ++docItem; |
||
185 | if (currItem->LayerNr != ll.LNr) |
||
186 | continue; |
||
187 | if (!currItem->printable()) |
||
188 | continue; |
||
189 | if ((m_doc->masterPageMode()) && ((currItem->OwnPage != -1) && (currItem->OwnPage != docCurrPageNo))) |
||
190 | continue; |
||
191 | if (!m_doc->masterPageMode() && !currItem->OnMasterPage.isEmpty()) |
||
192 | { |
||
193 | if (currItem->OnMasterPage != page->PageNam) |
||
194 | continue; |
||
195 | } |
||
196 | QRect oldR(currItem->getRedrawBounding(m_scale)); |
||
197 | if (clip.intersects(oldR)) |
||
198 | { |
||
199 | /*if (evSpon) |
||
200 | currItem->Dirty = true;*/ |
||
201 | /*if (forceRedraw) |
||
202 | currItem->Dirty = false;*/ |
||
203 | // if ((!Mpressed) || (m_doc->EditClip)) |
||
204 | DrawItem( currItem, painter, clip ); |
||
205 | //currItem->Redrawn = true; |
||
206 | if ((currItem->asTextFrame()) && ((currItem->NextBox != 0) || (currItem->BackBox != 0))) |
||
207 | { |
||
208 | PageItem *nextItem = currItem; |
||
209 | while (nextItem != 0) |
||
210 | { |
||
211 | if (nextItem->BackBox != 0) |
||
212 | nextItem = nextItem->BackBox; |
||
213 | else |
||
214 | break; |
||
215 | } |
||
216 | /*if (linkedFramesToShow.find(nextItem) == -1) |
||
217 | linkedFramesToShow.append(nextItem);*/ |
||
218 | } |
||
219 | } |
||
220 | } |
||
221 | QPtrListIterator<PageItem> docItem2(*m_doc->Items); |
||
222 | while ( (currItem = docItem2.current()) != 0 ) |
||
223 | { |
||
224 | ++docItem2; |
||
225 | if (currItem->LayerNr != ll.LNr) |
||
226 | continue; |
||
227 | if (!currItem->isTableItem) |
||
228 | continue; |
||
229 | QRect oldR(currItem->getRedrawBounding(m_scale)); |
||
230 | if (clip.intersects(oldR)) |
||
231 | { |
||
232 | painter->setZoomFactor(m_scale); |
||
233 | painter->save(); |
||
234 | painter->translate(currItem->xPos() * m_scale, currItem->yPos() * m_scale); |
||
235 | painter->rotate(currItem->rotation()); |
||
236 | if (currItem->lineColor() != "None") |
||
237 | { |
||
238 | ScColorShade tmp( m_doc->PageColors[currItem->lineColor()], currItem->lineShade() ); |
||
239 | if ((currItem->TopLine) || (currItem->RightLine) || (currItem->BottomLine) || (currItem->LeftLine)) |
||
240 | { |
||
241 | painter->setPen(tmp, currItem->Pwidth, currItem->PLineArt, Qt::SquareCap, currItem->PLineJoin); |
||
242 | if (currItem->TopLine) |
||
243 | painter->drawLine(FPoint(0.0, 0.0), FPoint(currItem->width(), 0.0)); |
||
244 | if (currItem->RightLine) |
||
245 | painter->drawLine(FPoint(currItem->width(), 0.0), FPoint(currItem->width(), currItem->height())); |
||
246 | if (currItem->BottomLine) |
||
247 | painter->drawLine(FPoint(currItem->width(), currItem->height()), FPoint(0.0, currItem->height())); |
||
248 | if (currItem->LeftLine) |
||
249 | painter->drawLine(FPoint(0.0, currItem->height()), FPoint(0.0, 0.0)); |
||
250 | } |
||
251 | } |
||
252 | painter->restore(); |
||
253 | } |
||
254 | } |
||
255 | } |
||
256 | Lnr++; |
||
257 | } |
||
258 | } |
||
259 | painter->setZoomFactor(z); |
||
260 | } |
||
261 | |||
262 | void ScPageOutput::DrawItem( PageItem* item, ScPainterExBase* painter, QRect rect ) |
||
263 | { |
||
264 | double sc = m_scale; |
||
265 | DrawItem_Pre(item, painter, sc); |
||
266 | PageItem::ItemType itemType = item->itemType(); |
||
267 | if( itemType == PageItem::ImageFrame ) |
||
268 | DrawItem_ImageFrame( (PageItem_ImageFrame*) item, painter, sc ); |
||
269 | else if( itemType == PageItem::Line ) |
||
270 | DrawItem_Line( (PageItem_Line*) item, painter ); |
||
271 | else if( itemType == PageItem::PathText ) |
||
272 | DrawItem_PathText( (PageItem_PathText*) item, painter, sc ); |
||
273 | else if( itemType == PageItem::Polygon ) |
||
274 | DrawItem_Polygon( (PageItem_Polygon*) item, painter ); |
||
275 | else if( itemType == PageItem::PolyLine ) |
||
276 | DrawItem_PolyLine( (PageItem_PolyLine*) item, painter ); |
||
277 | else if( itemType == PageItem::TextFrame ) |
||
278 | DrawItem_TextFrame( (PageItem_TextFrame*) item, painter, rect, sc); |
||
279 | DrawItem_Post(item, painter); |
||
280 | } |
||
281 | |||
282 | void ScPageOutput::DrawItem_Pre( PageItem* item, ScPainterExBase* painter, double scale ) |
||
283 | { |
||
284 | double sc = scale; |
||
285 | painter->save(); |
||
286 | if (!item->isEmbedded) |
||
287 | { |
||
288 | painter->setZoomFactor(sc); |
||
289 | painter->translate( item->xPos() * sc, item->yPos() * sc); |
||
290 | // painter->rotate(item->rotation()); |
||
291 | } |
||
292 | painter->rotate(item->rotation()); |
||
293 | painter->setLineWidth(item->Pwidth); |
||
294 | if (item->GrType != 0) |
||
295 | { |
||
296 | painter->setFillMode(ScPainterExBase::Gradient); |
||
297 | painter->fill_gradient = VGradientEx(item->fill_gradient, *m_doc); |
||
298 | QWMatrix grm; |
||
299 | grm.rotate(item->rotation()); |
||
300 | FPointArray gra; |
||
301 | switch (item->GrType) |
||
302 | { |
||
303 | case 1: |
||
304 | case 2: |
||
305 | case 3: |
||
306 | case 4: |
||
307 | case 6: |
||
308 | gra.setPoints(2, item->GrStartX, item->GrStartY, item->GrEndX, item->GrEndY); |
||
309 | gra.map(grm); |
||
310 | painter->setGradient(VGradientEx::linear, gra.point(0), gra.point(1)); |
||
311 | break; |
||
312 | case 5: |
||
313 | case 7: |
||
314 | gra.setPoints(2, item->GrStartX, item->GrStartY, item->GrEndX, item->GrEndY); |
||
315 | painter->setGradient(VGradientEx::radial, gra.point(0), gra.point(1), gra.point(0)); |
||
316 | break; |
||
317 | } |
||
318 | } |
||
319 | else |
||
320 | { |
||
321 | painter->fill_gradient = VGradientEx(VGradientEx::linear); |
||
322 | if (item->fillColor() != "None") |
||
323 | { |
||
324 | painter->setBrush( ScColorShade(m_doc->PageColors[item->fillColor()], item->fillShade()) ); |
||
325 | painter->setFillMode(ScPainterExBase::Solid); |
||
326 | } |
||
327 | else |
||
328 | painter->setFillMode(ScPainterExBase::None); |
||
329 | } |
||
330 | if (item->lineColor() != "None") |
||
331 | { |
||
332 | if ((item->Pwidth == 0) && !item->asLine()) |
||
333 | painter->setLineWidth(0); |
||
334 | else |
||
335 | { |
||
336 | ScColorShade tmp(m_doc->PageColors[item->lineColor()], item->lineShade()); |
||
337 | painter->setPen( tmp , item->Pwidth, item->PLineArt, item->PLineEnd, item->PLineJoin); |
||
338 | if (item->DashValues.count() != 0) |
||
339 | painter->setDash(item->DashValues, item->DashOffset); |
||
340 | } |
||
341 | } |
||
342 | else |
||
343 | painter->setLineWidth(0); |
||
344 | painter->setBrushOpacity(1.0 - item->fillTransparency()); |
||
345 | painter->setPenOpacity(1.0 - item->lineTransparency()); |
||
346 | } |
||
347 | |||
348 | void ScPageOutput::DrawItem_Post( PageItem* item, ScPainterExBase* painter ) |
||
349 | { |
||
350 | bool doStroke=true; |
||
351 | if ( item->itemType() == PageItem::PathText || item->itemType() == PageItem::PolyLine || item->itemType() == PageItem::Line ) |
||
352 | doStroke=false; |
||
353 | if ((doStroke)) |
||
354 | { |
||
355 | if (item->lineColor() != "None") |
||
356 | { |
||
357 | ScColorShade tmp(m_doc->PageColors[item->lineColor()], item->lineShade()); |
||
358 | painter->setPen(tmp, item->Pwidth, item->PLineArt, item->PLineEnd, item->PLineJoin); |
||
359 | if (item->DashValues.count() != 0) |
||
360 | painter->setDash(item->DashValues, item->DashOffset); |
||
361 | } |
||
362 | else |
||
363 | painter->setLineWidth(0); |
||
364 | if (!item->isTableItem) |
||
365 | { |
||
366 | painter->setupPolygon(&item->PoLine); |
||
367 | if (item->NamedLStyle.isEmpty()) |
||
368 | painter->strokePath(); |
||
369 | else |
||
370 | { |
||
371 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
372 | for (int it = ml.size()-1; it > -1; it--) |
||
373 | { |
||
374 | ScColorShade tmp( m_doc->PageColors[ml[it].Color], ml[it].Shade ); |
||
375 | painter->setPen(tmp, ml[it].Width, |
||
376 | static_cast<Qt::PenStyle>(ml[it].Dash), |
||
377 | static_cast<Qt::PenCapStyle>(ml[it].LineEnd), |
||
378 | static_cast<Qt::PenJoinStyle>(ml[it].LineJoin)); |
||
379 | painter->strokePath(); |
||
380 | } |
||
381 | } |
||
382 | } |
||
383 | } |
||
384 | if ((!item->isEmbedded)) |
||
385 | { |
||
386 | double scpInv = 1.0 / (QMAX(m_scale, 1)); |
||
387 | } |
||
388 | item->Tinput = false; |
||
389 | item->FrameOnly = false; |
||
390 | painter->restore(); |
||
391 | } |
||
392 | |||
393 | void ScPageOutput::DrawCharacters( PageItem* item, ScPainterExBase *painter, struct PageItem::ZZ *hl) |
||
394 | { |
||
395 | double csi = static_cast<double>(hl->Siz) / 100.0; |
||
396 | QString ccx = hl->Zeich; |
||
397 | if ((ccx == QChar(13)) || (ccx == QChar(9)) || (ccx == QChar(28)) || (ccx == QChar(27)) || (ccx == QChar(26))) |
||
398 | return; |
||
399 | if (ccx == QChar(29)) |
||
400 | ccx = " "; |
||
401 | if (ccx == QChar(24)) |
||
402 | ccx = "-"; |
||
403 | uint chr = ccx[0].unicode(); |
||
404 | if (hl->ZFo->CharWidth.contains(chr)) |
||
405 | { |
||
406 | QWMatrix chma, chma2, chma3, chma4, chma5, chma6; |
||
407 | chma.scale(csi, csi); |
||
408 | chma5.scale(painter->zoomFactor(), painter->zoomFactor()); |
||
409 | FPointArray gly = hl->ZFo->GlyphArray[chr].Outlines.copy(); |
||
410 | if (gly.size() > 3) |
||
411 | { |
||
412 | chma2.scale(hl->scale / 1000.0, hl->scalev / 1000.0); |
||
413 | if (item->reversed()) |
||
414 | { |
||
415 | chma3.scale(-1, 1); |
||
416 | chma3.translate(-hl->wide, 0); |
||
417 | chma4.translate(hl->xco, hl->yco-((hl->Siz / 10.0) * (hl->scalev / 1000.0))); |
||
418 | } |
||
419 | else |
||
420 | chma4.translate(hl->xco, hl->yco-((hl->Siz / 10.0) * (hl->scalev / 1000.0))); |
||
421 | if (hl->base != 0) |
||
422 | chma6.translate(0, -(hl->Siz / 10.0) * (hl->base / 1000.0) * painter->zoomFactor()); |
||
423 | gly.map(chma * chma2 * chma3 * chma4 * chma5 * chma6); |
||
424 | painter->setFillMode(1); |
||
425 | bool fr = painter->fillRule(); |
||
426 | painter->setFillRule(false); |
||
427 | painter->setupTextPolygon(&gly); |
||
428 | if ((hl->ZFo->isStroked) && ((hl->Siz * hl->outline / 10000.0) != 0)) |
||
429 | { |
||
430 | painter->setPen(painter->brush(), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
431 | painter->setLineWidth(hl->Siz * hl->outline / 10000.0); |
||
432 | painter->strokePath(); |
||
433 | } |
||
434 | else |
||
435 | { |
||
436 | if ((hl->Style & 256) && (hl->Farb2 != "None")) |
||
437 | { |
||
438 | painter->save(); |
||
439 | painter->translate((hl->Siz * hl->shadowX / 10000.0) * painter->zoomFactor(), -(hl->Siz * hl->shadowY / 10000.0) * painter->zoomFactor()); |
||
440 | ScColorShade tmp = painter->brush(); |
||
441 | painter->setBrush(painter->pen()); |
||
442 | painter->setupTextPolygon(&gly); // Necessary if path is not part of the graphic state |
||
443 | painter->fillPath(); |
||
444 | painter->setBrush(tmp); |
||
445 | painter->restore(); |
||
446 | painter->setupTextPolygon(&gly); // Necessary if path is not part of the graphic state |
||
447 | } |
||
448 | if (hl->Farb != "None") |
||
449 | painter->fillPath(); |
||
450 | if ((hl->Style & 4) && (hl->Farb2 != "None") && ((hl->Siz * hl->outline / 10000.0) != 0)) |
||
451 | { |
||
452 | painter->setLineWidth(hl->Siz * hl->outline / 10000.0); |
||
453 | painter->strokePath(); |
||
454 | } |
||
455 | } |
||
456 | painter->setFillRule(fr); |
||
457 | } |
||
458 | if (hl->Style & 16) |
||
459 | { |
||
460 | double st, lw; |
||
461 | if ((hl->strikepos != -1) || (hl->strikewidth != -1)) |
||
462 | { |
||
463 | if (hl->strikepos != -1) |
||
464 | st = (hl->strikepos / 1000.0) * (hl->ZFo->numAscent * (hl->realSiz / 10.0)); |
||
465 | else |
||
466 | st = hl->ZFo->strikeout_pos * (hl->realSiz / 10.0); |
||
467 | if (hl->strikewidth != -1) |
||
468 | lw = (hl->strikewidth / 1000.0) * (hl->realSiz / 10.0); |
||
469 | else |
||
470 | lw = QMAX(hl->ZFo->strokeWidth * (hl->realSiz / 10.0), 1); |
||
471 | } |
||
472 | else |
||
473 | { |
||
474 | st = hl->ZFo->strikeout_pos * (hl->realSiz / 10.0); |
||
475 | lw = QMAX(hl->ZFo->strokeWidth * (hl->realSiz / 10.0), 1); |
||
476 | } |
||
477 | if (hl->base != 0) |
||
478 | st += (hl->Siz / 10.0) * (hl->base / 1000.0); |
||
479 | painter->setPen(painter->brush()); |
||
480 | painter->setLineWidth(lw); |
||
481 | painter->drawLine(FPoint(hl->xco-hl->kern, hl->yco-st), FPoint(hl->xco+hl->wide, hl->yco-st)); |
||
482 | } |
||
483 | if ((hl->Style & 8) || ((hl->Style & 512) && (!ccx[0].isSpace()))) |
||
484 | { |
||
485 | double st, lw; |
||
486 | if ((hl->underpos != -1) || (hl->underwidth != -1)) |
||
487 | { |
||
488 | if (hl->underpos != -1) |
||
489 | st = (hl->underpos / 1000.0) * (hl->ZFo->numDescender * (hl->realSiz / 10.0)); |
||
490 | else |
||
491 | st = hl->ZFo->underline_pos * (hl->realSiz / 10.0); |
||
492 | if (hl->underwidth != -1) |
||
493 | lw = (hl->underwidth / 1000.0) * (hl->realSiz / 10.0); |
||
494 | else |
||
495 | lw = QMAX(hl->ZFo->strokeWidth * (hl->realSiz / 10.0), 1); |
||
496 | } |
||
497 | else |
||
498 | { |
||
499 | st = hl->ZFo->underline_pos * (hl->realSiz / 10.0); |
||
500 | lw = QMAX(hl->ZFo->strokeWidth * (hl->realSiz / 10.0), 1); |
||
501 | } |
||
502 | if (hl->base != 0) |
||
503 | st += (hl->Siz / 10.0) * (hl->base / 1000.0); |
||
504 | painter->setPen(painter->brush()); |
||
505 | painter->setLineWidth(lw); |
||
506 | painter->drawLine(FPoint(hl->xco-hl->kern, hl->yco-st), FPoint(hl->xco+hl->wide, hl->yco-st)); |
||
507 | } |
||
508 | } |
||
509 | else |
||
510 | { |
||
511 | ScColorShade colorRed( ScColor(255, 0, 0), 100 ); |
||
512 | painter->setLineWidth(1); |
||
513 | painter->setPen(colorRed); |
||
514 | painter->setBrush(colorRed); |
||
515 | painter->setFillMode(1); |
||
516 | painter->drawRect(hl->xco, hl->yco-(hl->Siz / 10.0), (hl->Siz / 10.0)*(hl->scale / 1000.0), (hl->Siz / 10.0)); |
||
517 | } |
||
518 | } |
||
519 | |||
520 | void ScPageOutput::DrawItem_Embedded( PageItem* item, ScPainterExBase *p, QRect e, struct PageItem::ZZ *hl) |
||
521 | { |
||
522 | QPtrList<PageItem> emG; |
||
523 | emG.clear(); |
||
524 | if (hl->embedded != 0) |
||
525 | { |
||
526 | if (!m_doc->DoDrawing) |
||
527 | { |
||
528 | hl->embedded->Redrawn = true; |
||
529 | hl->embedded->Tinput = false; |
||
530 | hl->embedded->FrameOnly = false; |
||
531 | return; |
||
532 | } |
||
533 | emG.append(hl->embedded); |
||
534 | if (hl->embedded->Groups.count() != 0) |
||
535 | { |
||
536 | for (uint ga=0; ga<m_doc->FrameItems.count(); ++ga) |
||
537 | { |
||
538 | if (m_doc->FrameItems.at(ga)->Groups.count() != 0) |
||
539 | { |
||
540 | if (m_doc->FrameItems.at(ga)->Groups.top() == hl->embedded->Groups.top()) |
||
541 | { |
||
542 | if (m_doc->FrameItems.at(ga)->ItemNr != hl->embedded->ItemNr) |
||
543 | { |
||
544 | if (emG.find(m_doc->FrameItems.at(ga)) == -1) |
||
545 | emG.append(m_doc->FrameItems.at(ga)); |
||
546 | } |
||
547 | } |
||
548 | } |
||
549 | } |
||
550 | } |
||
551 | for (uint em = 0; em < emG.count(); ++em) |
||
552 | { |
||
553 | PageItem* embedded = emG.at(em); |
||
554 | struct ParagraphStyle vg; |
||
555 | QValueList<ParagraphStyle> savedParagraphStyles; |
||
556 | for (int xxx=0; xxx<5; ++xxx) |
||
557 | { |
||
558 | vg.LineSpaMode = m_doc->docParagraphStyles[xxx].LineSpaMode; |
||
559 | vg.BaseAdj = m_doc->docParagraphStyles[xxx].BaseAdj; |
||
560 | vg.LineSpa = m_doc->docParagraphStyles[xxx].LineSpa; |
||
561 | vg.FontSize = m_doc->docParagraphStyles[xxx].FontSize; |
||
562 | vg.Indent = m_doc->docParagraphStyles[xxx].Indent; |
||
563 | vg.First = m_doc->docParagraphStyles[xxx].First; |
||
564 | vg.gapBefore = m_doc->docParagraphStyles[xxx].gapBefore; |
||
565 | vg.gapAfter = m_doc->docParagraphStyles[xxx].gapAfter; |
||
566 | savedParagraphStyles.append(vg); |
||
567 | } |
||
568 | p->save(); |
||
569 | embedded->setXPos(embedded->xPos() + hl->xco + embedded->gXpos); |
||
570 | embedded->setYPos(embedded->yPos() + (hl->yco - (embedded->gHeight * (hl->scalev / 1000.0))) + embedded->gYpos); |
||
571 | 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()); |
||
572 | if (hl->base != 0) |
||
573 | { |
||
574 | p->translate(0, -embedded->gHeight * (hl->base / 1000.0) * p->zoomFactor()); |
||
575 | embedded->setYPos(embedded->yPos() - embedded->gHeight * (hl->base / 1000.0)); |
||
576 | } |
||
577 | p->scale(hl->scale / 1000.0, hl->scalev / 1000.0); |
||
578 | //embedded->Dirty = Dirty; |
||
579 | double sc = 1; |
||
580 | double pws = embedded->Pwidth; |
||
581 | DrawItem_Pre(embedded, p, sc); |
||
582 | switch(embedded->itemType()) |
||
583 | { |
||
584 | case PageItem::ImageFrame: |
||
585 | DrawItem_ImageFrame((PageItem_ImageFrame*) embedded, p, sc); |
||
586 | break; |
||
587 | case PageItem::TextFrame: |
||
588 | DrawItem_TextFrame((PageItem_TextFrame*) embedded, p, e, sc); |
||
589 | break; |
||
590 | case PageItem::Line: |
||
591 | embedded->Pwidth = pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0); |
||
592 | DrawItem_Line((PageItem_Line*) embedded, p); |
||
593 | break; |
||
594 | case PageItem::Polygon: |
||
595 | DrawItem_Polygon((PageItem_Polygon*) embedded, p); |
||
596 | break; |
||
597 | case PageItem::PolyLine: |
||
598 | embedded->Pwidth = pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0); |
||
599 | DrawItem_PolyLine((PageItem_PolyLine*) embedded, p); |
||
600 | break; |
||
601 | case PageItem::PathText: |
||
602 | DrawItem_PathText( (PageItem_PathText*) embedded, p, sc); |
||
603 | break; |
||
604 | default: |
||
605 | break; |
||
606 | } |
||
607 | embedded->Pwidth = pws * QMIN(hl->scale / 1000.0, hl->scalev / 1000.0); |
||
608 | DrawItem_Post(embedded, p); |
||
609 | p->restore(); |
||
610 | embedded->Pwidth = pws; |
||
611 | for (int xxx=0; xxx<5; ++xxx) |
||
612 | { |
||
613 | m_doc->docParagraphStyles[xxx].LineSpaMode = savedParagraphStyles[xxx].LineSpaMode; |
||
614 | m_doc->docParagraphStyles[xxx].BaseAdj = savedParagraphStyles[xxx].BaseAdj; |
||
615 | m_doc->docParagraphStyles[xxx].LineSpa = savedParagraphStyles[xxx].LineSpa; |
||
616 | m_doc->docParagraphStyles[xxx].FontSize = savedParagraphStyles[xxx].FontSize; |
||
617 | m_doc->docParagraphStyles[xxx].Indent = savedParagraphStyles[xxx].Indent; |
||
618 | m_doc->docParagraphStyles[xxx].First = savedParagraphStyles[xxx].First; |
||
619 | m_doc->docParagraphStyles[xxx].gapBefore = savedParagraphStyles[xxx].gapBefore; |
||
620 | m_doc->docParagraphStyles[xxx].gapAfter = savedParagraphStyles[xxx].gapAfter; |
||
621 | } |
||
622 | savedParagraphStyles.clear(); |
||
623 | } |
||
624 | } |
||
625 | } |
||
626 | |||
627 | void ScPageOutput::DrawItem_ImageFrame( PageItem_ImageFrame* item, ScPainterExBase* painter, double scale ) |
||
628 | { |
||
629 | if ((item->fillColor() != "None") || (item->GrType != 0)) |
||
630 | { |
||
631 | painter->setupPolygon(&item->PoLine); |
||
632 | painter->fillPath(); |
||
633 | } |
||
634 | if (item->Pfile.isEmpty()) |
||
635 | { |
||
636 | if ((item->Frame) && (m_doc->guidesSettings.framesShown)) |
||
637 | { |
||
638 | painter->setPen( ScColorShade(Qt::black, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
639 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height())); |
||
640 | painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0)); |
||
641 | } |
||
642 | } |
||
643 | else |
||
644 | { |
||
645 | if ((!item->PicArt) || (!item->PicAvail)) |
||
646 | { |
||
647 | if ((item->Frame) && (m_doc->guidesSettings.framesShown)) |
||
648 | { |
||
649 | painter->setPen( ScColorShade(Qt::red, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
650 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height())); |
||
651 | painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0)); |
||
652 | } |
||
653 | } |
||
654 | else |
||
655 | { |
||
656 | ScImage scImg; |
||
657 | ScImage* pImage = NULL; |
||
658 | double imScaleX = item->imageXScale(); |
||
659 | double imScaleY = item->imageYScale(); |
||
660 | if( m_reloadImages ) |
||
661 | { |
||
662 | bool dummy; |
||
663 | QFileInfo fInfo(item->Pfile); |
||
664 | QString ext = fInfo.extension(false); |
||
665 | scImg.imgInfo.valid = false; |
||
666 | scImg.imgInfo.clipPath = ""; |
||
667 | scImg.imgInfo.PDSpathData.clear(); |
||
668 | scImg.imgInfo.layerInfo.clear(); |
||
669 | scImg.imgInfo.RequestProps = item->pixm.imgInfo.RequestProps; |
||
670 | scImg.imgInfo.isRequest = item->pixm.imgInfo.isRequest; |
||
671 | scImg.LoadPicture(item->Pfile, item->IProfile, 0, item->UseEmbedded, m_useProfiles, (int) m_imageMode, m_imageRes, &dummy); |
||
672 | if( ext == "eps" || ext == "pdf" || ext == "ps" ) |
||
673 | { |
||
674 | imScaleX *= (72.0 / (double) m_imageRes); |
||
675 | imScaleY *= (72.0 / (double) m_imageRes); |
||
676 | } |
||
677 | scImg.applyEffect(item->effectsInUse, m_doc->PageColors, true); |
||
678 | pImage = &scImg; |
||
679 | } |
||
680 | else |
||
681 | pImage = &item->pixm; |
||
682 | |||
683 | painter->save(); |
||
684 | if (item->imageClip.size() != 0) |
||
685 | painter->setupPolygon(&item->imageClip); |
||
686 | else |
||
687 | painter->setupPolygon(&item->PoLine); |
||
688 | painter->setClipPath(); |
||
689 | if (item->imageFlippedH()) |
||
690 | { |
||
691 | painter->translate(item->width() * scale, 0); |
||
692 | painter->scale(-1, 1); |
||
693 | } |
||
694 | if (item->imageFlippedV()) |
||
695 | { |
||
696 | painter->translate(0, item->height() * scale); |
||
697 | painter->scale(1, -1); |
||
698 | } |
||
699 | painter->translate(item->imageXOffset() * item->imageXScale() * scale, item->imageYOffset() * item->imageYScale() * scale); |
||
700 | //painter->translate(item->LocalX * imScaleX * scale, item->LocalY * imScaleY * scale); ?? |
||
701 | painter->scale( imScaleX, imScaleY ); |
||
702 | if (pImage->imgInfo.lowResType != 0) |
||
703 | painter->scale(pImage->imgInfo.lowResScale, pImage->imgInfo.lowResScale); |
||
704 | painter->drawImage(pImage); |
||
705 | painter->restore(); |
||
706 | } |
||
707 | } |
||
708 | } |
||
709 | |||
710 | void ScPageOutput::DrawItem_Line( PageItem_Line* item, ScPainterExBase* painter ) |
||
711 | { |
||
712 | int startArrowIndex; |
||
713 | int endArrowIndex; |
||
714 | |||
715 | startArrowIndex = item->startArrowIndex(); |
||
716 | endArrowIndex = item->endArrowIndex(); |
||
717 | |||
718 | if (item->NamedLStyle.isEmpty()) |
||
719 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
720 | else |
||
721 | { |
||
722 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
723 | for (int it = ml.size()-1; it > -1; it--) |
||
724 | { |
||
725 | ScColorShade colorShade(m_doc->PageColors[ml[it].Color], ml[it].Shade); |
||
726 | painter->setPen(colorShade, ml[it].Width, |
||
727 | static_cast<Qt::PenStyle>(ml[it].Dash), |
||
728 | static_cast<Qt::PenCapStyle>(ml[it].LineEnd), |
||
729 | static_cast<Qt::PenJoinStyle>(ml[it].LineJoin)); |
||
730 | painter->drawLine(FPoint(0, 0), FPoint(item->width(), 0)); |
||
731 | } |
||
732 | } |
||
733 | if (startArrowIndex != 0) |
||
734 | { |
||
735 | QWMatrix arrowTrans; |
||
736 | FPointArray arrow = ( *m_doc->arrowStyles.at(startArrowIndex - 1) ).points.copy(); |
||
737 | arrowTrans.translate( 0, 0 ); |
||
738 | arrowTrans.scale( item->lineWidth(), item->lineWidth()); |
||
739 | arrowTrans.scale( -1 , 1 ); |
||
740 | arrow.map( arrowTrans ); |
||
741 | painter->setBrush( painter->pen() ); |
||
742 | painter->setBrushOpacity( 1.0 - item->lineTransparency() ); |
||
743 | painter->setLineWidth( 0 ); |
||
744 | painter->setFillMode(ScPainterExBase::Solid); |
||
745 | painter->setupPolygon( &arrow ); |
||
746 | painter->fillPath(); |
||
747 | } |
||
748 | if (endArrowIndex != 0) |
||
749 | { |
||
750 | QWMatrix arrowTrans; |
||
751 | FPointArray arrow = (*m_doc->arrowStyles.at(endArrowIndex-1) ).points.copy(); |
||
752 | arrowTrans.translate( item->width(), 0 ); |
||
753 | arrowTrans.scale( item->lineWidth(), item->lineWidth()); |
||
754 | arrow.map( arrowTrans ); |
||
755 | painter->setBrush( painter->pen() ); |
||
756 | painter->setBrushOpacity( 1.0 - item->lineTransparency() ); |
||
757 | painter->setLineWidth( 0 ); |
||
758 | painter->setFillMode( ScPainterExBase::Solid ); |
||
759 | painter->setupPolygon( &arrow ); |
||
760 | painter->fillPath(); |
||
761 | } |
||
762 | } |
||
763 | |||
764 | void ScPageOutput::DrawItem_PathText( PageItem_PathText* item, ScPainterExBase* painter, double scale ) |
||
765 | { |
||
766 | uint a; |
||
767 | int chs; |
||
768 | double wide; |
||
769 | QString chx, chx2, chx3; |
||
770 | struct ScText *hl; |
||
771 | struct PageItem::ZZ *Zli; |
||
772 | double dx; |
||
773 | double sp = 0; |
||
774 | double oldSp = 0; |
||
775 | double oCurX = 0; |
||
776 | FPoint point = FPoint(0, 0); |
||
777 | FPoint normal = FPoint(0, 0); |
||
778 | FPoint tangent = FPoint(0, 0); |
||
779 | FPoint extPoint = FPoint(0, 0); |
||
780 | bool ext = false; |
||
781 | bool first = true; |
||
782 | double fsx = 0; |
||
783 | uint seg = 0; |
||
784 | double segLen = 0; |
||
785 | double distCurX; |
||
786 | double CurX = item->textToFrameDistLeft(); // item->CurX = item->textToFrameDistLeft() |
||
787 | double CurY = 0; |
||
788 | if (item->lineColor() != "None" && item->PoShow) |
||
789 | { |
||
790 | painter->setupPolygon(&item->PoLine, false); |
||
791 | painter->strokePath(); |
||
792 | } |
||
793 | if (item->itemText.count() != 0) |
||
794 | CurX += item->itemText.at(0)->csize * item->itemText.at(0)->cextra / 10000.0; |
||
795 | segLen = item->PoLine.lenPathSeg(seg); |
||
796 | for (a = 0; a < item->itemText.count(); ++a) |
||
797 | { |
||
798 | CurY = 0; |
||
799 | hl = item->itemText.at(a); |
||
800 | chx = hl->ch; |
||
801 | if ((chx == QChar(30)) || (chx == QChar(13)) || (chx == QChar(9)) || (chx == QChar(28))) |
||
802 | continue; |
||
803 | chs = hl->csize; |
||
804 | item->SetZeichAttr(hl, &chs, &chx); |
||
805 | if (chx == QChar(29)) |
||
806 | chx2 = " "; |
||
807 | else if (chx == QChar(24)) |
||
808 | chx2 = "-"; |
||
809 | else |
||
810 | chx2 = chx; |
||
811 | if (a < item->itemText.count()-1) |
||
812 | { |
||
813 | if (item->itemText.at(a+1)->ch == QChar(29)) |
||
814 | chx3 = " "; |
||
815 | else if (item->itemText.at(a+1)->ch == QChar(24)) |
||
816 | chx3 = "-"; |
||
817 | else |
||
818 | chx3 = item->itemText.at(a+1)->ch; |
||
819 | wide = Cwidth(m_doc, hl->cfont, chx2, chs, chx3); |
||
820 | } |
||
821 | else |
||
822 | wide = Cwidth(m_doc, hl->cfont, chx2, chs); |
||
823 | wide = wide * (hl->cscale / 1000.0); |
||
824 | dx = wide / 2.0; |
||
825 | CurX += dx; |
||
826 | ext = false; |
||
827 | while ( (seg < item->PoLine.size()-3) && (CurX > fsx + segLen)) |
||
828 | { |
||
829 | fsx += segLen; |
||
830 | seg += 4; |
||
831 | if (seg > item->PoLine.size()-3) |
||
832 | break; |
||
833 | segLen = item->PoLine.lenPathSeg(seg); |
||
834 | ext = true; |
||
835 | } |
||
836 | if (seg > item->PoLine.size()-3) |
||
837 | break; |
||
838 | if (CurX > fsx + segLen) |
||
839 | break; |
||
840 | if (ext) |
||
841 | { |
||
842 | sp = 0; |
||
843 | distCurX = item->PoLine.lenPathDist(seg, 0, sp); |
||
844 | while (distCurX <= ((CurX - oCurX) - (fsx - oCurX))) |
||
845 | { |
||
846 | sp += 0.001; |
||
847 | distCurX = item->PoLine.lenPathDist(seg, 0, sp); |
||
848 | } |
||
849 | item->PoLine.pointTangentNormalAt(seg, sp, &point, &tangent, &normal ); |
||
850 | CurX = (CurX - (CurX - fsx)) + distCurX; |
||
851 | oldSp = sp; |
||
852 | ext = false; |
||
853 | } |
||
854 | else |
||
855 | { |
||
856 | if( seg < item->PoLine.size()-3 ) |
||
857 | { |
||
858 | if (CurX > fsx + segLen) |
||
859 | break; |
||
860 | distCurX = item->PoLine.lenPathDist(seg, oldSp, sp); |
||
861 | while (distCurX <= (CurX - oCurX)) |
||
862 | { |
||
863 | sp += 0.001; |
||
864 | if (sp >= 1.0) |
||
865 | { |
||
866 | sp = 0.9999; |
||
867 | break; |
||
868 | } |
||
869 | distCurX = item->PoLine.lenPathDist(seg, oldSp, sp); |
||
870 | } |
||
871 | item->PoLine.pointTangentNormalAt(seg, sp, &point, &tangent, &normal ); |
||
872 | CurX = oCurX + distCurX; |
||
873 | oldSp = sp; |
||
874 | } |
||
875 | else |
||
876 | break; |
||
877 | } |
||
878 | hl->xp = point.x(); |
||
879 | hl->yp = point.y(); |
||
880 | hl->PtransX = tangent.x(); |
||
881 | hl->PtransY = tangent.y(); |
||
882 | hl->PRot = dx; |
||
883 | QWMatrix trafo = QWMatrix( 1, 0, 0, -1, -dx * scale, 0 ); |
||
884 | trafo *= QWMatrix( tangent.x(), tangent.y(), tangent.y(), -tangent.x(), point.x() * scale, point.y() * scale); |
||
885 | QWMatrix sca = painter->worldMatrix(); |
||
886 | trafo *= sca; |
||
887 | painter->save(); |
||
888 | QWMatrix savWM = painter->worldMatrix(); |
||
889 | painter->setWorldMatrix(trafo); |
||
890 | Zli = new PageItem::ZZ; |
||
891 | Zli->Zeich = chx; |
||
892 | if (hl->ccolor != "None") |
||
893 | { |
||
894 | ScColorShade tmp(m_doc->PageColors[hl->ccolor], hl->cshade); |
||
895 | painter->setBrush(tmp); |
||
896 | } |
||
897 | if (hl->cstroke != "None") |
||
898 | { |
||
899 | ScColorShade tmp(m_doc->PageColors[hl->cstroke], hl->cshade2); |
||
900 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
901 | } |
||
902 | Zli->Farb = hl->ccolor; |
||
903 | Zli->Farb2 = hl->cstroke; |
||
904 | Zli->shade = hl->cshade; |
||
905 | Zli->shade2 = hl->cshade2; |
||
906 | Zli->xco = 0; |
||
907 | Zli->yco = item->BaseOffs; |
||
908 | Zli->Sele = hl->cselect; |
||
909 | Zli->Siz = chs; |
||
910 | Zli->realSiz = hl->csize; |
||
911 | Zli->Style = hl->cstyle; |
||
912 | Zli->ZFo = hl->cfont; |
||
913 | Zli->wide = wide; |
||
914 | Zli->kern = hl->csize * hl->cextra / 10000.0; |
||
915 | Zli->scale = hl->cscale; |
||
916 | Zli->scalev = hl->cscalev; |
||
917 | Zli->base = hl->cbase; |
||
918 | Zli->shadowX = hl->cshadowx; |
||
919 | Zli->shadowY = hl->cshadowx; |
||
920 | Zli->outline = hl->coutline; |
||
921 | Zli->underpos = hl->cunderpos; |
||
922 | Zli->underwidth = hl->cunderwidth; |
||
923 | Zli->strikepos = hl->cstrikepos; |
||
924 | Zli->strikewidth = hl->cstrikewidth; |
||
925 | Zli->embedded = 0; |
||
926 | DrawCharacters(item, painter, Zli); |
||
927 | delete Zli; |
||
928 | painter->setWorldMatrix(savWM); |
||
929 | painter->restore(); |
||
930 | painter->setZoomFactor(scale); |
||
931 | item->MaxChars = a+1; |
||
932 | oCurX = CurX; |
||
933 | CurX -= dx; |
||
934 | CurX += wide+hl->csize * hl->cextra / 10000.0; |
||
935 | first = false; |
||
936 | } |
||
937 | } |
||
938 | |||
939 | void ScPageOutput::DrawItem_Polygon ( PageItem_Polygon* item , ScPainterExBase* painter ) |
||
940 | { |
||
941 | painter->setupPolygon(&item->PoLine); |
||
942 | painter->fillPath(); |
||
943 | } |
||
944 | |||
945 | void ScPageOutput::DrawItem_PolyLine( PageItem_PolyLine* item, ScPainterExBase* painter ) |
||
946 | { |
||
947 | int startArrowIndex; |
||
948 | int endArrowIndex; |
||
949 | |||
950 | startArrowIndex = item->startArrowIndex(); |
||
951 | endArrowIndex = item->endArrowIndex(); |
||
952 | |||
953 | if (item->PoLine.size()>=4) |
||
954 | { |
||
955 | if ((item->fillColor() != "None") || (item->GrType != 0)) |
||
956 | { |
||
957 | FPointArray cli; |
||
958 | FPoint Start; |
||
959 | bool firstp = true; |
||
960 | for (uint n = 0; n < item->PoLine.size()-3; n += 4) |
||
961 | { |
||
962 | if (firstp) |
||
963 | { |
||
964 | Start = item->PoLine.point(n); |
||
965 | firstp = false; |
||
966 | } |
||
967 | if (item->PoLine.point(n).x() > 900000) |
||
968 | { |
||
969 | cli.addPoint(item->PoLine.point(n-2)); |
||
970 | cli.addPoint(item->PoLine.point(n-2)); |
||
971 | cli.addPoint(Start); |
||
972 | cli.addPoint(Start); |
||
973 | cli.setMarker(); |
||
974 | firstp = true; |
||
975 | continue; |
||
976 | } |
||
977 | cli.addPoint(item->PoLine.point(n)); |
||
978 | cli.addPoint(item->PoLine.point(n+1)); |
||
979 | cli.addPoint(item->PoLine.point(n+2)); |
||
980 | cli.addPoint(item->PoLine.point(n+3)); |
||
981 | } |
||
982 | if (cli.size() > 2) |
||
983 | { |
||
984 | FPoint l1 = cli.point(cli.size()-2); |
||
985 | cli.addPoint(l1); |
||
986 | cli.addPoint(l1); |
||
987 | cli.addPoint(Start); |
||
988 | cli.addPoint(Start); |
||
989 | } |
||
990 | painter->setupPolygon(&cli); |
||
991 | painter->fillPath(); |
||
992 | } |
||
993 | painter->setupPolygon(&item->PoLine, false); |
||
994 | if (item->NamedLStyle.isEmpty()) |
||
995 | painter->strokePath(); |
||
996 | else |
||
997 | { |
||
998 | multiLine ml = m_doc->MLineStyles[item->NamedLStyle]; |
||
999 | for (int it = ml.size()-1; it > -1; it--) |
||
1000 | { |
||
1001 | ScColorShade tmp(m_doc->PageColors[ml[it].Color], ml[it].Shade); |
||
1002 | painter->setPen(tmp, ml[it].Width, |
||
1003 | static_cast<Qt::PenStyle>(ml[it].Dash), |
||
1004 | static_cast<Qt::PenCapStyle>(ml[it].LineEnd), |
||
1005 | static_cast<Qt::PenJoinStyle>(ml[it].LineJoin)); |
||
1006 | painter->strokePath(); |
||
1007 | } |
||
1008 | } |
||
1009 | if (startArrowIndex != 0) |
||
1010 | { |
||
1011 | FPoint Start = item->PoLine.point(0); |
||
1012 | for (uint xx = 1; xx < item->PoLine.size(); xx += 2) |
||
1013 | { |
||
1014 | FPoint Vector = item->PoLine.point(xx); |
||
1015 | if ((Start.x() != Vector.x()) || (Start.y() != Vector.y())) |
||
1016 | { |
||
1017 | double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI); |
||
1018 | QWMatrix arrowTrans; |
||
1019 | FPointArray arrow = (*m_doc->arrowStyles.at(startArrowIndex-1)).points.copy(); |
||
1020 | arrowTrans.translate(Start.x(), Start.y()); |
||
1021 | arrowTrans.rotate(r); |
||
1022 | arrowTrans.scale(item->lineWidth(), item->lineWidth()); |
||
1023 | arrow.map(arrowTrans); |
||
1024 | painter->setBrush(painter->pen()); |
||
1025 | painter->setBrushOpacity(1.0 - item->lineTransparency()); |
||
1026 | painter->setLineWidth(0); |
||
1027 | painter->setFillMode(ScPainterExBase::Solid); |
||
1028 | painter->setupPolygon(&arrow); |
||
1029 | painter->fillPath(); |
||
1030 | break; |
||
1031 | } |
||
1032 | } |
||
1033 | } |
||
1034 | if (endArrowIndex != 0) |
||
1035 | { |
||
1036 | FPoint End = item->PoLine.point(item->PoLine.size()-2); |
||
1037 | for (uint xx = item->PoLine.size()-1; xx > 0; xx -= 2) |
||
1038 | { |
||
1039 | FPoint Vector = item->PoLine.point(xx); |
||
1040 | if ((End.x() != Vector.x()) || (End.y() != Vector.y())) |
||
1041 | { |
||
1042 | double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI); |
||
1043 | QWMatrix arrowTrans; |
||
1044 | FPointArray arrow = (*m_doc->arrowStyles.at(endArrowIndex-1)).points.copy(); |
||
1045 | arrowTrans.translate(End.x(), End.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 | } |
||
1060 | } |
||
1061 | |||
1062 | void ScPageOutput::DrawItem_TextFrame( PageItem_TextFrame* item, ScPainterExBase* painter, QRect e, double scale ) |
||
1063 | { |
||
1064 | double CurX = 0; // item->CurX = item->textToFrameDistLeft() |
||
1065 | double CurY = 0; |
||
1066 | |||
1067 | switch (item->itemType()) |
||
1068 | { |
||
1069 | case PageItem::TextFrame: |
||
1070 | { |
||
1071 | QPainter pp, pf2; |
||
1072 | PageItem *nextItem; |
||
1073 | QPoint pt1, pt2; |
||
1074 | FPoint ColBound; |
||
1075 | QRegion cm; |
||
1076 | uint a, nrc, nrc2, startLin; |
||
1077 | int absa, aSpa, chs, chsd, CurrCol; |
||
1078 | uint BuPos, LastSP, MaxText; |
||
1079 | double oldCurY, LastXp, EndX, OFs, OFs2, wide, lineCorr, ColWidth, kernVal, RTabX; |
||
1080 | QString chx, chx2, chx3; |
||
1081 | struct ScText *hl; |
||
1082 | struct PageItem::ZZ *Zli; |
||
1083 | struct PageItem::ZZ *Zli2; |
||
1084 | |||
1085 | bool outs = false; |
||
1086 | bool fBorder = false; |
||
1087 | bool RTab = false; |
||
1088 | bool goNoRoom = false; |
||
1089 | bool goNextColumn = false; |
||
1090 | uint StartRT, StartRT2; |
||
1091 | int TabCode = 0; |
||
1092 | int HyphenCount = 0; |
||
1093 | QValueList<PageItem::TabRecord> tTabValues; |
||
1094 | bool DropCmode = false; |
||
1095 | bool AbsHasDrop = false; |
||
1096 | double desc, asce, maxDY, firstDes, desc2, maxDX, tabDist; |
||
1097 | int DropLines; |
||
1098 | bool StartOfCol = true; |
||
1099 | tTabValues.clear(); |
||
1100 | |||
1101 | for (int xxx=0; xxx<5; ++xxx) |
||
1102 | { |
||
1103 | m_doc->docParagraphStyles[xxx].LineSpaMode = item->LineSpMode; |
||
1104 | if (item->LineSpMode == 2) |
||
1105 | m_doc->docParagraphStyles[xxx].BaseAdj = true; |
||
1106 | else |
||
1107 | m_doc->docParagraphStyles[xxx].BaseAdj = false; |
||
1108 | m_doc->docParagraphStyles[xxx].LineSpa = item->LineSp; |
||
1109 | m_doc->docParagraphStyles[xxx].FontSize = item->fontSize(); |
||
1110 | m_doc->docParagraphStyles[xxx].Indent = 0; |
||
1111 | m_doc->docParagraphStyles[xxx].First = 0; |
||
1112 | m_doc->docParagraphStyles[xxx].gapBefore = 0; |
||
1113 | m_doc->docParagraphStyles[xxx].gapAfter = 0; |
||
1114 | m_doc->docParagraphStyles[xxx].textAlignment = xxx; |
||
1115 | } |
||
1116 | |||
1117 | QPtrList<PageItem::ZZ> LiList; |
||
1118 | LiList.setAutoDelete(true); |
||
1119 | 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)); |
||
1120 | painter->save(); |
||
1121 | pf2.begin(ScMW->view->viewport()); |
||
1122 | pf2.translate(item->xPos(), item->yPos()); |
||
1123 | pf2.rotate(item->rotation()); |
||
1124 | //painter->translate(item->xPos(), item->yPos()); |
||
1125 | //painter->rotate(item->rotation()); |
||
1126 | if ((item->fillColor() != "None") || (item->GrType != 0)) |
||
1127 | { |
||
1128 | painter->setupPolygon(&item->PoLine); |
||
1129 | painter->fillPath(); |
||
1130 | } |
||
1131 | if (item->lineColor() != "None") |
||
1132 | lineCorr = item->lineWidth() / 2.0; |
||
1133 | else |
||
1134 | lineCorr = 0; |
||
1135 | if ((item->isAnnotation()) && (item->annotation().Type() == 2) && (!item->Pfile.isEmpty()) && (item->PicAvail) && (item->PicArt) && (item->annotation().UseIcons())) |
||
1136 | { |
||
1137 | painter->setupPolygon(&item->PoLine); |
||
1138 | painter->setClipPath(); |
||
1139 | painter->save(); |
||
1140 | painter->scale(item->imageXScale(), item->imageYScale()); |
||
1141 | painter->translate(static_cast<int>(item->imageXOffset() * item->imageXScale()), static_cast<int>(item->imageYOffset() * item->imageYScale())); |
||
1142 | if (!item->pixm.isNull()) |
||
1143 | painter->drawImage(&item->pixm); |
||
1144 | painter->restore(); |
||
1145 | } |
||
1146 | if ((item->itemText.count() != 0)) |
||
1147 | { |
||
1148 | if (item->imageFlippedH()) |
||
1149 | { |
||
1150 | painter->translate(item->width() * scale, 0); |
||
1151 | painter->scale(-1, 1); |
||
1152 | } |
||
1153 | if (item->imageFlippedV()) |
||
1154 | { |
||
1155 | painter->translate(0, item->height() * scale); |
||
1156 | painter->scale(1, -1); |
||
1157 | } |
||
1158 | struct PageItem::ZZ Zli3; |
||
1159 | CurrCol = 0; |
||
1160 | ColWidth = item->columnWidth(); |
||
1161 | ColBound = FPoint((ColWidth + item->ColGap) * CurrCol + item->textToFrameDistLeft() + lineCorr, ColWidth * (CurrCol+1) + item->ColGap * CurrCol + item->textToFrameDistLeft()+lineCorr); |
||
1162 | ColBound = FPoint(ColBound.x(), ColBound.y() + item->textToFrameDistRight() + lineCorr); |
||
1163 | tabDist = ColBound.x(); |
||
1164 | uint tabCc = 0; |
||
1165 | for (a = 0; a < item->itemText.count(); ++a) |
||
1166 | { |
||
1167 | if (a >= item->MaxChars) |
||
1168 | break; |
||
1169 | hl = item->itemText.at(a); |
||
1170 | if (hl->cab < 5) |
||
1171 | tTabValues = item->TabValues; |
||
1172 | else |
||
1173 | tTabValues = m_doc->docParagraphStyles[hl->cab].TabValues; |
||
1174 | if (hl->cstyle & 16384) |
||
1175 | tabCc = 0; |
||
1176 | chx = hl->ch; |
||
1177 | if (hl->yp == 0) |
||
1178 | continue; |
||
1179 | if (hl->ch == QChar(30)) |
||
1180 | chx = item->ExpandToken(a); |
||
1181 | if (hl->ccolor != "None") |
||
1182 | { |
||
1183 | ScColorShade tmp(m_doc->PageColors[hl->ccolor], hl->cshade); |
||
1184 | painter->setBrush(tmp); |
||
1185 | } |
||
1186 | if (hl->cstroke != "None") |
||
1187 | { |
||
1188 | ScColorShade tmp(m_doc->PageColors[hl->cstroke], hl->cshade2); |
||
1189 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
1190 | } |
||
1191 | chs = hl->csize; |
||
1192 | if (hl->cstyle & 2048) |
||
1193 | { |
||
1194 | if (m_doc->docParagraphStyles[hl->cab].BaseAdj) |
||
1195 | chs = qRound(10 * ((m_doc->typographicSettings.valueBaseGrid * (m_doc->docParagraphStyles[hl->cab].DropLin-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / (RealCHeight(m_doc, hl->cfont, chx, 10)))); |
||
1196 | else |
||
1197 | { |
||
1198 | if (m_doc->docParagraphStyles[hl->cab].LineSpaMode == 0) |
||
1199 | chs = qRound(10 * ((m_doc->docParagraphStyles[hl->cab].LineSpa * (m_doc->docParagraphStyles[hl->cab].DropLin-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / (RealCHeight(m_doc, hl->cfont, chx, 10)))); |
||
1200 | else |
||
1201 | { |
||
1202 | double currasce = RealFHeight(m_doc, hl->cfont, m_doc->docParagraphStyles[hl->cab].FontSize); |
||
1203 | chs = qRound(10 * ((currasce * (m_doc->docParagraphStyles[hl->cab].DropLin-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / RealCHeight(m_doc, hl->cfont, chx, 10))); |
||
1204 | } |
||
1205 | } |
||
1206 | } |
||
1207 | oldCurY = item->SetZeichAttr(hl, &chs, &chx); |
||
1208 | if ((chx == QChar(9)) && (tTabValues.count() != 0) && (tabCc < tTabValues.count()) && (!tTabValues[tabCc].tabFillChar.isNull())) |
||
1209 | { |
||
1210 | QString tabFillCharQStr(tTabValues[tabCc].tabFillChar); |
||
1211 | double wt = Cwidth(m_doc, hl->cfont, tabFillCharQStr, chs); |
||
1212 | int coun = static_cast<int>((hl->xp - tabDist) / wt); |
||
1213 | double sPos = hl->xp - (hl->xp - tabDist) + 1; |
||
1214 | desc = hl->cfont->numDescender * (-chs / 10.0); |
||
1215 | asce = hl->cfont->numAscent * (chs / 10.0); |
||
1216 | Zli3.Zeich = tabFillCharQStr; |
||
1217 | Zli3.Farb = hl->ccolor; |
||
1218 | Zli3.Farb2 = hl->cstroke; |
||
1219 | Zli3.shade = hl->cshade; |
||
1220 | Zli3.shade2 = hl->cshade2; |
||
1221 | Zli3.yco = hl->yp; |
||
1222 | Zli3.Sele = hl->cselect; |
||
1223 | Zli3.Siz = chs; |
||
1224 | Zli3.realSiz = hl->csize; |
||
1225 | Zli3.Style = hl->cstyle; |
||
1226 | Zli3.ZFo = hl->cfont; |
||
1227 | Zli3.wide = wt; |
||
1228 | Zli3.kern = 0; |
||
1229 | Zli3.scale = 1000; |
||
1230 | Zli3.scalev = 1000; |
||
1231 | Zli3.shadowX = hl->cshadowx; |
||
1232 | Zli3.shadowY = hl->cshadowy; |
||
1233 | Zli3.outline = hl->coutline; |
||
1234 | Zli3.base = hl->cbase; |
||
1235 | Zli3.underpos = hl->cunderpos; |
||
1236 | Zli3.underwidth = hl->cunderwidth; |
||
1237 | Zli3.strikepos = hl->cstrikepos; |
||
1238 | Zli3.strikewidth = hl->cstrikewidth; |
||
1239 | for (int cx = 0; cx < coun; ++cx) |
||
1240 | { |
||
1241 | Zli3.xco = sPos + wt * cx; |
||
1242 | if (e2.intersects(pf2.xForm(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc))))) |
||
1243 | DrawCharacters(item, painter, &Zli3); |
||
1244 | } |
||
1245 | } |
||
1246 | if (chx == QChar(9)) |
||
1247 | tabCc++; |
||
1248 | Zli3.Zeich = chx; |
||
1249 | Zli3.Farb = hl->ccolor; |
||
1250 | Zli3.Farb2 = hl->cstroke; |
||
1251 | Zli3.shade = hl->cshade; |
||
1252 | Zli3.shade2 = hl->cshade2; |
||
1253 | Zli3.xco = hl->xp; |
||
1254 | Zli3.yco = hl->yp; |
||
1255 | Zli3.Sele = hl->cselect; |
||
1256 | Zli3.Siz = chs; |
||
1257 | Zli3.realSiz = hl->csize; |
||
1258 | Zli3.Style = hl->cstyle; |
||
1259 | Zli3.ZFo = hl->cfont; |
||
1260 | if ((hl->ch == QChar(25)) && (hl->cembedded != 0)) |
||
1261 | Zli3.wide = (hl->cembedded->gWidth + hl->cembedded->Pwidth) * (hl->cscale / 1000.0); |
||
1262 | else |
||
1263 | Zli3.wide = Cwidth(m_doc, hl->cfont, chx, hl->csize) * (hl->cscale / 1000.0); |
||
1264 | if (hl->cstyle & 16384) |
||
1265 | Zli3.kern = 0; |
||
1266 | else |
||
1267 | Zli3.kern = chs * hl->cextra / 10000.0; |
||
1268 | Zli3.scale = hl->cscale; |
||
1269 | Zli3.scalev = hl->cscalev; |
||
1270 | Zli3.base = hl->cbase; |
||
1271 | Zli3.shadowX = hl->cshadowx; |
||
1272 | Zli3.shadowY = hl->cshadowy; |
||
1273 | Zli3.outline = hl->coutline; |
||
1274 | Zli3.underpos = hl->cunderpos; |
||
1275 | Zli3.underwidth = hl->cunderwidth; |
||
1276 | Zli3.strikepos = hl->cstrikepos; |
||
1277 | Zli3.strikewidth = hl->cstrikewidth; |
||
1278 | Zli3.embedded = hl->cembedded; |
||
1279 | /*if (!m_doc->RePos)*/ |
||
1280 | { |
||
1281 | double xcoZli = Zli3.xco; |
||
1282 | desc = Zli3.ZFo->numDescender * (-Zli3.Siz / 10.0); |
||
1283 | asce = Zli3.ZFo->numAscent * (Zli3.Siz / 10.0); |
||
1284 | if ((((Zli3.Sele) && (item->isSelected())) || (((item->NextBox != 0) || (item->BackBox != 0)) && (Zli3.Sele))) && (m_doc->appMode == modeEdit)) |
||
1285 | { |
||
1286 | wide = Zli3.wide; |
||
1287 | painter->setFillMode(1); |
||
1288 | painter->setBrush(ScColorShade(Qt::darkBlue, 100)); |
||
1289 | painter->setLineWidth(0); |
||
1290 | if ((a > 0) && (Zli3.Zeich == QChar(9))) |
||
1291 | { |
||
1292 | 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); |
||
1293 | wide = Zli3.xco - xcoZli + Zli3.wide; |
||
1294 | } |
||
1295 | //if (!m_doc->RePos) |
||
1296 | painter->drawRect(xcoZli, qRound(Zli3.yco-asce * (Zli3.scalev / 1000.0)), wide+1, qRound((asce+desc) * (Zli3.scalev / 1000.0))); |
||
1297 | painter->setBrush(ScColorShade(Qt::white, 100)); |
||
1298 | } |
||
1299 | if (Zli3.Farb2 != "None") |
||
1300 | { |
||
1301 | ScColorShade tmp(m_doc->PageColors[Zli3.Farb2], Zli3.shade2); |
||
1302 | painter->setPen(tmp, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
1303 | } |
||
1304 | if (((chx == QChar(13)) || (chx == QChar(28))) && (m_doc->guidesSettings.showControls)) |
||
1305 | { |
||
1306 | if (e2.intersects(pf2.xForm(QRect(qRound(Zli3.xco+Zli3.wide),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc))))) |
||
1307 | { |
||
1308 | FPointArray points; |
||
1309 | QWMatrix chma, chma2, chma4, chma5; |
||
1310 | double ytrans, xtrans; |
||
1311 | if (chx == QChar(13)) |
||
1312 | { |
||
1313 | points = m_doc->symReturn.copy(); |
||
1314 | if (a > 0) |
||
1315 | ytrans = item->itemText.at(a-1)->yp-((Zli3.Siz / 10.0) * 0.8); |
||
1316 | else |
||
1317 | ytrans = Zli3.yco-m_doc->docParagraphStyles[hl->cab].LineSpa-((Zli3.Siz / 10.0) * 0.8); |
||
1318 | } |
||
1319 | else |
||
1320 | { |
||
1321 | points = m_doc->symNewLine.copy(); |
||
1322 | if (a > 0) |
||
1323 | ytrans = item->itemText.at(a-1)->yp-((Zli3.Siz / 10.0) * 0.4); |
||
1324 | else |
||
1325 | ytrans = Zli3.yco-m_doc->docParagraphStyles[hl->cab].LineSpa-((Zli3.Siz / 10.0) * 0.4); |
||
1326 | } |
||
1327 | if (hl->cstyle & 16384) |
||
1328 | xtrans = Zli3.xco; |
||
1329 | else |
||
1330 | { |
||
1331 | if (a > 0) |
||
1332 | 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); |
||
1333 | else |
||
1334 | xtrans = Zli3.xco; |
||
1335 | } |
||
1336 | chma4.translate(xtrans, ytrans); |
||
1337 | chma.scale(Zli3.Siz / 100.0, Zli3.Siz / 100.0); |
||
1338 | chma2.scale(Zli3.scale / 1000.0, Zli3.scalev / 1000.0); |
||
1339 | chma5.scale(painter->zoomFactor(), painter->zoomFactor()); |
||
1340 | points.map(chma * chma2 * chma4 * chma5); |
||
1341 | painter->setupTextPolygon(&points); |
||
1342 | painter->setFillMode(1); |
||
1343 | painter->fillPath(); |
||
1344 | } |
||
1345 | } |
||
1346 | if (e2.intersects(pf2.xForm(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc))))) |
||
1347 | { |
||
1348 | if (Zli3.Zeich == QChar(25)) |
||
1349 | DrawItem_Embedded(item, painter, e, &Zli3); |
||
1350 | else |
||
1351 | DrawCharacters(item, painter, &Zli3); |
||
1352 | } |
||
1353 | if (hl->cstyle & 8192) |
||
1354 | { |
||
1355 | Zli3.Zeich = "-"; |
||
1356 | Zli3.xco = Zli3.xco + Zli3.wide; |
||
1357 | if (e2.intersects(pf2.xForm(QRect(qRound(Zli3.xco),qRound(Zli3.yco-asce), qRound(Zli3.wide+1), qRound(asce+desc))))) |
||
1358 | DrawCharacters(item, painter, &Zli3); |
||
1359 | } |
||
1360 | } |
||
1361 | tabDist = Zli3.xco+Zli3.wide; |
||
1362 | } |
||
1363 | //Dirty = false; |
||
1364 | //Redrawn = true; |
||
1365 | pf2.end(); |
||
1366 | painter->restore(); |
||
1367 | break; |
||
1368 | } |
||
1369 | if ((item->itemText.count() != 0) || (item->NextBox != 0)) |
||
1370 | { |
||
1371 | if (item->NextBox != 0) |
||
1372 | { |
||
1373 | nextItem = item->NextBox; |
||
1374 | while (nextItem != 0) |
||
1375 | { |
||
1376 | a = nextItem->itemText.count(); |
||
1377 | for (uint s=0; s<a; ++s) |
||
1378 | { |
||
1379 | item->itemText.append(nextItem->itemText.take(0)); |
||
1380 | } |
||
1381 | nextItem->MaxChars = 0; |
||
1382 | nextItem = nextItem->NextBox; |
||
1383 | } |
||
1384 | nextItem = item->NextBox; |
||
1385 | } |
||
1386 | m_doc->docParagraphStyles[0].LineSpa = item->LineSp; |
||
1387 | QRegion cl = QRegion(pf2.xForm(item->Clip)); |
||
1388 | int LayerLev = m_doc->layerLevelFromNumber(item->LayerNr); |
||
1389 | uint docItemsCount=m_doc->Items->count(); |
||
1390 | if (!item->isEmbedded) |
||
1391 | { |
||
1392 | if (!item->OnMasterPage.isEmpty()) |
||
1393 | { |
||
1394 | Page* Mp = m_doc->MasterPages.at(m_doc->MasterNames[item->OnMasterPage]); |
||
1395 | Page* Dp = m_doc->Pages->at(item->OwnPage); |
||
1396 | for (a = 0; a < m_doc->MasterItems.count(); ++a) |
||
1397 | { |
||
1398 | PageItem* docItem = m_doc->MasterItems.at(a); |
||
1399 | int LayerLevItem = m_doc->layerLevelFromNumber(docItem->LayerNr); |
||
1400 | if (((docItem->ItemNr > item->ItemNr) && (docItem->LayerNr == item->LayerNr)) || (LayerLevItem > LayerLev)) |
||
1401 | { |
||
1402 | if (docItem->textFlowsAroundFrame()) |
||
1403 | { |
||
1404 | pp.begin(ScMW->view->viewport()); |
||
1405 | pp.translate(docItem->xPos() - Mp->xOffset() + Dp->xOffset(), docItem->yPos() - Mp->yOffset() + Dp->yOffset()); |
||
1406 | pp.rotate(docItem->rotation()); |
||
1407 | if (docItem->textFlowUsesBoundingBox()) |
||
1408 | { |
||
1409 | QPointArray tcli; |
||
1410 | tcli.resize(4); |
||
1411 | tcli.setPoint(0, QPoint(0,0)); |
||
1412 | tcli.setPoint(1, QPoint(qRound(docItem->width()), 0)); |
||
1413 | tcli.setPoint(2, QPoint(qRound(docItem->width()), qRound(docItem->height()))); |
||
1414 | tcli.setPoint(3, QPoint(0, qRound(docItem->height()))); |
||
1415 | cm = QRegion(pp.xForm(tcli)); |
||
1416 | } |
||
1417 | else |
||
1418 | { |
||
1419 | if ((docItem->textFlowUsesContourLine()) && (docItem->ContourLine.size() != 0)) |
||
1420 | { |
||
1421 | QValueList<uint> Segs; |
||
1422 | QPointArray Clip2 = FlattenPath(docItem->ContourLine, Segs); |
||
1423 | cm = QRegion(pp.xForm(Clip2)); |
||
1424 | } |
||
1425 | else |
||
1426 | cm = QRegion(pp.xForm(docItem->Clip)); |
||
1427 | } |
||
1428 | pp.end(); |
||
1429 | cl = cl.subtract(cm); |
||
1430 | } |
||
1431 | } |
||
1432 | } |
||
1433 | for (a = 0; a < docItemsCount; ++a) |
||
1434 | { |
||
1435 | PageItem* docItem = m_doc->Items->at(a); |
||
1436 | if (docItem->textFlowsAroundFrame()) |
||
1437 | { |
||
1438 | pp.begin(ScMW->view->viewport()); |
||
1439 | pp.translate(docItem->xPos(), docItem->yPos()); |
||
1440 | pp.rotate(docItem->rotation()); |
||
1441 | if (docItem->textFlowUsesBoundingBox()) |
||
1442 | { |
||
1443 | QPointArray tcli; |
||
1444 | tcli.resize(4); |
||
1445 | tcli.setPoint(0, QPoint(0,0)); |
||
1446 | tcli.setPoint(1, QPoint(qRound(docItem->width()), 0)); |
||
1447 | tcli.setPoint(2, QPoint(qRound(docItem->width()), qRound(docItem->height()))); |
||
1448 | tcli.setPoint(3, QPoint(0, qRound(docItem->height()))); |
||
1449 | cm = QRegion(pp.xForm(tcli)); |
||
1450 | } |
||
1451 | else |
||
1452 | { |
||
1453 | if ((docItem->textFlowUsesContourLine()) && (docItem->ContourLine.size() != 0)) |
||
1454 | { |
||
1455 | QValueList<uint> Segs; |
||
1456 | QPointArray Clip2 = FlattenPath(docItem->ContourLine, Segs); |
||
1457 | cm = QRegion(pp.xForm(Clip2)); |
||
1458 | } |
||
1459 | else |
||
1460 | cm = QRegion(pp.xForm(docItem->Clip)); |
||
1461 | } |
||
1462 | pp.end(); |
||
1463 | cl = cl.subtract(cm); |
||
1464 | } |
||
1465 | } |
||
1466 | } |
||
1467 | for (a = 0; a < docItemsCount; ++a) |
||
1468 | { |
||
1469 | PageItem* docItem = m_doc->Items->at(a); |
||
1470 | int LayerLevItem = m_doc->layerLevelFromNumber(docItem->LayerNr); |
||
1471 | if (((docItem->ItemNr > item->ItemNr) && (docItem->LayerNr == item->LayerNr)) || (LayerLevItem > LayerLev)) |
||
1472 | { |
||
1473 | if (docItem->textFlowsAroundFrame()) |
||
1474 | { |
||
1475 | pp.begin(ScMW->view->viewport()); |
||
1476 | pp.translate(docItem->xPos(), docItem->yPos()); |
||
1477 | pp.rotate(docItem->rotation()); |
||
1478 | if (docItem->textFlowUsesBoundingBox()) |
||
1479 | { |
||
1480 | QPointArray tcli; |
||
1481 | tcli.resize(4); |
||
1482 | tcli.setPoint(0, QPoint(0,0)); |
||
1483 | tcli.setPoint(1, QPoint(qRound(docItem->width()), 0)); |
||
1484 | tcli.setPoint(2, QPoint(qRound(docItem->width()), qRound(docItem->height()))); |
||
1485 | tcli.setPoint(3, QPoint(0, qRound(docItem->height()))); |
||
1486 | cm = QRegion(pp.xForm(tcli)); |
||
1487 | } |
||
1488 | else |
||
1489 | { |
||
1490 | if ((docItem->textFlowUsesContourLine()) && (docItem->ContourLine.size() != 0)) |
||
1491 | { |
||
1492 | QValueList<uint> Segs; |
||
1493 | QPointArray Clip2 = FlattenPath(docItem->ContourLine, Segs); |
||
1494 | cm = QRegion(pp.xForm(Clip2)); |
||
1495 | } |
||
1496 | else |
||
1497 | cm = QRegion(pp.xForm(docItem->Clip)); |
||
1498 | } |
||
1499 | pp.end(); |
||
1500 | cl = cl.subtract(cm); |
||
1501 | } |
||
1502 | } |
||
1503 | } |
||
1504 | } |
||
1505 | if (item->imageFlippedH()) |
||
1506 | { |
||
1507 | painter->translate(item->width() * scale, 0); |
||
1508 | painter->scale(-1, 1); |
||
1509 | pf2.translate(item->width(), 0); |
||
1510 | pf2.scale(-1, 1); |
||
1511 | } |
||
1512 | if (item->imageFlippedV()) |
||
1513 | { |
||
1514 | painter->translate(0, item->height() * scale); |
||
1515 | painter->scale(1, -1); |
||
1516 | pf2.translate(0, item->height()); |
||
1517 | pf2.scale(1, -1); |
||
1518 | } |
||
1519 | CurrCol = 0; |
||
1520 | //ColWidth = (item->width() - (item->ColGap * (item->Cols - 1)) - item->textToFrameDistLeft() - item->textToFrameDistRight() - 2*lineCorr) / item->Cols; |
||
1521 | ColWidth = item->columnWidth(); |
||
1522 | ColBound = FPoint((ColWidth + item->ColGap) * CurrCol + item->textToFrameDistLeft() + lineCorr, ColWidth * (CurrCol+1) + item->ColGap * CurrCol + item->textToFrameDistLeft() + lineCorr); |
||
1523 | ColBound = FPoint(ColBound.x(), ColBound.y() + item->textToFrameDistRight() + lineCorr); |
||
1524 | CurX = ColBound.x(); |
||
1525 | if (item->itemText.count() > 0) |
||
1526 | { |
||
1527 | hl = item->itemText.at(0); |
||
1528 | if (m_doc->docParagraphStyles[hl->cab].Drop) |
||
1529 | { |
||
1530 | if (m_doc->docParagraphStyles[hl->cab].BaseAdj) |
||
1531 | chs = qRound(m_doc->typographicSettings.valueBaseGrid * m_doc->docParagraphStyles[hl->cab].DropLin * 10); |
||
1532 | else |
||
1533 | chs = qRound(m_doc->docParagraphStyles[hl->cab].LineSpa * m_doc->docParagraphStyles[hl->cab].DropLin * 10); |
||
1534 | } |
||
1535 | else |
||
1536 | chs = hl->csize; |
||
1537 | desc2 = -hl->cfont->numDescender * (chs / 10.0); |
||
1538 | CurY = item->textToFrameDistTop() + lineCorr; |
||
1539 | } |
||
1540 | else |
||
1541 | { |
||
1542 | desc2 = -(*m_doc->AllFonts)[item->font()]->numDescender * (item->fontSize() / 10.0); |
||
1543 | CurY = m_doc->docParagraphStyles[0].LineSpa + item->textToFrameDistTop() + lineCorr - desc2; |
||
1544 | } |
||
1545 | firstDes = desc2; |
||
1546 | LiList.clear(); |
||
1547 | BuPos = 0; |
||
1548 | LastSP = 0; |
||
1549 | LastXp = 0; |
||
1550 | outs = false; |
||
1551 | OFs = 0; |
||
1552 | OFs2 = 0; |
||
1553 | aSpa = 0; |
||
1554 | absa = 0; |
||
1555 | item->MaxChars = 0; |
||
1556 | tabDist = 0; |
||
1557 | MaxText = item->itemText.count(); |
||
1558 | StartOfCol = true; |
||
1559 | for (a = 0; a < MaxText; ++a) |
||
1560 | { |
||
1561 | hl = item->itemText.at(a); |
||
1562 | chx = hl->ch; |
||
1563 | if (hl->ch == QChar(30)) |
||
1564 | chx = item->ExpandToken(a); |
||
1565 | absa = hl->cab; |
||
1566 | if (m_doc->docParagraphStyles[absa].LineSpaMode == 1) |
||
1567 | m_doc->docParagraphStyles[absa].LineSpa = RealFHeight(m_doc, hl->cfont, hl->csize); |
||
1568 | if (a == 0) |
||
1569 | { |
||
1570 | if (item->BackBox != 0) |
||
1571 | { |
||
1572 | nextItem = item->BackBox; |
||
1573 | while (nextItem != 0) |
||
1574 | { |
||
1575 | uint nextItemTextCount=nextItem->itemText.count(); |
||
1576 | if (nextItemTextCount != 0) |
||
1577 | { |
||
1578 | if (nextItem->itemText.at(nextItemTextCount-1)->ch == QChar(13)) |
||
1579 | { |
||
1580 | CurY += m_doc->docParagraphStyles[absa].gapBefore; |
||
1581 | if (chx != QChar(13)) |
||
1582 | { |
||
1583 | DropCmode = m_doc->docParagraphStyles[absa].Drop; |
||
1584 | if (DropCmode) |
||
1585 | DropLines = m_doc->docParagraphStyles[absa].DropLin; |
||
1586 | } |
||
1587 | else |
||
1588 | DropCmode = false; |
||
1589 | break; |
||
1590 | } |
||
1591 | else |
||
1592 | break; |
||
1593 | } |
||
1594 | nextItem = nextItem->BackBox; |
||
1595 | } |
||
1596 | } |
||
1597 | else |
||
1598 | { |
||
1599 | if (chx != QChar(13)) |
||
1600 | { |
||
1601 | DropCmode = m_doc->docParagraphStyles[absa].Drop; |
||
1602 | if (DropCmode) |
||
1603 | DropLines = m_doc->docParagraphStyles[absa].DropLin; |
||
1604 | } |
||
1605 | else |
||
1606 | DropCmode = false; |
||
1607 | CurY += m_doc->docParagraphStyles[absa].gapBefore; |
||
1608 | } |
||
1609 | } |
||
1610 | hl->cstyle &= 0xF7FF; // 2047; |
||
1611 | hl->cstyle &= 8191; |
||
1612 | if (((m_doc->docParagraphStyles[absa].textAlignment == 3) || (m_doc->docParagraphStyles[absa].textAlignment == 4)) && (LiList.count() == 0) && (hl->ch == " ")) |
||
1613 | { |
||
1614 | hl->cstyle |= 4096; |
||
1615 | continue; |
||
1616 | } |
||
1617 | else |
||
1618 | hl->cstyle &= 0xEFFF; // 4095; |
||
1619 | if (LiList.count() == 0) |
||
1620 | { |
||
1621 | if (((a > 0) && (item->itemText.at(a-1)->ch == QChar(13))) || ((a == 0) && (item->BackBox == 0)) && (!StartOfCol)) |
||
1622 | { |
||
1623 | CurY += m_doc->docParagraphStyles[absa].gapBefore; |
||
1624 | if (chx != QChar(13)) |
||
1625 | DropCmode = m_doc->docParagraphStyles[absa].Drop; |
||
1626 | else |
||
1627 | DropCmode = false; |
||
1628 | if (DropCmode) |
||
1629 | { |
||
1630 | DropLines = m_doc->docParagraphStyles[absa].DropLin; |
||
1631 | if (m_doc->docParagraphStyles[hl->cab].BaseAdj) |
||
1632 | CurY += m_doc->typographicSettings.valueBaseGrid * (DropLines-1); |
||
1633 | else |
||
1634 | { |
||
1635 | if (m_doc->docParagraphStyles[absa].LineSpaMode == 0) |
||
1636 | CurY += m_doc->docParagraphStyles[absa].LineSpa * (DropLines-1); |
||
1637 | else |
||
1638 | CurY += RealFHeight(m_doc, hl->cfont, m_doc->docParagraphStyles[absa].FontSize) * (DropLines-1); |
||
1639 | } |
||
1640 | } |
||
1641 | } |
||
1642 | } |
||
1643 | if (DropCmode) |
||
1644 | { |
||
1645 | if (m_doc->docParagraphStyles[hl->cab].BaseAdj) |
||
1646 | { |
||
1647 | chsd = qRound(10 * ((m_doc->typographicSettings.valueBaseGrid * (DropLines-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / (RealCHeight(m_doc, hl->cfont, chx, 10)))); |
||
1648 | chs = qRound(10 * ((m_doc->typographicSettings.valueBaseGrid * (DropLines-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / RealCAscent(m_doc, hl->cfont, chx, 10))); |
||
1649 | } |
||
1650 | else |
||
1651 | { |
||
1652 | if (m_doc->docParagraphStyles[absa].LineSpaMode == 0) |
||
1653 | { |
||
1654 | chsd = qRound(10 * ((m_doc->docParagraphStyles[absa].LineSpa * (DropLines-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / (RealCHeight(m_doc, hl->cfont, chx, 10)))); |
||
1655 | chs = qRound(10 * ((m_doc->docParagraphStyles[absa].LineSpa * (DropLines-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / RealCAscent(m_doc, hl->cfont, chx, 10))); |
||
1656 | } |
||
1657 | else |
||
1658 | { |
||
1659 | double currasce = RealFHeight(m_doc, hl->cfont, m_doc->docParagraphStyles[hl->cab].FontSize); |
||
1660 | chsd = qRound(10 * ((currasce * (DropLines-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / (RealCHeight(m_doc, hl->cfont, chx, 10)))); |
||
1661 | chs = qRound(10 * ((currasce * (DropLines-1)+(hl->cfont->numAscent * (m_doc->docParagraphStyles[hl->cab].FontSize / 10.0))) / RealCAscent(m_doc, hl->cfont, chx, 10))); |
||
1662 | } |
||
1663 | } |
||
1664 | hl->cstyle |= 2048; |
||
1665 | } |
||
1666 | else |
||
1667 | { |
||
1668 | if ((hl->ch == QChar(25)) && (hl->cembedded != 0)) |
||
1669 | chs = qRound((hl->cembedded->gHeight + hl->cembedded->Pwidth) * 10); |
||
1670 | else |
||
1671 | chs = hl->csize; |
||
1672 | } |
||
1673 | oldCurY = item->SetZeichAttr(hl, &chs, &chx); |
||
1674 | if (chx == QChar(29)) |
||
1675 | chx2 = " "; |
||
1676 | else if (chx == QChar(24)) |
||
1677 | chx2 = "-"; |
||
1678 | else |
||
1679 | chx2 = chx; |
||
1680 | if ((hl->ch == QChar(25)) && (hl->cembedded != 0)) |
||
1681 | wide = hl->cembedded->gWidth + hl->cembedded->Pwidth; |
||
1682 | else |
||
1683 | { |
||
1684 | if (a < MaxText-1) |
||
1685 | { |
||
1686 | if (item->itemText.at(a+1)->ch == QChar(29)) |
||
1687 | chx3 = " "; |
||
1688 | else if (item->itemText.at(a+1)->ch == QChar(24)) |
||
1689 | chx3 = "-"; |
||
1690 | else |
||
1691 | chx3 = item->itemText.at(a+1)->ch; |
||
1692 | wide = Cwidth(m_doc, hl->cfont, chx2, chs, chx3); |
||
1693 | } |
||
1694 | else |
||
1695 | wide = Cwidth(m_doc, hl->cfont, chx2, chs); |
||
1696 | } |
||
1697 | if (DropCmode) |
||
1698 | { |
||
1699 | if ((hl->ch == QChar(25)) && (hl->cembedded != 0)) |
||
1700 | { |
||
1701 | wide = hl->cembedded->gWidth + hl->cembedded->Pwidth; |
||
1702 | if (m_doc->docParagraphStyles[hl->cab].BaseAdj) |
||
1703 | asce = m_doc->typographicSettings.valueBaseGrid * DropLines; |
||
1704 | else |
||
1705 | { |
||
1706 | if (m_doc->docParagraphStyles[absa].LineSpaMode == 0) |
||
1707 | asce = m_doc->docParagraphStyles[absa].LineSpa * DropLines; |
||
1708 | else |
||
1709 | asce = RealFHeight(m_doc, hl->cfont, m_doc->docParagraphStyles[absa].FontSize) * DropLines; |
||
1710 | } |
||
1711 | hl->cscalev = qRound(asce / (hl->cembedded->gHeight + hl->cembedded->Pwidth) * 1000.0); |
||
1712 | hl->cscale = hl->cscalev; |
||
1713 | } |
||
1714 | else |
||
1715 | { |
||
1716 | wide = RealCWidth(m_doc, hl->cfont, chx2, chsd); |
||
1717 | asce = RealCHeight(m_doc, hl->cfont, chx2, chsd); |
||
1718 | } |
||
1719 | desc2 = 0; |
||
1720 | desc = 0; |
||
1721 | } |
||
1722 | else |
||
1723 | { |
||
1724 | if ((hl->ch == QChar(25)) && (hl->cembedded != 0)) |
||
1725 | { |
||
1726 | asce = hl->cfont->numAscent * (hl->csize / 10.0); |
||
1727 | desc2 = 0; |
||
1728 | desc = 0; |
||
1729 | } |
||
1730 | else |
||
1731 | { |
||
1732 | desc2 = -hl->cfont->numDescender * (hl->csize / 10.0); |
||
1733 | desc = -hl->cfont->numDescender * (hl->csize / 10.0); |
||
1734 | asce = hl->cfont->numAscent * (hl->csize / 10.0); |
||
1735 | } |
||
1736 | } |
||
1737 | wide = wide * (hl->cscale / 1000.0); |
||
1738 | fBorder = false; |
||
1739 | if (CurY + item->textToFrameDistBottom() + lineCorr > item->height()) |
||
1740 | { |
||
1741 | StartOfCol = true; |
||
1742 | CurrCol++; |
||
1743 | if (CurrCol < item->Cols) |
||
1744 | { |
||
1745 | //ColWidth = (item->width() - (item->ColGap * (item->Cols - 1)) - item->textToFrameDistLeft() - item->textToFrameDistRight() - 2*lineCorr) / item->Cols; |
||
1746 | ColWidth = item->columnWidth(); |
||
1747 | ColBound = FPoint((ColWidth + item->ColGap) * CurrCol + item->textToFrameDistLeft() + lineCorr, ColWidth * (CurrCol+1) + item->ColGap * CurrCol + item->textToFrameDistLeft() + lineCorr); |
||
1748 | CurX = ColBound.x(); |
||
1749 | ColBound = FPoint(ColBound.x(), ColBound.y() + item->textToFrameDistRight() + lineCorr); |
||
1750 | CurY = asce + item->textToFrameDistTop() + lineCorr + 1; |
||
1751 | if (((a > 0) && (item->itemText.at(a-1)->ch == QChar(13))) || ((a == 0) && (item->BackBox == 0))) |
||
1752 | { |
||
1753 | if (chx != QChar(13)) |
||
1754 | DropCmode = m_doc->docParagraphStyles[hl->cab].Drop; |
||
1755 | else |
||
1756 | DropCmode = false; |
||
1757 | if (DropCmode) |
||
1758 | { |
||
1759 | if (m_doc->docParagraphStyles[hl->cab].BaseAdj) |
||
1760 | desc2 = -hl->cfont->numDescender * m_doc->typographicSettings.valueBaseGrid * m_doc->docParagraphStyles[hl->cab].DropLin; |
||
1761 | else |
||
1762 | desc2 = -hl->cfont->numDescender * m_doc->docParagraphStyles[hl->cab].LineSpa * m_doc->docParagraphStyles[hl->cab].DropLin; |
||
1763 | } |
||
1764 | if (DropCmode) |
||
1765 | DropLines = m_doc->docParagraphStyles[hl->cab].DropLin; |
||
1766 | } |
||
1767 | if (m_doc->docParagraphStyles[hl->cab].BaseAdj) |
||
1768 | { |
||
1769 | double by = item->yPos(); |
||
1770 | if (item->OwnPage != -1) |
||
1771 | by = item->yPos() - m_doc->Pages->at(item->OwnPage)->yOffset(); |
||
1772 | int ol1 = qRound((by + CurY - m_doc->typographicSettings.offsetBaseGrid) * 10000.0); |
||
1773 | int ol2 = static_cast<int>(ol1 / m_doc->typographicSettings.valueBaseGrid); |
||
1774 | CurY = ceil( ol2 / 10000.0 ) * m_doc->typographicSettings.valueBaseGrid + m_doc->typographicSettings.offsetBaseGrid - by; |
||
1775 | } |
||
1776 | } |
||
1777 | else |
||
1778 | { |
||
1779 | nrc = a; |
||
1780 | goto NoRoom; |
||
1781 | } |
||
1782 | } |
||
1783 | if (LiList.isEmpty()) |
||
1784 | { |
||
1785 | startLin = a; |
||
1786 | double TopOffset = asce; |
||
1787 | double BotOffset = desc2; |
||
1788 | goNoRoom = false; |
||
1789 | if (StartOfCol) |
||
1790 | { |
||
1791 | CurY = asce + item->textToFrameDistTop() + lineCorr+1; |
||
1792 | // if (((a > 0) && (item->itemText.at(a-1)->ch == QChar(13))) || ((a == 0) && (BackBox == 0))) |
||
1793 | // CurY += m_doc->docParagraphStyles[hl->cab].gapBefore; |
||
1794 | } |
||
1795 | if (m_doc->docParagraphStyles[hl->cab].BaseAdj) |
||
1796 | { |
||
1797 | double by = item->yPos(); |
||
1798 | if (item->OwnPage != -1) |
||
1799 | by = item->yPos() - m_doc->Pages->at(item->OwnPage)->yOffset(); |
||
1800 | int ol1 = qRound((by + CurY - m_doc->typographicSettings.offsetBaseGrid) * 10000.0); |
||
1801 | int ol2 = static_cast<int>(ol1 / m_doc->typographicSettings.valueBaseGrid); |
||
1802 | CurY = ceil( ol2 / 10000.0 ) * m_doc->typographicSettings.valueBaseGrid + m_doc->typographicSettings.offsetBaseGrid - by; |
||
1803 | } |
||
1804 | if (CurY-TopOffset < 0.0) |
||
1805 | CurY = TopOffset+1; |
||
1806 | pt1 = QPoint(static_cast<int>(ceil(CurX)), static_cast<int>(CurY+BotOffset)); |
||
1807 | pt2 = QPoint(static_cast<int>(ceil(CurX)), static_cast<int>(ceil(CurY-TopOffset))); |
||
1808 | while ((!cl.contains(pf2.xForm(pt1))) || (!cl.contains(pf2.xForm(pt2)))) |
||
1809 | { |
||
1810 | fBorder = true; |
||
1811 | CurX++; |
||
1812 | if (CurX + item->textToFrameDistRight() + lineCorr > ColBound.y()) |
||
1813 | { |
||
1814 | fBorder = false; |
||
1815 | if (StartOfCol) |
||
1816 | { |
||
1817 | CurX = ColBound.x(); |
||
1818 | CurY++; |
||
1819 | } |
||
1820 | else |
||
1821 | { |
||