filters

svgexport.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2002, 2003 The Karbon Developers
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 __SVGEXPORT_H__
00021 #define __SVGEXPORT_H__
00022 
00023 #include <KoFilter.h>
00024 
00025 #include "vvisitor.h"
00026 #include "vgradient.h"
00027 
00028 #include "svggraphiccontext.h"
00029 
00030 #include <qptrstack.h>
00031 
00032 class QTextStream;
00033 class VColor;
00034 class VPath;
00035 class VDocument;
00036 class VFill;
00037 class VGroup;
00038 class VImage;
00039 class VLayer;
00040 class VSubpath;
00041 class VStroke;
00042 class VText;
00043 class VTransformCmd;
00044 
00045 
00046 class SvgExport : public KoFilter, private VVisitor
00047 {
00048     Q_OBJECT
00049 
00050 public:
00051     SvgExport( KoFilter* parent, const char* name, const QStringList& );
00052     virtual ~SvgExport() {}
00053 
00054     virtual KoFilter::ConversionStatus convert( const QCString& from, const QCString& to );
00055 
00056 private:
00057     virtual void visitVPath( VPath& composite );
00058     virtual void visitVDocument( VDocument& document );
00059     virtual void visitVGroup( VGroup& group );
00060     virtual void visitVImage( VImage& image );
00061     virtual void visitVLayer( VLayer& layer );
00062     virtual void visitVSubpath( VSubpath& path );
00063     virtual void visitVText( VText& text );
00064 
00065     void getStroke( const VStroke& stroke, QTextStream *stream );
00066     void getColorStops( const QPtrVector<VColorStop> &colorStops );
00067     void getFill( const VFill& fill, QTextStream *stream );
00068     void getGradient( const VGradient& grad );
00069     void getPattern( const VPattern& patt );
00070     void getHexColor( QTextStream *, const VColor& color  );
00071     QString getID( VObject *obj );
00072 
00073     void writePathToStream( VPath &composite, const QString &id, QTextStream *stream, unsigned int indent );
00074 
00075     QTextStream* m_stream;
00076     QTextStream* m_defs;
00077     QTextStream* m_body;
00078 
00079     QPtrStack<SvgGraphicsContext>   m_gc;
00080 
00081     unsigned int m_indent;
00082     unsigned int m_indent2;
00083 
00084     VTransformCmd *m_trans;
00085 };
00086 
00087 #endif
00088 
KDE Home | KDE Accessibility Home | Description of Access Keys