home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / include / scribus-ng / scribusstructs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-12-22  |  9.2 KB  |  475 lines

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