Scribus
Open source desktop publishing at your fingertips
scribusstructs.h
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 */
7 #ifndef SCRIBUSSTRUCTS_H
8 #define SCRIBUSSTRUCTS_H
9 
10 #ifdef HAVE_CONFIG_H
11 #include "scconfig.h"
12 #endif
13 
14 #include <QAction>
15 #include <QByteArray>
16 #include <QDebug>
17 #include <QKeySequence>
18 #include <QList>
19 #include <QPolygon>
20 #include <QStack>
21 #include <QString>
22 #include <QMap>
23 #include <QVector>
24 
25 #include <vector>
26 
27 #include "scribusapi.h"
28 
29 #include "annotation.h"
30 #include "fpointarray.h"
31 #include "pageitem.h"
32 #include "margins.h"
33 #include "scfonts.h"
34 #include "scimagestructs.h"
35 #include "sctextstruct.h"
36 #include "vgradient.h"
37 #include "colormgmt/sccolormgmtstructs.h"
38 
39 extern bool SCRIBUS_API compareDouble(double, double);
40 
41 typedef struct
42 {
43  int r;
44  int g;
45  int b;
46  void getValues(int& vr, int& vg, int& vb) {vr = r; vg = g; vb = b;}
47 } RGBColor;
48 
49 typedef struct
50 {
51  int c;
52  int m;
53  int y;
54  int k;
55  void getValues(int& vc, int& vm, int& vy, int& vk) {vc = c; vm = m; vy = y; vk = k;}
56 } CMYKColor;
57 
59 {
60  PageItem::ItemType sourceType;
61  QString contentsFileName;
62  double LocalScX;
63  double LocalScY;
64  double LocalX;
65  double LocalY;
66  double LocalRot;
67  double ItemX;
68  double ItemY;
69  ScImageEffectList effects;
70  QString inputProfile;
71  bool useEmbedded;
72  eRenderIntent renderingIntent;
73 };
74 
76 {
77  DocPagesSetup() : pageArrangement(0), firstPageLocation(0), firstPageNumber(0), orientation(0), autoTextFrames(false), columnDistance(0), columnCount(1) {}
78  DocPagesSetup(int pa, int fpl, int fpn, int o, bool atf, double cd, double cc) :
79  pageArrangement(pa), firstPageLocation(fpl), firstPageNumber(fpn), orientation(o), autoTextFrames(atf),
80  columnDistance(cd), columnCount(cc) {}
81  int pageArrangement;
82  int firstPageLocation;
83  int firstPageNumber;
84  int orientation;
85  bool autoTextFrames;
86  double columnDistance;
87  double columnCount;
88 };
89 
90 struct PageSet
91 {
92  QString Name;
93  int FirstPage;
94  int Rows;
95  int Columns;
96 // double GapHorizontal;
97 // double GapVertical;
98 // double GapBelow;
99  QStringList pageNames;
100 };
101 
102 struct CMSData
103 {
104  QString DefaultMonitorProfile;
105  QString DefaultPrinterProfile;
106  QString DefaultImageRGBProfile;
107  QString DefaultImageCMYKProfile;
108  QString DefaultSolidColorRGBProfile;
109  QString DefaultSolidColorCMYKProfile;
110  int ComponentsInput2;
111  eRenderIntent DefaultIntentImages;
112  eRenderIntent DefaultIntentColors;
113  bool CMSinUse;
114  bool SoftProofOn;
115  bool SoftProofFullOn;
116  bool GamutCheck;
117  bool BlackPoint;
118 } ;
119 
121 {
122  double Width;
123  int Dash;
124  int LineEnd;
125  int LineJoin;
126  QString Color;
127  int Shade;
128  // setter necessary for use with serializer/digester
129  void setLineWidth(double value) { Width = value; }
130  void setDash(int value) { Dash = value; }
131  void setLineEnd(int value) { LineEnd = value; }
132  void setLineJoin(int value) { LineJoin = value; }
133  void setColor(const QString& name) { Color = name; }
134  void setShade(int value) { Shade = value; }
135  bool operator==(const SingleLine& other) const
136  {
137  if (!compareDouble(Width, other.Width) )
138  return false;
139  if ((Dash != other.Dash) || (LineEnd != other.LineEnd) || (LineJoin != other.LineJoin) ||
140  (Color != other.Color)|| (Shade != other.Shade))
141  return false;
142  return true;
143  }
144  bool operator!=(const SingleLine& other) const
145  {
146  return !(*this == other);
147  }
148 };
149 
150 struct Bullet //used by style reader while importing ODT files
151 {
152  QString name;
153  QString charStr;
154  double indent;
155  double firstLineIndent;
156  double tabPosition;
157  CharStyle* style;
158  Bullet() : name(""), charStr(""), indent(0.0), firstLineIndent(0.0), tabPosition(0.0), style(NULL) {}
159  Bullet(QString n, QString ch) : name(n), charStr(ch), indent(0.0), firstLineIndent(0.0), tabPosition(0.0), style(NULL) {}
160  Bullet(QString n, QString ch, double first, double ind, double tab, CharStyle* chStyle)
161  { name = n; charStr = ch, firstLineIndent = first; indent = ind; tabPosition = tab; style = chStyle; }
162 };
163 
164 struct ArrowDesc
165 {
166  QString name;
167  bool userArrow;
168  FPointArray points;
169 };
170 
172 {
174  pageEffectDuration = 1;
175  pageViewDuration = 1;
176  effectType = 0;
177  Dm = M = Di = 0;
178  }
179  int pageEffectDuration;
180  int pageViewDuration;
181  int effectType;
182  int Dm;
183  int M;
184  int Di;
185 };
186 
187 struct LPIData
188 {
189  int Frequency;
190  int Angle;
191  int SpotFunc;
192 };
193 
194 struct Keys
195 {
196  QString actionName;
197  QString cleanMenuText;
198  QKeySequence keySequence;
199  int tableRow;
200  QString menuName;
201  int menuPos;
202 };
203 
204 enum PrintEngine
205 {
206  PostScript1 = 1,
207  PostScript2 = 2,
208  PostScript3 = 3,
209  WindowsGDI = 4
210 };
211 typedef QMap<QString, PrintEngine> PrintEngineMap;
212 
214 {
215  bool firstUse;
216  bool toFile;
217  bool useAltPrintCommand;
218  bool outputSeparations;
219  bool useSpotColors;
220  bool useColor;
221  bool mirrorH;
222  bool mirrorV;
223  bool doGCR;
224  bool doClip;
225  bool setDevParam;
226  bool useDocBleeds;
227  bool cropMarks;
228  bool bleedMarks;
229  bool registrationMarks;
230  bool colorMarks;
231  bool includePDFMarks;
232  int copies;
233  PrintEngine prnEngine;
234  double markLength;
235  double markOffset;
236  MarginStruct bleeds;
237  std::vector<int> pageNumbers;
238  QString printerOptions;
239  QString printer;
240  QString filename;
241  QString separationName;
242  QStringList allSeparations;
243  QString printerCommand;
244  QByteArray devMode; // printer specific options on Windows
245 };
246 
247 typedef QMap<QString,QString> ProfilesL;
248 // typedef QValueVector<SingleLine> multiLine;
249 
250 class multiLine : public QList<SingleLine> {
251 public:
252  QString shortcut;
253  bool operator!=(const multiLine& other) const
254  {
255  return !(this->operator ==(other));
256  }
257 };
258 
259 typedef enum {
260  MissingGlyph = 1,
261  TextOverflow = 2,
262  ObjectNotOnPage = 3,
263  MissingImage = 4,
264  ImageDPITooLow = 5,
265  Transparency = 6,
266  PDFAnnotField = 7,
267  PlacedPDF = 8,
268  ImageDPITooHigh = 9,
269  ImageIsGIF = 10,
270  BlendMode = 11,
271  WrongFontInAnnotation = 12,
272  NotCMYKOrSpot = 13,
273  DeviceColorsAndOutputIntent = 14,
274  FontNotEmbedded = 15,
275  EmbeddedFontIsOpenType = 16,
276  OffConflictLayers = 17,
277  PartFilledImageFrame = 18,
278  MarksChanged = 19,
279  AppliedMasterDifferentSide = 20,
280  EmptyTextFrame = 21
281 } PreflightError;
282 
283 typedef QMap<PreflightError, int> errorCodes;
284 
285 
286 struct AlignObjs
287 {
288  int ObjNr;
289  int Group;
290  double x1;
291  double y1;
292  double x2;
293  double y2;
294  double width;
295  double height;
296  QList<PageItem*> Objects;
297 };
298 
300 enum PageOrientation
301 {
302  portraitPage = 0,
303  landscapePage = 1,
304  customPage = 30
305 };
306 
307 enum UpdateRequests
308 {
309  reqColorsUpdate = 1,
310  reqCharStylesUpdate = 2,
311  reqParaStylesUpdate = 4,
312  reqTextStylesUpdate = 6,
313  reqArrowStylesUpdate = 8,
314  reqLineStylesUpdate = 16,
315  reqSymbolsUpdate = 32,
316  reqDefFontListUpdate = 64,
317  reqDocFontListUpdate = 128,
318  reqStyleComboDocUpdate = 256,
319  reqCmsOptionsUpdate = 512,
320  reqCustomShapeUpdate = 1024,
321  reqInlinePalUpdate = 2048,
322  reqMarksUpdate = 4096,
323  reqNumUpdate = 8192,
324  reqUpdateAll = 65535
325 };
326 
328 typedef QList<double> Guides;
329 
331 struct Linked
332 {
333  int Start;
334  int StPag;
335 };
336 
337 // this is a quick hack to combine runs until I've thought of something better -- AV
338 class LastStyles {
339 public:
341  int StyleStart;
342  QString ParaStyle;
343  LastStyles() {
344  StyleStart = 0;
345  ParaStyle = "";
346  }
347 };
348 
350 {
351  public:
352  AttributeValue() : valid(false), value("")
353  {
354  }
355  AttributeValue(QString val)
356  {
357  if (val.isEmpty() || (val == ""))
358  {
359  valid = false;
360  value.clear();
361  }
362  else
363  {
364  valid = true;
365  value = val;
366  }
367  }
368  bool valid;
369  QString value;
370 };
371 
372 //TODO: Dict license showing, URL background unzipping, checksumming, pkg mgr platforms warning
374 {
375  QString lang;
376  QString version;
377  QString files;
378  QString extractfiles;
379  QString url;
380  QString desc;
381  QString license;
382  QString filetype;
383  QString type;
384  QString movetofile;
385  bool download;
386 };
387 
389 {
390  int id;
391  QUrl url;
392  QString name;
393  QString downloadLocation;
394  QString destinationLocation;
395  QString destinationName;
396  typedef enum {New, Started, Paused, Finished, Successful, Failed} DownloadState;
397  DownloadState state;
398 };
399 
400 enum
401 {
402  GS_ALL,
403  GS_MARGINS,
404  GS_FRAMES,
405  GS_GRID,
406  GS_GUIDES,
407  GS_BASELINE,
408  GS_LINKS,
409  GS_CONTROLS,
410  GS_RULERMODE,
411  GS_RULERS,
412  GS_COLUMNBORDERS,
413  GS_LAYERMARKERS,
414  GS_BLEED,
415  GS_MAX
416 };
417 
418 enum
419 {
420  PS_ALL,
421  PS_PROPERTIES,
422  PS_OUTLINE,
423  PS_SCRAPBOOK,
424  PS_LAYER,
425  PS_PAGE,
426  PS_BOOKMARK,
427  PS_7_UNUSED,
428  PS_UNDO,
429  PS_VERIFIER,
430  PS_DOWNLOADS,
431  PS_MAX
432 };
433 
434 #endif
435 
Definition: scribusstructs.h:171
Definition: charstyle.h:78
Definition: scribusstructs.h:194
Pagemargins and bleeds.
Definition: margins.h:25
Definition: scribusstructs.h:49
Definition: scribusstructs.h:120
Definition: scribusstructs.h:90
Definition: scribusstructs.h:75
Definition: scribusstructs.h:41
Definition: style.h:37
Definition: scribusstructs.h:213
Definition: scribusstructs.h:373
from ols scribusXml
Definition: scribusstructs.h:331
Definition: scribusstructs.h:286
Definition: scribusstructs.h:187
Definition: scribusstructs.h:164
ItemType
Item Type.
Definition: pageitem.h:174
Definition: fpointarray.h:42
Definition: scribusstructs.h:58
Definition: scribusstructs.h:250
Definition: scribusstructs.h:349
Definition: scribusstructs.h:150
Definition: scribusstructs.h:338
Definition: scribusstructs.h:102
Definition: scribusstructs.h:388