Rev 24782 | 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 | */ |
||
838 | cbradney | 7 | #ifndef SCRIBUSSTRUCTS_H |
8 | #define SCRIBUSSTRUCTS_H |
||
9 | |||
10 | #ifdef HAVE_CONFIG_H |
||
2688 | craig | 11 | #include "scconfig.h" |
838 | cbradney | 12 | #endif |
13 | |||
10967 | jghali | 14 | #include <QAction> |
15 | #include <QByteArray> |
||
12323 | cbradney | 16 | #include <QDebug> |
22147 | jghali | 17 | #include <QFlags> |
10967 | jghali | 18 | #include <QKeySequence> |
9803 | fschmid | 19 | #include <QList> |
10967 | jghali | 20 | #include <QPolygon> |
9919 | jghali | 21 | #include <QStack> |
10028 | cbradney | 22 | #include <QString> |
10947 | jghali | 23 | #include <QMap> |
12055 | jghali | 24 | #include <QVector> |
10967 | jghali | 25 | |
839 | cbradney | 26 | #include <vector> |
838 | cbradney | 27 | |
9403 | jghali | 28 | #include "scribusapi.h" |
17295 | jghali | 29 | |
30 | #include "annotation.h" |
||
23272 | craig | 31 | #include "colormgmt/sccolormgmtstructs.h" |
17295 | jghali | 32 | #include "fpointarray.h" |
23272 | craig | 33 | #include "margins.h" |
17295 | jghali | 34 | #include "pageitem.h" |
22614 | jghali | 35 | #include "sccolorstructs.h" |
17295 | jghali | 36 | #include "scfonts.h" |
10954 | jghali | 37 | #include "scimagestructs.h" |
3878 | cbradney | 38 | #include "sctextstruct.h" |
23272 | craig | 39 | #include "util_math.h" |
838 | cbradney | 40 | #include "vgradient.h" |
41 | |||
4579 | cbradney | 42 | struct CopyContentsBuffer |
43 | { |
||
44 | PageItem::ItemType sourceType; |
||
45 | QString contentsFileName; |
||
46 | double LocalScX; |
||
47 | double LocalScY; |
||
48 | double LocalX; |
||
49 | double LocalY; |
||
14861 | fschmid | 50 | double LocalRot; |
4831 | cbradney | 51 | double ItemX; |
52 | double ItemY; |
||
10954 | jghali | 53 | ScImageEffectList effects; |
4581 | cbradney | 54 | QString inputProfile; |
10954 | jghali | 55 | bool useEmbedded; |
14170 | jghali | 56 | eRenderIntent renderingIntent; |
4579 | cbradney | 57 | }; |
58 | |||
5789 | cbradney | 59 | struct DocPagesSetup |
60 | { |
||
23129 | craig | 61 | DocPagesSetup() = default; |
5789 | cbradney | 62 | DocPagesSetup(int pa, int fpl, int fpn, int o, bool atf, double cd, double cc) : |
63 | pageArrangement(pa), firstPageLocation(fpl), firstPageNumber(fpn), orientation(o), autoTextFrames(atf), |
||
64 | columnDistance(cd), columnCount(cc) {} |
||
23129 | craig | 65 | int pageArrangement {0}; |
66 | int firstPageLocation {0}; |
||
67 | int firstPageNumber {0}; |
||
68 | int orientation {0}; |
||
69 | bool autoTextFrames {false}; |
||
70 | double columnDistance {0.0}; |
||
71 | double columnCount {1.0}; |
||
5789 | cbradney | 72 | }; |
73 | |||
3016 | fschmid | 74 | struct PageSet |
75 | { |
||
76 | QString Name; |
||
77 | int FirstPage; |
||
78 | int Rows; |
||
79 | int Columns; |
||
3026 | fschmid | 80 | QStringList pageNames; |
3016 | fschmid | 81 | }; |
82 | |||
1065 | cbradney | 83 | struct CMSData |
844 | fschmid | 84 | { |
85 | QString DefaultMonitorProfile; |
||
86 | QString DefaultPrinterProfile; |
||
2984 | fschmid | 87 | QString DefaultImageRGBProfile; |
88 | QString DefaultImageCMYKProfile; |
||
5345 | mrdocs | 89 | QString DefaultSolidColorRGBProfile; |
90 | QString DefaultSolidColorCMYKProfile; |
||
844 | fschmid | 91 | int ComponentsInput2; |
14170 | jghali | 92 | eRenderIntent DefaultIntentImages; |
93 | eRenderIntent DefaultIntentColors; |
||
844 | fschmid | 94 | bool CMSinUse; |
95 | bool SoftProofOn; |
||
5345 | mrdocs | 96 | bool SoftProofFullOn; |
844 | fschmid | 97 | bool GamutCheck; |
98 | bool BlackPoint; |
||
23904 | jghali | 99 | }; |
838 | cbradney | 100 | |
23904 | jghali | 101 | enum |
102 | { |
||
103 | Gradient_None = 0, |
||
104 | Gradient_LinearLegacy1 = 1, |
||
105 | Gradient_LinearLegacy2 = 2, |
||
106 | Gradient_LinearLegacy3 = 3, |
||
107 | Gradient_LinearLegacy4 = 4, |
||
108 | Gradient_RadialLegacy5 = 5, |
||
109 | Gradient_Linear = 6, |
||
110 | Gradient_Radial = 7, |
||
111 | Gradient_Pattern = 8, |
||
112 | Gradient_4Colors = 9, |
||
113 | Gradient_Diamond = 10, |
||
114 | Gradient_Mesh = 11, |
||
115 | Gradient_PatchMesh = 12, |
||
116 | Gradient_Conical = 13, |
||
117 | Gradient_Hatch = 14 |
||
118 | }; |
||
119 | |||
23907 | jghali | 120 | enum |
121 | { |
||
122 | GradMask_None = 0, |
||
123 | GradMask_Linear = 1, |
||
124 | GradMask_Radial = 2, |
||
125 | GradMask_Pattern = 3, |
||
126 | GradMask_LinearLumAlpha = 4, |
||
127 | GradMask_RadialLumAlpha = 5, |
||
128 | GradMask_PatternLumAlpha = 6, |
||
129 | GradMask_PatternLumAlphaInverted = 7, |
||
130 | GradMask_PatternInverted = 8 |
||
131 | }; |
||
132 | |||
24782 | jghali | 133 | /** |
134 | * This enum describes the sides that can be selected. A selection can be |
||
135 | * expressed as an ORed combination of Left, Right, Top and Bottom. |
||
136 | */ |
||
137 | enum class TableSide |
||
138 | { |
||
139 | None = 0, /**< None of the sides are selected. */ |
||
140 | Left = 1, /**< The left side is selected. */ |
||
141 | Right = 2, /**< The right side is selected. */ |
||
142 | Top = 4, /**< The top side is selected. */ |
||
143 | Bottom = 8, /**< The bottom side is selected. */ |
||
144 | All = Left | Right | Top | Bottom |
||
145 | }; |
||
146 | Q_DECLARE_FLAGS(TableSides, TableSide) |
||
147 | Q_DECLARE_OPERATORS_FOR_FLAGS(TableSides) |
||
148 | |||
1065 | cbradney | 149 | struct SingleLine |
1429 | subik | 150 | { |
844 | fschmid | 151 | double Width; |
152 | int Dash; |
||
153 | int LineEnd; |
||
154 | int LineJoin; |
||
155 | QString Color; |
||
156 | int Shade; |
||
9403 | jghali | 157 | // setter necessary for use with serializer/digester |
158 | void setLineWidth(double value) { Width = value; } |
||
159 | void setDash(int value) { Dash = value; } |
||
160 | void setLineEnd(int value) { LineEnd = value; } |
||
161 | void setLineJoin(int value) { LineJoin = value; } |
||
162 | void setColor(const QString& name) { Color = name; } |
||
163 | void setShade(int value) { Shade = value; } |
||
164 | bool operator==(const SingleLine& other) const |
||
165 | { |
||
166 | if (!compareDouble(Width, other.Width) ) |
||
167 | return false; |
||
168 | if ((Dash != other.Dash) || (LineEnd != other.LineEnd) || (LineJoin != other.LineJoin) || |
||
169 | (Color != other.Color)|| (Shade != other.Shade)) |
||
170 | return false; |
||
171 | return true; |
||
172 | } |
||
173 | bool operator!=(const SingleLine& other) const |
||
174 | { |
||
175 | return !(*this == other); |
||
176 | } |
||
844 | fschmid | 177 | }; |
838 | cbradney | 178 | |
24782 | jghali | 179 | class multiLine : public QList<SingleLine> { |
180 | public: |
||
181 | QString shortcut; |
||
182 | bool operator!=(const multiLine& other) const |
||
183 | { |
||
184 | return !(this->operator ==(other)); |
||
185 | } |
||
186 | }; |
||
187 | |||
18047 | craig | 188 | struct Bullet //used by style reader while importing ODT files |
189 | { |
||
190 | QString name; |
||
191 | QString charStr; |
||
192 | double indent; |
||
193 | double firstLineIndent; |
||
194 | double tabPosition; |
||
195 | CharStyle* style; |
||
22516 | craig | 196 | Bullet() : indent(0.0), firstLineIndent(0.0), tabPosition(0.0), style(nullptr) {} |
197 | Bullet(QString n, QString ch) : name(n), charStr(ch), indent(0.0), firstLineIndent(0.0), tabPosition(0.0), style(nullptr) {} |
||
18047 | craig | 198 | Bullet(QString n, QString ch, double first, double ind, double tab, CharStyle* chStyle) |
21953 | craig | 199 | { name = n; charStr = ch, firstLineIndent = first; indent = ind; tabPosition = tab; style = chStyle; } |
18047 | craig | 200 | }; |
201 | |||
24359 | jghali | 202 | enum class ArrowDirection |
203 | { |
||
204 | StartArrow = 0, |
||
205 | EndArrow |
||
206 | }; |
||
207 | |||
1065 | cbradney | 208 | struct ArrowDesc |
844 | fschmid | 209 | { |
210 | QString name; |
||
24782 | jghali | 211 | bool userArrow { false }; |
844 | fschmid | 212 | FPointArray points; |
213 | }; |
||
838 | cbradney | 214 | |
1065 | cbradney | 215 | struct PDFPresentationData |
1429 | subik | 216 | { |
23129 | craig | 217 | PDFPresentationData() = default; |
218 | int pageEffectDuration {1}; |
||
219 | int pageViewDuration {1}; |
||
220 | int effectType {0}; |
||
221 | int Dm {0}; |
||
222 | int M {0}; |
||
223 | int Di {0}; |
||
844 | fschmid | 224 | }; |
838 | cbradney | 225 | |
1065 | cbradney | 226 | struct LPIData |
1429 | subik | 227 | { |
23700 | craig | 228 | int Frequency {0}; |
229 | int Angle {0}; |
||
230 | int SpotFunc {0}; |
||
844 | fschmid | 231 | }; |
838 | cbradney | 232 | |
844 | fschmid | 233 | struct Keys |
1429 | subik | 234 | { |
1230 | cbradney | 235 | QString actionName; |
1392 | cbradney | 236 | QString cleanMenuText; |
3933 | avox | 237 | QKeySequence keySequence; |
1392 | cbradney | 238 | int tableRow; |
5352 | cbradney | 239 | QString menuName; |
240 | int menuPos; |
||
844 | fschmid | 241 | }; |
838 | cbradney | 242 | |
24049 | jghali | 243 | enum class PrintLanguage |
10947 | jghali | 244 | { |
245 | PostScript1 = 1, |
||
246 | PostScript2 = 2, |
||
247 | PostScript3 = 3, |
||
24010 | jghali | 248 | WindowsGDI = 4, |
249 | PDF = 5 |
||
10947 | jghali | 250 | }; |
24049 | jghali | 251 | typedef QMap<QString, PrintLanguage> PrintLanguageMap; |
10947 | jghali | 252 | |
1429 | subik | 253 | struct PrintOptions |
844 | fschmid | 254 | { |
23845 | jghali | 255 | bool firstUse { true }; |
256 | bool toFile { false }; |
||
257 | bool useAltPrintCommand { false }; |
||
258 | bool outputSeparations { false }; |
||
259 | bool useSpotColors { true }; |
||
260 | bool useColor { true }; |
||
261 | bool mirrorH { false }; |
||
262 | bool mirrorV { false }; |
||
263 | bool doGCR { false }; |
||
264 | bool doClip { false }; |
||
265 | bool setDevParam { false }; |
||
266 | bool useDocBleeds { true }; |
||
267 | bool cropMarks { false }; |
||
268 | bool bleedMarks { false }; |
||
269 | bool registrationMarks { false }; |
||
270 | bool colorMarks { false }; |
||
271 | bool includePDFMarks { true }; |
||
272 | int copies { 1 }; |
||
24049 | jghali | 273 | PrintLanguage prnLanguage { PrintLanguage::PostScript3 }; |
23845 | jghali | 274 | double markLength { 20.0 }; |
275 | double markOffset { 0.0 }; |
||
7225 | cbradney | 276 | MarginStruct bleeds; |
838 | cbradney | 277 | std::vector<int> pageNumbers; |
278 | QString printerOptions; |
||
6954 | fschmid | 279 | QString printer; |
280 | QString filename; |
||
23845 | jghali | 281 | QString separationName { "All" }; |
6954 | fschmid | 282 | QStringList allSeparations; |
283 | QString printerCommand; |
||
10967 | jghali | 284 | QByteArray devMode; // printer specific options on Windows |
838 | cbradney | 285 | }; |
286 | |||
844 | fschmid | 287 | typedef QMap<QString,QString> ProfilesL; |
1460 | cbradney | 288 | |
23904 | jghali | 289 | enum PreflightError |
290 | { |
||
18491 | craig | 291 | MissingGlyph = 1, |
292 | TextOverflow = 2, |
||
293 | ObjectNotOnPage = 3, |
||
294 | MissingImage = 4, |
||
295 | ImageDPITooLow = 5, |
||
296 | Transparency = 6, |
||
297 | PDFAnnotField = 7, |
||
298 | PlacedPDF = 8, |
||
299 | ImageDPITooHigh = 9, |
||
300 | ImageIsGIF = 10, |
||
301 | BlendMode = 11, |
||
302 | WrongFontInAnnotation = 12, |
||
303 | NotCMYKOrSpot = 13, |
||
304 | DeviceColorsAndOutputIntent = 14, |
||
305 | FontNotEmbedded = 15, |
||
306 | EmbeddedFontIsOpenType = 16, |
||
307 | OffConflictLayers = 17, |
||
308 | PartFilledImageFrame = 18, |
||
18485 | craig | 309 | MarksChanged = 19, |
18491 | craig | 310 | AppliedMasterDifferentSide = 20, |
311 | EmptyTextFrame = 21 |
||
23904 | jghali | 312 | }; |
4512 | cbradney | 313 | |
314 | typedef QMap<PreflightError, int> errorCodes; |
||
315 | |||
844 | fschmid | 316 | |
2355 | cbradney | 317 | struct AlignObjs |
318 | { |
||
319 | int ObjNr; |
||
320 | int Group; |
||
321 | double x1; |
||
322 | double y1; |
||
323 | double x2; |
||
324 | double y2; |
||
2380 | cbradney | 325 | double width; |
326 | double height; |
||
22443 | jghali | 327 | PageItem* Object; |
2355 | cbradney | 328 | }; |
1641 | cbradney | 329 | |
5087 | subik | 330 | /*! \brief Human readable orientations */ |
3071 | subik | 331 | enum PageOrientation |
332 | { |
||
333 | portraitPage = 0, |
||
334 | landscapePage = 1, |
||
335 | customPage = 30 |
||
336 | }; |
||
337 | |||
22147 | jghali | 338 | /** |
339 | * Flags for ScribusView PageToPixmap() |
||
340 | */ |
||
23129 | craig | 341 | enum PageToPixmapFlag |
342 | { |
||
22147 | jghali | 343 | Pixmap_NoFlags = 0, |
344 | Pixmap_DrawFrame = 1 << 0, |
||
345 | Pixmap_DrawBackground = 1 << 1, |
||
22460 | jghali | 346 | Pixmap_DrawWhiteBackground = 1 << 2, |
347 | Pixmap_DontReloadImages = 1 << 3, |
||
22147 | jghali | 348 | }; |
349 | |||
350 | Q_DECLARE_FLAGS(PageToPixmapFlags, PageToPixmapFlag); |
||
351 | Q_DECLARE_OPERATORS_FOR_FLAGS(PageToPixmapFlags); |
||
352 | |||
16546 | jghali | 353 | enum UpdateRequests |
354 | { |
||
355 | reqColorsUpdate = 1, |
||
356 | reqCharStylesUpdate = 2, |
||
357 | reqParaStylesUpdate = 4, |
||
358 | reqTextStylesUpdate = 6, |
||
359 | reqArrowStylesUpdate = 8, |
||
360 | reqLineStylesUpdate = 16, |
||
361 | reqSymbolsUpdate = 32, |
||
362 | reqDefFontListUpdate = 64, |
||
363 | reqDocFontListUpdate = 128, |
||
364 | reqStyleComboDocUpdate = 256, |
||
365 | reqCmsOptionsUpdate = 512, |
||
366 | reqCustomShapeUpdate = 1024, |
||
17405 | fschmid | 367 | reqInlinePalUpdate = 2048, |
17826 | craig | 368 | reqMarksUpdate = 4096, |
18047 | craig | 369 | reqNumUpdate = 8192, |
16546 | jghali | 370 | reqUpdateAll = 65535 |
371 | }; |
||
372 | |||
5087 | subik | 373 | //! \brief Common type for guides list |
9803 | fschmid | 374 | typedef QList<double> Guides; |
5087 | subik | 375 | |
5642 | cbradney | 376 | // this is a quick hack to combine runs until I've thought of something better -- AV |
23129 | craig | 377 | class LastStyles |
378 | { |
||
5642 | cbradney | 379 | public: |
380 | CharStyle Style; |
||
381 | int StyleStart; |
||
7189 | avox | 382 | QString ParaStyle; |
5642 | cbradney | 383 | LastStyles() { |
384 | StyleStart = 0; |
||
385 | } |
||
386 | }; |
||
5789 | cbradney | 387 | |
19267 | craig | 388 | class AttributeValue |
389 | { |
||
390 | public: |
||
23129 | craig | 391 | AttributeValue() = default; |
21953 | craig | 392 | AttributeValue(const QString& val) |
19267 | craig | 393 | { |
23129 | craig | 394 | if (val.isEmpty()) |
19267 | craig | 395 | { |
396 | valid = false; |
||
20388 | craig | 397 | value.clear(); |
19267 | craig | 398 | } |
399 | else |
||
400 | { |
||
401 | valid = true; |
||
402 | value = val; |
||
403 | } |
||
404 | } |
||
23129 | craig | 405 | bool valid {false}; |
19267 | craig | 406 | QString value; |
407 | }; |
||
408 | |||
19785 | craig | 409 | //TODO: Dict license showing, URL background unzipping, checksumming, pkg mgr platforms warning |
19821 | craig | 410 | struct DownloadItem |
19785 | craig | 411 | { |
412 | QString lang; |
||
413 | QString version; |
||
414 | QString files; |
||
20367 | craig | 415 | QString extractfiles; |
19785 | craig | 416 | QString url; |
417 | QString desc; |
||
418 | QString license; |
||
419 | QString filetype; |
||
19821 | craig | 420 | QString type; |
19822 | craig | 421 | QString movetofile; |
21300 | craig | 422 | QString source; |
19785 | craig | 423 | bool download; |
424 | }; |
||
425 | |||
426 | struct DownloadData |
||
427 | { |
||
19787 | craig | 428 | int id; |
429 | QUrl url; |
||
19785 | craig | 430 | QString name; |
431 | QString downloadLocation; |
||
432 | QString destinationLocation; |
||
19822 | craig | 433 | QString destinationName; |
19787 | craig | 434 | typedef enum {New, Started, Paused, Finished, Successful, Failed} DownloadState; |
19785 | craig | 435 | DownloadState state; |
436 | }; |
||
437 | |||
19852 | craig | 438 | enum |
439 | { |
||
440 | GS_ALL, |
||
441 | GS_MARGINS, |
||
442 | GS_FRAMES, |
||
443 | GS_GRID, |
||
444 | GS_GUIDES, |
||
445 | GS_BASELINE, |
||
446 | GS_LINKS, |
||
447 | GS_CONTROLS, |
||
448 | GS_RULERMODE, |
||
449 | GS_RULERS, |
||
450 | GS_COLUMNBORDERS, |
||
451 | GS_LAYERMARKERS, |
||
19853 | craig | 452 | GS_BLEED, |
453 | GS_MAX |
||
19852 | craig | 454 | }; |
455 | |||
23282 | craig | 456 | //Always add new at the end, leave existing and deprecated items in the list |
19853 | craig | 457 | enum |
458 | { |
||
22067 | jghali | 459 | PAL_ALL, |
460 | PAL_PROPERTIES, |
||
461 | PAL_OUTLINE, |
||
462 | PAL_SCRAPBOOK, |
||
463 | PAL_LAYER, |
||
464 | PAL_PAGE, |
||
465 | PAL_BOOKMARK, |
||
466 | PAL_7_UNUSED, |
||
467 | PAL_UNDO, |
||
468 | PAL_VERIFIER, |
||
469 | PAL_DOWNLOADS, |
||
470 | PAL_TEXT, |
||
23282 | craig | 471 | PAL_CONTENT, |
25130 | jghali | 472 | PAL_ALIGNDISTRIBUTE, |
22067 | jghali | 473 | PAL_MAX |
19853 | craig | 474 | }; |
475 | |||
838 | cbradney | 476 | #endif |
10028 | cbradney | 477 |