karbon

vstroke.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001, The Karbon Developers
00003    Copyright (C) 2002, The Karbon Developers
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef __VSTROKE_H__
00022 #define __VSTROKE_H__
00023 
00024 #include <qvaluelist.h>
00025 
00026 #include "vcolor.h"
00027 #include "vdashpattern.h"
00028 #include "vgradient.h"
00029 #include "vpattern.h"
00030 #include <koffice_export.h>
00031 
00032 class QDomElement;
00033 class VObject;
00034 class KoGenStyle;
00035 class KoStyleStack;
00036 
00037 
00048 class KARBONBASE_EXPORT VStroke
00049 {
00050 public:
00051     enum VStrokeType
00052     {
00053         none     = 0,   
00054         solid    = 1,   
00055         grad     = 2,   
00056         patt     = 3,   
00057         unknown  = 4
00058     };
00059 
00060     enum VLineCap
00061     {
00062         capButt   = 0,
00063         capRound  = 1,
00064         capSquare = 2
00065     };
00066 
00067     enum VLineJoin
00068     {
00069         joinMiter = 0,
00070         joinRound = 1,
00071         joinBevel = 2
00072     };
00073 
00074     VStroke();
00075     VStroke( VObject* parent, float width = 1.0, const VLineCap cap = capButt,
00076              const VLineJoin join = joinMiter, float miterLimit = 10.0 );
00077     VStroke( const VColor &c, VObject* parent = 0L, float width = 1.0, const VLineCap cap = capButt,
00078              const VLineJoin join = joinMiter, float miterLimit = 10.0 );
00079     VStroke( const VStroke& stroke );
00080 
00081     void setParent( VObject* parent ) { m_parent = parent; }
00082     VObject* parent()const { return m_parent; }
00083 
00084     VStrokeType type() const { return m_type; }
00085     void setType( VStrokeType type ) { m_type = type; }
00086 
00087     const VColor& color() const { return m_color; }
00088     void setColor( const VColor& color ) { m_color = color; }
00089 
00090     float lineWidth() const { return m_lineWidth; }
00091     void setLineWidth( float width );
00092 
00093     VLineCap lineCap() const { return m_lineCap; }
00094     void setLineCap( VLineCap cap ) { m_lineCap = cap; }
00095 
00096     VLineJoin lineJoin() const { return m_lineJoin; }
00097     void setLineJoin( VLineJoin join ) { m_lineJoin = join; }
00098 
00099     float miterLimit() const { return m_miterLimit; }
00100     void setMiterLimit( float limit ) { m_miterLimit = limit; }
00101 
00102     VGradient& gradient() { return m_gradient; }
00103     const VGradient& gradient() const { return m_gradient; }
00104 
00105     VPattern& pattern() { return m_pattern; }
00106     const VPattern& pattern() const { return m_pattern; }
00107 
00108     VDashPattern& dashPattern() { return m_dashPattern; }
00109     const VDashPattern& dashPattern() const { return m_dashPattern; }
00110 
00111     void save( QDomElement& element ) const;
00112     void saveOasis( KoGenStyle &style ) const;
00113     void load( const QDomElement& element );
00114     void loadOasis( const KoStyleStack &stack );
00115 
00116 
00117     VStroke& operator=( const VStroke& stroke );
00118 
00119     void transform( const QWMatrix& m );
00120 
00121 private:
00122     VObject         *m_parent;
00123 
00124     VColor          m_color;
00125     VGradient       m_gradient;
00126     VPattern        m_pattern;
00127     float           m_lineWidth;
00128     float           m_miterLimit;
00129     VLineCap        m_lineCap   : 2;
00130     VLineJoin       m_lineJoin  : 2;
00131     VStrokeType     m_type      : 3;
00132     VDashPattern    m_dashPattern;
00133 };
00134 
00135 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys