kpresenter

KPrPieObject.h
1/* This file is part of the KDE project
2 Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
3 Copyright (C) 2005 Thorsten Zachmann <zachmann@kde.org>
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 kppieobject_h
22#define kppieobject_h
23
24#include "KPrObject.h"
25#include <KoBrush.h>
26#include <KoStyleStack.h>
27
28class KPrGradient;
29class DCOPObject;
30
31class KPrPieObject : public KPr2DObject, public KPrStartEndLine
32{
33public:
34 KPrPieObject();
35 KPrPieObject( const KoPen &_pen, const TQBrush &_brush, FillType _fillType,
36 const TQColor &_gColor1, const TQColor &_gColor2, BCType _gType, PieType _pieType,
37 int _p_angle, int _p_len, LineEnd _lineBegin, LineEnd _lineEnd,
38 bool _unbalanced, int _xfactor, int _yfactor );
39 virtual ~KPrPieObject() {}
40 virtual DCOPObject* dcopObject();
41 KPrPieObject &operator=( const KPrPieObject & );
42
43 virtual void setPieType( PieType _pieType )
44 { pieType = _pieType; m_redrawGradientPix = true; }
45 virtual void setPieAngle( int _p_angle )
46 { p_angle = _p_angle; m_redrawGradientPix = true; }
47 virtual void setPieLength( int _p_len )
48 { p_len = _p_len; m_redrawGradientPix = true; }
49 virtual void setLineBegin( LineEnd _lineBegin )
50 { lineBegin = _lineBegin; }
51 virtual void setLineEnd( LineEnd _lineEnd )
52 { lineEnd = _lineEnd; }
53
54 virtual ObjType getType() const
55 { return OT_PIE; }
56 virtual TQString getTypeString() const
57 {
58 switch ( pieType ) {
59 case PT_PIE:
60 return i18n("Pie");
61 break;
62 case PT_ARC:
63 return i18n("Arc");
64 break;
65 case PT_CHORD:
66 return i18n("Chord");
67 break;
68 }
69 return TQString();
70 }
71
72 virtual PieType getPieType() const
73 { return pieType; }
74 virtual int getPieAngle() const
75 { return p_angle; }
76 virtual int getPieLength() const
77 { return p_len; }
78 virtual LineEnd getLineBegin() const
79 { return lineBegin; }
80 virtual LineEnd getLineEnd() const
81 { return lineEnd; }
82
83 virtual TQDomDocumentFragment save( TQDomDocument& doc, double offset );
84
85 virtual double load(const TQDomElement &element);
86 virtual void flip(bool horizontal );
87 virtual void loadOasis(const TQDomElement &element, KoOasisContext & context, KPrLoadingInfo *info);
88
89 virtual KoSize getRealSize() const;
90 virtual KoPoint getRealOrig() const;
91
92protected:
93 virtual const char * getOasisElementName() const;
94 virtual bool saveOasisObjectAttributes( KPOasisSaveContext &sc ) const;
95 virtual void fillStyle( KoGenStyle& styleObjectAuto, KoGenStyles& mainStyles ) const;
96
97 virtual void paint( TQPainter *_painter, KoTextZoomHandler*_zoomHandler,
98 int /* pageNum */, bool drawingShadow, bool drawContour );
99
100 void setMinMax( double &min_x, double &min_y, double &max_x, double &max_y, KoPoint point ) const;
101 void getRealSizeAndOrig( KoSize &size, KoPoint &realOrig ) const;
102
103 void setEndPoints( KoPointArray &points ) const;
104
105 PieType pieType;
106 int p_angle, p_len;
107};
108
109#endif
Class: KPrGradient.
Definition KPrGradient.h:40
Temporary information used only during loading.