Scribus
Open source desktop publishing at your fingertips
importidmlimpl.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 IMPORTIDMLIMPL_H
8 #define IMPORTIDMLIMPL_H
9 
10 #include "pageitem.h"
11 #include "sccolor.h"
12 #include "fpointarray.h"
13 #include "docpreference.h"
14 
15 #include <QObject>
16 #include <QList>
17 #include <QTransform>
18 #include <QMultiMap>
19 #include <QtGlobal>
20 #include <QObject>
21 #include <QString>
22 #include <QRect>
23 #include <QStack>
24 #include <QDomNode>
25 #include <QDomElement>
26 #include <QPointF>
27 
28 class QString;
29 class ScribusDoc;
30 class MultiProgressDialog;
31 class Selection;
33 class ScLayer;
34 
35 enum Capitalization
36 {
37  AllCaps,
38  SmallCaps,
39  Normal
40 };
41 enum Justification
42 {
43  LeftAlign,
44  CenterAlign,
45  RightAlign,
46  FullyJustified
47 };
48 enum Position
49 {
50  NormalP,
51  SuperScript,
52  SubScript
53 };
55 {
56 // CommonTextProperties represented as Attributes
57  QString AppliedCStyle;
58  QString AppliedLanguage;
59  QString AppliedPStyle;
60  double AutoLeading;
61  double BaselineShift;
62  Capitalization Capital;
63  double DesiredGlyphScale;
64  double DesiredWordSpace;
65  double DropCapChars; //Not supported in Scribus
66  double DropCapLines;
67  QString FillColor;
68  QString FillTint;
69  double FirstLineIndent;
70  QString FontStyle;
71  double GradFillAngle;
72  double GradFillLength;
73  double GradStrokeAngle;
74  double GradStrokeLength;
75  double HorizontalScale;
76  Justification justify;
77  double KerningValue;
78  double LeftIndent;
79  double MaxGlyphScaling;
80  double MaxWordSpacing;
81  double MinGlyphScaling;
82  double MinWordSpacing;
83  double PointSize;
84  Position position;
85  double RightIndent;
86  double SpaceAfter;
87  double SpaceBefore;
88  double StrikeThruWeight;
89  double StrikeThruOffset;
90  bool StrikeThru;
91  QString StrokeColor;
92  double StrokeTint;
93  double Tracking;
94  bool Underline;
95  double UnderlineOffset;
96  double UnderlineWeight;
97 //CommonTextProperties represented as elements
98  QString AppliedFont;
99  /* Handle Tablists later */
100 };
101 
103 {
104  CommonTextProps properties;
105  QString Content;
106 };
107 
114 {
115  CommonTextProps properties;
116  QList<CStyleRange> cstyleRange;
117 };
118 
119 class Story
120 {
121  public:
122  QList<PStyleRange> pstyleRange;
123  CommonTextProps properties;
124 };
125 
126 struct PathPoint
127 {
128  QPointF Anchor;
129  QPointF Left;
130  QPoint Right;
131 };
132 
133 class ImportIdmlImpl : public QObject
134 {
135  Q_OBJECT
136  public:
137  ImportIdmlImpl();
138  ~ImportIdmlImpl() {};
139  bool run(const QString & target, ScribusDoc* doc=0);
140 
141  QString desmapPath, fontPath, stylePath, graphicPath, preferPath, mspreadPath;
142  private:
143  bool processDesignMap();
144  bool processFont();
145  bool processStyles();
146  bool importPStyles(QDomNode&);
147  bool importCStyles(QDomNode&) { return false; };
148  bool processSpreads();
149  bool processStory();
150  bool readStoryObjects(QDomNode);
151  void readComTextProps(QDomNode, CommonTextProps&);
152  void readSpread(QDomNode);
153  void readMSpread(QDomNode);
154  void docAttributes(QDomElement&);
155  void handleLanguage(QDomElement&);
156  void handleLayer(ScLayer&,QDomElement&);
157  void handleSection(ScribusDoc*, QDomElement&);
158  void handleCRFormat(QDomElement&);
159  void handleBookmarks(QDomElement&);
160 
162  void handleGroup(QDomNode);
163  void readGradiant(QDomNode);
164  void addTextFrame(ScribusDoc*,QDomNode);
165  void addPage(ScribusDoc*, QDomNode);
166  void addMasterPage(ScribusDoc*,QDomNode);
167  void addRectangle(ScribusDoc*,QDomNode) {};
168  void addOval(ScribusDoc*,QDomNode);
169  void addPolygon(ScribusDoc*,QDomNode) {};
170  void addGraphicLine(ScribusDoc*,QDomNode) {};
171  double findWidth(double,double,double,double);
172  double findHeight(double,double,double,double);
173  QTransform applyTransform(QString) { return QTransform(); }
174  PathPoint readPathPoint(QDomElement);
175 
176  void getMSpreadSrc(QDomElement&);
177  void getSpreadSrc(QDomElement&);
178  void getStorySrc(QDomElement&);
179  void getBStorySrc(QDomElement&);
180  void readParagraphStyle(ScribusDoc *doc, QDomNode node, ParagraphStyle& newStyle, SCFonts &fonts);
181  void readCharacterStyle(ScribusDoc *doc, QDomNode node, CharStyle& newStyle);
182  void fixLegacyParStyle(ParagraphStyle& pstyle);
183  void fixLegacyCStyle(CharStyle& cstyle) {};
184  CStyleRange readCStyleRange(QDomNode node);
185 
186  QDomElement loadXmlFile(QString &filename);
187  QDomDocument doc;
188  QDomNode node;
189  QDomElement root;
190  QDomElement element;
191  QMap<QString,int> layerMap;
192  QMap<QString,Story> storyMap;
193  QList<QString> storyList;
194  QList<QString> storyPath;
195  QList<QString> Spreads;
196  QList<QString> spreadPath;
197  QList<QString> MasterSpreads;
198  QList<QString> MSpreadPath;
199  QList<PageItem*> Elements;
200  int layerID;
201  int pageNumber;
202  int currentLayer;
203  int importerFlags;
204  int currentPageNr;
205  bool interactive;
206  bool cancel;
207  bool firstLayer;
208  double baseX, baseY;
209  double docWidth;
210  double docHeight;
211  QString baseFile;
212  QString activeLayer;
213  DocPreferences preference;
214  FPointArray coords;
215  MultiProgressDialog *progressDialog;
216  ScribusDoc* m_Doc;
217  SCFonts* m_AvailableFonts;
218  Selection *tmpSel;
219  ParagraphStyle vg;
220  CharStyle cs;
221  PageItem *currItem;
222 };
223 
224 #endif
Definition: charstyle.h:78
Definition: importidmlimpl.h:126
Definition: importidmlimpl.h:102
Definition: importidmlimpl.h:133
Stuct PStyleRange will hold the values of all those attributes/elements which can occur in the Paragr...
Definition: importidmlimpl.h:113
bool run(const QString &target, ScribusDoc *doc=0)
Definition: importidmlimpl.cpp:64
Definition: paragraphstyle.h:27
Definition: importidmlimpl.h:54
the Document Class
Definition: scribusdoc.h:90
Definition: sclayer.h:17
Definition: undomanager.h:52
Definition: pageitem.h:92
Definition: fpointarray.h:42
Definition: importidmlimpl.h:119
A class to represent the necessary preferences from Resources/Preferences.xml in the idml package...
Definition: docpreference.h:100
Main class SCFonts. Subclass of QDict. This class replaces the previous SCFonts typedef...
Definition: scfonts.h:36
Definition: selection.h:34