1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#ifndef SVGPLUG_H
#define SVGPLUG_H
#include <QObject>
#include <QDomElement>
#include "pluginapi.h"
#include "loadsaveplugin.h"
class QString;
class ScribusDoc;
class ScribusMainWindow;
class PageItem;
class Page;
class ScText;
struct SVGOptions
{
bool inlineImages;
bool exportPageBackground;
bool compressFile;
};
class PLUGIN_API SVGExportPlugin : public ScActionPlugin
{
Q_OBJECT
public:
// Standard plugin implementation
SVGExportPlugin();
virtual ~SVGExportPlugin();
/*!
\author Franz Schmid
\brief Run the SVG export
\param filename a file to export to
\retval bool true
*/
virtual bool run(ScribusDoc* doc=0, QString filename = QString::null);
virtual const QString fullTrName() const;
virtual const AboutData* getAboutData() const;
virtual void deleteAboutData(const AboutData* about) const;
virtual void languageChange();
virtual void addToMainWindowMenu(ScribusMainWindow *) {};
// Special features (none)
};
extern "C" PLUGIN_API int svgexplugin_getPluginAPIVersion();
extern "C" PLUGIN_API ScPlugin* svgexplugin_getPlugin();
extern "C" PLUGIN_API void svgexplugin_freePlugin(ScPlugin* plugin);
class SVGExPlug : public QObject
{
Q_OBJECT
public:
/*!
\author Franz Schmid
\brief Create the SVG exporter window
\param fName QString file name
*/
SVGExPlug( ScribusDoc* doc );
~SVGExPlug();
bool doExport( QString fName, SVGOptions &Opts );
SVGOptions Options;
private:
ScribusDoc* m_Doc;
/*!
\author Franz Schmid
\brief Process a page to export to SVG format
\param Seite Page *
*/
void ProcessPage(Page *page);
void ProcessItemOnPage(double xOffset, double yOffset, PageItem *Item, QDomElement *parentElem);
QDomElement processPolyItem(PageItem *Item, QString trans, QString fill, QString stroke);
QDomElement processLineItem(PageItem *Item, QString trans, QString stroke);
QDomElement processImageItem(PageItem *Item, QString trans, QString fill, QString stroke);
QDomElement processTextItem(PageItem *Item, QString trans, QString fill, QString stroke);
QDomElement processPathTextItem(PageItem *Item, QString trans, QString stroke);
QDomElement processInlineItem(double xpos, double ypos, QMatrix &finalMat, ScText *hl, bool pathT, QString trans);
QString handleGlyph(uint chr, ScText *hl);
QDomElement processArrows(PageItem *Item, QDomElement line, QString trans);
QString getFillStyle(PageItem *Item);
QString getStrokeStyle(PageItem *Item);
/*!
\author Franz Schmid
\param ite PageItem *
\retval QString Clipping Path
*/
QString SetClipPath(FPointArray *ite, bool closed);
/*!
\author Franz Schmid
\brief Converts double to string
\param c double
\retval QString
*/
QString FToStr(double c);
/*!
\author Franz Schmid
\brief Converts integer to QString
\param c int
\retval QString representation of value
*/
QString IToStr(int c);
/*!
\author Franz Schmid
\param farbe QString color
\param shad int
\param plug ScribusMainWindow *
\retval QString Colour settings
*/
QString MatrixToStr(QMatrix &mat);
QString SetColor(QString farbe, int shad);
/*!
\author Franz Schmid
\param sl struct SingleLine *
\param Item PageItem *
\retval QString Stroke settings
*/
QString GetMultiStroke(struct SingleLine *sl, PageItem *Item);
int GradCount;
int ClipCount;
int PattCount;
QString baseDir;
QDomDocument docu;
QDomElement docElement;
QDomElement globalDefs;
QList<QString> glyphNames;
};
#endif
|