kivio
kivio_shape_data.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KIVIO_SHAPE_DATA_H
00020 #define KIVIO_SHAPE_DATA_H
00021
00022 #include <qfont.h>
00023 #include <qcolor.h>
00024 #include <qdom.h>
00025 #include <qptrlist.h>
00026 #include <qstring.h>
00027
00028 #include "kivio_point.h"
00029
00030 class KivioFillStyle;
00031 class KivioLineStyle;
00032 class KivioTextStyle;
00033
00034 class KivioTextShapeData
00035 {
00036 public:
00037 KivioTextShapeData();
00038
00039 QString m_text;
00040 QColor m_textColor;
00041 QFont m_textFont;
00042 bool m_isHtml;
00043 int m_hTextAlign, m_vTextAlign;
00044 };
00045
00051 class KivioShapeData
00052 {
00053 public:
00057 typedef enum {
00058 kstNone = 0,
00059 kstArc,
00060 kstPie,
00061 kstLineArray,
00062 kstPolyline,
00063 kstPolygon,
00064 kstBezier,
00065 kstRectangle,
00066 kstRoundRectangle,
00067 kstEllipse,
00068 kstOpenPath,
00069 kstClosedPath,
00070 kstTextBox
00071 } KivioShapeType;
00072
00073 protected:
00074 friend class KivioShape;
00075
00076 QPtrList <KivioPoint> *m_pOriginalPointList;
00077
00078 KivioShapeType m_shapeType;
00079 KivioPoint m_position, m_dimensions;
00080 KivioFillStyle *m_pFillStyle;
00081
00082
00083
00084 KivioLineStyle *m_pLineStyle;
00085
00086 QString m_name;
00087
00088 KivioTextStyle *m_pTextData;
00089
00090 public:
00091 KivioShapeData();
00092 KivioShapeData( const KivioShapeData & );
00093 virtual ~KivioShapeData();
00094
00095 virtual void copyInto( KivioShapeData *pTarget ) const;
00096
00097 virtual bool loadXML( const QDomElement & );
00098 virtual QDomElement saveXML( QDomDocument & );
00099
00100
00101 KivioShapeType shapeType() const { return m_shapeType; }
00102 void setShapeType( KivioShapeType st );
00103
00104 static KivioShapeType shapeTypeFromString( const QString & );
00105
00106 QPtrList<KivioPoint> *pointList() { return m_pOriginalPointList; }
00107
00108 KivioFillStyle *fillStyle() const { return m_pFillStyle; }
00109 KivioLineStyle *lineStyle() const { return m_pLineStyle; }
00110 void setLineStyle(KivioLineStyle ls);
00111
00112
00113 const QString &name() const { return m_name; }
00114 void setName( const QString &newName ) { m_name=newName; }
00115
00116
00117
00118 KivioPoint *position() { return &m_position; }
00119 KivioPoint *dimensions() { return &m_dimensions; }
00120
00121 double x() { return m_position.x(); }
00122 double y() { return m_position.y(); }
00123 double w() { return m_dimensions.x(); }
00124 double h() { return m_dimensions.y(); }
00125
00126
00127
00128
00129 QString text();
00130 void setText( const QString &newText );
00131
00132 bool isHtml() const;
00133 void setIsHtml( bool b );
00134
00135 int hTextAlign() const;
00136 void setHTextAlign( int i );
00137
00138 int vTextAlign() const;
00139 void setVTextAlign( int i );
00140
00141 QFont textFont();
00142 void setTextFont( const QFont &f );
00143
00144 QColor textColor();
00145 void setTextColor( QColor c );
00146
00147 void setTextStyle( KivioTextStyle * );
00148 };
00149
00150 #endif
00151
00152
|