00001
00002
00003 #ifndef LABEL_H
00004 #define LABEL_H
00005
00006 #include <qtextstream.h>
00007 #include <qfont.h>
00008 #include <qcolor.h>
00009 #include <qsimplerichtext.h>
00010 #include <qstringlist.h>
00011 #include <qdom.h>
00012 #include <klocale.h>
00013 #include <kconfig.h>
00014 #include "Point.h"
00015
00016 class Label {
00017 public:
00018 Label(QString t = QString(""), QFont f = QFont(QString("Adobe Times"),14),QColor c = QColor("black"));
00019 QStringList Info();
00020 void save(QTextStream *ts);
00021 void open(QTextStream *ts, int version, bool skip=true);
00022 QDomElement saveXML(QDomDocument doc);
00023 void openXML(QDomNode node);
00024 void saveSettings(KConfig *config, QString entry);
00025 void readSettings(KConfig *config, QString entry);
00026 void draw(class Worksheet *ws, QPainter *p, Point pos,Point size, int w, int h, double phi);
00027
00028 bool inside(int x0, int y0, Point pos, Point size, int w, int h);
00029 bool insideY(int x0, int y0, Point pos, Point size, int w, int h);
00030 bool insideZ(int x0, int y0, Point pos, Point size, int w, int h);
00031 void setPosition(double X, double Y) { x=X; y=Y; }
00032 double X() { return x;}
00033 double Y() { return y;}
00034 void setX(double X) { x=X; }
00035 void setY(double Y) { y=Y; }
00036 QString Title() { return title; }
00037 QString simpleTitle();
00038 void setTitle(QString t) { title = t; }
00039 void setColor(QColor c) { color = c; }
00040 void setColor(QString c) { color = QColor(c); }
00041 QColor Color() { return color; }
00042 void setBackgroundColor(QColor c) { bgcolor = c; }
00043 void setBackgroundColor(QString c) { bgcolor = QColor(c); }
00044 QColor BackgroundColor() { return bgcolor; }
00045 void setFont(QFont f) { font = f; }
00046 QFont Font() { return font; }
00047 void setBoxed(bool b=true) { boxed = b; }
00048 bool Boxed() { return boxed; }
00049 void setTransparent(bool t) { transparent = t; }
00050 bool Transparent() { return transparent; }
00051 double Rotation() { return rotation; }
00052 void setRotation(double r) { rotation = r; }
00053 bool isTeXLabel() { return is_texlabel; }
00054 void setTeXLabel(bool t) { is_texlabel=t; }
00055 int Length();
00056 private:
00057 double x, y;
00058 QString title;
00059 QFont font;
00060 QColor color, bgcolor;
00061 QSimpleRichText *richtext;
00062 bool boxed;
00063 bool transparent;
00064 double rotation;
00065 bool is_texlabel;
00066 };
00067
00068 #endif //LABEL_H