Subversion Repositories Scribus

Rev

Rev 18731 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
18712 fschmid 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 IMPORTVSD_H
8
#define IMPORTVSD_H
9
 
10
#include <QObject>
11
#include <QString>
12
 
13
#include "pluginapi.h"
14
#include "pageitem.h"
15
#include "sccolor.h"
16
#include "fpointarray.h"
17
#include "vgradient.h"
18
#include <QList>
19
#include <QTransform>
20
#include <QMultiMap>
21
#include <QVector>
22
 
23
#include <libvisio/libvisio.h>
24
#include <libwpd-stream/libwpd-stream.h>
25
#include <libwpd/libwpd.h>
26
#include <libwpg/libwpg.h>
27
 
28
class MultiProgressDialog;
29
class ScribusDoc;
30
class Selection;
31
class TransactionSettings;
32
 
33
class RawVsdPainter : public libwpg::WPGPaintInterface
34
{
35
public:
36
        RawVsdPainter();
37
        void startGraphics(const ::WPXPropertyList &propList);
38
        void endGraphics();
39
        void startLayer(const ::WPXPropertyList &propList);
40
        void endLayer();
41
        void startEmbeddedGraphics(const ::WPXPropertyList &propList);
42
        void endEmbeddedGraphics();
43
        void setStyle(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &gradient);
44
        void drawRectangle(const ::WPXPropertyList &propList);
45
        void drawEllipse(const ::WPXPropertyList &propList);
46
        void drawPolyline(const ::WPXPropertyListVector &vertices);
47
        void drawPolygon(const ::WPXPropertyListVector &vertices);
48
        void drawPath(const ::WPXPropertyListVector &path);
49
        void drawGraphicObject(const ::WPXPropertyList &propList, const ::WPXBinaryData &binaryData);
50
        void startTextObject(const ::WPXPropertyList &propList, const ::WPXPropertyListVector &path);
51
        void endTextObject();
52
        void startTextLine(const ::WPXPropertyList &propList);
53
        void endTextLine();
54
        void startTextSpan(const ::WPXPropertyList &propList);
55
        void endTextSpan();
56
        void insertText(const ::WPXString &str);
57
        QString constructFontName(QString fontBaseName, QString fontStyle);
58
        double valueAsPoint(const WPXProperty *prop);
59
        double fromPercentage(const QString &s );
60
        QColor  parseColorN( const QString &rgbColor );
61
        QString parseColor( const QString &s );
62
        void insertImage(PageItem* ite, QString imgExt, QByteArray &imageData);
63
        void applyFill(PageItem* ite);
64
        void applyShadow(PageItem* ite);
65
        void finishItem(PageItem* ite);
66
 
67
        ScribusDoc* m_Doc;
68
        Selection* tmpSel;
69
        QList<PageItem*> *Elements;
70
        struct groupEntry
71
        {
72
                QList<PageItem*> Items;
73
                FPointArray clip;
74
        };
75
        QStack<groupEntry> groupStack;
76
        QStringList *importedColors;
77
        QStringList *importedPatterns;
78
        double LineW;
79
        QString CurrColorFill;
80
        QString CurrColorStroke;
81
        double CurrStrokeShade;
82
        double CurrFillShade;
83
        double CurrStrokeTrans;
84
        double CurrFillTrans;
85
        FPointArray Coords;
86
        bool fillrule;
87
        double gradientAngle;
88
        bool isGradient;
89
        VGradient currentGradient;
90
        QString gradColor1Str;
91
        QColor gradColor1;
92
        double gradColor1Trans;
93
        QString gradColor2Str;
94
        QColor gradColor2;
95
        double gradColor2Trans;
96
        QVector<double> dashArray;
97
        Qt::PenJoinStyle lineJoin;
98
        Qt::PenCapStyle lineEnd;
99
        double baseX, baseY;
100
        double docWidth;
101
        double docHeight;
102
        int importerFlags;
103
        bool firstPage;
104
        QString baseLayer;
105
        int actPage;
106
        WPXPropertyList m_style;
107
        PageItem *actTextItem;
108
        ParagraphStyle textStyle;
109
        CharStyle textCharStyle;
110
        double m_linespace;
111
        double m_maxFontSize;
112
        bool lineSpSet;
113
        bool lineSpIsPT;
114
        bool doProcessing;
115
};
116
 
117
//! \brief CDR importer plugin
118
class VsdPlug : public QObject
119
{
120
        Q_OBJECT
121
 
122
public:
123
        /*!
124
        \author Franz Schmid
125
        \date
126
        \brief Create the Cdr importer window.
127
        \param fName QString
128
        \param flags combination of loadFlags
129
        \param showProgress if progress must be displayed
130
        \retval EPSPlug plugin
131
        */
132
        VsdPlug( ScribusDoc* doc, int flags );
133
        ~VsdPlug();
134
 
135
        /*!
136
        \author Franz Schmid
137
        \date
138
        \brief Perform import.
139
        \param fn QString
140
        \param trSettings undo transaction settings
141
        \param flags combination of loadFlags
142
        \param showProgress if progress must be displayed
143
        \retval bool true if import was ok
144
         */
145
        bool import(QString fn, const TransactionSettings& trSettings, int flags, bool showProgress = true);
146
        QImage readThumbnail(QString fn);
147
 
148
private:
149
        bool convert(QString fn);
150
 
151
        QList<PageItem*> Elements;
152
        double baseX, baseY;
153
        double docWidth;
154
        double docHeight;
155
 
156
        QStringList importedColors;
157
        QStringList importedPatterns;
158
 
159
        bool interactive;
160
        MultiProgressDialog * progressDialog;
161
        bool cancel;
162
        ScribusDoc* m_Doc;
163
        Selection* tmpSel;
164
        int importerFlags;
165
 
166
public slots:
167
        void cancelRequested() { cancel = true; }
168
};
169
 
170
#endif