Scribus
Open source desktop publishing at your fingertips
importxps.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 /***************************************************************************
8  -------------------
9  begin : Sat Oct 26 2013
10  copyright : (C) 2013 by Franz Schmid
11  email : Franz.Schmid@altmuehlnet.de
12  ***************************************************************************/
13 #ifndef IMPORTXPS_H
14 #define IMPORTXPS_H
15 
16 #include "pluginapi.h"
17 #include "pageitem.h"
18 #include "sccolor.h"
19 #include "fpointarray.h"
20 #include <QList>
21 #include <QTransform>
22 #include <QMultiMap>
23 #include <QtGlobal>
24 #include <QObject>
25 #include <QString>
26 #include <QDomDocument>
27 #include <QDomElement>
28 
29 class MultiProgressDialog;
30 class ScribusDoc;
31 class Selection;
33 class ScZipHandler;
34 
36 class XpsPlug : public QObject
37 {
38  Q_OBJECT
39 
40 public:
50  XpsPlug( ScribusDoc* doc, int flags );
51  ~XpsPlug();
52 
63  bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
64  QImage readThumbnail(QString fn);
65 
66 private:
67  struct ObjState
68  {
69  QPainterPath currentPath;
70  bool currentPathClosed;
71  QPainterPath clipPath;
72  QTransform transform;
73  QString CurrColorFill;
74  double fillOpacity;
75  QString CurrColorStroke;
76  double strokeOpacity;
77  double LineW;
78  VGradient currentGradient;
79  QPointF gradientStart;
80  QPointF gradientEnd;
81  QPointF gradientFocus;
82  double gradientScale;
83  int fillGradientTyp;
84  QString imagePath;
85  QString patternName;
86  VGradient gradientMask;
87  QPointF maskStart;
88  QPointF maskEnd;
89  QPointF maskFocus;
90  double maskScale;
91  int maskTyp;
92  QString patternMask;
93  VGradient gradientStroke;
94  QPointF strokeStart;
95  QPointF strokeEnd;
96  QPointF strokeFocus;
97  double strokeScale;
98  int strokeTyp;
99  QString patternStroke;
100  int itemType;
101  Qt::PenCapStyle CapStyle;
102  Qt::PenJoinStyle JoinStyle;
103  QVector<double> DashPattern;
104  double DashOffset;
105  };
106  bool convert(QString fn);
107  bool parseDocSequence(QString designMap);
108  bool parseDocReference(QString designMap);
109  void parsePageReference(QString designMap);
110  PageItem* parseObjectXML(QDomElement& dpg, QString path);
111  void parseOpacityXML(QDomElement &spe, QString path, ObjState &obState);
112  void parseStrokeXML(QDomElement &spe, QString path, ObjState &obState);
113  void parseFillXML(QDomElement &spe, QString path, ObjState &obState);
114  void parsePathDataXML(QDomElement &spe, ObjState &obState, bool forClip = false);
115  QString parsePathGeometryXML(QDomElement &spe);
116  void parseResourceFile(QString resFile);
117  void resolveLinks();
118  PageItem* addClip(PageItem* retObj, ObjState &obState);
119  PageItem* createItem(QDomElement &dpg, ObjState &obState);
120  void finishItem(PageItem* item, ObjState &obState);
121  QString handleColor(QString rgbColor, double &opacity);
122  int hex2int(char hex);
123  bool parseGUID( const QString &guidString, unsigned short guid[16]);
124  ScFace loadFontByName(const QString &fileName);
125  QList<PageItem*> Elements;
126  double baseX, baseY;
127  double docWidth;
128  double docHeight;
129 
130  FPointArray Coords;
131  bool interactive;
132  MultiProgressDialog * progressDialog;
133  bool cancel;
134  ScribusDoc* m_Doc;
135  Selection* tmpSel;
136  int importerFlags;
137  QString baseFile;
138  QString m_FileName;
139  QStringList importedColors;
140  QStringList importedPatterns;
141  bool firstPage;
142  int pagecount;
143  double topMargin;
144  double leftMargin;
145  double rightMargin;
146  double bottomMargin;
147  double conversionFactor;
148  QHash<QString, QPainterPath> pathResources;
149  QHash<QString, PageItem*> linkTargets;
150  QHash<PageItem*, QString> linkSources;
151  QHash<QString, ScFace> loadedFonts;
152  ScZipHandler *uz;
153  QStringList tempFontFiles;
154 
155 public slots:
156  void cancelRequested() { cancel = true; }
157 };
158 
159 #endif
Definition: vgradient.h:78
the Document Class
Definition: scribusdoc.h:90
XpsPlug(ScribusDoc *doc, int flags)
Create the Xps importer window.
Definition: importxps.cpp:70
Base Class ScFace : This is a total rewrite of the old Foi class.
Definition: scface.h:73
Definition: undomanager.h:52
Definition: pageitem.h:92
Xps importer plugin.
Definition: importxps.h:36
Definition: scribus_zip.h:28
Definition: fpointarray.h:42
Definition: selection.h:34