Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scribusstructs.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #ifndef SCRIBUSSTRUCTS_H
00008 #define SCRIBUSSTRUCTS_H
00009 
00010 #ifdef HAVE_CONFIG_H
00011 #include "scconfig.h"
00012 #endif
00013 
00014 #include <qvaluestack.h>
00015 #include <qvaluelist.h>
00016 #include <qvaluevector.h>
00017 #include <qstring.h>
00018 #include <qaction.h>
00019 #include <qkeysequence.h>
00020 #include <vector>
00021 
00022 #include "scribusapi.h"
00023 #include "sctextstruct.h"
00024 #include "scfonts.h"
00025 #include "fpointarray.h"
00026 #include "vgradient.h"
00027 #include "annotation.h"
00028 #include "pageitem.h"
00029 
00030 extern bool SCRIBUS_API compareDouble(double, double);
00031 
00032 typedef struct
00033 {
00034        int r;
00035        int g;
00036        int b;
00037        void getValues(int& vr, int& vg, int& vb) {vr = r; vg = g; vb = b;}
00038 } RGBColor;
00039 
00040 typedef struct
00041 {
00042        int c;
00043        int m;
00044        int y;
00045        int k;
00046        void getValues(int& vc, int& vm, int& vy, int& vk) {vc = c; vm = m; vy = y; vk = k;}
00047 } CMYKColor;
00048 
00049 struct CopyPasteBuffer
00050 {
00051        PageItem::ItemType PType;
00052        double Xpos;
00053        double Ypos;
00054        double Width;
00055        double Height;
00056        double RadRect;
00057        int FrameType;
00058        bool ClipEdited;
00059        double Pwidth;
00060        QString Pcolor;
00061        QString Pcolor2;
00062        int Shade;
00063        int Shade2;
00064        int FillRule;
00065        QString GrColor;
00066        QString GrColor2;
00067        int GrShade;
00068        int GrShade2;
00069        VGradient fill_gradient;
00070        int GrType;
00071        QString pattern;
00072        double patternScaleX;
00073        double patternScaleY;
00074        double patternOffsetX;
00075        double patternOffsetY;
00076        double patternRotation;
00077        double GrStartX;
00078        double GrStartY;
00079        double GrEndX;
00080        double GrEndY;
00081        QString TxtStroke;
00082        QString TxtFill;
00083        int ShTxtStroke;
00084        int ShTxtFill;
00085        int TxtScale;
00086        int TxtScaleV;
00087        int TxTStyle;
00088        int TxTBase;
00089        int TxtShadowX;
00090        int TxtShadowY;
00091        int TxtOutline;
00092        int TxtUnderPos;
00093        int TxtUnderWidth;
00094        int TxtStrikePos;
00095        int TxtStrikeWidth;
00096        double Rot;
00097        int PLineArt;
00098        int PLineJoin;
00099        int PLineEnd;
00100        double LineSp;
00101        int LineSpMode;
00102        int ExtraV;
00103        double LocalScX;
00104        double LocalScY;
00105        double LocalX;
00106        double LocalY;
00107        bool PicArt;
00108        bool flippedH;
00109        bool flippedV;
00110        bool isPrintable;
00111        bool isBookmark;
00112        bool m_isAnnotation;
00113        Annotation m_annotation;
00114        QString AnName;
00115        double Extra;
00116        double TExtra;
00117        double BExtra;
00118        double RExtra;
00119        QString Pfile;
00120        QString Pfile2;
00121        QString Pfile3;
00122        QString IProfile;
00123        QString EmProfile;
00124        int IRender;
00125        bool UseEmbedded;
00126        QString itemText;
00127        QPointArray Clip;
00128        FPointArray PoLine;
00129        FPointArray ContourLine;
00130        bool PoShow;
00131        double BaseOffs;
00132        int textPathType;
00133        bool textPathFlipped;
00134        int TextflowMode;
00135        int textAlignment;
00136        QString IFont;
00137        int ISize;
00138        QValueStack<int> Groups;
00139        int LayerNr;
00140        bool ScaleType;
00141        bool AspectRatio;
00142        bool Locked;
00143        bool LockRes;
00144        double Transparency;
00145        double TranspStroke;
00146        int TransBlend;
00147        int TransBlendS;
00148        bool Reverse;
00149        QString NamedLStyle;
00150        QString Language;
00151        QString guiLanguage;
00152        int Cols;
00153        double ColGap;
00154        QValueList<ParagraphStyle::TabRecord> TabValues;
00155        QValueList<double> DashValues;
00156        double DashOffset;
00157        bool isTableItem;
00158        bool TopLine;
00159        bool LeftLine;
00160        bool RightLine;
00161        bool BottomLine;
00162        int LeftLinkID;
00163        int RightLinkID;
00164        int TopLinkID;
00165        int BottomLinkID;
00166        int startArrowIndex;
00167        int endArrowIndex;
00168        ObjAttrVector pageItemAttributes;
00169 };
00170 
00171 struct CopyContentsBuffer
00172 {
00173        PageItem::ItemType sourceType;
00174        QString contentsFileName;
00175        double LocalScX;
00176        double LocalScY;
00177        double LocalX;
00178        double LocalY;
00179        double ItemX;
00180        double ItemY;
00181        QString inputProfile;
00182        bool useEmbedded;
00183        int renderingIntent;
00184 };
00185 
00187 class MarginStruct
00188 {
00189        public:
00190               MarginStruct() : Top(0), Left(0), Bottom(0), Right(0) {}
00191               MarginStruct(double top, double left, double bottom, double right) :
00192                      Top(top), Left(left), Bottom(bottom), Right(right) {}
00193               MarginStruct(const MarginStruct& rhs) {Top=rhs.Top;Bottom=rhs.Bottom;Left=rhs.Left;Right=rhs.Right;}
00194               double Top;
00195               double Left;
00196               double Bottom;
00197               double Right;
00198 };
00199 
00200 struct DocPagesSetup
00201 {
00202        DocPagesSetup() : pageArrangement(0), firstPageLocation(0), firstPageNumber(0), orientation(0), autoTextFrames(false), columnDistance(0), columnCount(1) {}
00203        DocPagesSetup(int pa, int fpl, int fpn, int o, bool atf, double cd, double cc) :
00204               pageArrangement(pa), firstPageLocation(fpl), firstPageNumber(fpn), orientation(o), autoTextFrames(atf),
00205               columnDistance(cd), columnCount(cc) {}
00206        int pageArrangement;
00207        int firstPageLocation;
00208        int firstPageNumber;
00209        int orientation;
00210        bool autoTextFrames;
00211        double columnDistance;
00212        double columnCount;
00213 };
00214 
00215 struct PageSet
00216 {
00217        QString Name;
00218        int FirstPage;
00219        int Rows;
00220        int Columns;
00221        double GapHorizontal;
00222        double GapVertical;
00223        double GapBelow;
00224        QStringList pageNames;
00225 };
00226 
00227 struct CMSData
00228 {
00229        QString DefaultMonitorProfile;
00230        QString DefaultPrinterProfile;
00231        QString DefaultImageRGBProfile;
00232        QString DefaultImageCMYKProfile;
00233        QString DefaultSolidColorRGBProfile;
00234        QString DefaultSolidColorCMYKProfile;
00235        int ComponentsInput2;
00236        int ComponentsInput3;
00237        int ComponentsPrinter;
00238        int DefaultIntentImages;
00239        int DefaultIntentColors;
00240        bool CMSinUse;
00241        bool SoftProofOn;
00242        bool SoftProofFullOn;
00243        bool GamutCheck;
00244        bool BlackPoint;
00245 } ;
00246 
00247 struct SingleLine
00248 {
00249        double Width;
00250        int Dash;
00251        int LineEnd;
00252        int LineJoin;
00253        QString Color;
00254        int Shade;
00255        // setter necessary for use with serializer/digester
00256        void setLineWidth(double value) { Width = value; }
00257        void setDash(int value)         { Dash = value; }
00258        void setLineEnd(int value)      { LineEnd = value; }
00259        void setLineJoin(int value)     { LineJoin = value; }
00260        void setColor(const QString& name) { Color = name; }
00261        void setShade(int value)        { Shade = value; }
00262        bool operator==(const SingleLine& other) const
00263        {
00264               if (!compareDouble(Width, other.Width) )
00265                      return false;
00266               if ((Dash != other.Dash)  || (LineEnd != other.LineEnd) || (LineJoin != other.LineJoin) ||
00267                      (Color != other.Color)|| (Shade != other.Shade))
00268                      return false;
00269               return true;
00270        }
00271        bool operator!=(const SingleLine& other) const
00272        {
00273               return !(*this == other);
00274        }
00275 };
00276 
00277 struct ArrowDesc
00278 {
00279        QString name;
00280        bool userArrow;
00281        FPointArray points;
00282 };
00283 
00284 struct Layer
00285 {
00286        int LNr;
00287        int Level;
00288        int blendMode;
00289        bool isPrintable;
00290        bool isViewable;
00291        bool isEditable;
00292        bool flowControl;
00293        bool outlineMode;
00294        double transparency;
00295        QColor markerColor;
00296        QString Name;
00297 };
00298 
00299 struct PDFPresentationData
00300 {
00301        int pageEffectDuration;
00302        int pageViewDuration;
00303        int effectType;
00304        int Dm;
00305        int M;
00306        int Di;
00307 };
00308 
00309 struct LPIData
00310 {
00311        int Frequency;
00312        int Angle;
00313        int SpotFunc;
00314 };
00315 
00316 struct Keys
00317 {
00318        QString actionName;
00319        QString cleanMenuText;
00320        QKeySequence keySequence;
00321        int tableRow;
00322        QString menuName;
00323        int menuPos;
00324 };
00325 
00326 struct PrintOptions
00327 {
00328        bool firstUse;
00329        bool toFile;
00330        bool useAltPrintCommand;
00331        bool outputSeparations;
00332        bool useSpotColors;
00333        bool useColor;
00334        bool mirrorH;
00335        bool mirrorV;
00336        bool useICC;
00337        bool doGCR;
00338        bool doClip;
00339        bool setDevParam;
00340        bool doOverprint;
00341        bool cropMarks;
00342        bool bleedMarks;
00343        bool registrationMarks;
00344        bool colorMarks;
00345        int copies;
00346        int PSLevel;
00347        double markOffset;
00348        MarginStruct bleeds;
00349        std::vector<int> pageNumbers;
00350        QString printerOptions;
00351        QString printer;
00352        QString filename;
00353        QString separationName;
00354        QStringList allSeparations;
00355        QString printerCommand;
00356 };
00357 
00358 typedef QMap<QString,QString> ProfilesL;
00359 // typedef QValueVector<SingleLine> multiLine;
00360 
00361 class multiLine : public QValueVector<SingleLine> {
00362 public:
00363        QString shortcut;
00364        bool operator!=(const multiLine& other) const
00365        {
00366               return !(this->operator ==(other));
00367        }
00368 };
00369 
00370 typedef enum {
00371        MissingGlyph=1,
00372        TextOverflow=2,
00373        ObjectNotOnPage=3,
00374        MissingImage=4,
00375        ImageDPITooLow=5,
00376        Transparency=6,
00377        PDFAnnotField=7,
00378        PlacedPDF=8,
00379        ImageDPITooHigh=9,
00380        ImageIsGIF=10,
00381        BlendMode=11,
00382        WrongFontInAnnotation=12
00383 } PreflightError;
00384 
00385 typedef QMap<PreflightError, int> errorCodes;
00386 
00387 enum AppMode
00388 {
00389        modeNormal,
00390        modeDrawShapes,
00391        modeStoryEditor,
00392        modeDrawPicture,
00393        modeDrawText,
00394        modeMagnifier,
00395        modeEdit,
00396        modeDrawLine,
00397        modeRotation,
00398        modeLinkFrames,
00399        modeUnlinkFrames,
00400        modeDrawRegularPolygon,
00401        modeDrawBezierLine,
00402        modeInsertPDFButton,
00403        modeInsertPDFTextfield,
00404        modeInsertPDFCheckbox,
00405        modeInsertPDFCombobox,
00406        modeInsertPDFListbox,
00407        modeInsertPDFTextAnnotation,
00408        modeInsertPDFLinkAnnotation,
00409        modeDrawFreehandLine,
00410        modeDrawTable,
00411        modePanning,
00412        modeMeasurementTool,
00413        modeEditGradientVectors,
00414        modeEyeDropper,
00415        modeCopyProperties
00416 };
00417 
00418 struct AlignObjs
00419 {
00420        int ObjNr;
00421        int Group;
00422        double x1;
00423        double y1;
00424        double x2;
00425        double y2;
00426        double width;
00427        double height;
00428        QPtrList<PageItem> Objects;
00429 };
00430 
00432 enum PageOrientation
00433 {
00434        portraitPage = 0,
00435        landscapePage = 1,
00436        customPage = 30
00437 };
00438 
00440 typedef QValueList<double> Guides;
00441 
00443 struct Linked 
00444 { 
00445        int Start;
00446        int StPag;
00447 };
00448 
00449 // this is a quick hack to combine runs until I've thought of something better -- AV
00450 class LastStyles {
00451 public:
00452        CharStyle Style;
00453        int StyleStart;
00454        QString ParaStyle;
00455        LastStyles() {
00456               StyleStart = 0;
00457               ParaStyle = "";
00458        }
00459 };
00460 
00461 #endif