kpresenter

KPrSVGPathParser.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2005 Thorsten Zachmann <zachmann@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KPRSVGPATHPARSER_H
00021 #define KPRSVGPATHPARSER_H
00022 
00023 #include <svgpathparser.h>
00024 #include "global.h"
00025 #include "KoPointArray.h"
00026 
00027 class KPrSVGPathParser : public SVGPathParser
00028 {
00029 public:
00033     virtual ~KPrSVGPathParser() {};
00034 
00048     ObjType getType( QString &d );
00049 
00058     KoPointArray getPoints( QString &d, bool convert2lines = false );
00059     
00060 protected:
00061     virtual void svgMoveTo( double x1, double y1, bool abs = true );
00062     virtual void svgLineTo( double x1, double y1, bool abs = true );
00063     virtual void svgCurveToCubic(  double x1, double y1, double x2, double y2, double x, double y, bool abs = true );
00064     virtual void svgClosePath();
00065 
00066 private:
00068     bool m_type;
00069     enum PathType
00070     {
00071         SEEN_MOVE = 1,
00072         SEEN_LINE = 2,
00073         SEEN_CUBIC = 4,
00074         SEEN_QUADRIC = 8,
00075         SEEN_CLOSE = 16,
00076         NO_BEZIER = 32,
00077         UNSUPPORTED = 64
00078     };
00080     int m_pathType;
00081 
00083     KoPointArray m_points;
00085     KoPoint m_curPoint;
00087     int m_pointIdx;
00089     bool m_convert2lines;
00090 };
00091 
00092 #endif /* KPRSVGPATHPARSER_H */
KDE Home | KDE Accessibility Home | Description of Access Keys