Scribus
Open source desktop publishing at your fingertips
importdrw.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  importdrw.h - description
9  -------------------
10  begin : Mon Jan 11 2010
11  copyright : (C) 2010 by Franz Schmid
12  email : Franz.Schmid@altmuehlnet.de
13  ***************************************************************************/
14 
15 #ifndef IMPORTDRW_H
16 #define IMPORTDRW_H
17 
18 #include "pluginapi.h"
19 #include "pageitem.h"
20 #include "sccolor.h"
21 #include "fpointarray.h"
22 #include <QList>
23 #include <QTransform>
24 #include <QMultiMap>
25 #include <QtGlobal>
26 #include <QObject>
27 #include <QString>
28 
29 class MultiProgressDialog;
30 class ScribusDoc;
31 class Selection;
33 
35 class DrwPlug : public QObject
36 {
37  Q_OBJECT
38 
39 public:
49  DrwPlug( ScribusDoc* doc, int flags );
50  ~DrwPlug();
51 
62  bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
63  QImage readThumbnail(QString fn);
64 
65 private:
66  bool convert(QString fn);
67  void decodeCmdData(QDataStream &ts, uint dataLen, quint8 cmd);
68  void decodeCmd(quint8 cmd, int pos);
69  void decodeSymbol(QDataStream &ds, bool last = false);
70  void handleLineStyle(PageItem* currentItem, quint8 flags, QString lineColor);
71  void handleGradient(PageItem* currentItem, quint8 patternIndex, QString fillColor, QString backColor, QRectF bBox);
72  void handlePreviewBitmap(QDataStream &ds);
73  QString handleColor(ScColor &color, QString proposedName);
74  void getCommonData(QDataStream &ds);
75  QString getColor(QDataStream &ds);
76  void finishItem(PageItem* ite, bool scale = true);
77  double getValue(QDataStream &ds);
78  double getRawValue(QDataStream &ds);
79  QPointF getCoordinate(QDataStream &ds);
80 
81  QList<PageItem*> Elements;
82  struct DRWGroup
83  {
84  double xoffset;
85  double yoffset;
86  double width;
87  double height;
88  double lineWidth;
89  double scaleX;
90  double scaleY;
91  double rotationAngle;
92  int nrOfItems;
93  int counter;
94  bool filled;
95  quint8 patternIndex;
96  quint8 flags;
97  QString fillColor;
98  QString lineColor;
99  QString backColor;
100  QPointF posPivot;
101  QList<PageItem*> GElements;
102  };
103  QStack<DRWGroup> groupStack;
104  struct DRWObjectList
105  {
106  double groupX;
107  double groupY;
108  double width;
109  double height;
110  double scaleX;
111  double scaleY;
112  double rotationAngle;
113  QPointF posPivot;
114  quint16 nrOfItems;
115  quint16 counter;
116  QString itemGroupName;
117  PageItem* groupItem;
118  QList<PageItem*> GElements;
119  };
120  QStack<DRWObjectList> listStack;
121  struct DRWGradient
122  {
123  int type;
124  double xOffset;
125  double yOffset;
126  double angle;
127  };
128  QMap<int, DRWGradient> gradientMap;
129  QMap<int, QByteArray> patternDataMap;
130  QMap<QString, QString> patternMap;
131  double baseX, baseY;
132  double docWidth;
133  double docHeight;
134  QStringList importedColors;
135  QStringList importedPatterns;
136  QString lineColor;
137  QString fillColor;
138  QString backColor;
139  double lineWidth;
140  int createObjCode;
141  int nrOfPoints;
142  PageItem *currentItem;
143  quint8 flags;
144  quint8 patternIndex;
145  QRectF bBox;
146 
147  QImage tmpImage;
148  QImage tmpImage2;
149  quint16 bitsPerPixel;
150  quint16 bytesScanline;
151  quint16 planes;
152  quint16 imageHeight;
153  quint16 imageWidth;
154  quint16 scanLinesRead;
155  quint8 rTrans;
156  quint8 gTrans;
157  quint8 bTrans;
158  bool imageValid;
159 
160  quint8 fontID;
161  quint8 fontStyle;
162  quint16 nrOfChars;
163  quint16 fontSize;
164  quint16 fontWidth;
165  quint16 nrOfParagraphs;
166  quint16 paragraphCounter;
167  QString fontName;
168  QString fontColor;
169  struct DRWParagraph
170  {
171  quint8 paragraphAlignment;
172  quint16 paragraphLen;
173  };
174  QList<DRWParagraph> paragraphList;
175  QMap<quint8, QString> fontMap;
176 
177  int symbolCount;
178  int recordCount;
179 
180  FPointArray Coords;
181  QByteArray cmdData;
182  double scaleFactor;
183  double scaleX;
184  double scaleY;
185  double rotationAngle;
186  QPointF posPivot;
187  bool interactive;
188  MultiProgressDialog * progressDialog;
189  bool cancel;
190  ScribusDoc* m_Doc;
191  Selection* tmpSel;
192  int importerFlags;
193  QString baseFile;
194  QImage thumbnailImage;
195  bool thumbRead;
196 
197 public slots:
198  void cancelRequested() { cancel = true; }
199 };
200 
201 #endif
DrwPlug(ScribusDoc *doc, int flags)
Create the Cvg importer window.
Definition: importdrw.cpp:62
Definition: sccolor.h:51
the Document Class
Definition: scribusdoc.h:90
Definition: undomanager.h:52
Definition: pageitem.h:92
Definition: fpointarray.h:42
Drw importer plugin.
Definition: importdrw.h:35
Definition: selection.h:34