importai.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef IMPORTAI_H
00008 #define IMPORTAI_H
00009
00010 #include "qglobal.h"
00011 #include "qobject.h"
00012 #include "qstring.h"
00013
00014 #include "pluginapi.h"
00015 #include "pageitem.h"
00016 #include "sccolor.h"
00017 #include "fpointarray.h"
00018 #include "vgradient.h"
00019 #include <QList>
00020 #include <QMatrix>
00021
00022 class MultiProgressDialog;
00023 class ScribusDoc;
00024 class Selection;
00025
00027 class AIPlug : public QObject
00028 {
00029 Q_OBJECT
00030
00031 public:
00041 AIPlug( ScribusDoc* doc, int flags );
00042 ~AIPlug();
00043
00053 bool import(QString fn, int flags, bool showProgress = true);
00054
00055 private:
00056
00068 bool extractFromPDF(QString infile, QString outfile);
00069 bool decompressAIData(QString &fName);
00070 bool parseHeader(QString fName, double &x, double &y, double &b, double &h);
00071 QString removeAIPrefix(QString comment);
00072 QString parseColor(QString data);
00073 QString parseColorGray(QString data);
00074 QString parseColorRGB(QString data);
00075 QString parseCustomColor(QString data, double &shade);
00076 QString parseCustomColorX(QString data, double &shade, QString type);
00077 QStringList getStrings(QString data);
00078 void getCommands(QString data, QStringList &commands);
00079 void processData(QString data);
00080 void processGradientData(QString data);
00081 void processPattern(QDataStream &ts);
00082 void processRaster(QDataStream &ts);
00083 void processComment(QDataStream &ts, QString comment);
00084 bool convert(QString fn);
00085
00086 QList<PageItem*> Elements;
00087 QList<PageItem*> PatternElements;
00088 QStack<QList<PageItem*> > groupStack;
00089 ColorList CustColors;
00090 double baseX, baseY;
00091 double docX;
00092 double docY;
00093 double docWidth;
00094 double docHeight;
00095
00096 double LineW;
00097 Qt::PenCapStyle CapStyle;
00098 Qt::PenJoinStyle JoinStyle;
00099 double DashOffset;
00100 QList<double> DashPattern;
00101 double Opacity;
00102 int blendMode;
00103 QString CurrColorFill;
00104 QString CurrColorStroke;
00105 double CurrStrokeShade;
00106 double CurrFillShade;
00107 bool fillRule;
00108 bool itemLocked;
00109
00110 FPointArray Coords;
00111 FPointArray clipCoords;
00112 FPoint currentPoint;
00113 int currentLayer;
00114 bool firstLayer;
00115 bool FirstU, WasU, ClosedPath;
00116 bool interactive;
00117 MultiProgressDialog * progressDialog;
00118 bool cancel;
00119 ScribusDoc* m_Doc;
00120 Selection* tmpSel;
00121 QStringList importedColors;
00122 int importerFlags;
00123 QStringList commandList;
00124 bool convertedPDF;
00125 QMap<QString, VGradient> m_gradients;
00126 VGradient currentGradient;
00127 QString currentGradientName;
00128 QMatrix currentGradientMatrix;
00129 QPointF currentGradientOrigin;
00130 double currentGradientAngle;
00131 double currentGradientLenght;
00132 bool gradientMode;
00133 bool wasBC;
00134 bool itemRendered;
00135 QMatrix startMatrix;
00136 QMatrix endMatrix;
00137 bool patternMode;
00138 QString currentPatternDefName;
00139 QString currentPatternName;
00140 double patternX1;
00141 double patternY1;
00142 double patternX2;
00143 double patternY2;
00144 double currentPatternX;
00145 double currentPatternY;
00146 double currentPatternXScale;
00147 double currentPatternYScale;
00148 double currentPatternRotation;
00149 QString docCreator;
00150 QString docDate;
00151 QString docTime;
00152 QString docOrganisation;
00153 QString docTitle;
00154 int textMode;
00155 QMatrix textMatrix;
00156 StoryText textData;
00157 QString textFont;
00158 double textSize;
00159 double maxWidth;
00160 double tempW;
00161 double maxHeight;
00162 double textKern;
00163 double textScaleH;
00164 double textScaleV;
00165 int startCurrentTextRange;
00166 int endCurrentTextRange;
00167 int imgNum;
00168 QString baseFile;
00169
00170 public slots:
00171 void cancelRequested() { cancel = true; }
00172 };
00173
00174 #endif