Scribus
Open source desktop publishing at your fingertips
importidml.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 Jan 14 2012
10  copyright : (C) 2012 by Franz Schmid
11  email : Franz.Schmid@altmuehlnet.de
12  ***************************************************************************/
13 #ifndef IMPORTIDML_H
14 #define IMPORTIDML_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 #include "third_party/zip/scribus_zip.h"
30 
31 class MultiProgressDialog;
32 class ScribusDoc;
33 class Selection;
35 
37 class IdmlPlug : public QObject
38 {
39  Q_OBJECT
40 
41 public:
51  IdmlPlug( ScribusDoc* doc, int flags );
52  ~IdmlPlug();
53 
64  bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
65  QImage readThumbnail(QString fn);
66  bool readColors(const QString& fileName, ColorList & colors);
67 
68 private:
69  struct ObjectStyle
70  {
71  QString parentStyle;
72  QString fillColor;
73  QString fillGradient;
74  QString strokeColor;
75  QString strokeGradient;
76  int fillTint;
77  int strokeTint;
78  double lineWidth;
79  double Opacity;
80  int blendMode;
81  QPointF gradientFillStart;
82  double gradientFillLength;
83  double gradientFillAngle;
84  QPointF gradientStrokeStart;
85  double gradientStrokeLength;
86  double gradientStrokeAngle;
87  double Extra;
88  double TExtra;
89  double BExtra;
90  double RExtra;
91  double TextColumnCount;
92  double TextColumnGutter;
93  double TextColumnFixedWidth;
94  PageItem::TextFlowMode TextFlow;
95  QString LeftLineEnd;
96  QString RightLineEnd;
97  };
98  QString getNodeValue(QDomNode &baseNode, QString path);
99  bool convert(QString fn);
100  bool parseFontsXML(const QDomElement& grElem);
101  void parseFontsXMLNode(const QDomElement& grNode);
102  bool parseGraphicsXML(const QDomElement& grElem);
103  void parseGraphicsXMLNode(const QDomElement& grNode);
104  bool parseStylesXML(const QDomElement& sElem);
105  void parseStylesXMLNode(const QDomElement& sNode);
106  void parseObjectStyle(const QDomElement& styleElem);
107  void parseCharacterStyle(const QDomElement& styleElem);
108  void parseParagraphStyle(const QDomElement& styleElem);
109  bool parsePreferencesXML(const QDomElement& prElem);
110  void parsePreferencesXMLNode(const QDomElement& prNode);
111  bool parseSpreadXML(const QDomElement& spElem);
112  void parseSpreadXMLNode(const QDomElement& spNode);
113  QList<PageItem*> parseItemXML(const QDomElement& itElem, QTransform pTrans = QTransform());
114  bool parseStoryXML(const QDomElement& stElem);
115  void parseStoryXMLNode(const QDomElement& stNode);
116  void parseParagraphStyleRange(QDomElement &ste, PageItem* item);
117  void parseCharacterStyleRange(QDomElement &stt, PageItem* item, QString fontBase, QString fontStyle, ParagraphStyle &newStyle, int posC);
118  void readCharStyleAttributes(CharStyle &newStyle, const QDomElement &styleElem);
119  void readParagraphStyleAttributes(ParagraphStyle &newStyle, const QDomElement &styleElem);
120  void resolveObjectStyle(ObjectStyle &nstyle, QString baseStyleName);
121  int convertBlendMode(QString blendName);
122  QString constructFontName(QString fontBaseName, QString fontStyle);
123 
124  QList<PageItem*> Elements;
125  double baseX, baseY;
126  double docWidth;
127  double docHeight;
128 
129  FPointArray Coords;
130  bool interactive;
131  MultiProgressDialog * progressDialog;
132  bool cancel;
133  ScribusDoc* m_Doc;
134  Selection* tmpSel;
135  int importerFlags;
136  QString baseFile;
137  bool firstLayer;
138  bool firstPage;
139  int pagecount;
140  int mpagecount;
141  bool facingPages;
142  QDomDocument designMapDom;
143  QStringList importedColors;
144  QMap<QString, QString> colorTranslate;
145  QStringList importedGradients;
146  QMap<QString, QString> gradientTranslate;
147  QMap<QString, int> gradientTypeMap;
148  QMap<QString, QString> layerTranslate;
149  QMap<QString, PageItem*> storyMap;
150  QMap<QString, QString> styleTranslate;
151  QMap<QString, QStringList> styleParents;
152  QMap<QString, QString> charStyleTranslate;
153  QMap<QString, QMap<QString, QString> > fontTranslateMap;
154  QMap<QString, QStringList> masterSpreads;
155  QString def_fillColor;
156  QString def_fillGradient;
157  QString def_strokeColor;
158  QString def_strokeGradient;
159  QString def_LeftLineEnd;
160  QString def_RightLineEnd;
161  int def_Blendmode;
162  int def_fillBlendmode;
163  int def_strokeBlendmode;
164  int def_fillTint;
165  int def_strokeTint;
166  double def_lineWidth;
167  double def_Opacity;
168  double def_fillOpacity;
169  double def_strokeOpacity;
170  double def_gradientAngle;
171  double def_gradientLen;
172  double def_gradientX;
173  double def_gradientY;
174  double def_gradientStrokeStartX;
175  double def_gradientStrokeStartY;
176  double def_gradientStrokeLength;
177  double def_gradientStrokeAngle;
178  double def_Extra;
179  double def_TExtra;
180  double def_BExtra;
181  double def_RExtra;
182  double def_TextColumnCount;
183  double def_TextColumnGutter;
184  double def_TextColumnFixedWidth;
185  PageItem::TextFlowMode def_TextFlow;
186  QMap<PageItem*, QString> frameLinks;
187  QMap<QString, PageItem*> frameTargets;
188  QMap<QString, ObjectStyle> ObjectStyles;
189 
190  ScZipHandler *fun;
191 
192 public slots:
193  void cancelRequested() { cancel = true; }
194 };
195 
196 #endif
Definition: charstyle.h:78
Idml importer plugin.
Definition: importidml.h:37
TextFlowMode
Text flow mode.
Definition: pageitem.h:198
Definition: paragraphstyle.h:27
Definition: sccolor.h:155
the Document Class
Definition: scribusdoc.h:90
Definition: undomanager.h:52
Definition: pageitem.h:92
Definition: scribus_zip.h:28
Definition: fpointarray.h:42
IdmlPlug(ScribusDoc *doc, int flags)
Create the Idml importer window.
Definition: importidml.cpp:67
Definition: selection.h:34