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
|
/* This file is part of the KDE project
Copyright (C) 2002, The Karbon Developers
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __VTEXT_H__
#define __VTEXT_H__
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <tqptrlist.h>
#include <tqstring.h>
#include <tqfont.h>
#include <koffice_export.h>
#include "vpath.h"
#include "vcomposite.h"
class VGroup;
typedef TQPtrList<VPath> VPathList;
typedef TQPtrListIterator<VPath> VPathListIterator;
#ifdef Above
#undef Above
#endif
class KARBONBASE_EXPORT VText : public VObject
{
public:
enum Position {
Above,
On,
Under
};
enum Alignment {
Left,
Center,
Right
};
VText( VObject* tqparent, VState state = normal );
VText( const TQFont &font, const VSubpath& basePath, Position position, Alignment tqalignment, const TQString& text );
VText( const VText& text );
virtual ~VText();
virtual DCOPObject* dcopObject();
virtual void setText( const TQString& text );
virtual const TQString& text() { return m_text; }
virtual void setFont( const TQFont& font ) { m_font = font; }
virtual const TQFont& font() { return m_font; }
virtual void setBasePath( const VSubpath& path ) { m_basePath = path; }
virtual VSubpath& basePath() { return m_basePath; }
virtual void setPosition( Position position ) { m_position = position; }
virtual Position position() { return m_position; }
virtual void tqsetAlignment( Alignment tqalignment ) { m_tqalignment = tqalignment; }
virtual Alignment tqalignment() { return m_tqalignment; }
virtual void setUseShadow( bool state ) { m_shadow = state; }
virtual bool useShadow() { return m_shadow; }
virtual void setShadow( int angle, int distance, bool translucent )
{ m_translucentShadow = translucent; m_shadowAngle = angle; m_shadowDistance = distance; }
virtual bool translucentShadow() { return m_translucentShadow; }
virtual int shadowAngle() { return m_shadowAngle; }
virtual int shadowDistance() { return m_shadowDistance; }
virtual void setOffset( double offset );
virtual double offset() { return m_offset; }
/**
* Provides read only access to the glyphs.
*/
const VPathList& glyphs() const
{
return m_glyphs;
}
virtual void draw( VPainter *painter, const KoRect* rect = 0L ) const;
virtual const KoRect& boundingBox() const;
virtual void save( TQDomElement& element ) const;
virtual void load( const TQDomElement& element );
virtual VText* clone() const;
virtual VGroup* toVGroup() const;
virtual void setState( const VState state );
virtual void accept( VVisitor& visitor );
#ifdef HAVE_KARBONTEXT
void traceText();
protected:
TQString buildRequest( TQString family, int weight, int slant, double size, int &id );
#endif // HAVE_KARBONTEXT
private:
// The font to use to draw the text.
TQFont m_font;
// The base path. Doesn't belong to the document.
VSubpath m_basePath;
// The text position
Position m_position;
// The text tqalignment
Alignment m_tqalignment;
// The text to draw
TQString m_text;
// Shadow parameters
bool m_shadow;
bool m_translucentShadow;
int m_shadowDistance;
int m_shadowAngle;
// The glyphs (allow to keep a font even if not present on the computer. works as long as you don't edit the text.)
VPathList m_glyphs;
// the position offset
double m_offset;
};
#endif
|