Rev 18495 | Rev 18542 | 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 | */ |
||
3 | paul | 7 | /*************************************************************************** |
8 | pageitem.cpp - description |
||
9 | ------------------- |
||
10 | begin : Sat Apr 7 2001 |
||
11 | copyright : (C) 2001 by Franz Schmid |
||
12 | email : Franz.Schmid@altmuehlnet.de |
||
13 | ***************************************************************************/ |
||
14 | |||
15 | /*************************************************************************** |
||
16 | * * |
||
17 | * This program is free software; you can redistribute it and/or modify * |
||
18 | * it under the terms of the GNU General Public License as published by * |
||
19 | * the Free Software Foundation; either version 2 of the License, or * |
||
20 | * (at your option) any later version. * |
||
21 | * * |
||
22 | ***************************************************************************/ |
||
136 | Franz | 23 | |
3 | paul | 24 | #include "pageitem.h" |
16503 | craig | 25 | |
10220 | cbradney | 26 | #include <QPainter> |
27 | #include <QPen> |
||
28 | #include <QFont> |
||
29 | #include <QRegion> |
||
30 | #include <QPoint> |
||
16856 | craig | 31 | #include <QPointF> |
10220 | cbradney | 32 | #include <QFileInfo> |
3 | paul | 33 | #include <qdrawutil.h> |
10220 | cbradney | 34 | #include <QRegExp> |
35 | #include <QMessageBox> |
||
10284 | fschmid | 36 | #include <QPolygon> |
2104 | cbradney | 37 | #include <cassert> |
17826 | craig | 38 | #include <sstream> |
11645 | fschmid | 39 | #include <QDebug> |
4772 | cbradney | 40 | |
10532 | avox | 41 | #include "canvas.h" |
10601 | mrdocs | 42 | #include "cmsettings.h" |
10212 | cbradney | 43 | #include "colorblind.h" |
44 | #include "commonstrings.h" |
||
17826 | craig | 45 | #include "desaxe/saxXML.h" |
46 | #include "marks.h" |
||
16736 | jghali | 47 | |
17092 | jghali | 48 | #include "pageitem_group.h" |
17709 | craig | 49 | #include "pageitem_regularpolygon.h" |
50 | #include "pageitem_arc.h" |
||
17735 | craig | 51 | #include "pageitem_spiral.h" |
16503 | craig | 52 | #include "pageitem_textframe.h" |
18047 | craig | 53 | #include "pageitem_noteframe.h" |
10386 | mrdocs | 54 | #include "pageitem_latexframe.h" |
10212 | cbradney | 55 | #include "prefsmanager.h" |
16736 | jghali | 56 | |
10212 | cbradney | 57 | #include "resourcecollection.h" |
13497 | jghali | 58 | #include "scclocale.h" |
10212 | cbradney | 59 | #include "sccolorengine.h" |
14539 | jghali | 60 | #include "scimagecacheproxy.h" |
16736 | jghali | 61 | #include "sclimits.h" |
62 | #include "scpage.h" |
||
4772 | cbradney | 63 | #include "scpainter.h" |
10212 | cbradney | 64 | #include "scpaths.h" |
65 | #include "scpattern.h" |
||
243 | Franz | 66 | #include "scribus.h" |
10212 | cbradney | 67 | #include "scribusapp.h" |
5243 | cbradney | 68 | #include "scribuscore.h" |
10212 | cbradney | 69 | #include "scribusdoc.h" |
3030 | cbradney | 70 | #include "scribusstructs.h" |
4320 | cbradney | 71 | #include "scribuswin.h" |
13503 | cbradney | 72 | #include "sctextstream.h" |
3934 | cbradney | 73 | #include "selection.h" |
16159 | fschmid | 74 | #include "text/storytext.h" |
1204 | tsoots | 75 | #include "undomanager.h" |
76 | #include "undostate.h" |
||
2533 | craig | 77 | #include "util.h" |
16736 | jghali | 78 | #include "util_file.h" |
10212 | cbradney | 79 | #include "util_formats.h" |
16736 | jghali | 80 | #include "util_icon.h" |
10203 | cbradney | 81 | #include "util_math.h" |
12277 | cbradney | 82 | #include "util_text.h" |
2533 | craig | 83 | |
16736 | jghali | 84 | #include "ui/guidemanager.h" |
85 | #include "ui/propertiespalette.h" |
||
86 | |||
16281 | jghali | 87 | #include <cairo.h> |
88 | |||
504 | cbradney | 89 | using namespace std; |
90 | |||
3625 | avox | 91 | PageItem::PageItem(const PageItem & other) |
92 | : QObject(other.parent()), |
||
10532 | avox | 93 | UndoObject(other), SingleObservable<PageItem>(other.m_Doc->itemsChanged()), |
3625 | avox | 94 | |
95 | // 200 attributes! That is madness, or to quote some famous people from Kriquet: |
||
96 | // "THAT ALL HAS TO GO!" |
||
97 | gXpos(other.gXpos), |
||
98 | gYpos(other.gYpos), |
||
99 | gWidth(other.gWidth), |
||
100 | gHeight(other.gHeight), |
||
101 | GrType(other.GrType), |
||
102 | GrStartX(other.GrStartX), |
||
103 | GrStartY(other.GrStartY), |
||
104 | GrEndX(other.GrEndX), |
||
105 | GrEndY(other.GrEndY), |
||
14278 | fschmid | 106 | GrFocalX(other.GrFocalX), |
107 | GrFocalY(other.GrFocalY), |
||
108 | GrScale(other.GrScale), |
||
14284 | fschmid | 109 | GrSkew(other.GrSkew), |
14952 | fschmid | 110 | GrControl1(other.GrControl1), |
111 | GrControl2(other.GrControl2), |
||
112 | GrControl3(other.GrControl3), |
||
113 | GrControl4(other.GrControl4), |
||
14981 | fschmid | 114 | GrControl5(other.GrControl5), |
14952 | fschmid | 115 | GrColorP1(other.GrColorP1), |
116 | GrColorP2(other.GrColorP2), |
||
117 | GrColorP3(other.GrColorP3), |
||
118 | GrColorP4(other.GrColorP4), |
||
119 | GrCol1transp(other.GrCol1transp), |
||
120 | GrCol2transp(other.GrCol2transp), |
||
121 | GrCol3transp(other.GrCol3transp), |
||
122 | GrCol4transp(other.GrCol4transp), |
||
123 | GrCol1Shade(other.GrCol1Shade), |
||
124 | GrCol2Shade(other.GrCol2Shade), |
||
125 | GrCol3Shade(other.GrCol3Shade), |
||
126 | GrCol4Shade(other.GrCol4Shade), |
||
16729 | fschmid | 127 | meshGradientPatches(other.meshGradientPatches), |
15024 | fschmid | 128 | meshGradientArray(other.meshGradientArray), |
15517 | fschmid | 129 | selectedMeshPointX(other.selectedMeshPointX), |
130 | selectedMeshPointY(other.selectedMeshPointY), |
||
131 | selectedMeshControlPoint(other.selectedMeshControlPoint), |
||
16891 | fschmid | 132 | snapToPatchGrid(other.snapToPatchGrid), |
3625 | avox | 133 | Cols(other.Cols), |
134 | ColGap(other.ColGap), |
||
18204 | fschmid | 135 | m_startArrowIndex(other.m_startArrowIndex), |
136 | m_endArrowIndex(other.m_endArrowIndex), |
||
137 | m_startArrowScale(other.m_startArrowScale), |
||
138 | m_endArrowScale(other.m_endArrowScale), |
||
3903 | cbradney | 139 | PLineArt(other.PLineArt), |
3625 | avox | 140 | PLineEnd(other.PLineEnd), |
141 | PLineJoin(other.PLineJoin), |
||
142 | NamedLStyle(other.NamedLStyle), |
||
143 | Clip(other.Clip), |
||
144 | PoLine(other.PoLine), |
||
145 | ContourLine(other.ContourLine), |
||
146 | imageClip(other.imageClip), |
||
147 | Segments(other.Segments), |
||
148 | effectsInUse(other.effectsInUse), |
||
149 | PoShow(other.PoShow), |
||
150 | BaseOffs(other.BaseOffs), |
||
7926 | fschmid | 151 | textPathType(other.textPathType), |
152 | textPathFlipped(other.textPathFlipped), |
||
3625 | avox | 153 | ClipEdited(other.ClipEdited), |
154 | FrameType(other.FrameType), |
||
155 | OwnPage(other.OwnPage), |
||
156 | oldOwnPage(other.oldOwnPage), |
||
3903 | cbradney | 157 | pixm(other.pixm), |
158 | Pfile(other.Pfile), |
||
3625 | avox | 159 | Pfile2(other.Pfile2), |
160 | Pfile3(other.Pfile3), |
||
161 | IProfile(other.IProfile), |
||
162 | UseEmbedded(other.UseEmbedded), |
||
163 | EmProfile(other.EmProfile), |
||
164 | IRender(other.IRender), |
||
14444 | fschmid | 165 | OverrideCompressionMethod(other.OverrideCompressionMethod), |
166 | CompressionMethodIndex(other.CompressionMethodIndex), |
||
167 | OverrideCompressionQuality(other.OverrideCompressionQuality), |
||
168 | CompressionQualityIndex(other.CompressionQualityIndex), |
||
4621 | cbradney | 169 | |
13097 | subik | 170 | PictureIsAvailable(other.PictureIsAvailable), |
3625 | avox | 171 | OrigW(other.OrigW), |
172 | OrigH(other.OrigH), |
||
3903 | cbradney | 173 | BBoxX(other.BBoxX), |
174 | BBoxH(other.BBoxH), |
||
3625 | avox | 175 | CurX(other.CurX), |
176 | CurY(other.CurY), |
||
177 | itemText(other.itemText), |
||
3903 | cbradney | 178 | isBookmark(other.isBookmark), |
179 | HasSel(other.HasSel), |
||
3625 | avox | 180 | isAutoText(other.isAutoText), |
5362 | avox | 181 | inPdfArticle(other.inPdfArticle), |
3625 | avox | 182 | isRaster(other.isRaster), |
183 | OldB(other.OldB), |
||
184 | OldH(other.OldH), |
||
185 | OldB2(other.OldB2), |
||
186 | OldH2(other.OldH2), |
||
187 | Sizing(other.Sizing), |
||
13875 | jghali | 188 | LayerID(other.LayerID), |
3625 | avox | 189 | ScaleType(other.ScaleType), |
190 | AspectRatio(other.AspectRatio), |
||
191 | DashValues(other.DashValues), |
||
192 | DashOffset(other.DashOffset), |
||
193 | fill_gradient(other.fill_gradient), |
||
194 | fillRule(other.fillRule), |
||
5320 | fschmid | 195 | doOverprint(other.doOverprint), |
3625 | avox | 196 | LeftLink(other.LeftLink), |
197 | RightLink(other.RightLink), |
||
198 | TopLink(other.TopLink), |
||
199 | BottomLink(other.BottomLink), |
||
200 | LeftLinkID(other.LeftLinkID), |
||
201 | RightLinkID(other.RightLinkID), |
||
202 | TopLinkID(other.TopLinkID), |
||
203 | BottomLinkID(other.BottomLinkID), |
||
204 | LeftLine(other.LeftLine), |
||
205 | RightLine(other.RightLine), |
||
206 | TopLine(other.TopLine), |
||
207 | BottomLine(other.BottomLine), |
||
208 | isTableItem(other.isTableItem), |
||
209 | isSingleSel(other.isSingleSel), |
||
16105 | fschmid | 210 | groupItemList(other.groupItemList), |
211 | groupWidth(other.groupWidth), |
||
212 | groupHeight(other.groupHeight), |
||
3625 | avox | 213 | BoundingX(other.BoundingX), |
214 | BoundingY(other.BoundingY), |
||
215 | BoundingW(other.BoundingW), |
||
216 | BoundingH(other.BoundingH), |
||
217 | ChangedMasterItem(other.ChangedMasterItem), |
||
218 | OnMasterPage(other.OnMasterPage), |
||
219 | isEmbedded(other.isEmbedded), |
||
18022 | craig | 220 | m_roundedCorderRadius(other.m_roundedCorderRadius), |
3988 | cbradney | 221 | oldXpos(other.oldXpos), |
222 | oldYpos(other.oldYpos), |
||
223 | oldWidth(other.oldWidth), |
||
4010 | cbradney | 224 | oldHeight(other.oldHeight), |
4073 | cbradney | 225 | oldRot(other.oldRot), |
4821 | cbradney | 226 | oldLocalScX(other.oldLocalScX), |
227 | oldLocalScY(other.oldLocalScY), |
||
228 | oldLocalX(other.oldLocalX), |
||
229 | oldLocalY(other.oldLocalY), |
||
4084 | cbradney | 230 | m_Doc(other.m_Doc), |
231 | m_isAnnotation(other.m_isAnnotation), |
||
4621 | cbradney | 232 | m_annotation(other.m_annotation), |
233 | PicArt(other.PicArt), |
||
234 | m_lineWidth(other.m_lineWidth), |
||
14168 | fschmid | 235 | Oldm_lineWidth(other.Oldm_lineWidth), |
236 | patternStrokeVal(other.patternStrokeVal), |
||
237 | patternStrokeScaleX(other.patternStrokeScaleX), |
||
238 | patternStrokeScaleY(other.patternStrokeScaleY), |
||
239 | patternStrokeOffsetX(other.patternStrokeOffsetX), |
||
240 | patternStrokeOffsetY(other.patternStrokeOffsetY), |
||
241 | patternStrokeRotation(other.patternStrokeRotation), |
||
14260 | fschmid | 242 | patternStrokeSkewX(other.patternStrokeSkewX), |
243 | patternStrokeSkewY(other.patternStrokeSkewY), |
||
14403 | fschmid | 244 | patternStrokeSpace(other.patternStrokeSpace), |
14276 | fschmid | 245 | patternStrokeMirrorX(other.patternStrokeMirrorX), |
246 | patternStrokeMirrorY(other.patternStrokeMirrorY), |
||
14398 | fschmid | 247 | patternStrokePath(other.patternStrokePath), |
14168 | fschmid | 248 | gradientStrokeVal(other.gradientStrokeVal), |
14213 | fschmid | 249 | stroke_gradient(other.stroke_gradient), |
14168 | fschmid | 250 | GrTypeStroke(other.GrTypeStroke), |
251 | GrStrokeStartX(other.GrStrokeStartX), |
||
252 | GrStrokeStartY(other.GrStrokeStartY), |
||
253 | GrStrokeEndX(other.GrStrokeEndX), |
||
14278 | fschmid | 254 | GrStrokeEndY(other.GrStrokeEndY), |
255 | GrStrokeFocalX(other.GrStrokeFocalX), |
||
256 | GrStrokeFocalY(other.GrStrokeFocalY), |
||
14284 | fschmid | 257 | GrStrokeScale(other.GrStrokeScale), |
14297 | fschmid | 258 | GrStrokeSkew(other.GrStrokeSkew), |
259 | GrMask(other.GrMask), |
||
260 | GrMaskStartX(other.GrMaskStartX), |
||
261 | GrMaskStartY(other.GrMaskStartY), |
||
262 | GrMaskEndX(other.GrMaskEndX), |
||
263 | GrMaskEndY(other.GrMaskEndY), |
||
264 | GrMaskFocalX(other.GrMaskFocalX), |
||
265 | GrMaskFocalY(other.GrMaskFocalY), |
||
266 | GrMaskScale(other.GrMaskScale), |
||
267 | GrMaskSkew(other.GrMaskSkew), |
||
268 | patternMaskScaleX(other.patternMaskScaleX), |
||
269 | patternMaskScaleY(other.patternMaskScaleY), |
||
270 | patternMaskOffsetX(other.patternMaskOffsetX), |
||
271 | patternMaskOffsetY(other.patternMaskOffsetY), |
||
272 | patternMaskRotation(other.patternMaskRotation), |
||
273 | patternMaskSkewX(other.patternMaskSkewX), |
||
274 | patternMaskSkewY(other.patternMaskSkewY), |
||
275 | patternMaskMirrorX(other.patternMaskMirrorX), |
||
276 | patternMaskMirrorY(other.patternMaskMirrorY), |
||
277 | patternMaskVal(other.patternMaskVal), |
||
18204 | fschmid | 278 | mask_gradient(other.mask_gradient), |
279 | // protected |
||
280 | undoManager(other.undoManager), |
||
281 | BackBox(NULL), // otherwise other.BackBox->NextBox would be inconsistent |
||
282 | NextBox(NULL), // otherwise other.NextBox->BackBox would be inconsistent |
||
283 | firstChar(0), // since this box is unlinked now |
||
284 | MaxChars(0), // since the layout is invalid now |
||
285 | m_sampleItem(false), |
||
286 | m_textDistanceMargins(other.m_textDistanceMargins), |
||
287 | m_ItemType(other.m_ItemType), |
||
288 | AnName(other.AnName), |
||
289 | gradientVal(other.gradientVal), |
||
290 | patternVal(other.patternVal), |
||
291 | patternScaleX(other.patternScaleX), |
||
292 | patternScaleY(other.patternScaleY), |
||
293 | patternOffsetX(other.patternOffsetX), |
||
294 | patternOffsetY(other.patternOffsetY), |
||
295 | patternRotation(other.patternRotation), |
||
296 | patternSkewX(other.patternSkewX), |
||
297 | patternSkewY(other.patternSkewY), |
||
298 | patternMirrorX(other.patternMirrorX), |
||
299 | patternMirrorY(other.patternMirrorY), |
||
300 | fillColorVal(other.fillColorVal), |
||
301 | lineColorVal(other.lineColorVal), |
||
302 | lineShadeVal(other.lineShadeVal), |
||
303 | fillShadeVal(other.fillShadeVal), |
||
304 | fillTransparencyVal(other.fillTransparencyVal), |
||
305 | lineTransparencyVal(other.lineTransparencyVal), |
||
306 | fillBlendmodeVal(other.fillBlendmodeVal), |
||
307 | lineBlendmodeVal(other.lineBlendmodeVal), |
||
308 | m_ImageIsFlippedH(other.m_ImageIsFlippedH), |
||
309 | m_ImageIsFlippedV(other.m_ImageIsFlippedV), |
||
310 | m_Locked(other.m_Locked), |
||
311 | m_SizeLocked(other.m_SizeLocked), |
||
312 | m_SizeHLocked(other.m_SizeHLocked), |
||
313 | m_SizeVLocked(other.m_SizeVLocked), |
||
314 | textFlowModeVal(other.textFlowModeVal), |
||
315 | pageItemAttributes(other.pageItemAttributes), |
||
316 | m_PrintEnabled(other.m_PrintEnabled), |
||
317 | tagged(other.tagged), |
||
318 | fillQColor(other.fillQColor), |
||
319 | strokeQColor(other.strokeQColor), |
||
320 | GrColorP1QColor(other.GrColorP1QColor), |
||
321 | GrColorP2QColor(other.GrColorP2QColor), |
||
322 | GrColorP3QColor(other.GrColorP3QColor), |
||
323 | GrColorP4QColor(other.GrColorP4QColor), |
||
324 | m_xPos(other.m_xPos), |
||
325 | m_yPos(other.m_yPos), |
||
326 | m_width(other.m_width), |
||
327 | m_height(other.m_height), |
||
328 | m_rotation(other.m_rotation), |
||
329 | m_isSelected(other.m_isSelected), |
||
330 | m_imageXScale(other.m_imageXScale), |
||
331 | m_imageYScale(other.m_imageYScale), |
||
332 | m_imageXOffset(other.m_imageXOffset), |
||
333 | m_imageYOffset(other.m_imageYOffset), |
||
334 | m_imageRotation(other.m_imageRotation), |
||
335 | m_isReversed(other.m_isReversed), |
||
336 | firstLineOffsetP(other.firstLineOffsetP) |
||
3625 | avox | 337 | { |
7068 | fschmid | 338 | QString tmp; |
339 | m_Doc->TotalItems++; |
||
340 | AnName += tmp.setNum(m_Doc->TotalItems); |
||
341 | uniqueNr = m_Doc->TotalItems; |
||
8047 | avox | 342 | invalid = true; |
12795 | fschmid | 343 | if (other.isInlineImage) |
344 | { |
||
345 | QFileInfo inlFi(Pfile); |
||
346 | QString ext = inlFi.suffix(); |
||
18203 | fschmid | 347 | QTemporaryFile *tempFile = new QTemporaryFile(QDir::tempPath() + "/scribus_temp_XXXXXX." + ext); |
348 | tempFile->setAutoRemove(false); |
||
349 | tempFile->open(); |
||
350 | QString fileName = getLongPathName(tempFile->fileName()); |
||
351 | tempFile->close(); |
||
12795 | fschmid | 352 | copyFile(Pfile, fileName); |
353 | Pfile = fileName; |
||
18203 | fschmid | 354 | delete tempFile; |
12795 | fschmid | 355 | isInlineImage = true; |
18203 | fschmid | 356 | isTempFile = true; |
12795 | fschmid | 357 | } |
358 | else |
||
359 | { |
||
360 | isInlineImage = false; |
||
18203 | fschmid | 361 | isTempFile = false; |
12795 | fschmid | 362 | } |
16943 | fschmid | 363 | Parent = NULL; |
16926 | fschmid | 364 | unWeld(); |
3625 | avox | 365 | } |
366 | |||
367 | |||
2707 | subik | 368 | PageItem::PageItem(ScribusDoc *pa, ItemType newType, double x, double y, double w, double h, double w2, QString fill, QString outline) |
4061 | craig | 369 | // Initialize superclass(es) |
10532 | avox | 370 | : QObject(pa), SingleObservable<PageItem>(pa->itemsChanged()), |
4061 | craig | 371 | // Initialize member variables |
14444 | fschmid | 372 | OverrideCompressionMethod(false), |
373 | CompressionMethodIndex(0), |
||
374 | OverrideCompressionQuality(false), |
||
375 | CompressionQualityIndex(0), |
||
4688 | cbradney | 376 | itemText(pa), |
4061 | craig | 377 | undoManager(UndoManager::instance()), |
1749 | craig | 378 | lineShadeVal(100), |
1657 | craig | 379 | fillShadeVal(100), |
380 | fillTransparencyVal(0.0), |
||
381 | lineTransparencyVal(0.0), |
||
5746 | fschmid | 382 | fillBlendmodeVal(0), |
383 | lineBlendmodeVal(0), |
||
4699 | cbradney | 384 | m_ImageIsFlippedH(0), |
385 | m_ImageIsFlippedV(0), |
||
4695 | cbradney | 386 | m_Locked(false), |
387 | m_SizeLocked(false), |
||
17826 | craig | 388 | m_SizeHLocked(false), |
389 | m_SizeVLocked(false), |
||
5620 | jghali | 390 | textFlowModeVal(TextFlowDisabled) |
3 | paul | 391 | { |
16943 | fschmid | 392 | Parent = NULL; |
10532 | avox | 393 | m_Doc = pa; |
3 | paul | 394 | QString tmp; |
395 | BackBox = 0; |
||
396 | NextBox = 0; |
||
18032 | craig | 397 | gXpos = oldXpos = m_xPos = x; |
398 | gYpos = oldYpos = m_yPos = y; |
||
4821 | cbradney | 399 | //CB Surely we can remove some of these? |
18095 | craig | 400 | OldB2 = OldB = oldWidth = m_width = w; |
401 | OldH2 = OldH = oldHeight = m_height = h; |
||
456 | fschmid | 402 | BoundingX = x; |
403 | BoundingY = y; |
||
404 | BoundingW = w; |
||
405 | BoundingH = h; |
||
4593 | cbradney | 406 | m_ItemType = newType; |
18022 | craig | 407 | oldRot = m_rotation = 0; |
1394 | cbradney | 408 | fillColorVal = fill; |
4593 | cbradney | 409 | lineColorVal = m_ItemType == PageItem::TextFrame ? fill : outline; |
12726 | jghali | 410 | gWidth = gHeight = 0; |
3 | paul | 411 | GrType = 0; |
292 | Franz | 412 | GrStartX = 0; |
413 | GrStartY = 0; |
||
294 | Franz | 414 | GrEndX = w; |
292 | Franz | 415 | GrEndY = 0; |
14278 | fschmid | 416 | GrFocalX = 0; |
417 | GrFocalY = 0; |
||
418 | GrScale = 1; |
||
14284 | fschmid | 419 | GrSkew = 0; |
14952 | fschmid | 420 | GrControl1 = FPoint(0,0); |
421 | GrControl2 = FPoint(w, 0); |
||
422 | GrControl3 = FPoint(w, h); |
||
423 | GrControl4 = FPoint(0, h); |
||
14981 | fschmid | 424 | GrControl5 = FPoint(w / 2.0, h / 2.0); |
14952 | fschmid | 425 | GrCol1transp = 1.0; |
426 | GrCol2transp = 1.0; |
||
427 | GrCol3transp = 1.0; |
||
428 | GrCol4transp = 1.0; |
||
429 | GrCol1Shade = 100; |
||
430 | GrCol2Shade = 100; |
||
431 | GrCol3Shade = 100; |
||
432 | GrCol4Shade = 100; |
||
16729 | fschmid | 433 | meshGradientPatches.clear(); |
15024 | fschmid | 434 | meshGradientArray.clear(); |
435 | selectedMeshPointX = -1; |
||
436 | selectedMeshPointY = -1; |
||
14150 | fschmid | 437 | gradientVal = ""; |
14168 | fschmid | 438 | GrTypeStroke = 0; |
439 | GrStrokeStartX = 0; |
||
440 | GrStrokeStartY = 0; |
||
441 | GrStrokeEndX = w; |
||
442 | GrStrokeEndY = 0; |
||
14278 | fschmid | 443 | GrStrokeFocalX = 0; |
444 | GrStrokeFocalY = 0; |
||
445 | GrStrokeScale = 1; |
||
14284 | fschmid | 446 | GrStrokeSkew = 0; |
14168 | fschmid | 447 | gradientStrokeVal = ""; |
6368 | fschmid | 448 | patternVal = ""; |
6414 | fschmid | 449 | patternScaleX = 100; |
450 | patternScaleY = 100; |
||
451 | patternOffsetX = 0; |
||
452 | patternOffsetY = 0; |
||
453 | patternRotation = 0; |
||
14260 | fschmid | 454 | patternSkewX = 0; |
455 | patternSkewY = 0; |
||
14276 | fschmid | 456 | patternMirrorX = false; |
457 | patternMirrorY = false; |
||
14168 | fschmid | 458 | patternStrokeVal = ""; |
459 | patternStrokeScaleX = 100; |
||
460 | patternStrokeScaleY = 100; |
||
461 | patternStrokeOffsetX = 0; |
||
462 | patternStrokeOffsetY = 0; |
||
463 | patternStrokeRotation = 0; |
||
14260 | fschmid | 464 | patternStrokeSkewX = 0; |
465 | patternStrokeSkewY = 0; |
||
14403 | fschmid | 466 | patternStrokeSpace = 1.0; |
14276 | fschmid | 467 | patternStrokeMirrorX = false; |
468 | patternStrokeMirrorY = false; |
||
14398 | fschmid | 469 | patternStrokePath = false; |
4580 | cbradney | 470 | m_lineWidth = w2; |
471 | Oldm_lineWidth = w2; |
||
14932 | cbradney | 472 | PLineArt = Qt::PenStyle(m_Doc->itemToolPrefs().shapeLineStyle); |
8522 | cbradney | 473 | PLineEnd = Qt::FlatCap; |
474 | PLineJoin = Qt::MiterJoin; |
||
18022 | craig | 475 | m_isSelected = false; |
3 | paul | 476 | ClipEdited = false; |
477 | FrameType = 0; |
||
478 | CurX = 0; |
||
479 | CurY = 0; |
||
18012 | craig | 480 | m_textDistanceMargins=m_Doc->itemToolPrefs().textDistances; |
5721 | avox | 481 | firstChar = 0; |
387 | Franz | 482 | MaxChars = 0; |
18007 | craig | 483 | m_sampleItem = false; |
3 | paul | 484 | Pfile = ""; |
2004 | fschmid | 485 | pixm = ScImage(); |
14932 | cbradney | 486 | pixm.imgInfo.lowResType = m_Doc->itemToolPrefs().imageLowResType; |
3 | paul | 487 | Pfile2 = ""; |
488 | Pfile3 = ""; |
||
18022 | craig | 489 | oldLocalScX = m_imageXScale = 1; |
490 | oldLocalScY = m_imageYScale = 1; |
||
3 | paul | 491 | OrigW = 0; |
492 | OrigH = 0; |
||
18032 | craig | 493 | oldLocalX = m_imageXOffset = 0; |
494 | oldLocalY = m_imageYOffset = 0; |
||
18022 | craig | 495 | m_imageRotation = 0; |
3 | paul | 496 | BBoxX = 0; |
497 | BBoxH = 0; |
||
18022 | craig | 498 | m_roundedCorderRadius = 0; |
4593 | cbradney | 499 | switch (m_ItemType) |
167 | Franz | 500 | { |
1460 | cbradney | 501 | case Polygon: |
340 | Franz | 502 | Clip.setPoints(4, static_cast<int>(w/2), 0, static_cast<int>(w), static_cast<int>(h/2), |
503 | static_cast<int>(w/2), static_cast<int>(h), 0,static_cast<int>(h/2)); |
||
3 | paul | 504 | break; |
505 | default: |
||
340 | Franz | 506 | Clip.setPoints(4, 0,0, static_cast<int>(w),0, static_cast<int>(w), static_cast<int>(h), 0,static_cast<int>(h)); |
3 | paul | 507 | break; |
167 | Franz | 508 | } |
3 | paul | 509 | PoLine.resize(0); |
340 | Franz | 510 | ContourLine.resize(0); |
2040 | fschmid | 511 | imageClip.resize(0); |
3 | paul | 512 | Segments.clear(); |
513 | PoShow = false; |
||
514 | BaseOffs = 0; |
||
7926 | fschmid | 515 | textPathType = 0; |
516 | textPathFlipped = false; |
||
13888 | jghali | 517 | OwnPage = m_Doc->currentPage() ? m_Doc->currentPage()->pageNr() : -1; |
1211 | tsoots | 518 | oldOwnPage = OwnPage; |
4401 | fschmid | 519 | savedOwnPage = OwnPage; |
3 | paul | 520 | PicArt = true; |
13097 | subik | 521 | PictureIsAvailable = false; |
4698 | cbradney | 522 | m_PrintEnabled = true; |
3 | paul | 523 | isBookmark = false; |
4102 | cbradney | 524 | m_isAnnotation = false; |
16926 | fschmid | 525 | weldList.clear(); |
10321 | mrdocs | 526 | |
4593 | cbradney | 527 | switch (m_ItemType) |
268 | Franz | 528 | { |
1460 | cbradney | 529 | case ImageFrame: |
13839 | fschmid | 530 | case OSGFrame: |
10321 | mrdocs | 531 | case LatexFrame: |
532 | //We can't determine if this is a latex frame here |
||
533 | // because c++'s typeinfos are still saying it's |
||
534 | // a plain pageitem |
||
535 | // This is fixed in the PageItem_LatexFrame constructor |
||
268 | Franz | 536 | AnName = tr("Image"); |
1250 | tsoots | 537 | setUPixmap(Um::IImageFrame); |
268 | Franz | 538 | break; |
1460 | cbradney | 539 | case TextFrame: |
268 | Franz | 540 | AnName = tr("Text"); |
1250 | tsoots | 541 | setUPixmap(Um::ITextFrame); |
268 | Franz | 542 | break; |
1460 | cbradney | 543 | case Line: |
268 | Franz | 544 | AnName = tr("Line"); |
1250 | tsoots | 545 | setUPixmap(Um::ILine); |
268 | Franz | 546 | break; |
1460 | cbradney | 547 | case Polygon: |
268 | Franz | 548 | AnName = tr("Polygon"); |
1250 | tsoots | 549 | setUPixmap(Um::IPolygon); |
268 | Franz | 550 | break; |
1460 | cbradney | 551 | case PolyLine: |
268 | Franz | 552 | AnName = tr("Polyline"); |
1250 | tsoots | 553 | setUPixmap(Um::IPolyline); |
268 | Franz | 554 | break; |
1460 | cbradney | 555 | case PathText: |
268 | Franz | 556 | AnName = tr("PathText"); |
1250 | tsoots | 557 | setUPixmap(Um::IPathText); |
268 | Franz | 558 | break; |
15060 | fschmid | 559 | case Symbol: |
560 | AnName = tr("Symbol"); |
||
561 | setUPixmap(Um::IPolygon); |
||
562 | break; |
||
16105 | fschmid | 563 | case Group: |
564 | AnName = tr("Group"); |
||
565 | setUPixmap(Um::IPolygon); |
||
566 | break; |
||
16191 | fschmid | 567 | case RegularPolygon: |
568 | AnName = tr("RegularPolygon"); |
||
569 | setUPixmap(Um::IPolygon); |
||
570 | break; |
||
16215 | fschmid | 571 | case Arc: |
572 | AnName = tr("Arc"); |
||
573 | setUPixmap(Um::IPolygon); |
||
574 | break; |
||
16311 | fschmid | 575 | case Spiral: |
576 | AnName = tr("Spiral"); |
||
577 | setUPixmap(Um::IPolygon); |
||
578 | break; |
||
16856 | craig | 579 | case Table: |
580 | AnName = tr("Table"); |
||
581 | //setUPixmap(Um::IPolygon); // TODO: Fix this. |
||
582 | break; |
||
268 | Franz | 583 | default: |
584 | AnName = "Item"; |
||
585 | break; |
||
586 | } |
||
4939 | fschmid | 587 | m_Doc->TotalItems++; |
4084 | cbradney | 588 | AnName += tmp.setNum(m_Doc->TotalItems); // +" "+QDateTime::currentDateTime().toString(); |
7068 | fschmid | 589 | uniqueNr = m_Doc->TotalItems; |
87 | Franz | 590 | AutoName = true; |
1204 | tsoots | 591 | setUName(AnName); |
4084 | cbradney | 592 | m_annotation.setBorderColor(outline); |
3 | paul | 593 | HasSel = false; |
594 | isAutoText = false; |
||
5362 | avox | 595 | inPdfArticle = false; |
3 | paul | 596 | isRaster = false; |
597 | Sizing = false; |
||
16961 | fschmid | 598 | // toPixmap = false; |
3 | paul | 599 | UseEmbedded = true; |
14170 | jghali | 600 | IRender = Intent_Relative_Colorimetric; |
3 | paul | 601 | EmProfile = ""; |
16105 | fschmid | 602 | groupItemList.clear(); |
603 | groupWidth = 1.0; |
||
604 | groupHeight = 1.0; |
||
13875 | jghali | 605 | LayerID = m_Doc->activeLayer(); |
3 | paul | 606 | ScaleType = true; |
607 | AspectRatio = true; |
||
18022 | craig | 608 | m_isReversed = false; |
27 | Franz | 609 | NamedLStyle = ""; |
68 | Franz | 610 | DashValues.clear(); |
611 | DashOffset = 0; |
||
1905 | fschmid | 612 | fillRule = true; |
5320 | fschmid | 613 | doOverprint = false; |
14168 | fschmid | 614 | stroke_gradient = VGradient(VGradient::linear); |
615 | stroke_gradient.clearStops(); |
||
616 | if (lineColorVal != CommonStrings::None) |
||
617 | { |
||
618 | const ScColor& col = m_Doc->PageColors[lineColorVal]; |
||
619 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
||
620 | stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, lineColorVal, 100); |
||
621 | stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, lineColorVal, 100); |
||
622 | } |
||
623 | else |
||
624 | { |
||
14932 | cbradney | 625 | if (m_Doc->itemToolPrefs().shapeLineColor != CommonStrings::None) |
14168 | fschmid | 626 | { |
14932 | cbradney | 627 | const ScColor& col = m_Doc->PageColors[m_Doc->itemToolPrefs().shapeLineColor]; |
14168 | fschmid | 628 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
14932 | cbradney | 629 | stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, m_Doc->itemToolPrefs().shapeLineColor, 100); |
630 | stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, m_Doc->itemToolPrefs().shapeLineColor, 100); |
||
14168 | fschmid | 631 | } |
632 | else |
||
633 | { |
||
634 | if (fillColorVal != CommonStrings::None) |
||
635 | { |
||
636 | const ScColor& col = m_Doc->PageColors[fillColorVal]; |
||
637 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
||
638 | stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, fillColorVal, 100); |
||
639 | stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, fillColorVal, 100); |
||
640 | } |
||
641 | else |
||
642 | { |
||
14932 | cbradney | 643 | if (m_Doc->itemToolPrefs().shapeLineColor != CommonStrings::None) |
14168 | fschmid | 644 | { |
14932 | cbradney | 645 | const ScColor& col = m_Doc->PageColors[m_Doc->itemToolPrefs().shapeFillColor]; |
14168 | fschmid | 646 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
14932 | cbradney | 647 | stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, m_Doc->itemToolPrefs().shapeFillColor, 100); |
648 | stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, m_Doc->itemToolPrefs().shapeFillColor, 100); |
||
14168 | fschmid | 649 | } |
650 | else if (m_Doc->PageColors.contains("Black")) |
||
651 | { |
||
652 | const ScColor& col = m_Doc->PageColors["Black"]; |
||
653 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
||
654 | stroke_gradient.addStop(qcol, 0.0, 0.5, 1.0, "Black", 100); |
||
655 | stroke_gradient.addStop(qcol, 1.0, 0.5, 1.0, "Black", 100); |
||
656 | } |
||
657 | } |
||
658 | } |
||
659 | } |
||
68 | Franz | 660 | fill_gradient = VGradient(VGradient::linear); |
295 | Franz | 661 | fill_gradient.clearStops(); |
7478 | jghali | 662 | if (fillColorVal != CommonStrings::None) |
663 | { |
||
664 | const ScColor& col = m_Doc->PageColors[fillColorVal]; |
||
12642 | jghali | 665 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
666 | fill_gradient.addStop(qcol, 0.0, 0.5, 1.0, fillColorVal, 100); |
||
667 | fill_gradient.addStop(qcol, 1.0, 0.5, 1.0, fillColorVal, 100); |
||
14952 | fschmid | 668 | GrColorP1 = fillColorVal; |
669 | GrColorP2 = fillColorVal; |
||
670 | GrColorP3 = fillColorVal; |
||
671 | GrColorP4 = fillColorVal; |
||
7478 | jghali | 672 | } |
304 | Franz | 673 | else |
7478 | jghali | 674 | { |
14932 | cbradney | 675 | if (m_Doc->itemToolPrefs().shapeFillColor != CommonStrings::None) |
7656 | fschmid | 676 | { |
14932 | cbradney | 677 | const ScColor& col = m_Doc->PageColors[m_Doc->itemToolPrefs().shapeFillColor]; |
12642 | jghali | 678 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
14932 | cbradney | 679 | fill_gradient.addStop(qcol, 0.0, 0.5, 1.0, m_Doc->itemToolPrefs().shapeFillColor, 100); |
680 | fill_gradient.addStop(qcol, 1.0, 0.5, 1.0, m_Doc->itemToolPrefs().shapeFillColor, 100); |
||
14952 | fschmid | 681 | GrColorP1 = m_Doc->itemToolPrefs().shapeFillColor; |
682 | GrColorP2 = m_Doc->itemToolPrefs().shapeFillColor; |
||
683 | GrColorP3 = m_Doc->itemToolPrefs().shapeFillColor; |
||
684 | GrColorP4 = m_Doc->itemToolPrefs().shapeFillColor; |
||
7656 | fschmid | 685 | } |
686 | else |
||
687 | { |
||
688 | if (lineColorVal != CommonStrings::None) |
||
689 | { |
||
690 | const ScColor& col = m_Doc->PageColors[lineColorVal]; |
||
12642 | jghali | 691 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
692 | fill_gradient.addStop(qcol, 0.0, 0.5, 1.0, lineColorVal, 100); |
||
693 | fill_gradient.addStop(qcol, 1.0, 0.5, 1.0, lineColorVal, 100); |
||
14952 | fschmid | 694 | GrColorP1 = lineColorVal; |
695 | GrColorP2 = lineColorVal; |
||
696 | GrColorP3 = lineColorVal; |
||
697 | GrColorP4 = lineColorVal; |
||
7656 | fschmid | 698 | } |
699 | else |
||
700 | { |
||
14932 | cbradney | 701 | if (m_Doc->itemToolPrefs().shapeLineColor != CommonStrings::None) |
7656 | fschmid | 702 | { |
14932 | cbradney | 703 | const ScColor& col = m_Doc->PageColors[m_Doc->itemToolPrefs().shapeLineColor]; |
12642 | jghali | 704 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
14932 | cbradney | 705 | fill_gradient.addStop(qcol, 0.0, 0.5, 1.0, m_Doc->itemToolPrefs().shapeLineColor, 100); |
706 | fill_gradient.addStop(qcol, 1.0, 0.5, 1.0, m_Doc->itemToolPrefs().shapeLineColor, 100); |
||
14952 | fschmid | 707 | GrColorP1 = m_Doc->itemToolPrefs().shapeLineColor; |
708 | GrColorP2 = m_Doc->itemToolPrefs().shapeLineColor; |
||
709 | GrColorP3 = m_Doc->itemToolPrefs().shapeLineColor; |
||
710 | GrColorP4 = m_Doc->itemToolPrefs().shapeLineColor; |
||
7656 | fschmid | 711 | } |
12642 | jghali | 712 | else if (m_Doc->PageColors.contains("Black")) |
713 | { |
||
714 | const ScColor& col = m_Doc->PageColors["Black"]; |
||
715 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
||
716 | fill_gradient.addStop(qcol, 0.0, 0.5, 1.0, "Black", 100); |
||
717 | fill_gradient.addStop(qcol, 1.0, 0.5, 1.0, "Black", 100); |
||
14952 | fschmid | 718 | GrColorP1 = "Black"; |
719 | GrColorP2 = "Black"; |
||
720 | GrColorP3 = "Black"; |
||
721 | GrColorP4 = "Black"; |
||
12642 | jghali | 722 | } |
7656 | fschmid | 723 | } |
724 | } |
||
7478 | jghali | 725 | } |
14297 | fschmid | 726 | GrMask = 0; |
727 | GrMaskStartX = 0; |
||
728 | GrMaskStartY = 0; |
||
729 | GrMaskEndX = w; |
||
730 | GrMaskEndY = 0; |
||
731 | GrMaskFocalX = 0; |
||
732 | GrMaskFocalY = 0; |
||
733 | GrMaskScale = 1; |
||
734 | GrMaskSkew = 0; |
||
735 | patternMaskScaleX = 100; |
||
736 | patternMaskScaleY = 100; |
||
737 | patternMaskOffsetX = 0; |
||
738 | patternMaskOffsetY = 0; |
||
739 | patternMaskRotation = 0; |
||
740 | patternMaskSkewX = 0; |
||
741 | patternMaskSkewY = 0; |
||
742 | patternMaskMirrorX = false; |
||
743 | patternMaskMirrorY = false; |
||
744 | patternMaskVal = ""; |
||
745 | gradientMaskVal = ""; |
||
746 | mask_gradient = VGradient(VGradient::linear); |
||
747 | mask_gradient.clearStops(); |
||
748 | const ScColor& col = m_Doc->PageColors["Black"]; |
||
749 | QColor qcol = ScColorEngine::getRGBColor(col, m_Doc); |
||
750 | mask_gradient.addStop(qcol, 0.0, 0.5, 1.0, "Black", 100); |
||
751 | mask_gradient.addStop(qcol, 1.0, 0.5, 1.0, "Black", 100); |
||
15024 | fschmid | 752 | |
753 | QList<meshPoint> mgList; |
||
754 | meshPoint mgP; |
||
16869 | fschmid | 755 | meshGradientPatch patch; |
756 | mgP.resetTo(FPoint(0.0, 0.0)); |
||
15024 | fschmid | 757 | mgP.transparency = 1.0; |
758 | mgP.shade = 100; |
||
759 | mgP.colorName = "Black"; |
||
760 | mgP.color = qcol; |
||
761 | mgList.append(mgP); |
||
16869 | fschmid | 762 | patch.TL = mgP; |
18095 | craig | 763 | mgP.resetTo(FPoint(m_width / 2.0, 0.0)); |
15024 | fschmid | 764 | mgList.append(mgP); |
18095 | craig | 765 | mgP.resetTo(FPoint(m_width, 0.0)); |
15024 | fschmid | 766 | mgList.append(mgP); |
16869 | fschmid | 767 | patch.TR = mgP; |
15024 | fschmid | 768 | meshGradientArray.append(mgList); |
769 | mgList.clear(); |
||
18095 | craig | 770 | mgP.resetTo(FPoint(0.0, m_height / 2.0)); |
15024 | fschmid | 771 | mgList.append(mgP); |
18095 | craig | 772 | mgP.resetTo(FPoint(m_width / 2.0, m_height / 2.0)); |
15024 | fschmid | 773 | mgList.append(mgP); |
18095 | craig | 774 | mgP.resetTo(FPoint(m_width, m_height / 2.0)); |
15024 | fschmid | 775 | mgList.append(mgP); |
776 | meshGradientArray.append(mgList); |
||
777 | mgList.clear(); |
||
18095 | craig | 778 | mgP.resetTo(FPoint(0.0, m_height)); |
15024 | fschmid | 779 | mgList.append(mgP); |
16869 | fschmid | 780 | patch.BL = mgP; |
18095 | craig | 781 | mgP.resetTo(FPoint(m_width / 2.0, m_height)); |
15024 | fschmid | 782 | mgList.append(mgP); |
18095 | craig | 783 | mgP.resetTo(FPoint(m_width, m_height)); |
15024 | fschmid | 784 | mgList.append(mgP); |
16869 | fschmid | 785 | patch.BR = mgP; |
15024 | fschmid | 786 | meshGradientArray.append(mgList); |
16869 | fschmid | 787 | meshGradientPatches.append(patch); |
15024 | fschmid | 788 | |
12270 | cbradney | 789 | firstLineOffsetP = FLOPRealGlyphHeight; |
14932 | cbradney | 790 | Cols = m_Doc->itemToolPrefs().textColumns; |
791 | ColGap = m_Doc->itemToolPrefs().textColumnGap; |
||
232 | Franz | 792 | LeftLink = 0; |
793 | RightLink = 0; |
||
794 | TopLink = 0; |
||
795 | BottomLink = 0; |
||
234 | Franz | 796 | LeftLinkID = 0; |
797 | RightLinkID = 0; |
||
798 | TopLinkID = 0; |
||
799 | BottomLinkID = 0; |
||
232 | Franz | 800 | LeftLine = 0; |
801 | RightLine = false; |
||
802 | TopLine = false; |
||
803 | BottomLine = false; |
||
804 | isTableItem = false; |
||
805 | isSingleSel = false; |
||
383 | Franz | 806 | Dirty = false; |
5362 | avox | 807 | invalid = true; |
456 | fschmid | 808 | ChangedMasterItem = false; |
2434 | fschmid | 809 | isEmbedded = false; |
13888 | jghali | 810 | OnMasterPage = m_Doc->currentPage() ? m_Doc->currentPage()->pageName() : QString(); |
14932 | cbradney | 811 | m_startArrowIndex = m_Doc->itemToolPrefs().lineStartArrow; |
812 | m_endArrowIndex = m_Doc->itemToolPrefs().lineEndArrow; |
||
15345 | fschmid | 813 | m_startArrowScale = 100; |
814 | m_endArrowScale = 100; |
||
2056 | fschmid | 815 | effectsInUse.clear(); |
1659 | cbradney | 816 | //Page Item Attributes |
817 | pageItemAttributes.clear(); |
||
14927 | cbradney | 818 | for(ObjAttrVector::Iterator objAttrIt = m_Doc->itemAttributes().begin() ; objAttrIt != m_Doc->itemAttributes().end(); ++objAttrIt ) |
1659 | cbradney | 819 | { |
4593 | cbradney | 820 | if (((*objAttrIt).autoaddto=="textframes" && m_ItemType==TextFrame) || |
821 | ((*objAttrIt).autoaddto=="imageframes" && m_ItemType==ImageFrame) |
||
1659 | cbradney | 822 | ) |
823 | pageItemAttributes.append(*objAttrIt); |
||
824 | } |
||
12795 | fschmid | 825 | isInlineImage = false; |
18203 | fschmid | 826 | isTempFile = false; |
3 | paul | 827 | } |
828 | |||
17826 | craig | 829 | PageItem::~PageItem() |
830 | { |
||
18203 | fschmid | 831 | if ((isTempFile) && (!Pfile.isEmpty())) |
832 | QFile::remove(Pfile); |
||
17826 | craig | 833 | //remove marks |
834 | |||
835 | if (isTextFrame()) |
||
836 | { |
||
837 | if (!asTextFrame()->isInChain() && itemText.length() >0) |
||
838 | { |
||
839 | for (int pos=0; pos < itemText.length(); ++pos) |
||
840 | { |
||
18524 | avox | 841 | if (itemText.hasMark(pos)) |
17826 | craig | 842 | { |
18524 | avox | 843 | Mark* mrk = itemText.mark(pos); |
18047 | craig | 844 | if (!mrk->isType(MARKBullNumType)) |
845 | m_Doc->eraseMark(mrk); |
||
17826 | craig | 846 | } |
847 | } |
||
848 | } |
||
849 | } |
||
850 | // if (isWeld()) |
||
851 | // unWeldFromMaster(true); |
||
852 | // if (isWelded()) |
||
853 | // unWeldChild(); |
||
854 | } |
||
855 | |||
4644 | cbradney | 856 | void PageItem::setXPos(const double newXPos, bool drawingOnly) |
3903 | cbradney | 857 | { |
18032 | craig | 858 | m_xPos = newXPos; |
4644 | cbradney | 859 | if (drawingOnly || m_Doc->isLoading()) |
860 | return; |
||
4621 | cbradney | 861 | checkChanges(); |
3903 | cbradney | 862 | } |
863 | |||
4644 | cbradney | 864 | void PageItem::setYPos(const double newYPos, bool drawingOnly) |
3903 | cbradney | 865 | { |
18032 | craig | 866 | m_yPos = newYPos; |
4644 | cbradney | 867 | if (drawingOnly || m_Doc->isLoading()) |
868 | return; |
||
4621 | cbradney | 869 | checkChanges(); |
3903 | cbradney | 870 | } |
871 | |||
4644 | cbradney | 872 | void PageItem::setXYPos(const double newXPos, const double newYPos, bool drawingOnly) |
3903 | cbradney | 873 | { |
18032 | craig | 874 | m_xPos = newXPos; |
875 | m_yPos = newYPos; |
||
4644 | cbradney | 876 | if (drawingOnly || m_Doc->isLoading()) |
877 | return; |
||
4621 | cbradney | 878 | checkChanges(); |
3934 | cbradney | 879 | } |
880 | |||
18357 | jghali | 881 | int PageItem::level() const |
17092 | jghali | 882 | { |
18357 | jghali | 883 | PageItem* thisItem = const_cast<PageItem*>(this); |
17092 | jghali | 884 | if (Parent == NULL) |
885 | { |
||
886 | if (m_Doc) |
||
887 | { |
||
888 | QList<PageItem*>* items = OnMasterPage.isEmpty() ? &m_Doc->DocItems : &m_Doc->MasterItems; |
||
18357 | jghali | 889 | return (items->indexOf(thisItem) + 1); |
17092 | jghali | 890 | } |
891 | return 0; |
||
892 | } |
||
18357 | jghali | 893 | return (Parent->asGroupFrame()->groupItemList.indexOf(thisItem) + 1); |
17092 | jghali | 894 | } |
895 | |||
4644 | cbradney | 896 | void PageItem::moveBy(const double dX, const double dY, bool drawingOnly) |
3934 | cbradney | 897 | { |
898 | if (dX==0.0 && dY==0.0) |
||
899 | return; |
||
12820 | pierre | 900 | invalid = true; |
3903 | cbradney | 901 | if (dX!=0.0) |
16115 | fschmid | 902 | { |
18032 | craig | 903 | m_xPos+=dX; |
16115 | fschmid | 904 | gXpos+=dX; |
905 | } |
||
3903 | cbradney | 906 | if (dY!=0.0) |
16115 | fschmid | 907 | { |
18032 | craig | 908 | m_yPos+=dY; |
16115 | fschmid | 909 | gYpos+=dY; |
910 | } |
||
4644 | cbradney | 911 | if (drawingOnly || m_Doc->isLoading()) |
912 | return; |
||
17826 | craig | 913 | moveWelded(dX, dY); |
4621 | cbradney | 914 | checkChanges(); |
3903 | cbradney | 915 | } |
916 | |||
3934 | cbradney | 917 | void PageItem::setWidth(const double newWidth) |
918 | { |
||
18095 | craig | 919 | m_width = newWidth; |
13013 | fschmid | 920 | updateConstants(); |
14681 | fschmid | 921 | if (m_Doc->isLoading()) |
922 | return; |
||
4621 | cbradney | 923 | checkChanges(); |
3934 | cbradney | 924 | } |
925 | |||
926 | void PageItem::setHeight(const double newHeight) |
||
927 | { |
||
18095 | craig | 928 | m_height = newHeight; |
13013 | fschmid | 929 | updateConstants(); |
14681 | fschmid | 930 | if (m_Doc->isLoading()) |
931 | return; |
||
4621 | cbradney | 932 | checkChanges(); |
3934 | cbradney | 933 | } |
934 | |||
8418 | fschmid | 935 | void PageItem::setWidthHeight(const double newWidth, const double newHeight, bool drawingOnly) |
936 | { |
||
18095 | craig | 937 | m_width = newWidth; |
938 | m_height = newHeight; |
||
13013 | fschmid | 939 | updateConstants(); |
8418 | fschmid | 940 | if (drawingOnly) |
941 | return; |
||
942 | checkChanges(); |
||
943 | } |
||
944 | |||
3934 | cbradney | 945 | void PageItem::setWidthHeight(const double newWidth, const double newHeight) |
946 | { |
||
18095 | craig | 947 | m_width = newWidth; |
948 | m_height = newHeight; |
||
13013 | fschmid | 949 | updateConstants(); |
14681 | fschmid | 950 | if (m_Doc->isLoading()) |
951 | return; |
||
4621 | cbradney | 952 | checkChanges(); |
3934 | cbradney | 953 | } |
954 | |||
955 | void PageItem::resizeBy(const double dH, const double dW) |
||
956 | { |
||
957 | if (dH==0.0 && dW==0.0) |
||
958 | return; |
||
959 | if (dH!=0.0) |
||
18095 | craig | 960 | m_width+=dH; |
3934 | cbradney | 961 | if (dW!=0.0) |
18095 | craig | 962 | m_height+=dW; |
13013 | fschmid | 963 | updateConstants(); |
14681 | fschmid | 964 | if (m_Doc->isLoading()) |
965 | return; |
||
4621 | cbradney | 966 | checkChanges(); |
3934 | cbradney | 967 | } |
968 | |||
4663 | cbradney | 969 | void PageItem::setRotation(const double newRotation, bool drawingOnly) |
3934 | cbradney | 970 | { |
18022 | craig | 971 | double dR = newRotation - m_rotation; |
972 | double oldRot = m_rotation; |
||
973 | m_rotation = newRotation; |
||
4663 | cbradney | 974 | if (drawingOnly || m_Doc->isLoading()) |
975 | return; |
||
17826 | craig | 976 | rotateWelded(dR, oldRot); |
14681 | fschmid | 977 | checkChanges(); |
3934 | cbradney | 978 | } |
979 | |||
980 | void PageItem::rotateBy(const double dR) |
||
981 | { |
||
982 | if (dR==0.0) |
||
983 | return; |
||
18022 | craig | 984 | m_rotation+=dR; |
14681 | fschmid | 985 | if (m_Doc->isLoading()) |
986 | return; |
||
4621 | cbradney | 987 | checkChanges(); |
3934 | cbradney | 988 | } |
989 | |||
990 | void PageItem::setSelected(const bool toSelect) |
||
991 | { |
||
18022 | craig | 992 | m_isSelected=toSelect; |
3934 | cbradney | 993 | } |
994 | |||
3988 | cbradney | 995 | void PageItem::setImageXScale(const double newImageXScale) |
3985 | cbradney | 996 | { |
18022 | craig | 997 | m_imageXScale=newImageXScale; |
14681 | fschmid | 998 | if (m_Doc->isLoading()) |
999 | return; |
||
4821 | cbradney | 1000 | checkChanges(); |
3985 | cbradney | 1001 | } |
1002 | |||
1003 | void PageItem::setImageYScale(const double newImageYScale) |
||
1004 | { |
||
18022 | craig | 1005 | m_imageYScale=newImageYScale; |
14681 | fschmid | 1006 | if (m_Doc->isLoading()) |
1007 | return; |
||
4821 | cbradney | 1008 | checkChanges(); |
3985 | cbradney | 1009 | } |
1010 | |||
1011 | void PageItem::setImageXYScale(const double newImageXScale, const double newImageYScale) |
||
1012 | { |
||
18022 | craig | 1013 | m_imageXScale=newImageXScale; |
1014 | m_imageYScale=newImageYScale; |
||
14681 | fschmid | 1015 | if (m_Doc->isLoading()) |
1016 | return; |
||
4821 | cbradney | 1017 | checkChanges(); |
3985 | cbradney | 1018 | } |
1019 | |||
3988 | cbradney | 1020 | void PageItem::setImageXOffset(const double newImageXOffset) |
3985 | cbradney | 1021 | { |
18032 | craig | 1022 | m_imageXOffset=newImageXOffset; |
14681 | fschmid | 1023 | if (m_Doc->isLoading()) |
1024 | return; |
||
4821 | cbradney | 1025 | checkChanges(); |
3985 | cbradney | 1026 | } |
1027 | |||
1028 | void PageItem::setImageYOffset(const double newImageYOffset) |
||
1029 | { |
||
18032 | craig | 1030 | m_imageYOffset=newImageYOffset; |
14681 | fschmid | 1031 | if (m_Doc->isLoading()) |
1032 | return; |
||
4821 | cbradney | 1033 | checkChanges(); |
3985 | cbradney | 1034 | } |
1035 | |||
1036 | void PageItem::setImageXYOffset(const double newImageXOffset, const double newImageYOffset) |
||
1037 | { |
||
18032 | craig | 1038 | m_imageXOffset=newImageXOffset; |
1039 | m_imageYOffset=newImageYOffset; |
||
14681 | fschmid | 1040 | if (m_Doc->isLoading()) |
1041 | return; |
||
4821 | cbradney | 1042 | checkChanges(); |
3985 | cbradney | 1043 | } |
1044 | |||
1045 | void PageItem::moveImageXYOffsetBy(const double dX, const double dY) |
||
1046 | { |
||
1047 | if (dX==0.0 && dY==0.0) |
||
1048 | return; |
||
16703 | jghali | 1049 | if (dX != 0.0) |
18032 | craig | 1050 | m_imageXOffset += dX; |
16703 | jghali | 1051 | if (dY != 0.0) |
18032 | craig | 1052 | m_imageYOffset += dY; |
14681 | fschmid | 1053 | if (m_Doc->isLoading()) |
1054 | return; |
||
4821 | cbradney | 1055 | checkChanges(); |
3985 | cbradney | 1056 | } |
1057 | |||
14861 | fschmid | 1058 | void PageItem::setImageRotation(const double newRotation) |
1059 | { |
||
18022 | craig | 1060 | if(m_imageRotation == newRotation) |
17709 | craig | 1061 | return; |
17744 | craig | 1062 | if(UndoManager::undoEnabled()) |
1063 | { |
||
1064 | SimpleState *ss = new SimpleState(Um::Rotate,"",Um::IRotate); |
||
1065 | ss->set("IMAGE_ROTATION","image_rotation"); |
||
18022 | craig | 1066 | ss->set("OLD_ROT",m_imageRotation); |
17744 | craig | 1067 | ss->set("NEW_ROT",newRotation); |
1068 | undoManager->action(this,ss); |
||
1069 | } |
||
18022 | craig | 1070 | m_imageRotation = newRotation; |
14861 | fschmid | 1071 | if (m_Doc->isLoading()) |
1072 | return; |
||
1073 | checkChanges(); |
||
1074 | } |
||
1075 | |||
3988 | cbradney | 1076 | void PageItem::setReversed(bool newReversed) |
1077 | { |
||
18022 | craig | 1078 | if (m_isReversed == newReversed) |
16703 | jghali | 1079 | return; |
16609 | craig | 1080 | if (UndoManager::undoEnabled()) |
1081 | { |
||
1082 | SimpleState *ss = new SimpleState(Um::FlipH, 0, Um::IFlipH); |
||
16703 | jghali | 1083 | ss->set("REVERSE_TEXT", newReversed); |
16609 | craig | 1084 | undoManager->action(this, ss); |
1085 | } |
||
18022 | craig | 1086 | m_isReversed = newReversed; |
3988 | cbradney | 1087 | } |
3985 | cbradney | 1088 | |
16621 | craig | 1089 | //return frame where is text end |
1090 | PageItem * PageItem::frameTextEnd() |
||
1091 | { |
||
1092 | PageItem * LastBox = this; |
||
1093 | if (frameOverflows() && NextBox) |
||
1094 | { // text ending in some next frame |
||
1095 | LastBox = NextBox; |
||
1096 | while (LastBox != 0 && !LastBox->frameDisplays(itemText.length()-1)) |
||
1097 | LastBox = LastBox->nextInChain(); |
||
1098 | } |
||
1099 | else if (frameUnderflows() && BackBox) |
||
1100 | { //text ending in some previous frame |
||
1101 | LastBox = BackBox; |
||
1102 | while (LastBox != 0 && !LastBox->frameDisplays(itemText.length()-1)) |
||
1103 | LastBox = LastBox->prevInChain(); |
||
1104 | } |
||
1105 | return LastBox; |
||
1106 | } |
||
5559 | avox | 1107 | |
1108 | /// returns true if text overflows |
||
1109 | bool PageItem::frameOverflows() const |
||
1110 | { |
||
12414 | jghali | 1111 | // Fix #6991 : "Text overflow" warning when there is a text underflow in fact |
1112 | /*return NextBox == NULL && itemText.length() > static_cast<int>(MaxChars);*/ |
||
12820 | pierre | 1113 | return ( NextBox == NULL ) |
1114 | && ( static_cast<int> ( firstChar ) < itemText.length() ) |
||
13131 | jghali | 1115 | // Fix #7766 : scribus.textOverflows() returns 0 if there is no place for the overflow mark |
1116 | /*&& ( firstChar < MaxChars )*/ |
||
1117 | && ( firstChar <= MaxChars ) |
||
12820 | pierre | 1118 | && ( itemText.length() > static_cast<int> ( MaxChars ) ); |
5559 | avox | 1119 | } |
1120 | |||
16845 | craig | 1121 | int PageItem::frameOverflowCount() const |
1122 | { |
||
1123 | if (frameOverflows()) |
||
1124 | return itemText.length()-MaxChars; |
||
1125 | return 0; |
||
1126 | } |
||
1127 | |||
17100 | fschmid | 1128 | int PageItem::maxCharsInFrame() |
1129 | { |
||
1130 | return MaxChars; |
||
1131 | } |
||
1132 | |||
16621 | craig | 1133 | /// returns true if text is ending before that frame |
1134 | bool PageItem::frameUnderflows() const |
||
1135 | { |
||
1136 | if (BackBox == NULL) |
||
1137 | return false; |
||
1138 | //FIX ME - I have found that condition if frame is empty |
||
1139 | //and has been linked with previous frame |
||
1140 | //if you will find any better solution - fix that function |
||
1141 | return (firstInFrame() > lastInFrame()); |
||
1142 | } |
||
1143 | |||
16856 | craig | 1144 | void PageItem::drawOverflowMarker(ScPainter *p) |
1145 | { |
||
1146 | qreal sideLength = 10 / qMax(p->zoomFactor(), 1.0); |
||
1147 | qreal offset = 1 / qMax(p->zoomFactor(), 1.0); |
||
18095 | craig | 1148 | qreal left = m_width - sideLength-offset;// / 2; |
16856 | craig | 1149 | qreal right = left + sideLength; |
18095 | craig | 1150 | qreal top = m_height - sideLength-offset;// * 1.5; |
16856 | craig | 1151 | qreal bottom = top + sideLength; |
1152 | |||
1153 | QColor color(PrefsManager::instance()->appPrefs.displayPrefs.frameNormColor); |
||
1154 | if ((isBookmark) || (m_isAnnotation)) |
||
1155 | color = PrefsManager::instance()->appPrefs.displayPrefs.frameAnnotationColor; |
||
1156 | if ((BackBox != 0) || (NextBox != 0)) |
||
1157 | color = PrefsManager::instance()->appPrefs.displayPrefs.frameLinkColor; |
||
1158 | if (m_Locked) |
||
1159 | color = PrefsManager::instance()->appPrefs.displayPrefs.frameLockColor; |
||
1160 | if (m_Doc->m_Selection->containsItem(this)) |
||
1161 | color = Qt::red; |
||
1162 | |||
1163 | p->save(); |
||
1164 | |||
17790 | fschmid | 1165 | p->setPen(color, 0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
16856 | craig | 1166 | p->setPenOpacity(1.0); |
1167 | p->setBrush(Qt::white); |
||
1168 | p->setBrushOpacity(1.0); |
||
1169 | p->setFillMode(ScPainter::Solid); |
||
17790 | fschmid | 1170 | p->drawSharpRect(left, top, sideLength, sideLength); |
1171 | p->drawSharpLine(QPointF(left, top), QPointF(right, bottom)); |
||
1172 | p->drawSharpLine(QPointF(left, bottom), QPointF(right, top)); |
||
16856 | craig | 1173 | |
1174 | p->restore(); |
||
1175 | } |
||
1176 | |||
5559 | avox | 1177 | int PageItem::firstInFrame() const |
1178 | { |
||
5721 | avox | 1179 | return firstChar; |
5559 | avox | 1180 | } |
1181 | int PageItem::lastInFrame() const |
||
1182 | { |
||
8562 | jghali | 1183 | return qMin(signed(MaxChars), itemText.length()) - 1; |
5559 | avox | 1184 | } |
1185 | |||
16589 | jghali | 1186 | bool PageItem::testLinkCandidate(PageItem* nxt) |
1187 | { |
||
1188 | if (this->nextInChain() ) |
||
1189 | return false; |
||
18338 | jghali | 1190 | if (!nxt || nxt->prevInChain() ) |
16589 | jghali | 1191 | return false; |
1192 | for (PageItem* ff=nxt; ff; ff=ff->nextInChain()) |
||
1193 | { |
||
1194 | if (ff == this) return false; |
||
1195 | } |
||
1196 | return true; |
||
1197 | } |
||
7994 | avox | 1198 | |
17708 | craig | 1199 | void PageItem::link(PageItem* nxt, bool addPARSEP) |
7994 | avox | 1200 | { |
1201 | assert( !nextInChain() ); |
||
1202 | assert( !nxt->prevInChain() ); |
||
8075 | avox | 1203 | for (PageItem* ff=nxt; ff; ff=ff->nextInChain()) |
1204 | { |
||
1205 | assert (ff != this); |
||
1206 | } |
||
13655 | jghali | 1207 | // Append only if necessary to avoid the |
1208 | // charstyle: access at end of text warning |
||
17708 | craig | 1209 | bool first = false; |
1210 | bool createUndo = addPARSEP; |
||
1211 | |||
1212 | if (nxt->prevInChain() == NULL) |
||
1213 | first = true; |
||
1214 | int textLen = itemText.length(); |
||
13655 | jghali | 1215 | if (nxt->itemText.length() > 0) |
17708 | craig | 1216 | { //case when text will be joined with next frame text |
1217 | //do not add PARSEP if first frame has no text or text ends already with PARSEP |
||
1218 | if (addPARSEP && (textLen > 0) && (itemText.text(textLen-1) != SpecialChars::PARSEP)) |
||
1219 | itemText.insertChars(textLen, SpecialChars::PARSEP); |
||
1220 | else |
||
1221 | addPARSEP = false; |
||
13655 | jghali | 1222 | itemText.append(nxt->itemText); |
17708 | craig | 1223 | } |
7994 | avox | 1224 | NextBox = nxt; |
1225 | nxt->BackBox = this; |
||
8325 | avox | 1226 | // update AutoText |
1227 | if (isAutoText) |
||
1228 | { |
||
1229 | PageItem* after = nxt; |
||
1230 | while (after) |
||
1231 | { |
||
1232 | after->isAutoText = true; |
||
1233 | m_Doc->LastAuto = after; |
||
1234 | after = after->NextBox; |
||
1235 | } |
||
1236 | } |
||
1237 | else if (nxt->isAutoText) |
||
1238 | { |
||
1239 | PageItem* before = this; |
||
1240 | while (before) |
||
1241 | { |
||
1242 | before->isAutoText = true; |
||
1243 | m_Doc->FirstAuto = before; |
||
1244 | before = before->BackBox; |
||
1245 | } |
||
1246 | } |
||
7994 | avox | 1247 | invalid = true; |
8325 | avox | 1248 | while (nxt) |
1249 | { |
||
9490 | avox | 1250 | nxt->itemText = itemText; |
8325 | avox | 1251 | nxt->invalid = true; |
1252 | nxt->firstChar = 0; |
||
1253 | nxt = nxt->NextBox; |
||
1254 | } |
||
17708 | craig | 1255 | if (UndoManager::undoEnabled() && createUndo) //addPARESEP is false only if linking is invoked from undo action for unlinkWithText |
16490 | craig | 1256 | { |
17744 | craig | 1257 | ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >(Um::LinkTextFrame); |
16490 | craig | 1258 | is->set("LINK_TEXT_FRAME", "linkTextFrame"); |
17708 | craig | 1259 | is->set("FIRST", first); |
1260 | is->set("JOIN_POS", textLen); |
||
1261 | is->set("ADDPARSEP", addPARSEP); |
||
17744 | craig | 1262 | is->setItem(qMakePair(this, NextBox)); |
16490 | craig | 1263 | undoManager->action(this, is); |
1264 | } |
||
7994 | avox | 1265 | } |
1266 | |||
17708 | craig | 1267 | void PageItem::unlink(bool createUndo) |
7994 | avox | 1268 | { |
1269 | if( NextBox ) |
||
1270 | { |
||
16490 | craig | 1271 | PageItem *undoNextBox=NextBox; |
7994 | avox | 1272 | // make sure lastInFrame is valid |
1273 | layout(); |
||
12246 | cbradney | 1274 | /* |
1275 | //<< CB #6332: Stop the StoryText cut and break and act like other publishing apps |
||
7994 | avox | 1276 | // move following text to new StoryText |
1277 | itemText.select(lastInFrame()+1, itemText.length()-lastInFrame()-1); |
||
12246 | cbradney | 1278 | */ |
7994 | avox | 1279 | StoryText follow(m_Doc); |
12246 | cbradney | 1280 | /* |
7994 | avox | 1281 | follow.setDefaultStyle(itemText.defaultStyle()); |
1282 | follow.insert(0, itemText, true); |
||
1283 | // remove following text from this chain |
||
1284 | itemText.removeSelection(); |
||
12246 | cbradney | 1285 | //>> |
1286 | */ |
||
8325 | avox | 1287 | // update auto pointers |
1288 | if (isAutoText) |
||
1289 | { |
||
1290 | PageItem* before = this; |
||
1291 | while (before) |
||
1292 | { |
||
1293 | before->isAutoText = false; |
||
1294 | before = before->BackBox; |
||
1295 | } |
||
1296 | m_Doc->FirstAuto = NextBox; |
||
1297 | } |
||
7994 | avox | 1298 | // link following frames to new text |
1299 | NextBox->firstChar = 0; |
||
1300 | NextBox->BackBox = NULL; |
||
1301 | while (NextBox) { |
||
1302 | NextBox->itemText = follow; |
||
1303 | NextBox->invalid = true; |
||
8325 | avox | 1304 | NextBox->firstChar = 0; |
7994 | avox | 1305 | NextBox = NextBox->NextBox; |
1306 | } |
||
1307 | // NextBox == NULL now |
||
11743 | jghali | 1308 | NextBox = NULL; |
17708 | craig | 1309 | if (UndoManager::undoEnabled() && createUndo) |
16490 | craig | 1310 | { |
17744 | craig | 1311 | ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >(Um::UnlinkTextFrame); |
16490 | craig | 1312 | is->set("UNLINK_TEXT_FRAME", "unlinkTextFrame"); |
17744 | craig | 1313 | is->setItem(qMakePair(this, undoNextBox)); |
16490 | craig | 1314 | undoManager->action(this, is); |
1315 | } |
||
7994 | avox | 1316 | } |
1317 | } |
||
1318 | |||
8325 | avox | 1319 | void PageItem::dropLinks() |
1320 | { |
||
1321 | // update auto pointers |
||
1322 | if (isAutoText && NextBox == 0) |
||
1323 | { |
||
1324 | m_Doc->LastAuto = BackBox; |
||
1325 | } |
||
1326 | if (isAutoText && BackBox == 0) |
||
1327 | { |
||
1328 | m_Doc->FirstAuto = NextBox; |
||
1329 | } |
||
1330 | isAutoText = false; |
||
1331 | |||
1332 | // leave text in remaining chain |
||
1333 | PageItem* before = BackBox; |
||
1334 | PageItem* after = NextBox; |
||
1335 | if (after != 0 || before != 0) |
||
1336 | { |
||
1337 | itemText = StoryText(m_Doc); |
||
1338 | if (before) |
||
1339 | before->NextBox = after; |
||
1340 | if (after) |
||
1341 | { |
||
1342 | after->BackBox = before; |
||
1343 | while (after) |
||
1344 | { |
||
1345 | after->invalid = true; |
||
1346 | after->firstChar = 0; |
||
1347 | after = after->NextBox; |
||
1348 | } |
||
1349 | } |
||
9403 | jghali | 1350 | // JG we should set BackBox and NextBox to NULL at a point |
11743 | jghali | 1351 | BackBox = NextBox = NULL; |
8325 | avox | 1352 | } |
1353 | } |
||
1354 | |||
17565 | craig | 1355 | //unlink selected frame from text chain |
1356 | //but copy or cut its content from itemText |
||
1357 | void PageItem::unlinkWithText(bool cutText) |
||
1358 | { |
||
1359 | PageItem * Next = NextBox; |
||
17708 | craig | 1360 | PageItem * Prev = BackBox; |
1361 | int length = itemText.length(); |
||
1362 | |||
1363 | //unlink first frame in chain |
||
1364 | if (Prev == NULL) |
||
1365 | { |
||
1366 | if (lastInFrame() < length -1) |
||
1367 | { |
||
1368 | StoryText content(m_Doc); |
||
1369 | itemText.select(lastInFrame() +1, length - (lastInFrame() +1)); |
||
1370 | content.insert(0, itemText, cutText); |
||
1371 | itemText.removeSelection(); |
||
1372 | unlink(false); |
||
1373 | Next->itemText.insert(0, content); |
||
1374 | Next->update(); |
||
1375 | } |
||
1376 | else |
||
1377 | { |
||
1378 | unlink(false); |
||
1379 | if (!cutText) |
||
1380 | { |
||
1381 | Next->itemText.insert(0, itemText); |
||
1382 | Next->update(); |
||
1383 | } |
||
1384 | } |
||
1385 | } |
||
1386 | else |
||
1387 | { |
||
1388 | itemText.select(firstInFrame(), length - firstInFrame()); |
||
1389 | StoryText content(m_Doc); |
||
1390 | content.insert(0, itemText, true); |
||
1391 | if (cutText) |
||
1392 | itemText.removeSelection(); |
||
1393 | Prev->unlink(false); |
||
1394 | itemText.insert(0, content); |
||
1395 | update(); |
||
1396 | } |
||
1397 | if (UndoManager::undoEnabled()) |
||
1398 | { |
||
17744 | craig | 1399 | ScItemState<QPair<PageItem*, PageItem*> > *is = new ScItemState<QPair<PageItem*, PageItem*> >(Um::UnlinkTextFrame); |
17708 | craig | 1400 | is->set("UNLINK_TEXT_FRAME", "unlinkTextFrame"); |
1401 | is->set("CUT_TEXT", cutText); |
||
17744 | craig | 1402 | is->setItem(qMakePair(Prev, Next)); |
17708 | craig | 1403 | undoManager->action(this, is); |
1404 | } |
||
17565 | craig | 1405 | } |
1406 | |||
5559 | avox | 1407 | /// tests if a character is displayed by this frame |
1408 | bool PageItem::frameDisplays(int textpos) const |
||
1409 | { |
||
5673 | avox | 1410 | return 0 <= textpos && textpos < signed(MaxChars) && textpos < itemText.length(); |
5559 | avox | 1411 | } |
1412 | |||
1413 | |||
1414 | /// returns the style at the current charpos |
||
1415 | const ParagraphStyle& PageItem::currentStyle() const |
||
1416 | { |
||
16626 | jghali | 1417 | if (frameDisplays(itemText.cursorPosition())) |
1418 | return itemText.paragraphStyle(itemText.cursorPosition()); |
||
5559 | avox | 1419 | else |
1420 | return itemText.defaultStyle(); |
||
1421 | } |
||
1422 | |||
5569 | avox | 1423 | /// returns the style at the current charpos for changing |
1424 | ParagraphStyle& PageItem::changeCurrentStyle() |
||
1425 | { |
||
16626 | jghali | 1426 | if (frameDisplays(itemText.cursorPosition())) |
1427 | return const_cast<ParagraphStyle&>(itemText.paragraphStyle(itemText.cursorPosition())); |
||
5569 | avox | 1428 | else |
5691 | avox | 1429 | return const_cast<ParagraphStyle&>(itemText.defaultStyle()); |
5569 | avox | 1430 | } |
1431 | |||
5559 | avox | 1432 | /// returns the style at the current charpos |
1433 | const CharStyle& PageItem::currentCharStyle() const |
||
1434 | { |
||
16626 | jghali | 1435 | if (frameDisplays(itemText.cursorPosition())) |
1436 | return itemText.charStyle(itemText.cursorPosition()); |
||
5559 | avox | 1437 | else |
1438 | return itemText.defaultStyle().charStyle(); |
||
1439 | } |
||
1440 | |||
16838 | jghali | 1441 | void PageItem::currentTextProps(ParagraphStyle& parStyle) const |
1442 | { |
||
1443 | parStyle = this->currentStyle(); |
||
1444 | int position = itemText.cursorPosition(); |
||
1445 | if (itemText.lengthOfSelection() > 0) |
||
1446 | position = qMin(qMax(itemText.endOfSelection() - 1, 0), qMax(position, itemText.startOfSelection())); |
||
1447 | |||
1448 | if (frameDisplays(position)) |
||
1449 | parStyle.charStyle().setStyle( itemText.charStyle(position) ); |
||
1450 | else |
||
1451 | parStyle.charStyle().setStyle( itemText.defaultStyle().charStyle() ); |
||
1452 | } |
||
1453 | |||
3988 | cbradney | 1454 | void PageItem::setTextToFrameDistLeft(double newLeft) |
1455 | { |
||
18012 | craig | 1456 | if(m_textDistanceMargins.Left==newLeft) |
17641 | craig | 1457 | return; |
1458 | if (UndoManager::undoEnabled()) |
||
1459 | { |
||
1460 | SimpleState *ss = new SimpleState(Um::TextFrameDist, "", Um::ITextFrame); |
||
1461 | ss->set("LEFT_TEXTFRAMEDIST", "left_textframedist"); |
||
18012 | craig | 1462 | ss->set("OLD_DIST",m_textDistanceMargins.Left); |
17641 | craig | 1463 | ss->set("NEW_DIST",newLeft); |
1464 | undoManager->action(this, ss); |
||
1465 | } |
||
18012 | craig | 1466 | m_textDistanceMargins.Left=newLeft; |
16546 | jghali | 1467 | //emit textToFrameDistances(Extra, TExtra, BExtra, RExtra); |
3988 | cbradney | 1468 | } |
3985 | cbradney | 1469 | |
3988 | cbradney | 1470 | void PageItem::setTextToFrameDistRight(double newRight) |
1471 | { |
||
18012 | craig | 1472 | if(m_textDistanceMargins.Right==newRight) |
17641 | craig | 1473 | return; |
1474 | if (UndoManager::undoEnabled()) |
||
1475 | { |
||
1476 | SimpleState *ss = new SimpleState(Um::TextFrameDist, "", Um::ITextFrame); |
||
1477 | ss->set("RIGHT_TEXTFRAMEDIST", "right_textframedist"); |
||
18012 | craig | 1478 | ss->set("OLD_DIST",m_textDistanceMargins.Right); |
17641 | craig | 1479 | ss->set("NEW_DIST",newRight); |
1480 | undoManager->action(this, ss); |
||
1481 | } |
||
18012 | craig | 1482 | m_textDistanceMargins.Right=newRight; |
16546 | jghali | 1483 | //emit textToFrameDistances(Extra, TExtra, BExtra, RExtra); |
3988 | cbradney | 1484 | } |
3985 | cbradney | 1485 | |
3988 | cbradney | 1486 | void PageItem::setTextToFrameDistTop(double newTop) |
1487 | { |
||
18012 | craig | 1488 | if(m_textDistanceMargins.Top==newTop) |
17641 | craig | 1489 | return; |
1490 | if (UndoManager::undoEnabled()) |
||
1491 | { |
||
1492 | SimpleState *ss = new SimpleState(Um::TextFrameDist, "", Um::ITextFrame); |
||
1493 | ss->set("TOP_TEXTFRAMEDIST", "top_textframedist"); |
||
18012 | craig | 1494 | ss->set("OLD_DIST",m_textDistanceMargins.Top); |
17641 | craig | 1495 | ss->set("NEW_DIST",newTop); |
1496 | undoManager->action(this, ss); |
||
1497 | } |
||
18012 | craig | 1498 | m_textDistanceMargins.Top=newTop; |
16546 | jghali | 1499 | //emit textToFrameDistances(Extra, TExtra, BExtra, RExtra); |
3988 | cbradney | 1500 | } |
3985 | cbradney | 1501 | |
3988 | cbradney | 1502 | void PageItem::setTextToFrameDistBottom(double newBottom) |
1503 | { |
||
18012 | craig | 1504 | if(m_textDistanceMargins.Bottom==newBottom) |
17641 | craig | 1505 | return; |
1506 | if (UndoManager::undoEnabled()) |
||
1507 | { |
||
1508 | SimpleState *ss = new SimpleState(Um::TextFrameDist, "", Um::ITextFrame); |
||
1509 | ss->set("BOTTOM_TEXTFRAMEDIST", "bottom_textframedist"); |
||
18012 | craig | 1510 | ss->set("OLD_DIST",m_textDistanceMargins.Bottom); |
17641 | craig | 1511 | ss->set("NEW_DIST",newBottom); |
1512 | undoManager->action(this, ss); |
||
1513 | } |
||
18012 | craig | 1514 | m_textDistanceMargins.Bottom=newBottom; |
16546 | jghali | 1515 | //emit textToFrameDistances(Extra, TExtra, BExtra, RExtra); |
3988 | cbradney | 1516 | } |
3985 | cbradney | 1517 | |
3988 | cbradney | 1518 | void PageItem::setTextToFrameDist(double newLeft, double newRight, double newTop, double newBottom) |
1519 | { |
||
17641 | craig | 1520 | UndoTransaction* activeTransaction = NULL; |
1521 | if (UndoManager::undoEnabled()) |
||
1522 | activeTransaction = new UndoTransaction(undoManager->beginTransaction(Um::TextFrame, Um::IDocument, Um::TextFrameDist, "", Um::ITextFrame)); |
||
1523 | setTextToFrameDistLeft(newLeft); |
||
1524 | setTextToFrameDistRight(newRight); |
||
1525 | setTextToFrameDistTop(newTop); |
||
1526 | setTextToFrameDistBottom(newBottom); |
||
1527 | if (activeTransaction) |
||
1528 | { |
||
1529 | activeTransaction->commit(); |
||
1530 | delete activeTransaction; |
||
1531 | activeTransaction = NULL; |
||
1532 | } |
||
16546 | jghali | 1533 | //emit textToFrameDistances(Extra, TExtra, BExtra, RExtra); |
3988 | cbradney | 1534 | } |
3985 | cbradney | 1535 | |
14932 | cbradney | 1536 | double PageItem::gridOffset() const { return m_Doc->guidesPrefs().offsetBaselineGrid; } |
1537 | double PageItem::gridDistance() const { return m_Doc->guidesPrefs().valueBaselineGrid; } |
||
5559 | avox | 1538 | |
1539 | void PageItem::setGridOffset(double) { } // FIXME |
||
1540 | void PageItem::setGridDistance(double) { } // FIXME |
||
1541 | void PageItem::setColumns(int n) |
||
1542 | { |
||
17641 | craig | 1543 | if(Cols==n) |
1544 | return; |
||
17744 | craig | 1545 | if(UndoManager::undoEnabled()) |
1546 | { |
||
17641 | craig | 1547 | SimpleState *ss = new SimpleState(Um::Columns, "", Um::IBorder); |
1548 | ss->set("COLUMNS", "columns"); |
||
1549 | ss->set("OLD_COLUMNS", Cols); |
||
1550 | ss->set("NEW_COLUMNS",n); |
||
1551 | undoManager->action(this, ss); |
||
1552 | } |
||
1553 | Cols = qMax(1, n); |
||
5559 | avox | 1554 | } |
1555 | void PageItem::setColumnGap(double gap) |
||
1556 | { |
||
17641 | craig | 1557 | if(ColGap==gap) |
1558 | return; |
||
1559 | if(UndoManager::undoEnabled()){ |
||
1560 | SimpleState *ss = new SimpleState(Um::Columns, "", Um::IBorder); |
||
1561 | ss->set("COLUMNSGAP", "columnsgap"); |
||
1562 | ss->set("OLD_COLUMNS", ColGap); |
||
1563 | ss->set("NEW_COLUMNS",gap); |
||
1564 | undoManager->action(this, ss); |
||
1565 | } |
||
1566 | ColGap = gap; |
||
5559 | avox | 1567 | } |
1568 | |||
3989 | cbradney | 1569 | void PageItem::setCornerRadius(double newRadius) |
1570 | { |
||
18022 | craig | 1571 | if(m_roundedCorderRadius==newRadius) |
17644 | craig | 1572 | return; |
17744 | craig | 1573 | if(UndoManager::undoEnabled()) |
1574 | { |
||
1575 | SimpleState *state = new SimpleState(Um::RoundCorner,"",Um::IBorder); |
||
1576 | state->set("CORNER_RADIUS","corner_radius"); |
||
18022 | craig | 1577 | state->set("OLD_RADIUS",m_roundedCorderRadius); |
17744 | craig | 1578 | state->set("NEW_RADIUS",newRadius); |
1579 | undoManager->action(this,state); |
||
1580 | } |
||
18022 | craig | 1581 | m_roundedCorderRadius=newRadius; |
16546 | jghali | 1582 | //emit cornerRadius(RadRect); |
3989 | cbradney | 1583 | } |
3985 | cbradney | 1584 | |
3988 | cbradney | 1585 | |
1586 | |||
10840 | avox | 1587 | /** Paints the item. |
1588 | CHANGE: cullingArea is in doc coordinates! |
||
1589 | */ |
||
11052 | avox | 1590 | void PageItem::DrawObj(ScPainter *p, QRectF cullingArea) |
3 | paul | 1591 | { |
4084 | cbradney | 1592 | if (!m_Doc->DoDrawing) |
1740 | cbradney | 1593 | return; |
10945 | jghali | 1594 | if (cullingArea.isNull()) |
10840 | avox | 1595 | { |
1596 | cullingArea = QRectF(QPointF(m_Doc->minCanvasCoordinate.x(), m_Doc->minCanvasCoordinate.y()), |
||
1597 | QPointF(m_Doc->maxCanvasCoordinate.x(), m_Doc->maxCanvasCoordinate.y())).toAlignedRect(); |
||
1598 | } |
||
17394 | fschmid | 1599 | |
1600 | no_fill = false; |
||
1601 | no_stroke = false; |
||
14681 | fschmid | 1602 | DrawObj_Pre(p); |
13875 | jghali | 1603 | if (m_Doc->layerOutline(LayerID)) |
5572 | fschmid | 1604 | { |
16902 | fschmid | 1605 | if ((itemType()==TextFrame || itemType()==ImageFrame || itemType()==PathText || itemType()==Line || itemType()==PolyLine || itemType()==Group || itemType()==Symbol)) |
14681 | fschmid | 1606 | DrawObj_Item(p, cullingArea); |
5572 | fschmid | 1607 | } |
1608 | else |
||
7549 | fschmid | 1609 | { |
16105 | fschmid | 1610 | DrawObj_Item(p, cullingArea); |
7549 | fschmid | 1611 | } |
2434 | fschmid | 1612 | DrawObj_Post(p); |
1736 | cbradney | 1613 | } |
1614 | |||
14681 | fschmid | 1615 | void PageItem::DrawObj_Pre(ScPainter *p) |
1740 | cbradney | 1616 | { |
1741 | cbradney | 1617 | p->save(); |
2434 | fschmid | 1618 | if (!isEmbedded) |
18032 | craig | 1619 | p->translate(m_xPos, m_yPos); |
18022 | craig | 1620 | p->rotate(m_rotation); |
13875 | jghali | 1621 | if (m_Doc->layerOutline(LayerID)) |
1741 | cbradney | 1622 | { |
13875 | jghali | 1623 | p->setPen(m_Doc->layerMarker(LayerID), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
5572 | fschmid | 1624 | p->setFillMode(ScPainter::None); |
1625 | p->setBrushOpacity(1.0); |
||
1626 | p->setPenOpacity(1.0); |
||
1741 | cbradney | 1627 | } |
1628 | else |
||
1629 | { |
||
16105 | fschmid | 1630 | if (!isGroup()) |
1741 | cbradney | 1631 | { |
14306 | fschmid | 1632 | p->setBlendModeFill(fillBlendmode()); |
14297 | fschmid | 1633 | p->setLineWidth(m_lineWidth); |
1634 | if (GrType != 0) |
||
5572 | fschmid | 1635 | { |
14297 | fschmid | 1636 | if (GrType == 8) |
6368 | fschmid | 1637 | { |
14297 | fschmid | 1638 | if ((patternVal.isEmpty()) || (!m_Doc->docPatterns.contains(patternVal))) |
6368 | fschmid | 1639 | { |
14297 | fschmid | 1640 | p->fill_gradient = VGradient(VGradient::linear); |
1641 | if (fillColor() != CommonStrings::None) |
||
1642 | { |
||
1643 | p->setBrush(fillQColor); |
||
1644 | p->setFillMode(ScPainter::Solid); |
||
1645 | } |
||
1646 | else |
||
17394 | fschmid | 1647 | { |
1648 | no_fill = true; |
||
14297 | fschmid | 1649 | p->setFillMode(ScPainter::None); |
17394 | fschmid | 1650 | } |
14297 | fschmid | 1651 | if ((!patternVal.isEmpty()) && (!m_Doc->docPatterns.contains(patternVal))) |
1652 | { |
||
1653 | GrType = 0; |
||
1654 | patternVal = ""; |
||
1655 | } |
||
6368 | fschmid | 1656 | } |
1657 | else |
||
12215 | fschmid | 1658 | { |
14297 | fschmid | 1659 | p->setPattern(&m_Doc->docPatterns[patternVal], patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternMirrorX, patternMirrorY); |
1660 | p->setFillMode(ScPainter::Pattern); |
||
12215 | fschmid | 1661 | } |
6368 | fschmid | 1662 | } |
1663 | else |
||
1664 | { |
||
14952 | fschmid | 1665 | if (GrType == 9) |
14297 | fschmid | 1666 | { |
14952 | fschmid | 1667 | p->setFillMode(ScPainter::Gradient); |
1668 | FPoint pG1 = FPoint(0, 0); |
||
1669 | FPoint pG2 = FPoint(width(), 0); |
||
1670 | FPoint pG3 = FPoint(width(), height()); |
||
1671 | FPoint pG4 = FPoint(0, height()); |
||
1672 | p->set4ColorGeometry(pG1, pG2, pG3, pG4, GrControl1, GrControl2, GrControl3, GrControl4); |
||
1673 | p->set4ColorColors(GrColorP1QColor, GrColorP2QColor, GrColorP3QColor, GrColorP4QColor); |
||
14297 | fschmid | 1674 | } |
1675 | else |
||
1676 | { |
||
14952 | fschmid | 1677 | if ((!gradientVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientVal))) |
1678 | gradientVal = ""; |
||
1679 | if (!(gradientVal.isEmpty()) && (m_Doc->docGradients.contains(gradientVal))) |
||
1680 | fill_gradient = m_Doc->docGradients[gradientVal]; |
||
15024 | fschmid | 1681 | if ((fill_gradient.Stops() < 2) && (GrType < 9)) // fall back to solid filling if there are not enough colorstops in the gradient. |
14297 | fschmid | 1682 | { |
14952 | fschmid | 1683 | if (fillColor() != CommonStrings::None) |
1684 | { |
||
1685 | p->setBrush(fillQColor); |
||
1686 | p->setFillMode(ScPainter::Solid); |
||
1687 | } |
||
1688 | else |
||
17394 | fschmid | 1689 | { |
1690 | no_fill = true; |
||
14952 | fschmid | 1691 | p->setFillMode(ScPainter::None); |
17394 | fschmid | 1692 | } |
14297 | fschmid | 1693 | } |
14952 | fschmid | 1694 | else |
1695 | { |
||
1696 | p->setFillMode(ScPainter::Gradient); |
||
1697 | p->fill_gradient = fill_gradient; |
||
1698 | switch (GrType) |
||
1699 | { |
||
1700 | case 1: |
||
1701 | case 2: |
||
1702 | case 3: |
||
1703 | case 4: |
||
1704 | case 6: |
||
1705 | p->setGradient(VGradient::linear, FPoint(GrStartX, GrStartY), FPoint(GrEndX, GrEndY), FPoint(GrStartX, GrStartY), GrScale, GrSkew); |
||
1706 | break; |
||
1707 | case 5: |
||
1708 | case 7: |
||
1709 | p->setGradient(VGradient::radial, FPoint(GrStartX, GrStartY), FPoint(GrEndX, GrEndY), FPoint(GrFocalX, GrFocalY), GrScale, GrSkew); |
||
1710 | break; |
||
14981 | fschmid | 1711 | case 10: |
1712 | p->setFillMode(ScPainter::Gradient); |
||
15024 | fschmid | 1713 | p->setDiamondGeometry(FPoint(0, 0), FPoint(width(), 0), FPoint(width(), height()), FPoint(0, height()), GrControl1, GrControl2, GrControl3, GrControl4, GrControl5); |
14981 | fschmid | 1714 | break; |
15024 | fschmid | 1715 | case 11: |
16786 | fschmid | 1716 | case 13: |
15024 | fschmid | 1717 | p->setFillMode(ScPainter::Gradient); |
1718 | p->setMeshGradient(FPoint(0, 0), FPoint(width(), 0), FPoint(width(), height()), FPoint(0, height()), meshGradientArray); |
||
1719 | break; |
||
16729 | fschmid | 1720 | case 12: |
1721 | p->setFillMode(ScPainter::Gradient); |
||
1722 | p->setMeshGradient(FPoint(0, 0), FPoint(width(), 0), FPoint(width(), height()), FPoint(0, height()), meshGradientPatches); |
||
1723 | break; |
||
14952 | fschmid | 1724 | } |
1725 | } |
||
14297 | fschmid | 1726 | } |
6368 | fschmid | 1727 | } |
5572 | fschmid | 1728 | } |
6368 | fschmid | 1729 | else |
1730 | { |
||
14297 | fschmid | 1731 | p->fill_gradient = VGradient(VGradient::linear); |
1732 | if (fillColor() != CommonStrings::None) |
||
6368 | fschmid | 1733 | { |
14297 | fschmid | 1734 | p->setBrush(fillQColor); |
1735 | p->setFillMode(ScPainter::Solid); |
||
7684 | fschmid | 1736 | } |
1737 | else |
||
17394 | fschmid | 1738 | { |
1739 | no_fill = true; |
||
14297 | fschmid | 1740 | p->setFillMode(ScPainter::None); |
17394 | fschmid | 1741 | } |
6368 | fschmid | 1742 | } |
14297 | fschmid | 1743 | if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0)) |
5572 | fschmid | 1744 | { |
14297 | fschmid | 1745 | p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin); |
1746 | if (DashValues.count() != 0) |
||
1747 | p->setDash(DashValues, DashOffset); |
||
5572 | fschmid | 1748 | } |
1749 | else |
||
14297 | fschmid | 1750 | p->setLineWidth(0); |
14306 | fschmid | 1751 | p->setBrushOpacity(1.0 - fillTransparency()); |
1752 | p->setPenOpacity(1.0 - lineTransparency()); |
||
14297 | fschmid | 1753 | p->setFillRule(fillRule); |
14318 | fschmid | 1754 | if ((GrMask == 1) || (GrMask == 2) || (GrMask == 4) || (GrMask == 5)) |
14297 | fschmid | 1755 | { |
14318 | fschmid | 1756 | if ((GrMask == 1) || (GrMask == 2)) |
1757 | p->setMaskMode(1); |
||
1758 | else |
||
1759 | p->setMaskMode(3); |
||
14300 | fschmid | 1760 | if ((!gradientMaskVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientMaskVal))) |
1761 | gradientMaskVal = ""; |
||
1762 | if (!(gradientMaskVal.isEmpty()) && (m_Doc->docGradients.contains(gradientMaskVal))) |
||
1763 | mask_gradient = m_Doc->docGradients[gradientMaskVal]; |
||
14297 | fschmid | 1764 | p->mask_gradient = mask_gradient; |
14318 | fschmid | 1765 | if ((GrMask == 1) || (GrMask == 4)) |
14297 | fschmid | 1766 | p->setGradientMask(VGradient::linear, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskStartX, GrMaskStartY), GrMaskScale, GrMaskSkew); |
1767 | else |
||
1768 | p->setGradientMask(VGradient::radial, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskFocalX, GrMaskFocalY), GrMaskScale, GrMaskSkew); |
||
1769 | } |
||
16732 | fschmid | 1770 | else if ((GrMask == 3) || (GrMask == 6) || (GrMask == 7) || (GrMask == 8)) |
14308 | fschmid | 1771 | { |
1772 | if ((patternMaskVal.isEmpty()) || (!m_Doc->docPatterns.contains(patternMaskVal))) |
||
1773 | p->setMaskMode(0); |
||
1774 | else |
||
1775 | { |
||
1776 | p->setPatternMask(&m_Doc->docPatterns[patternMaskVal], patternMaskScaleX, patternMaskScaleY, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY); |
||
14318 | fschmid | 1777 | if (GrMask == 3) |
1778 | p->setMaskMode(2); |
||
16732 | fschmid | 1779 | else if (GrMask == 6) |
1780 | p->setMaskMode(4); |
||
1781 | else if (GrMask == 7) |
||
1782 | p->setMaskMode(5); |
||
14318 | fschmid | 1783 | else |
16732 | fschmid | 1784 | p->setMaskMode(6); |
14308 | fschmid | 1785 | } |
1786 | } |
||
14297 | fschmid | 1787 | else |
1788 | p->setMaskMode(0); |
||
1741 | cbradney | 1789 | } |
7549 | fschmid | 1790 | } |
1740 | cbradney | 1791 | } |
1792 | |||
2434 | fschmid | 1793 | void PageItem::DrawObj_Post(ScPainter *p) |
1740 | cbradney | 1794 | { |
1795 | bool doStroke=true; |
||
16899 | fschmid | 1796 | if (m_Doc->layerOutline(LayerID)) |
1740 | cbradney | 1797 | { |
16899 | fschmid | 1798 | if (itemType()!=Line) |
1740 | cbradney | 1799 | { |
16899 | fschmid | 1800 | p->setPen(m_Doc->layerMarker(LayerID), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
1801 | p->setFillMode(ScPainter::None); |
||
1802 | p->setBrushOpacity(1.0); |
||
1803 | p->setPenOpacity(1.0); |
||
1804 | if (itemType()==PolyLine) |
||
1805 | p->setupPolygon(&PoLine, false); |
||
1806 | else if (itemType() == PathText) |
||
5582 | fschmid | 1807 | { |
16899 | fschmid | 1808 | if (PoShow) |
5582 | fschmid | 1809 | p->setupPolygon(&PoLine, false); |
16899 | fschmid | 1810 | else |
1811 | doStroke = false; |
||
1812 | } |
||
1813 | else |
||
1814 | p->setupPolygon(&PoLine); |
||
1815 | if (doStroke) |
||
1816 | p->strokePath(); |
||
1817 | if (itemType()==ImageFrame) |
||
1818 | { |
||
1819 | if (imageClip.size() != 0) |
||
7549 | fschmid | 1820 | { |
16899 | fschmid | 1821 | p->setupPolygon(&imageClip); |
7549 | fschmid | 1822 | p->strokePath(); |
5584 | fschmid | 1823 | } |
1824 | } |
||
1740 | cbradney | 1825 | } |
16899 | fschmid | 1826 | } |
1827 | else |
||
1828 | { |
||
1829 | if (!isGroup()) |
||
7549 | fschmid | 1830 | { |
14308 | fschmid | 1831 | p->setBlendModeFill(0); |
14298 | fschmid | 1832 | p->setMaskMode(0); |
16856 | craig | 1833 | // TODO: Investigate whether itemType()==Table should really be here. I got artifacts without it so keeping it here for now. /estan |
1834 | if (itemType()==PathText || itemType()==PolyLine || itemType()==Spiral || itemType()==Line || itemType()==Symbol || itemType()==Group || itemType()==Table) |
||
7549 | fschmid | 1835 | doStroke=false; |
1836 | if ((doStroke) && (!m_Doc->RePos)) |
||
1837 | { |
||
14306 | fschmid | 1838 | p->setBlendModeStroke(lineBlendmode()); |
1839 | p->setPenOpacity(1.0 - lineTransparency()); |
||
14197 | fschmid | 1840 | if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0)) |
14168 | fschmid | 1841 | { |
1842 | p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin); |
||
1843 | if (DashValues.count() != 0) |
||
1844 | p->setDash(DashValues, DashOffset); |
||
1845 | } |
||
1846 | else |
||
1847 | p->setLineWidth(0); |
||
17418 | fschmid | 1848 | if ((itemType() == LatexFrame) || (itemType() == ImageFrame) || (itemType() == OSGFrame)) |
1849 | p->setupPolygon(&PoLine); |
||
1850 | if (NamedLStyle.isEmpty()) |
||
1740 | cbradney | 1851 | { |
17418 | fschmid | 1852 | if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal))) |
13013 | fschmid | 1853 | { |
17418 | fschmid | 1854 | if (patternStrokePath) |
13013 | fschmid | 1855 | { |
17418 | fschmid | 1856 | QPainterPath guidePath = PoLine.toQPainterPath(false); |
1857 | DrawStrokePattern(p, guidePath); |
||
14168 | fschmid | 1858 | } |
17418 | fschmid | 1859 | else |
14197 | fschmid | 1860 | { |
17418 | fschmid | 1861 | p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY); |
1862 | p->setStrokeMode(ScPainter::Pattern); |
||
1863 | p->strokePath(); |
||
1864 | } |
||
1865 | } |
||
1866 | else if (GrTypeStroke > 0) |
||
1867 | { |
||
1868 | if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal))) |
||
1869 | gradientStrokeVal = ""; |
||
1870 | if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal))) |
||
1871 | stroke_gradient = m_Doc->docGradients[gradientStrokeVal]; |
||
1872 | if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient. |
||
1873 | { |
||
1874 | if (lineColor() != CommonStrings::None) |
||
14197 | fschmid | 1875 | { |
17418 | fschmid | 1876 | p->setBrush(strokeQColor); |
1877 | p->setStrokeMode(ScPainter::Solid); |
||
14197 | fschmid | 1878 | } |
1879 | else |
||
1880 | { |
||
17418 | fschmid | 1881 | no_stroke = true; |
1882 | p->setStrokeMode(ScPainter::None); |
||
14197 | fschmid | 1883 | } |
1884 | } |
||
17418 | fschmid | 1885 | else |
14168 | fschmid | 1886 | { |
17418 | fschmid | 1887 | p->setStrokeMode(ScPainter::Gradient); |
1888 | p->stroke_gradient = stroke_gradient; |
||
1889 | if (GrTypeStroke == 6) |
||
1890 | p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew); |
||
1891 | else |
||
1892 | p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew); |
||
13013 | fschmid | 1893 | } |
17418 | fschmid | 1894 | p->strokePath(); |
13013 | fschmid | 1895 | } |
17418 | fschmid | 1896 | else if (lineColor() != CommonStrings::None) |
1897 | { |
||
1898 | p->setStrokeMode(ScPainter::Solid); |
||
1899 | p->setPen(strokeQColor, m_lineWidth, PLineArt, PLineEnd, PLineJoin); |
||
1900 | if (DashValues.count() != 0) |
||
1901 | p->setDash(DashValues, DashOffset); |
||
1902 | p->strokePath(); |
||
1903 | } |
||
7549 | fschmid | 1904 | else |
17418 | fschmid | 1905 | no_stroke = true; |
1906 | } |
||
1907 | else |
||
1908 | { |
||
1909 | p->setStrokeMode(ScPainter::Solid); |
||
1910 | multiLine ml = m_Doc->MLineStyles[NamedLStyle]; |
||
1911 | QColor tmp; |
||
1912 | for (int it = ml.size()-1; it > -1; it--) |
||
5572 | fschmid | 1913 | { |
17418 | fschmid | 1914 | struct SingleLine& sl = ml[it]; |
1915 | // Qt4 if ((!sl.Color != CommonStrings::None) && (sl.Width != 0)) |
||
1916 | if (sl.Color != CommonStrings::None) // && (sl.Width != 0)) |
||
6568 | fschmid | 1917 | { |
17418 | fschmid | 1918 | SetQColor(&tmp, sl.Color, sl.Shade); |
1919 | p->setPen(tmp, sl.Width, static_cast<Qt::PenStyle>(sl.Dash), static_cast<Qt::PenCapStyle>(sl.LineEnd), static_cast<Qt::PenJoinStyle>(sl.LineJoin)); |
||
1920 | p->strokePath(); |
||
6568 | fschmid | 1921 | } |
5572 | fschmid | 1922 | } |
1740 | cbradney | 1923 | } |
14308 | fschmid | 1924 | p->setBlendModeStroke(0); |
7549 | fschmid | 1925 | } |
5746 | fschmid | 1926 | } |
1740 | cbradney | 1927 | } |
14208 | fschmid | 1928 | p->setFillMode(ScPainter::Solid); |
14469 | fschmid | 1929 | p->setBlendModeFill(0); |
14208 | fschmid | 1930 | p->setStrokeMode(ScPainter::Solid); |
14469 | fschmid | 1931 | p->setBlendModeStroke(0); |
14681 | fschmid | 1932 | p->restore(); |
1933 | } |
||
1934 | |||
1935 | void PageItem::DrawObj_Decoration(ScPainter *p) |
||
1936 | { |
||
1937 | p->save(); |
||
18079 | fschmid | 1938 | p->setAntialiasing(false); |
14681 | fschmid | 1939 | if (!isEmbedded) |
18032 | craig | 1940 | p->translate(m_xPos, m_yPos); |
18022 | craig | 1941 | p->rotate(m_rotation); |
4084 | cbradney | 1942 | if ((!isEmbedded) && (!m_Doc->RePos)) |
2434 | fschmid | 1943 | { |
17790 | fschmid | 1944 | double scpInv = 0; |
16105 | fschmid | 1945 | if (!isGroup()) |
1740 | cbradney | 1946 | { |
18007 | craig | 1947 | if ((drawFrame()) && (m_Doc->guidesPrefs().framesShown) && ((itemType() == ImageFrame) || (itemType() == LatexFrame) || (itemType() == OSGFrame) || (itemType() == PathText)) && (no_stroke)) |
3919 | fschmid | 1948 | { |
13974 | cbradney | 1949 | p->setPen(PrefsManager::instance()->appPrefs.displayPrefs.frameNormColor, scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
7549 | fschmid | 1950 | if ((isBookmark) || (m_isAnnotation)) |
13974 | cbradney | 1951 | p->setPen(PrefsManager::instance()->appPrefs.displayPrefs.frameAnnotationColor, scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
7549 | fschmid | 1952 | if ((BackBox != 0) || (NextBox != 0)) |
13974 | cbradney | 1953 | p->setPen(PrefsManager::instance()->appPrefs.displayPrefs.frameLinkColor, scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
7549 | fschmid | 1954 | if (m_Locked) |
13974 | cbradney | 1955 | p->setPen(PrefsManager::instance()->appPrefs.displayPrefs.frameLockColor, scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
7549 | fschmid | 1956 | p->setFillMode(0); |
1957 | if (itemType()==PathText) |
||
3919 | fschmid | 1958 | { |
7549 | fschmid | 1959 | if (Clip.count() != 0) |
3919 | fschmid | 1960 | { |
7549 | fschmid | 1961 | FPointArray tclip; |
1962 | FPoint np = FPoint(Clip.point(0)); |
||
1963 | tclip.resize(2); |
||
1964 | tclip.setPoint(0, np); |
||
1965 | tclip.setPoint(1, np); |
||
8557 | subik | 1966 | for (int a = 1; a < Clip.size(); ++a) |
7549 | fschmid | 1967 | { |
1968 | np = FPoint(Clip.point(a)); |
||
1969 | tclip.putPoints(tclip.size(), 4, np.x(), np.y(), np.x(), np.y(), np.x(), np.y(), np.x(), np.y()); |
||
1970 | } |
||
1971 | np = FPoint(Clip.point(0)); |
||
1972 | tclip.putPoints(tclip.size(), 2, np.x(), np.y(), np.x(), np.y()); |
||
1973 | p->setupPolygon(&tclip); |
||
3919 | fschmid | 1974 | } |
1975 | } |
||
12004 | fschmid | 1976 | else |
17790 | fschmid | 1977 | p->setupSharpPolygon(&PoLine); |
7549 | fschmid | 1978 | p->strokePath(); |
3919 | fschmid | 1979 | } |
1740 | cbradney | 1980 | } |
14932 | cbradney | 1981 | if ((m_Doc->guidesPrefs().framesShown) && textFlowUsesContourLine() && (ContourLine.size() != 0)) |
8494 | fschmid | 1982 | { |
17790 | fschmid | 1983 | p->setPen(Qt::darkGray, 0, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin); |
1984 | p->setupSharpPolygon(&ContourLine); |
||
8494 | fschmid | 1985 | p->strokePath(); |
1986 | } |
||
14808 | fschmid | 1987 | if (itemType()==ImageFrame) |
1988 | { |
||
14971 | cbradney | 1989 | double minres = m_Doc->checkerProfiles()[m_Doc->curCheckProfile()].minResolution; |
1990 | double maxres = m_Doc->checkerProfiles()[m_Doc->curCheckProfile()].maxResolution; |
||
1991 | bool checkres = m_Doc->checkerProfiles()[m_Doc->curCheckProfile()].checkResolution; |
||
17224 | craig | 1992 | if ((((72.0 / imageXScale()) < minres) |
14808 | fschmid | 1993 | || ((72.0 / imageYScale()) < minres) |
1994 | || ((72.0 / imageXScale()) > maxres) |
||
1995 | || ((72.0 / imageYScale()) > maxres)) |
||
16177 | fschmid | 1996 | && (isRaster) && (checkres) && (!m_Doc->drawAsPreview) && (PrefsManager::instance()->appPrefs.displayPrefs.showVerifierWarningsOnCanvas)) |
14808 | fschmid | 1997 | { |
18095 | craig | 1998 | double ofx = m_width - 22.0; |
1999 | double ofy = m_height - 22.0; |
||
14808 | fschmid | 2000 | p->save(); |
2001 | p->translate(ofx, ofy); |
||
2002 | QImage ico = loadIcon("22/dialog-warning.png").toImage(); |
||
2003 | p->drawImage(&ico); |
||
2004 | p->restore(); |
||
2005 | } |
||
2006 | } |
||
16177 | fschmid | 2007 | if ((m_Doc->guidesPrefs().layerMarkersShown) && (m_Doc->layerCount() > 1) && (!m_Doc->layerOutline(LayerID)) && (isGroup()) && (!m_Doc->drawAsPreview)) |
1740 | cbradney | 2008 | { |
17790 | fschmid | 2009 | p->setPen(Qt::black, 0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
5619 | fschmid | 2010 | p->setPenOpacity(1.0); |
13875 | jghali | 2011 | p->setBrush(m_Doc->layerMarker(LayerID)); |
5619 | fschmid | 2012 | p->setBrushOpacity(1.0); |
5572 | fschmid | 2013 | p->setFillMode(ScPainter::Solid); |
5584 | fschmid | 2014 | double ofwh = 10; |
18095 | craig | 2015 | double ofx = m_width - ofwh/2; |
2016 | double ofy = m_height - ofwh*3; |
||
17790 | fschmid | 2017 | p->drawSharpRect(ofx, ofy, ofwh, ofwh); |
5572 | fschmid | 2018 | } |
17394 | fschmid | 2019 | if (no_fill && no_stroke && m_Doc->guidesPrefs().framesShown) |
2020 | { |
||
2021 | p->setPen(PrefsManager::instance()->appPrefs.displayPrefs.frameNormColor, scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
2022 | if (m_Locked) |
||
2023 | p->setPen(PrefsManager::instance()->appPrefs.displayPrefs.frameLockColor, scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); |
||
2024 | p->setFillMode(ScPainter::None); |
||
18095 | craig | 2025 | p->drawSharpRect(0, 0, m_width, m_height); |
17394 | fschmid | 2026 | no_fill = false; |
2027 | no_stroke = false; |
||
2028 | } |
||
4145 | cbradney | 2029 | //CB disabled for now |
4847 | cbradney | 2030 | //if (m_Doc->m_Selection->findItem(this)!=-1) |
4145 | cbradney | 2031 | // drawLockedMarker(p); |
2434 | fschmid | 2032 | } |
8180 | fschmid | 2033 | FrameOnly = false; |
18079 | fschmid | 2034 | p->setAntialiasing(true); |
2434 | fschmid | 2035 | p->restore(); |
1740 | cbradney | 2036 | } |
2037 | |||
11052 | avox | 2038 | void PageItem::DrawObj_Embedded(ScPainter *p, QRectF cullingArea, const CharStyle& style, PageItem* cembedded) |
2434 | fschmid | 2039 | { |
8174 | avox | 2040 | if (!cembedded) |
2041 | return; |
||
2042 | if (!m_Doc->DoDrawing) |
||
2043 | return; |
||
9856 | fschmid | 2044 | QList<PageItem*> emG; |
2955 | fschmid | 2045 | emG.clear(); |
8174 | avox | 2046 | emG.append(cembedded); |
9856 | fschmid | 2047 | for (int em = 0; em < emG.count(); ++em) |
8174 | avox | 2048 | { |
2049 | PageItem* embedded = emG.at(em); |
||
12299 | fschmid | 2050 | p->save(); |
2051 | double x = embedded->xPos(); |
||
2052 | double y = embedded->yPos(); |
||
18032 | craig | 2053 | embedded->m_xPos = embedded->gXpos; |
2054 | embedded->m_yPos = (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos; |
||
12299 | fschmid | 2055 | p->translate((embedded->gXpos * (style.scaleH() / 1000.0)), ( - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos * (style.scaleV() / 1000.0))); |
2056 | if (style.baselineOffset() != 0) |
||
2057 | { |
||
2058 | p->translate(0, -embedded->gHeight * (style.baselineOffset() / 1000.0)); |
||
18032 | craig | 2059 | embedded->m_yPos -= embedded->gHeight * (style.baselineOffset() / 1000.0); |
12299 | fschmid | 2060 | } |
2061 | p->scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
||
8174 | avox | 2062 | embedded->Dirty = Dirty; |
12309 | fschmid | 2063 | embedded->invalid = true; |
8174 | avox | 2064 | double pws = embedded->m_lineWidth; |
14681 | fschmid | 2065 | embedded->DrawObj_Pre(p); |
8174 | avox | 2066 | switch(embedded->itemType()) |
2067 | { |
||
2068 | case ImageFrame: |
||
2069 | case TextFrame: |
||
10321 | mrdocs | 2070 | case LatexFrame: |
13839 | fschmid | 2071 | case OSGFrame: |
8174 | avox | 2072 | case Polygon: |
2073 | case PathText: |
||
15060 | fschmid | 2074 | case Symbol: |
16105 | fschmid | 2075 | case Group: |
16191 | fschmid | 2076 | case RegularPolygon: |
16215 | fschmid | 2077 | case Arc: |
17349 | fschmid | 2078 | case Table: |
14681 | fschmid | 2079 | embedded->DrawObj_Item(p, cullingArea); |
8174 | avox | 2080 | break; |
2081 | case Line: |
||
2082 | case PolyLine: |
||
16311 | fschmid | 2083 | case Spiral: |
8562 | jghali | 2084 | embedded->m_lineWidth = pws * qMin(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
14681 | fschmid | 2085 | embedded->DrawObj_Item(p, cullingArea); |
8174 | avox | 2086 | break; |
2087 | default: |
||
2088 | break; |
||
2089 | } |
||
8562 | jghali | 2090 | embedded->m_lineWidth = pws * qMin(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
8174 | avox | 2091 | embedded->DrawObj_Post(p); |
18032 | craig | 2092 | embedded->m_xPos = x; |
2093 | embedded->m_yPos = y; |
||
8174 | avox | 2094 | p->restore(); |
2095 | embedded->m_lineWidth = pws; |
||
2434 | fschmid | 2096 | } |
18052 | fschmid | 2097 | if (m_Doc->guidesPrefs().framesShown) |
2098 | { |
||
2099 | p->save(); |
||
18095 | craig | 2100 | p->translate(0, -(cembedded->m_height * (style.scaleV() / 1000.0))); |
18052 | fschmid | 2101 | if (style.baselineOffset() != 0) |
18095 | craig | 2102 | p->translate(0, -cembedded->m_height * (style.baselineOffset() / 1000.0)); |
18052 | fschmid | 2103 | p->scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0); |
2104 | p->setPen(PrefsManager::instance()->appPrefs.displayPrefs.frameNormColor, 0, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin); |
||
2105 | p->setFillMode(ScPainter::None); |
||
18095 | craig | 2106 | p->drawSharpRect(0, 0, cembedded->m_width, cembedded->m_height); |
18052 | fschmid | 2107 | p->restore(); |
2108 | } |
||
2434 | fschmid | 2109 | } |
2110 | |||
14403 | fschmid | 2111 | void PageItem::DrawStrokePattern(ScPainter *p, QPainterPath &path) |
2112 | { |
||
2113 | ScPattern pat = m_Doc->docPatterns[patternStrokeVal]; |
||
2114 | double pLen = path.length() - ((pat.width / 2.0) * (patternStrokeScaleX / 100.0)); |
||
2115 | double adv = pat.width * patternStrokeScaleX / 100.0 * patternStrokeSpace; |
||
2116 | double xpos = patternStrokeOffsetX * patternStrokeScaleX / 100.0; |
||
2117 | while (xpos < pLen) |
||
2118 | { |
||
2119 | double currPerc = path.percentAtLength(xpos); |
||
2120 | double currAngle = path.angleAtPercent(currPerc); |
||
2121 | if (currAngle <= 180.0) |
||
2122 | currAngle *= < |