1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef IMPORTXFIG_H
#define IMPORTXFIG_H
#include "qglobal.h"
#include "qobject.h"
#include "qstring.h"
#include "pluginapi.h"
#include "pageitem.h"
#include "sccolor.h"
#include "fpointarray.h"
#include <QList>
#include <QMatrix>
#include <QMultiMap>
class MultiProgressDialog;
class ScribusDoc;
class Selection;
class TransactionSettings;
//! \brief Xfig importer plugin
class XfigPlug : public QObject
{
Q_OBJECT
public:
/*!
\author Franz Schmid
\date
\brief Create the AI importer window.
\param fName QString
\param flags combination of loadFlags
\param showProgress if progress must be displayed
\retval EPSPlug plugin
*/
XfigPlug( ScribusDoc* doc, int flags );
~XfigPlug();
/*!
\author Franz Schmid
\date
\brief Perform import.
\param fn QString
\param trSettings undo transaction settings
\param flags combination of loadFlags
\param showProgress if progress must be displayed
\retval bool true if import was ok
*/
bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
private:
/*!
\author Franz Schmid
\date
\brief Does the conversion.
\param fn QString
\param x X position
\param y Y position
\param b double
\param h double
\retval bool true if conversion was ok
*/
bool parseHeader(QString fName, double &x, double &y, double &b, double &h);
void parseColor(QString data);
void useColor(int colorNum, int area_fill, bool forFill);
QVector<double> getDashValues(double linewidth, int code);
void processArrows(int forward_arrow, QString fArrowData, int backward_arrow, QString bArrowData, int depth, PageItem *ite);
void processPolyline(QDataStream &ts, QString data);
void processSpline(QDataStream &ts, QString data);
void processArc(QDataStream &ts, QString data);
void processEllipse(QString data);
QString cleanText(QString text);
void processText(QString data);
void processData(QDataStream &ts, QString data);
double fig2Pts(double in);
void resortItems();
bool convert(QString fn);
QList<PageItem*> Elements;
QList<PageItem*> PatternElements;
QMultiMap<int, int> depthMap;
int currentItemNr;
QStack<QList<PageItem*> > groupStack;
ColorList CustColors;
double baseX, baseY;
double docX;
double docY;
double docWidth;
double docHeight;
double LineW;
QString CurrColorFill;
QString CurrColorStroke;
double CurrStrokeShade;
double CurrFillShade;
FPointArray Coords;
FPointArray clipCoords;
bool interactive;
MultiProgressDialog * progressDialog;
bool cancel;
ScribusDoc* m_Doc;
Selection* tmpSel;
QMap<int, QString> importedColors;
int importerFlags;
bool patternMode;
QString currentPatternDefName;
QString currentPatternName;
double patternX1;
double patternY1;
double patternX2;
double patternY2;
double currentPatternX;
double currentPatternY;
double currentPatternXScale;
double currentPatternYScale;
double currentPatternRotation;
QString docCreator;
QString docDate;
QString docTime;
QString docOrganisation;
QString docTitle;
int oldDocItemCount;
QString baseFile;
public slots:
void cancelRequested() { cancel = true; }
};
#endif
|