Rev 17919 | Rev 18734 | 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 | */ |
||
3136 | fschmid | 7 | /*************************************************************************** |
8 | pslib.h - description |
||
9 | ------------------- |
||
10 | begin : Sat May 26 2001 |
||
11 | copyright : (C) 2001 by Franz Schmid |
||
12 | email : Franz.Schmid@altmuehlnet.de |
||
13 | ***************************************************************************/ |
||
14 | |||
15 | /*************************************************************************** |
||
16 | * * |
||
17 | * This program is free software; you can redistribute it and/or modify * |
||
18 | * it under the terms of the GNU General Public License as published by * |
||
19 | * the Free Software Foundation; either version 2 of the License, or * |
||
20 | * (at your option) any later version. * |
||
21 | * * |
||
22 | ***************************************************************************/ |
||
23 | |||
24 | #ifndef PSLIB_H |
||
25 | #define PSLIB_H |
||
10223 | cbradney | 26 | |
3136 | fschmid | 27 | #include <vector> |
5980 | avox | 28 | #include <utility> |
10223 | cbradney | 29 | |
11534 | jghali | 30 | #include <QDataStream> |
10223 | cbradney | 31 | #include <QFile> |
32 | #include <QList> |
||
33 | #include <QPen> |
||
34 | #include <QString> |
||
35 | |||
36 | #include "scribusapi.h" |
||
6954 | fschmid | 37 | #include "scribusstructs.h" |
14491 | jghali | 38 | #include "colormgmt/sccolormgmtengine.h" |
17310 | fschmid | 39 | #include "tableborder.h" |
3136 | fschmid | 40 | |
5291 | avox | 41 | |
16729 | fschmid | 42 | class ScPage; |
13805 | jghali | 43 | class ScribusDoc; |
10601 | mrdocs | 44 | class PageItem; |
4037 | cbradney | 45 | class MultiProgressDialog; |
11568 | jghali | 46 | class ScImage; |
13873 | jghali | 47 | class ScLayer; |
4037 | cbradney | 48 | |
3136 | fschmid | 49 | /** |
50 | *@author Franz Schmid |
||
51 | * Diese Klasse erzeugt Postscript-Dateien |
||
52 | */ |
||
53 | |||
4037 | cbradney | 54 | class SCRIBUS_API PSLib : public QObject |
55 | { |
||
56 | Q_OBJECT |
||
57 | public: |
||
11562 | jghali | 58 | |
59 | typedef enum |
||
60 | { |
||
61 | OptimizeCompat = 0, |
||
62 | OptimizeSize = 1 |
||
63 | } Optimization; |
||
64 | |||
6954 | fschmid | 65 | PSLib(PrintOptions &options, bool psart, SCFonts &AllFonts, QMap<QString, QMap<uint, FPointArray> > DocFonts, ColorList DocColors, bool pdf = false, bool spot = true); |
4037 | cbradney | 66 | virtual ~PSLib() {}; |
11060 | jghali | 67 | |
11562 | jghali | 68 | void setOptimization (Optimization opt) { optimization = opt; } |
69 | |||
11060 | jghali | 70 | virtual int CreatePS(ScribusDoc* Doc, PrintOptions &options); |
71 | virtual const QString& errorMessage(void); |
||
72 | |||
73 | virtual void PS_Error(const QString& message); |
||
11551 | jghali | 74 | virtual void PS_Error_ImageDataWriteFailure(void); |
11060 | jghali | 75 | virtual void PS_Error_ImageLoadFailure(const QString& fileName); |
11389 | jghali | 76 | virtual void PS_Error_MaskLoadFailure(const QString& fileName); |
11060 | jghali | 77 | virtual void PS_Error_InsufficientMemory(void); |
78 | |||
4037 | cbradney | 79 | virtual bool PS_set_file(QString fn); |
80 | virtual void PS_set_Info(QString art, QString was); |
||
17401 | jghali | 81 | virtual bool PS_begin_doc(ScribusDoc *doc, double x, double y, double width, double height, int numpage, bool doDev, bool sep, bool farb, bool ic, bool gcr); |
16729 | fschmid | 82 | virtual void PS_begin_page(ScPage* pg, MarginStruct* Ma, bool Clipping); |
4037 | cbradney | 83 | virtual void PS_end_page(); |
84 | virtual void PS_curve(double x1, double y1, double x2, double y2, double x3, double y3); |
||
85 | virtual void PS_moveto(double x, double y); |
||
86 | virtual void PS_lineto(double x, double y); |
||
87 | virtual void PS_closepath(); |
||
88 | virtual void PS_translate(double x, double y); |
||
89 | virtual void PS_scale(double x, double y); |
||
90 | virtual void PS_rotate(double x); |
||
91 | virtual void PS_clip(bool mu); |
||
92 | virtual void PS_save(); |
||
93 | virtual void PS_restore(); |
||
94 | virtual void PS_setcmykcolor_fill(double c, double m, double y, double k); |
||
95 | virtual void PS_setcmykcolor_dummy(); |
||
96 | virtual void PS_setcmykcolor_stroke(double c, double m, double y, double k); |
||
97 | virtual void PS_setlinewidth(double w); |
||
98 | virtual void PS_setcapjoin(Qt::PenCapStyle ca, Qt::PenJoinStyle jo); |
||
12055 | jghali | 99 | virtual void PS_setdash(Qt::PenStyle st, double offset, QVector<double> dash); |
4037 | cbradney | 100 | virtual void PS_selectfont(QString f, double s); |
101 | virtual void PS_fill(); |
||
9920 | fschmid | 102 | virtual void PS_fillspot(QString color, double shade); |
4037 | cbradney | 103 | virtual void PS_stroke(); |
9920 | fschmid | 104 | virtual void PS_strokespot(QString color, double shade); |
4037 | cbradney | 105 | virtual void PS_fill_stroke(); |
106 | virtual void PS_newpath(); |
||
107 | virtual void PS_show(double x, double y); |
||
108 | virtual void PS_showSub(uint chr, QString font, double size, bool stroke); |
||
14324 | jghali | 109 | virtual void PS_show_xyG(QString font, uint gl, double x, double y, QString colorName, double shade); |
11060 | jghali | 110 | virtual bool PS_image(PageItem *c, double x, double y, QString fn, double scalex, double scaley, QString Prof, bool UseEmbedded, bool UseProf, QString Name = ""); |
111 | virtual bool PS_ImageData(PageItem *c, QString fn, QString Name, QString Prof, bool UseEmbedded, bool UseProf); |
||
4037 | cbradney | 112 | virtual void PS_plate(int nr, QString name = ""); |
113 | virtual void PS_setGray(); |
||
114 | virtual void PDF_Bookmark(QString text, uint Seite); |
||
12589 | fschmid | 115 | virtual void PDF_Annotation(PageItem *item, QString text, double x, double y, double b, double h); |
4037 | cbradney | 116 | virtual void PS_close(); |
117 | virtual void PS_insert(QString i); |
||
118 | virtual void PS_TemplateStart(QString Name); |
||
119 | virtual void PS_TemplateEnd(); |
||
120 | virtual void PS_UseTemplate(QString Name); |
||
16729 | fschmid | 121 | virtual bool ProcessItem(ScribusDoc* Doc, ScPage* a, PageItem* c, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master, bool embedded = false, bool useTemplate = false); |
122 | virtual void ProcessPage(ScribusDoc* Doc, ScPage* a, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true); |
||
123 | virtual bool ProcessMasterPageLayer(ScribusDoc* Doc, ScPage* a, ScLayer& ll, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true); |
||
124 | virtual bool ProcessPageLayer(ScribusDoc* Doc, ScPage* a, ScLayer& ll, uint PNr, bool sep = false, bool farb = true, bool ic = false, bool gcr = true); |
||
13951 | fschmid | 125 | virtual void drawArrow(PageItem *ite, QTransform &arrowTrans, int arrowIndex, bool gcr); |
9920 | fschmid | 126 | virtual void putColor(const QString& color, double shade, bool fill); |
14324 | jghali | 127 | virtual void putColorNoDraw(const QString& color, double shade, bool gcr); |
16729 | fschmid | 128 | virtual void GetBleeds(ScPage* page, double& left, double& right); |
129 | virtual void GetBleeds(ScPage* page, double& left, double& right, double& bottom, double& top); |
||
4037 | cbradney | 130 | virtual void SetClipPath(FPointArray *c, bool poly = true); |
16729 | fschmid | 131 | virtual void HandleBrushPattern(PageItem *c, QPainterPath &path, ScPage* a, uint PNr, bool sep, bool farb, bool ic, bool gcr, bool master); |
14168 | fschmid | 132 | virtual void HandleStrokePattern(PageItem *c); |
15024 | fschmid | 133 | virtual void HandleMeshGradient(PageItem* c, bool gcr); |
16729 | fschmid | 134 | virtual void HandlePatchMeshGradient(PageItem* c, bool gcr); |
14981 | fschmid | 135 | virtual void HandleDiamondGradient(PageItem* c, bool gcr); |
136 | virtual void HandleTensorGradient(PageItem* c, bool gcr); |
||
14230 | fschmid | 137 | virtual void HandleGradientFillStroke(PageItem *c, bool gcr, bool stroke = true, bool forArrow = false); |
11333 | jghali | 138 | virtual void SetColor(const QString& color, double shade, int *h, int *s, int *v, int *k, bool gcr); |
139 | virtual void SetColor(const ScColor& color, double shade, int *h, int *s, int *v, int *k, bool gcr); |
||
16729 | fschmid | 140 | virtual void setTextSt(ScribusDoc* Doc, PageItem* ite, bool gcr, uint a, ScPage* pg, bool sep, bool farb, bool ic, bool master); |
141 | virtual void setTextCh(ScribusDoc* Doc, PageItem* ite, double x, double y, bool gcr, uint a, uint d, ScText *hl, const ParagraphStyle& pstyle, ScPage* pg, bool sep, bool farb, bool ic, bool master); |
||
15548 | fschmid | 142 | bool psExport; |
11562 | jghali | 143 | |
4037 | cbradney | 144 | private: |
11568 | jghali | 145 | |
11280 | jghali | 146 | void PutStream (const QString& c); |
147 | void PutStream (const QByteArray& array, bool hexEnc); |
||
148 | void PutStream (const char* in, int length, bool hexEnc); |
||
11551 | jghali | 149 | |
11568 | jghali | 150 | bool PutImageToStream(ScImage& image, int plate); |
151 | bool PutImageToStream(ScImage& image, const QByteArray& mask, int plate); |
||
152 | |||
11551 | jghali | 153 | bool PutImageDataToStream(const QByteArray& image); |
154 | bool PutInterleavedImageMaskToStream(const QByteArray& image, const QByteArray& mask, bool gray); |
||
155 | |||
11107 | jghali | 156 | void WriteASCII85Bytes(const QByteArray& array); |
157 | void WriteASCII85Bytes(const unsigned char* array, int length); |
||
11562 | jghali | 158 | |
17310 | fschmid | 159 | void paintBorder(const TableBorder& border, const QPointF& start, const QPointF& end, const QPointF& startOffsetFactors, const QPointF& endOffsetFactors, bool gcr); |
160 | |||
11562 | jghali | 161 | Optimization optimization; |
162 | |||
4037 | cbradney | 163 | QString ToStr(double c); |
164 | QString IToStr(int c); |
||
11750 | jghali | 165 | QString MatrixToStr(double m11, double m12, double m21, double m22, double x, double y); |
4037 | cbradney | 166 | QString PSEncode(QString in); |
11060 | jghali | 167 | QString ErrorMessage; |
4037 | cbradney | 168 | QString Prolog; |
169 | QString Header; |
||
170 | QString Creator; |
||
171 | QString User; |
||
172 | QString Titel; |
||
173 | QString BBox; |
||
174 | QString BBoxH; |
||
175 | QString Farben; |
||
176 | QString FNamen; |
||
177 | QString PDev; |
||
178 | QString GrayCalc; |
||
179 | bool GraySc; |
||
180 | int Seiten; |
||
181 | QString FillColor; |
||
182 | QString StrokeColor; |
||
183 | double LineW; |
||
184 | QString Fonts; |
||
185 | QString FontDesc; |
||
186 | QMap<QString, QString> UsedFonts; |
||
13769 | jghali | 187 | QMap<QString, QString> FontSubsetMap; |
188 | typedef QMap<uint, std::pair<QChar, QString> > GlyphList; |
||
189 | QMap<QString, GlyphList> GlyphsOfFont; |
||
4037 | cbradney | 190 | bool isPDF; |
191 | QFile Spool; |
||
11534 | jghali | 192 | QDataStream spoolStream; |
11317 | jghali | 193 | int Plate; |
4037 | cbradney | 194 | bool DoSep; |
195 | bool useSpotColors; |
||
4477 | fschmid | 196 | bool fillRule; |
6671 | fschmid | 197 | bool applyICC; |
14170 | jghali | 198 | ScColorTransform solidTransform; |
4037 | cbradney | 199 | QString currentSpot; |
200 | ColorList colorsToUse; |
||
201 | QString colorDesc; |
||
6388 | fschmid | 202 | ScribusDoc *m_Doc; |
4037 | cbradney | 203 | QMap<QString, QString> spotMap; |
204 | MultiProgressDialog* progressDialog; |
||
205 | bool usingGUI; |
||
206 | bool abortExport; |
||
6954 | fschmid | 207 | PrintOptions Options; |
16729 | fschmid | 208 | ScPage* ActPage; |
4037 | cbradney | 209 | |
210 | protected slots: |
||
211 | void cancelRequested(); |
||
3136 | fschmid | 212 | }; |
213 | |||
214 | #endif |