kivio_shape_data.h
1/*
2 * Kivio - Visual Modelling and Flowcharting
3 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19#ifndef KIVIO_SHAPE_DATA_H
20#define KIVIO_SHAPE_DATA_H
21
22#include <tqfont.h>
23#include <tqcolor.h>
24#include <tqdom.h>
25#include <tqptrlist.h>
26#include <tqstring.h>
27
28#include "kivio_point.h"
29
30class KivioFillStyle;
31class KivioLineStyle;
32class KivioTextStyle;
33
34class KivioTextShapeData
35{
36public:
37 KivioTextShapeData();
38
39 TQString m_text; // The text inside this shape
40 TQColor m_textColor; // The text color
41 TQFont m_textFont; // The text font
42 bool m_isHtml; // Is the text HTML formatted?
43 int m_hTextAlign, m_vTextAlign; // Horizontal and vertical text alignment flags
44};
45
52{
53public:
57 typedef enum {
58 kstNone = 0,
59 kstArc,
60 kstPie,
61 kstLineArray,
62 kstPolyline,
63 kstPolygon,
64 kstBezier,
65 kstRectangle,
66 kstRoundRectangle,
67 kstEllipse,
68 kstOpenPath,
69 kstClosedPath,
70 kstTextBox
72
73protected:
74 friend class KivioShape;
75
76 TQPtrList <KivioPoint> *m_pOriginalPointList; // Original point list loaded from an SML file
77
78 KivioShapeType m_shapeType; // The shape type
79 KivioPoint m_position, m_dimensions; // The position and dimensions
80 KivioFillStyle *m_pFillStyle; // The fill style
81
82// TQColor m_fgColor; // The foreground color
83// float m_lineWidth; // The line width
84 KivioLineStyle *m_pLineStyle;
85
86 TQString m_name; // The name of this shape
87
88 KivioTextStyle *m_pTextData; // A pointer to text data (if applicable, e.g. TextBox)
89
90public:
93 virtual ~KivioShapeData();
94
95 virtual void copyInto( KivioShapeData *pTarget ) const;
96
97 virtual bool loadXML( const TQDomElement & );
98 virtual TQDomElement saveXML( TQDomDocument & );
99
100
101 KivioShapeType shapeType() const { return m_shapeType; }
102 void setShapeType( KivioShapeType st );
103
104 static KivioShapeType shapeTypeFromString( const TQString & );
105
106 TQPtrList<KivioPoint> *pointList() { return m_pOriginalPointList; }
107
108 KivioFillStyle *fillStyle() const { return m_pFillStyle; }
109 KivioLineStyle *lineStyle() const { return m_pLineStyle; }
110 void setLineStyle(KivioLineStyle ls);
111
112
113 const TQString &name() const { return m_name; }
114 void setName( const TQString &newName ) { m_name=newName; }
115
116
117 // Dimensions / Position
118 KivioPoint *position() { return &m_position; }
119 KivioPoint *dimensions() { return &m_dimensions; }
120
121 double x() { return m_position.x(); }
122 double y() { return m_position.y(); }
123 double w() { return m_dimensions.x(); }
124 double h() { return m_dimensions.y(); }
125
126
127
128 // Text functions
129 TQString text();
130 void setText( const TQString &newText );
131
132 bool isHtml() const;
133 void setIsHtml( bool b );
134
135 int hTextAlign() const;
136 void setHTextAlign( int i );
137
138 int vTextAlign() const;
139 void setVTextAlign( int i );
140
141 TQFont textFont();
142 void setTextFont( const TQFont &f );
143
144 TQColor textColor();
145 void setTextColor( TQColor c );
146
147 void setTextStyle( KivioTextStyle * );
148};
149
150#endif
151
152
A class containing all the data for a KivioShape.
virtual bool loadXML(const TQDomElement &)
Load this object from an XML element.
KivioShapeType
The possible shape types.
virtual TQDomElement saveXML(TQDomDocument &)
Save this object to an XML element.