Scribus
Open source desktop publishing at your fingertips
importwpg.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 IMPORTWPG_H
8 #define IMPORTWPG_H
9 
10 #include "qglobal.h"
11 #include "qobject.h"
12 #include "qstring.h"
13 
14 #include "pluginapi.h"
15 #include "pageitem.h"
16 #include "sccolor.h"
17 #include "fpointarray.h"
18 #include "vgradient.h"
19 #include <QList>
20 #include <QTransform>
21 #include <QMultiMap>
22 #include <QVector>
23 #include "third_party/wpg/libwpg.h"
24 
25 class MultiProgressDialog;
26 class ScribusDoc;
27 class Selection;
29 
31 {
32 public:
33  ScrPainter();
34 
35  void startGraphics(double imageWidth, double imageHeight);
36  void endGraphics();
37  void startLayer(unsigned int id);
38  void endLayer(unsigned int id);
39  void setPen(const libwpg::WPGPen& pen);
40  void setBrush(const libwpg::WPGBrush& brush);
41  void setFillRule(FillRule rule);
42  void drawRectangle(const libwpg::WPGRect& rect, double rx, double ry);
43  void drawEllipse(const libwpg::WPGPoint& center, double rx, double ry);
44  void drawPolygon(const libwpg::WPGPointArray& vertices, bool closed);
45  void drawPath(const libwpg::WPGPath& path);
46  void drawBitmap(const libwpg::WPGBitmap& bitmap, double hres, double vres);
47  void drawImageObject(const libwpg::WPGBinaryData& binaryData);
48 
49  void finishItem(PageItem* ite);
50  QList<PageItem*> Elements;
51  QStringList importedColors;
52  ScribusDoc* m_Doc;
53  double LineW;
54  QString CurrColorFill;
55  QString CurrColorStroke;
56  double CurrStrokeShade;
57  double CurrFillShade;
58  double CurrStrokeTrans;
59  double CurrFillTrans;
60  FPointArray Coords;
61  double baseX, baseY;
62  bool fillrule;
63  double gradientAngle;
64  bool isGradient;
65  bool fillSet;
66  bool strokeSet;
67  VGradient currentGradient;
68  QVector<double> dashArray;
69  Qt::PenJoinStyle lineJoin;
70  Qt::PenCapStyle lineEnd;
71  int flags;
72  bool firstLayer;
73 };
74 
76 class WpgPlug : public QObject
77 {
78  Q_OBJECT
79 
80 public:
90  WpgPlug( ScribusDoc* doc, int flags );
91  ~WpgPlug();
92 
103  bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
104  QImage readThumbnail(QString fn);
105 
106 private:
107  bool convert(QString fn);
108 
109  QList<PageItem*> Elements;
110  double baseX, baseY;
111  double docWidth;
112  double docHeight;
113 
114  QStringList importedColors;
115 
116  bool interactive;
117  MultiProgressDialog * progressDialog;
118  bool cancel;
119  ScribusDoc* m_Doc;
120  Selection* tmpSel;
121  int importerFlags;
122 
123 public slots:
124  void cancelRequested() { cancel = true; }
125 };
126 
127 #endif
Definition: importwpg.h:30
Definition: WPGBitmap.h:37
Definition: WPGPoint.h:34
Definition: WPGPath.h:55
Definition: WPGBinaryData.h:39
Definition: WPGPaintInterface.h:41
Definition: vgradient.h:78
WPG importer plugin.
Definition: importwpg.h:76
the Document Class
Definition: scribusdoc.h:90
Definition: WPGBrush.h:35
Definition: undomanager.h:52
Definition: WPGPen.h:51
Definition: WPGPoint.h:51
Definition: WPGRect.h:34
WpgPlug(ScribusDoc *doc, int flags)
Create the Wpg importer window.
Definition: importwpg.cpp:425
Definition: pageitem.h:92
Definition: fpointarray.h:42
Definition: selection.h:34