00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __kofontdiapreview_h__
00021 #define __kofontdiapreview_h__
00022
00023 #include <q3frame.h>
00024 #include <QString>
00025 #include <QColor>
00026 #include <QFont>
00027 #include <QPainter>
00028
00032 class KoFontDiaPreview : public Q3Frame
00033 {
00034 Q_OBJECT
00035 public:
00039 KoFontDiaPreview( QWidget* parent =0, const char* name = 0, Qt::WFlags fl = 0 );
00040 ~KoFontDiaPreview();
00041
00042 void setText( const QString &text );
00043 void setFont( const QFont &font );
00044 void setFontColor( const QColor &textColor );
00045 void setBackgroundColor( const QColor &backgroundColor );
00046 void setShadow( double sdx, double sdy, QColor shadowColor );
00047 void setUnderlining( int underlining, int underliningStyle, const QColor underliningColor, bool wordByWord );
00048 void setWordByWord( bool wordByWord );
00049 void setStrikethrough( int strikethrough, int strikethroughStylestrikethrough, bool wordByWord );
00050 void setCapitalisation( int capitalisation );
00051 void setSubSuperscript( int subSuper, int offset, double relativeSize );
00052
00053
00054 private:
00055 void drawContents( QPainter* );
00056
00057 QString m_text;
00058 QString displayText;
00059 QFont m_font;
00060 QFont displayFont;
00061 int m_fontSize;
00062 QColor m_textColor;
00063 QColor m_backgroundColor;
00064 double m_shadowDistanceX;
00065 double m_shadowDistanceY;
00066 QColor m_shadowColor;
00067 int m_underlining;
00068 int m_underliningStyle;
00069 QColor m_underliningColor;
00070 bool m_wordByWord;
00071 int m_strikethrough;
00072 int m_strikethroughStyle;
00073 int m_capitalisation;
00074 int m_subSuper;
00075 int m_offset;
00076 double m_relativeSize;
00077
00078 QString formatCapitalisation( const QString &string );
00079 void drawUnderline( int x, int y, int width, int thickness, QColor & color, QPainter *p );
00080 void drawUnderlineWave( int x, int y, int width, int thickness, QColor & color, QPainter *p );
00081 void drawStrikethrough( int x, int y, int width, int thickness, QPainter *p );
00082 };
00083
00084 #endif