Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef KLFSTYLE_H
00025 #define KLFSTYLE_H
00026
00027 #include <QList>
00028 #include <QDataStream>
00029
00030 #include <klfbackend.h>
00031
00032
00037 struct KLF_EXPORT KLFStyle {
00049 struct KLF_EXPORT BBoxExpand {
00050 BBoxExpand(double t = -1, double r = -1, double b = -1, double l = -1)
00051 : top(t), right(r), bottom(b), left(l) { }
00052 BBoxExpand(const BBoxExpand& c) : top(c.top), right(c.right), bottom(c.bottom), left(c.left) { }
00053
00054 inline bool valid() const { return top >= 0 && right >= 0 && bottom >= 0 && left >= 0; }
00055
00056 double top;
00057 double right;
00058 double bottom;
00059 double left;
00060 inline const BBoxExpand& operator=(const BBoxExpand& other)
00061 { top = other.top; right = other.right; bottom = other.bottom; left = other.left; return *this; }
00062 inline bool operator==(const BBoxExpand& x) const
00063 { return top == x.top && right == x.right && bottom == x.bottom && left == x.left; }
00064 };
00065
00066 KLFStyle(QString nm = QString(), unsigned long fgcol = qRgba(0,0,0,255),
00067 unsigned long bgcol = qRgba(255,255,255,0),
00068 const QString& mmode = QString(),
00069 const QString& pre = QString(),
00070 int dotsperinch = -1)
00071 : name(nm), fg_color(fgcol), bg_color(bgcol), mathmode(mmode), preamble(pre),
00072 dpi(dotsperinch)
00073 {
00074 }
00075
00076 KLFStyle(const KLFBackend::klfInput& input)
00077 : name(), fg_color(input.fg_color), bg_color(input.bg_color), mathmode(input.mathmode),
00078 preamble(input.preamble), dpi(input.dpi), overrideBBoxExpand()
00079 {
00080 }
00081
00082 KLFStyle(const KLFStyle& o)
00083 : name(o.name), fg_color(o.fg_color), bg_color(o.bg_color), mathmode(o.mathmode),
00084 preamble(o.preamble), dpi(o.dpi), overrideBBoxExpand(o.overrideBBoxExpand)
00085 {
00086 }
00087
00088 QString name;
00089 unsigned long fg_color;
00090 unsigned long bg_color;
00091 QString mathmode;
00092 QString preamble;
00093 int dpi;
00094 BBoxExpand overrideBBoxExpand;
00095
00096 inline const KLFStyle& operator=(const KLFStyle& o) {
00097 name = o.name; fg_color = o.fg_color; bg_color = o.bg_color; mathmode = o.mathmode;
00098 preamble = o.preamble; dpi = o.dpi; overrideBBoxExpand = o.overrideBBoxExpand;
00099 return *this;
00100 }
00101 };
00102
00103 Q_DECLARE_METATYPE(KLFStyle)
00104 ;
00105
00106 typedef QList<KLFStyle> KLFStyleList;
00107
00108 KLF_EXPORT QDataStream& operator<<(QDataStream& stream, const KLFStyle& style);
00109 KLF_EXPORT QDataStream& operator>>(QDataStream& stream, KLFStyle& style);
00110
00111 KLF_EXPORT bool operator==(const KLFStyle& a, const KLFStyle& b);
00112
00113
00114
00115
00116 #endif