filters

wmfexport.h

00001 /* This file is part of the KDE project
00002  * Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
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 version 2 as published by the Free Software Foundation.
00007  *
00008  * This library is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011  * Library General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Library General Public License
00014  * along with this library; see the file COPYING.LIB.  If not, write to
00015  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016  * Boston, MA 02110-1301, USA.
00017 */
00018 
00019 #ifndef WMFEXPORT_H
00020 #define WMFEXPORT_H
00021 
00022 #include <qpen.h>
00023 #include <qbrush.h>
00024 #include <qptrlist.h>
00025 #include <qpointarray.h>
00026 #include <KoFilter.h>
00027 #include "vvisitor.h"
00028 
00029 class KoWmfWrite;
00030 class VPath;
00031 class VDocument;
00032 class VSubpath;
00033 class VText;
00034 
00035 class WmfExport : public KoFilter, private VVisitor
00036 {
00037     Q_OBJECT
00038 
00039 public:
00040     WmfExport( KoFilter *parent, const char *name, const QStringList&);
00041     virtual ~WmfExport();
00042 
00043     virtual KoFilter::ConversionStatus convert( const QCString& from, const QCString& to );
00044 
00045 private:
00046     void visitVPath( VPath& composite );
00047     void visitVDocument( VDocument& document );
00048     void visitVSubpath( VSubpath& path );
00049     void visitVText( VText& text );
00050     void getBrush( QBrush& brush, const VFill *fill );
00051     void getPen( QPen& pen, const VStroke *stroke );
00052     
00053     // coordinate transformation
00054     // translate origin from (left,bottom) to (left,top) -> scale to wmf size 
00055     // Wmf origin is (left,top) corner
00056     // Karbon origin is (left,bottom) corner
00057     int coordX( double left ) 
00058             { return (int)(left * mScaleX); }
00059     int coordY( double top ) 
00060             { return (int)((mDoc->height() - top) * mScaleY); }
00061     
00062 private:
00063     KoWmfWrite *mWmf;
00064     VDocument *mDoc;
00065     int       mDpi;
00066     double    mScaleX;
00067     double    mScaleY;
00068     QPtrList<QPointArray> mListPa;
00069 };
00070 
00071 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys