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