kpresenter

KPrPieObject.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00003    Copyright (C) 2005 Thorsten Zachmann <zachmann@kde.org>
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 kppieobject_h
00022 #define kppieobject_h
00023 
00024 #include "KPrObject.h"
00025 #include <KoBrush.h>
00026 #include <KoStyleStack.h>
00027 
00028 class KPrGradient;
00029 class DCOPObject;
00030 
00031 class KPrPieObject : public KPr2DObject, public KPrStartEndLine
00032 {
00033 public:
00034     KPrPieObject();
00035     KPrPieObject( const KoPen &_pen, const QBrush &_brush, FillType _fillType,
00036                  const QColor &_gColor1, const QColor &_gColor2, BCType _gType, PieType _pieType,
00037                  int _p_angle, int _p_len, LineEnd _lineBegin, LineEnd _lineEnd,
00038                  bool _unbalanced, int _xfactor, int _yfactor );
00039     virtual ~KPrPieObject() {}
00040     virtual DCOPObject* dcopObject();
00041     KPrPieObject &operator=( const KPrPieObject & );
00042 
00043     virtual void setPieType( PieType _pieType )
00044         { pieType = _pieType; m_redrawGradientPix = true; }
00045     virtual void setPieAngle( int _p_angle )
00046         { p_angle = _p_angle; m_redrawGradientPix = true; }
00047     virtual void setPieLength( int _p_len )
00048         { p_len = _p_len; m_redrawGradientPix = true; }
00049     virtual void setLineBegin( LineEnd _lineBegin )
00050         { lineBegin = _lineBegin; }
00051     virtual void setLineEnd( LineEnd _lineEnd )
00052         { lineEnd = _lineEnd; }
00053 
00054     virtual ObjType getType() const
00055         { return OT_PIE; }
00056     virtual QString getTypeString() const
00057         {
00058             switch ( pieType ) {
00059             case PT_PIE:
00060                 return i18n("Pie");
00061                 break;
00062             case PT_ARC:
00063                 return i18n("Arc");
00064                 break;
00065             case PT_CHORD:
00066                 return i18n("Chord");
00067                 break;
00068             }
00069             return QString::null;
00070         }
00071 
00072     virtual PieType getPieType() const
00073         { return pieType; }
00074     virtual int getPieAngle() const
00075         { return p_angle; }
00076     virtual int getPieLength() const
00077         { return p_len; }
00078     virtual LineEnd getLineBegin() const
00079         { return lineBegin; }
00080     virtual LineEnd getLineEnd() const
00081         { return lineEnd; }
00082 
00083     virtual QDomDocumentFragment save( QDomDocument& doc, double offset );
00084 
00085     virtual double load(const QDomElement &element);
00086     virtual void flip(bool horizontal );
00087     virtual void loadOasis(const QDomElement &element, KoOasisContext & context, KPrLoadingInfo *info);
00088 
00089     virtual KoSize getRealSize() const;
00090     virtual KoPoint getRealOrig() const;
00091 
00092 protected:
00093     virtual const char * getOasisElementName() const;
00094     virtual bool saveOasisObjectAttributes( KPOasisSaveContext &sc ) const;
00095     virtual void fillStyle( KoGenStyle& styleObjectAuto, KoGenStyles& mainStyles ) const;
00096 
00097     virtual void paint( QPainter *_painter, KoTextZoomHandler*_zoomHandler,
00098                         int /* pageNum */, bool drawingShadow, bool drawContour );
00099 
00100     void setMinMax( double &min_x, double &min_y, double &max_x, double &max_y, KoPoint point ) const;
00101     void getRealSizeAndOrig( KoSize &size, KoPoint &realOrig ) const;
00102 
00103     void setEndPoints( KoPointArray &points ) const;
00104 
00105     PieType pieType;
00106     int p_angle, p_len;
00107 };
00108 
00109 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys