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 ~Label();
00020 QStringList Info();
00021 void save(QTextStream *ts);
00022 void open(QTextStream *ts, int version, bool skip=true);
00023 QDomElement saveXML(QDomDocument doc);
00024 void openXML(QDomNode node);
00025 void saveSettings(KConfig *config, QString entry);
00026 void readSettings(KConfig *config, QString entry);
00027 void draw(class Worksheet *ws, QPainter *p, Point pos,Point size, int w, int h, double phi);
00028
00029 bool inside(int x0, int y0, Point pos, Point size, int w, int h);
00030 bool insideY(int x0, int y0, Point pos, Point size, int w, int h);
00031 bool insideZ(int x0, int y0, Point pos, Point size, int w, int h);
00032 void setPosition(double X, double Y) { x=X; y=Y; }
00033 double X() { return x;}
00034 double Y() { return y;}
00035 void setX(double X) { x=X; }
00036 void setY(double Y) { y=Y; }
00037 QString Title() { return title; }
00038 QString simpleTitle();
00039 void setTitle(QString t) { title = t; }
00040 void setColor(QColor c) { color = c; }
00041 void setColor(QString c) { color = QColor(c); }
00042 QColor Color() { return color; }
00043 void setBackgroundColor(QColor c) { bgcolor = c; }
00044 void setBackgroundColor(QString c) { bgcolor = QColor(c); }
00045 QColor BackgroundColor() { return bgcolor; }
00046 void setFont(QFont f) { font = f; }
00047 QFont Font() { return font; }
00048 void setBoxed(bool b=true) { boxed = b; }
00049 bool Boxed() { return boxed; }
00050 void setTransparent(bool t) { transparent = t; }
00051 bool Transparent() { return transparent; }
00052 double Rotation() { return rotation; }
00053 void setRotation(double r) { rotation = r; }
00054 bool isTeXLabel() { return is_texlabel; }
00055 void setTeXLabel(bool t) { is_texlabel=t; }
00056 int Length();
00057 private:
00058 double x, y;
00059 QString title;
00060 QFont font;
00061 QColor color, bgcolor;
00062 QSimpleRichText *richtext;
00063 bool boxed;
00064 bool transparent;
00065 double rotation;
00066 bool is_texlabel;
00067 };
00068
00069 #endif //LABEL_H