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