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