Scribus
Open source desktop publishing at your fingertips
importai.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 IMPORTAI_H
8 #define IMPORTAI_H
9 
10 #include <QList>
11 #include <QTransform>
12 #include <QObject>
13 #include <QString>
14 
15 #include "pluginapi.h"
16 
17 #include "fpointarray.h"
18 #include "mesh.h"
19 #include "sccolor.h"
20 #include "text/storytext.h"
21 #include "vgradient.h"
22 
23 class MultiProgressDialog;
24 class PageItem;
25 class ScribusDoc;
26 class Selection;
28 
30 class AIPlug : public QObject
31 {
32  Q_OBJECT
33 
34 public:
42  AIPlug( ScribusDoc* doc, int flags );
43  ~AIPlug();
44 
55  bool import(QString fNameIn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
56  QImage readThumbnail(QString fn);
57  bool readColors(const QString& fileName, ColorList & colors);
58 
59 private:
60 
69  bool extractFromPDF(QString infile, QString outfile);
70 
71  bool decompressAIData(QString &fName);
72  bool parseHeader(QString fName, double &x, double &y, double &b, double &h);
73  QString removeAIPrefix(QString comment);
74  QString parseColor(QString data);
75  QString parseColorGray(QString data);
76  QString parseColorRGB(QString data);
77  QString parseCustomColor(QString data, double &shade);
78  QString parseCustomColorX(QString data, double &shade, QString type);
79  QStringList getStrings(QString data);
80  void getCommands(QString data, QStringList &commands);
81  void decodeA85(QByteArray &psdata, QString tmp);
82  void processData(QString data);
83  void processGradientData(QString data);
84  void processSymbol(QDataStream &ts, bool sym);
85  void processPattern(QDataStream &ts);
86  void processRaster(QDataStream &ts);
87  void processComment(QDataStream &ts, QString comment);
88  bool convert(QString fn);
89 
90  QList<PageItem*> Elements;
91  QList<PageItem*> PatternElements;
92  QStack<QList<PageItem*> > groupStack;
93  QStack<FPointArray> clipStack;
94  ColorList CustColors;
95  QStringList importedColors;
96  QStringList importedGradients;
97  QStringList importedPatterns;
98  double baseX, baseY;
99  double docX;
100  double docY;
101  double docWidth;
102  double docHeight;
103 
104  double LineW;
105  Qt::PenCapStyle CapStyle;
106  Qt::PenJoinStyle JoinStyle;
107  double DashOffset;
108  QList<double> DashPattern;
109  double Opacity;
110  int blendMode;
111  QString CurrColorFill;
112  QString CurrColorStroke;
113  double CurrStrokeShade;
114  double CurrFillShade;
115  bool fillRule;
116  bool itemLocked;
117 
118  FPointArray Coords;
119  FPointArray clipCoords;
120  FPointArray currentSpecialPath;
121  FPoint currentPoint;
122  int currentLayer;
123  bool firstLayer;
124  bool FirstU, WasU, ClosedPath;
125  bool interactive;
126  MultiProgressDialog * progressDialog;
127  bool cancel;
128  ScribusDoc* m_Doc;
129  Selection* tmpSel;
130  int importerFlags;
131  QStringList commandList;
132  bool convertedPDF;
133  QMap<QString, VGradient> m_gradients;
134  VGradient currentGradient;
135  QString currentGradientName;
136  QTransform currentGradientMatrix;
137  QPointF currentGradientOrigin;
138  double currentGradientAngle;
139  double currentGradientLenght;
140  bool gradientMode;
141  bool wasBC;
142  bool itemRendered;
143  QTransform startMatrix;
144  QTransform endMatrix;
145  bool patternMode;
146  QString currentPatternDefName;
147  QString currentPatternName;
148  double patternX1;
149  double patternY1;
150  double patternX2;
151  double patternY2;
152  double currentPatternX;
153  double currentPatternY;
154  double currentPatternXScale;
155  double currentPatternYScale;
156  double currentPatternRotation;
157  QString currentStrokePatternName;
158  double currentStrokePatternX;
159  double currentStrokePatternY;
160  double currentStrokePatternXScale;
161  double currentStrokePatternYScale;
162  double currentStrokePatternRotation;
163  bool meshMode;
164  int meshXSize, meshYSize;
165  int currentMeshXPos, currentMeshYPos;
166  int meshNodeCounter;
167  int meshColorMode;
168  double meshNode1PointX, meshNode1PointY;
169  double meshNode1Control1X, meshNode1Control1Y;
170  double meshNode1Control2X, meshNode1Control2Y;
171  double meshNode2PointX, meshNode2PointY;
172  double meshNode2Control1X, meshNode2Control1Y;
173  double meshNode2Control2X, meshNode2Control2Y;
174  double meshNode3PointX, meshNode3PointY;
175  double meshNode3Control1X, meshNode3Control1Y;
176  double meshNode3Control2X, meshNode3Control2Y;
177  double meshNode4PointX, meshNode4PointY;
178  double meshNode4Control1X, meshNode4Control1Y;
179  double meshNode4Control2X, meshNode4Control2Y;
180  QString meshColor1, meshColor2, meshColor3, meshColor4;
181  QList<QList<meshPoint> > meshGradientArray;
182  QString docCreator;
183  QString docDate;
184  QString docTime;
185  QString docOrganisation;
186  QString docTitle;
187  int textMode;
188  QTransform textMatrix;
189  StoryText textData;
190  QString textFont;
191  double textSize;
192  double maxWidth;
193  double tempW;
194  double maxHeight;
195  double textKern;
196  double textScaleH;
197  double textScaleV;
198  int startCurrentTextRange;
199  int endCurrentTextRange;
200  QString currentSymbolName;
201  QMap<QString, QPointF> importedSymbols;
202  bool symbolMode;
203  bool dataMode;
204  bool fObjectMode;
205  QString dataString;
206 
207 public slots:
208  void cancelRequested() { cancel = true; }
209 };
210 
211 #endif
AIPlug(ScribusDoc *doc, int flags)
Create the AI importer window.
Definition: importai.cpp:65
Definition: storytext.h:71
Definition: vgradient.h:78
Definition: sccolor.h:155
A point with floating point precision.
Definition: fpoint.h:43
the Document Class
Definition: scribusdoc.h:90
Definition: undomanager.h:52
Definition: pageitem.h:92
Definition: fpointarray.h:42
Adobe Illustrator importer plugin.
Definition: importai.h:30
Definition: selection.h:34