karbon
vtext.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __VTEXT_H__
00021 #define __VTEXT_H__
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include <qptrlist.h>
00028 #include <qstring.h>
00029 #include <qfont.h>
00030 #include <koffice_export.h>
00031
00032 #include "vpath.h"
00033 #include "vcomposite.h"
00034
00035 class VGroup;
00036
00037 typedef QPtrList<VPath> VPathList;
00038 typedef QPtrListIterator<VPath> VPathListIterator;
00039
00040 #ifdef Above
00041 #undef Above
00042 #endif
00043
00044 class KARBONBASE_EXPORT VText : public VObject
00045 {
00046 public:
00047 enum Position {
00048 Above,
00049 On,
00050 Under
00051 };
00052
00053 enum Alignment {
00054 Left,
00055 Center,
00056 Right
00057 };
00058
00059 VText( VObject* parent, VState state = normal );
00060 VText( const QFont &font, const VSubpath& basePath, Position position, Alignment alignment, const QString& text );
00061 VText( const VText& text );
00062 virtual ~VText();
00063 virtual DCOPObject* dcopObject();
00064
00065 virtual void setText( const QString& text );
00066 virtual const QString& text() { return m_text; }
00067 virtual void setFont( const QFont& font ) { m_font = font; }
00068 virtual const QFont& font() { return m_font; }
00069 virtual void setBasePath( const VSubpath& path ) { m_basePath = path; }
00070 virtual VSubpath& basePath() { return m_basePath; }
00071 virtual void setPosition( Position position ) { m_position = position; }
00072 virtual Position position() { return m_position; }
00073 virtual void setAlignment( Alignment alignment ) { m_alignment = alignment; }
00074 virtual Alignment alignment() { return m_alignment; }
00075 virtual void setUseShadow( bool state ) { m_shadow = state; }
00076 virtual bool useShadow() { return m_shadow; }
00077 virtual void setShadow( int angle, int distance, bool translucent )
00078 { m_translucentShadow = translucent; m_shadowAngle = angle; m_shadowDistance = distance; }
00079 virtual bool translucentShadow() { return m_translucentShadow; }
00080 virtual int shadowAngle() { return m_shadowAngle; }
00081 virtual int shadowDistance() { return m_shadowDistance; }
00082 virtual void setOffset( double offset );
00083 virtual double offset() { return m_offset; }
00084
00088 const VPathList& glyphs() const
00089 {
00090 return m_glyphs;
00091 }
00092
00093 virtual void draw( VPainter *painter, const KoRect* rect = 0L ) const;
00094
00095 virtual const KoRect& boundingBox() const;
00096
00097 virtual void save( QDomElement& element ) const;
00098 virtual void load( const QDomElement& element );
00099
00100 virtual VText* clone() const;
00101 virtual VGroup* toVGroup() const;
00102
00103 virtual void setState( const VState state );
00104
00105 virtual void accept( VVisitor& visitor );
00106
00107 #ifdef HAVE_KARBONTEXT
00108 void traceText();
00109
00110 protected:
00111 QString buildRequest( QString family, int weight, int slant, double size, int &id );
00112 #endif // HAVE_KARBONTEXT
00113
00114 private:
00115
00116 QFont m_font;
00117
00118 VSubpath m_basePath;
00119
00120 Position m_position;
00121
00122 Alignment m_alignment;
00123
00124 QString m_text;
00125
00126 bool m_shadow;
00127 bool m_translucentShadow;
00128 int m_shadowDistance;
00129 int m_shadowAngle;
00130
00131 VPathList m_glyphs;
00132
00133 double m_offset;
00134 };
00135
00136 #endif
|