Subversion Repositories Scribus

Rev

Rev 14170 | Rev 14260 | 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
*/
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>
10967 jghali 17
#include <QKeySequence>
9803 fschmid 18
#include <QList>
10967 jghali 19
#include <QPolygon>
9919 jghali 20
#include <QStack>
10028 cbradney 21
#include <QString>
10947 jghali 22
#include <QMap>
12055 jghali 23
#include <QVector>
10967 jghali 24
 
839 cbradney 25
#include <vector>
838 cbradney 26
 
9403 jghali 27
#include "scribusapi.h"
14170 jghali 28
#include "colormngt/sccolormngtstructs.h"
10954 jghali 29
#include "scimagestructs.h"
3878 cbradney 30
#include "sctextstruct.h"
838 cbradney 31
#include "scfonts.h"
32
#include "fpointarray.h"
33
#include "vgradient.h"
4084 cbradney 34
#include "annotation.h"
838 cbradney 35
#include "pageitem.h"
36
 
9403 jghali 37
extern bool SCRIBUS_API compareDouble(double, double);
38
 
7478 jghali 39
typedef struct
40
{
41
        int r;
42
        int g;
43
        int b;
44
        void getValues(int& vr, int& vg, int& vb) {vr = r; vg = g; vb = b;}
45
} RGBColor;
46
 
47
typedef struct
48
{
49
        int c;
50
        int m;
51
        int y;
52
        int k;
53
        void getValues(int& vc, int& vm, int& vy, int& vk) {vc = c; vm = m; vy = y; vk = k;}
54
} CMYKColor;
55
 
1065 cbradney 56
struct CopyPasteBuffer
1429 subik 57
{
1460 cbradney 58
        PageItem::ItemType PType;
844 fschmid 59
        double Xpos;
60
        double Ypos;
61
        double Width;
62
        double Height;
63
        double RadRect;
64
        int FrameType;
65
        bool ClipEdited;
66
        double Pwidth;
67
        QString Pcolor;
68
        QString Pcolor2;
9920 fschmid 69
        double Shade;
70
        double Shade2;
6454 jghali 71
        int FillRule;
844 fschmid 72
        QString GrColor;
73
        QString GrColor2;
74
        int GrShade;
75
        int GrShade2;
76
        VGradient fill_gradient;
77
        int GrType;
6369 fschmid 78
        QString pattern;
6414 fschmid 79
        double patternScaleX;
80
        double patternScaleY;
81
        double patternOffsetX;
82
        double patternOffsetY;
83
        double patternRotation;
844 fschmid 84
        double GrStartX;
85
        double GrStartY;
86
        double GrEndX;
87
        double GrEndY;
14231 fschmid 88
        VGradient stroke_gradient;
89
        int GrTypeStroke;
90
        double GrStrokeStartX;
91
        double GrStrokeStartY;
92
        double GrStrokeEndX;
93
        double GrStrokeEndY;
844 fschmid 94
        QString TxtStroke;
95
        QString TxtFill;
96
        int ShTxtStroke;
97
        int ShTxtFill;
98
        int TxtScale;
2230 fschmid 99
        int TxtScaleV;
844 fschmid 100
        int TxTStyle;
2234 fschmid 101
        int TxTBase;
2247 fschmid 102
        int TxtShadowX;
103
        int TxtShadowY;
2257 fschmid 104
        int TxtOutline;
2262 fschmid 105
        int TxtUnderPos;
106
        int TxtUnderWidth;
2272 fschmid 107
        int TxtStrikePos;
108
        int TxtStrikeWidth;
844 fschmid 109
        double Rot;
110
        int PLineArt;
111
        int PLineJoin;
112
        int PLineEnd;
113
        double LineSp;
2309 fschmid 114
        int LineSpMode;
2382 fschmid 115
        int ExtraV;
844 fschmid 116
        double LocalScX;
117
        double LocalScY;
118
        double LocalX;
119
        double LocalY;
120
        bool PicArt;
1392 cbradney 121
        bool flippedH;
122
        bool flippedV;
844 fschmid 123
        bool isPrintable;
124
        bool isBookmark;
4084 cbradney 125
        bool m_isAnnotation;
126
        Annotation m_annotation;
127
        QString AnName;
844 fschmid 128
        double Extra;
129
        double TExtra;
130
        double BExtra;
131
        double RExtra;
12269 cbradney 132
        FirstLineOffsetPolicy firstLineOffsetP;
844 fschmid 133
        QString Pfile;
134
        QString Pfile2;
135
        QString Pfile3;
136
        QString IProfile;
137
        QString EmProfile;
14170 jghali 138
        eRenderIntent IRender;
844 fschmid 139
        bool UseEmbedded;
1065 cbradney 140
        QString itemText;
10284 fschmid 141
        QPolygon Clip;
844 fschmid 142
        FPointArray PoLine;
143
        FPointArray ContourLine;
144
        bool PoShow;
145
        double BaseOffs;
7926 fschmid 146
        int textPathType;
147
        bool textPathFlipped;
5620 jghali 148
        int TextflowMode;
1065 cbradney 149
        int textAlignment;
844 fschmid 150
        QString IFont;
151
        int ISize;
9919 jghali 152
        QStack<int> Groups;
13875 jghali 153
        int  LayerID;
844 fschmid 154
        bool ScaleType;
155
        bool AspectRatio;
156
        bool Locked;
157
        bool LockRes;
158
        double Transparency;
159
        double TranspStroke;
5746 fschmid 160
        int TransBlend;
161
        int TransBlendS;
844 fschmid 162
        bool Reverse;
163
        QString NamedLStyle;
164
        QString Language;
165
        QString guiLanguage;
166
        int Cols;
167
        double ColGap;
9797 avox 168
        QList<ParagraphStyle::TabRecord> TabValues;
12055 jghali 169
        QVector<double> DashValues;
844 fschmid 170
        double DashOffset;
171
        bool isTableItem;
172
        bool TopLine;
173
        bool LeftLine;
174
        bool RightLine;
175
        bool BottomLine;
176
        int LeftLinkID;
177
        int RightLinkID;
178
        int TopLinkID;
179
        int BottomLinkID;
180
        int startArrowIndex;
181
        int endArrowIndex;
1655 cbradney 182
        ObjAttrVector pageItemAttributes;
844 fschmid 183
};
838 cbradney 184
 
4579 cbradney 185
struct CopyContentsBuffer
186
{
187
        PageItem::ItemType sourceType;
188
        QString contentsFileName;
189
        double LocalScX;
190
        double LocalScY;
191
        double LocalX;
192
        double LocalY;
4831 cbradney 193
        double ItemX;
194
        double ItemY;
10954 jghali 195
        ScImageEffectList effects;
4581 cbradney 196
        QString inputProfile;
10954 jghali 197
        bool   useEmbedded;
14170 jghali 198
        eRenderIntent renderingIntent;
4579 cbradney 199
};
200
 
7225 cbradney 201
/** \brief Pagemargins and bleeds*/
7226 cbradney 202
class MarginStruct
1429 subik 203
{
7226 cbradney 204
        public:
8503 cbradney 205
                MarginStruct() : Top(0), Left(0), Bottom(0), Right(0) {}
7226 cbradney 206
                MarginStruct(double top, double left, double bottom, double right) :
8503 cbradney 207
                        Top(top), Left(left), Bottom(bottom), Right(right) {}
7226 cbradney 208
                MarginStruct(const MarginStruct& rhs) {Top=rhs.Top;Bottom=rhs.Bottom;Left=rhs.Left;Right=rhs.Right;}
12323 cbradney 209
                void set(double top, double left, double bottom, double right) {Top=top;Bottom=bottom;Left=left;Right=right;}
12419 cbradney 210
                void resetToZero() {Top=0.0;Bottom=0.0;Left=0.0;Right=0.0;}
211
                bool hasNonZeroValue() { return Top!=0.0 || Bottom!=0.0 || Left!=0.0 || Right!=0.0;}
12323 cbradney 212
                void print() {qDebug() << Top << Left << Bottom << Right;}
7226 cbradney 213
                double Top;
214
                double Left;
215
                double Bottom;
216
                double Right;
844 fschmid 217
};
838 cbradney 218
 
5789 cbradney 219
struct DocPagesSetup
220
{
221
        DocPagesSetup() : pageArrangement(0), firstPageLocation(0), firstPageNumber(0), orientation(0), autoTextFrames(false), columnDistance(0), columnCount(1) {}
222
        DocPagesSetup(int pa, int fpl, int fpn, int o, bool atf, double cd, double cc) :
223
                pageArrangement(pa), firstPageLocation(fpl), firstPageNumber(fpn), orientation(o), autoTextFrames(atf),
224
                columnDistance(cd), columnCount(cc) {}
225
        int pageArrangement;
226
        int firstPageLocation;
227
        int firstPageNumber;
228
        int orientation;
229
        bool autoTextFrames;
230
        double columnDistance;
231
        double columnCount;
232
};
233
 
3016 fschmid 234
struct PageSet
235
{
236
        QString Name;
237
        int FirstPage;
238
        int Rows;
239
        int Columns;
11349 fschmid 240
//      double GapHorizontal;
241
//      double GapVertical;
242
//      double GapBelow;
3026 fschmid 243
        QStringList pageNames;
3016 fschmid 244
};
245
 
1065 cbradney 246
struct CMSData
844 fschmid 247
{
248
        QString DefaultMonitorProfile;
249
        QString DefaultPrinterProfile;
2984 fschmid 250
        QString DefaultImageRGBProfile;
251
        QString DefaultImageCMYKProfile;
5345 mrdocs 252
        QString DefaultSolidColorRGBProfile;
253
        QString DefaultSolidColorCMYKProfile;
844 fschmid 254
        int ComponentsInput2;
5345 mrdocs 255
        int ComponentsInput3;
844 fschmid 256
        int ComponentsPrinter;
14170 jghali 257
        eRenderIntent DefaultIntentImages;
258
        eRenderIntent DefaultIntentColors;
844 fschmid 259
        bool CMSinUse;
260
        bool SoftProofOn;
5345 mrdocs 261
        bool SoftProofFullOn;
844 fschmid 262
        bool GamutCheck;
263
        bool BlackPoint;
264
} ;
838 cbradney 265
 
1065 cbradney 266
struct SingleLine
1429 subik 267
{
844 fschmid 268
        double Width;
269
        int Dash;
270
        int LineEnd;
271
        int LineJoin;
272
        QString Color;
273
        int Shade;
9403 jghali 274
        // setter necessary for use with serializer/digester
275
        void setLineWidth(double value) { Width = value; }
276
        void setDash(int value)         { Dash = value; }
277
        void setLineEnd(int value)      { LineEnd = value; }
278
        void setLineJoin(int value)     { LineJoin = value; }
279
        void setColor(const QString& name) { Color = name; }
280
        void setShade(int value)        { Shade = value; }
281
        bool operator==(const SingleLine& other) const
282
        {
283
                if (!compareDouble(Width, other.Width) )
284
                        return false;
285
                if ((Dash != other.Dash)  || (LineEnd != other.LineEnd) || (LineJoin != other.LineJoin) ||
286
                        (Color != other.Color)|| (Shade != other.Shade))
287
                        return false;
288
                return true;
289
        }
290
        bool operator!=(const SingleLine& other) const
291
        {
292
                return !(*this == other);
293
        }
844 fschmid 294
};
838 cbradney 295
 
1065 cbradney 296
struct ArrowDesc
844 fschmid 297
{
298
        QString name;
299
        bool userArrow;
300
        FPointArray points;
301
};
838 cbradney 302
 
1065 cbradney 303
struct PDFPresentationData
1429 subik 304
{
1065 cbradney 305
        int pageEffectDuration;
306
        int pageViewDuration;
307
        int effectType;
844 fschmid 308
        int Dm;
309
        int M;
310
        int Di;
311
};
838 cbradney 312
 
1065 cbradney 313
struct LPIData
1429 subik 314
{
844 fschmid 315
        int Frequency;
316
        int Angle;
317
        int SpotFunc;
318
};
838 cbradney 319
 
844 fschmid 320
struct Keys
1429 subik 321
{
1230 cbradney 322
        QString actionName;
1392 cbradney 323
        QString cleanMenuText;
3933 avox 324
        QKeySequence keySequence;
1392 cbradney 325
        int tableRow;
5352 cbradney 326
        QString menuName;
327
        int menuPos;
844 fschmid 328
};
838 cbradney 329
 
10947 jghali 330
enum PrintEngine
331
{
332
        PostScript1 = 1,
333
        PostScript2 = 2,
334
        PostScript3 = 3,
335
        WindowsGDI  = 4
336
};
337
typedef QMap<QString, PrintEngine> PrintEngineMap;
338
 
1429 subik 339
struct PrintOptions
844 fschmid 340
{
7104 fschmid 341
        bool firstUse;
838 cbradney 342
        bool toFile;
343
        bool useAltPrintCommand;
344
        bool outputSeparations;
3068 fschmid 345
        bool useSpotColors;
838 cbradney 346
        bool useColor;
347
        bool mirrorH;
348
        bool mirrorV;
349
        bool useICC;
350
        bool doGCR;
4649 fschmid 351
        bool doClip;
1861 fschmid 352
        bool setDevParam;
12247 jghali 353
        bool useDocBleeds;
6954 fschmid 354
        bool cropMarks;
355
        bool bleedMarks;
356
        bool registrationMarks;
357
        bool colorMarks;
12589 fschmid 358
        bool includePDFMarks;
10947 jghali 359
        int  copies;
360
        PrintEngine prnEngine;
6954 fschmid 361
        double markOffset;
7225 cbradney 362
        MarginStruct bleeds;
838 cbradney 363
        std::vector<int> pageNumbers;
364
        QString printerOptions;
6954 fschmid 365
        QString printer;
366
        QString filename;
367
        QString separationName;
368
        QStringList allSeparations;
369
        QString printerCommand;
10967 jghali 370
        QByteArray devMode; // printer specific options on Windows
838 cbradney 371
};
372
 
844 fschmid 373
typedef QMap<QString,QString> ProfilesL;
6951 tsoots 374
// typedef QValueVector<SingleLine> multiLine;
1460 cbradney 375
 
10028 cbradney 376
class multiLine : public QList<SingleLine> {
9403 jghali 377
public:
6951 tsoots 378
        QString shortcut;
9403 jghali 379
        bool operator!=(const multiLine& other) const
380
        {
381
                return !(this->operator ==(other));
382
        }
6951 tsoots 383
};
4512 cbradney 384
 
385
typedef enum {
386
        MissingGlyph=1,
387
        TextOverflow=2,
388
        ObjectNotOnPage=3,
389
        MissingImage=4,
390
        ImageDPITooLow=5,
391
        Transparency=6,
392
        PDFAnnotField=7,
5239 fschmid 393
        PlacedPDF=8,
5269 subik 394
        ImageDPITooHigh=9,
5674 fschmid 395
        ImageIsGIF=10,
8474 fschmid 396
        BlendMode=11,
14043 jghali 397
        WrongFontInAnnotation=12,
398
        NotCMYKOrSpot=13,
399
        DeviceColorAndOutputIntend=14,
400
        FontNotEmbedded=15,
401
        EmbeddedFontIsOpenType=16
4512 cbradney 402
} PreflightError;
403
 
404
typedef QMap<PreflightError, int> errorCodes;
405
 
1065 cbradney 406
enum AppMode
407
{
2603 cbradney 408
        modeNormal,
409
        modeDrawShapes,
410
        modeStoryEditor,
11298 cbradney 411
        modeDrawImage,
2603 cbradney 412
        modeDrawText,
413
        modeMagnifier,
414
        modeEdit,
415
        modeDrawLine,
416
        modeRotation,
417
        modeLinkFrames,
418
        modeUnlinkFrames,
419
        modeDrawRegularPolygon,
420
        modeDrawBezierLine,
421
        modeInsertPDFButton,
422
        modeInsertPDFTextfield,
423
        modeInsertPDFCheckbox,
424
        modeInsertPDFCombobox,
425
        modeInsertPDFListbox,
426
        modeInsertPDFTextAnnotation,
427
        modeInsertPDFLinkAnnotation,
428
        modeDrawFreehandLine,
429
        modeDrawTable,
430
        modePanning,
431
        modeMeasurementTool,
432
        modeEditGradientVectors,
433
        modeEyeDropper,
10228 avox 434
        modeCopyProperties,
10532 avox 435
        modeEditClip,
12971 jghali 436
        modeDrawLatex,
13839 fschmid 437
        modeImportObject,
438
        modeInsertPDF3DAnnotation
1065 cbradney 439
};
844 fschmid 440
 
2355 cbradney 441
struct AlignObjs
442
{
443
        int ObjNr;
444
        int Group;
445
        double x1;
446
        double y1;
447
        double x2;
448
        double y2;
2380 cbradney 449
        double width;
450
        double height;
9856 fschmid 451
        QList<PageItem*> Objects;
2355 cbradney 452
};
1641 cbradney 453
 
5087 subik 454
/*! \brief Human readable orientations */
3071 subik 455
enum PageOrientation
456
{
457
        portraitPage = 0,
458
        landscapePage = 1,
459
        customPage = 30
460
};
461
 
5087 subik 462
//! \brief Common type for guides list
9803 fschmid 463
typedef QList<double> Guides;
5087 subik 464
 
5642 cbradney 465
//! \brief from ols scribusXml
14043 jghali 466
struct Linked
467
{
5642 cbradney 468
        int Start;
469
        int StPag;
470
};
471
 
472
// this is a quick hack to combine runs until I've thought of something better -- AV
473
class LastStyles {
474
public:
475
        CharStyle Style;
476
        int StyleStart;
7189 avox 477
        QString ParaStyle;
5642 cbradney 478
        LastStyles() {
479
                StyleStart = 0;
7189 avox 480
                ParaStyle = "";
5642 cbradney 481
        }
482
};
5789 cbradney 483
 
838 cbradney 484
#endif
10028 cbradney 485
 
10140 jghali 486
 
14043 jghali 487