karbon

vstroke.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, The Karbon Developers
3 Copyright (C) 2002, The Karbon Developers
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library 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 GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef __VSTROKE_H__
22#define __VSTROKE_H__
23
24#include <tqvaluelist.h>
25
26#include "vcolor.h"
27#include "vdashpattern.h"
28#include "vgradient.h"
29#include "vpattern.h"
30#include <koffice_export.h>
31
32class TQDomElement;
33class VObject;
34class KoGenStyle;
35class KoStyleStack;
36
37
48class KARBONBASE_EXPORT VStroke
49{
50public:
52 {
53 none = 0,
54 solid = 1,
55 grad = 2,
56 patt = 3,
57 unknown = 4
58 };
59
60 enum VLineCap
61 {
62 capButt = 0,
63 capRound = 1,
64 capSquare = 2
65 };
66
67 enum VLineJoin
68 {
69 joinMiter = 0,
70 joinRound = 1,
71 joinBevel = 2
72 };
73
74 VStroke();
75 VStroke( VObject* parent, float width = 1.0, const VLineCap cap = capButt,
76 const VLineJoin join = joinMiter, float miterLimit = 10.0 );
77 VStroke( const VColor &c, VObject* parent = 0L, float width = 1.0, const VLineCap cap = capButt,
78 const VLineJoin join = joinMiter, float miterLimit = 10.0 );
79 VStroke( const VStroke& stroke );
80
81 void setParent( VObject* parent ) { m_parent = parent; }
82 VObject* parent()const { return m_parent; }
83
84 VStrokeType type() const { return m_type; }
85 void setType( VStrokeType type ) { m_type = type; }
86
87 const VColor& color() const { return m_color; }
88 void setColor( const VColor& color ) { m_color = color; }
89
90 float lineWidth() const { return m_lineWidth; }
91 void setLineWidth( float width );
92
93 VLineCap lineCap() const { return m_lineCap; }
94 void setLineCap( VLineCap cap ) { m_lineCap = cap; }
95
96 VLineJoin lineJoin() const { return m_lineJoin; }
97 void setLineJoin( VLineJoin join ) { m_lineJoin = join; }
98
99 float miterLimit() const { return m_miterLimit; }
100 void setMiterLimit( float limit ) { m_miterLimit = limit; }
101
102 VGradient& gradient() { return m_gradient; }
103 const VGradient& gradient() const { return m_gradient; }
104
105 VPattern& pattern() { return m_pattern; }
106 const VPattern& pattern() const { return m_pattern; }
107
108 VDashPattern& dashPattern() { return m_dashPattern; }
109 const VDashPattern& dashPattern() const { return m_dashPattern; }
110
111 void save( TQDomElement& element ) const;
112 void saveOasis( KoGenStyle &style ) const;
113 void load( const TQDomElement& element );
114 void loadOasis( const KoStyleStack &stack );
115
116
117 VStroke& operator=( const VStroke& stroke );
118
119 void transform( const TQWMatrix& m );
120
121private:
122 VObject *m_parent;
123
124 VColor m_color;
125 VGradient m_gradient;
126 VPattern m_pattern;
127 float m_lineWidth;
128 float m_miterLimit;
129 VLineCap m_lineCap : 2;
130 VLineJoin m_lineJoin : 2;
131 VStrokeType m_type : 3;
132 VDashPattern m_dashPattern;
133};
134
135#endif
This class keeps track of color properties.
Definition vcolor.h:41
The dash pattern consistes of a sequence of on/off values.
The base class for all karbon objects.
Definition vobject.h:50
Manages stroke properties.
Definition vstroke.h:49
VStrokeType
Definition vstroke.h:52