filters

wmfexport.h
1/* This file is part of the KDE project
2 * Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License version 2 as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
12 *
13 * You should have received a copy of the GNU Library General Public License
14 * along with this library; see the file COPYING.LIB. If not, write to
15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17*/
18
19#ifndef WMFEXPORT_H
20#define WMFEXPORT_H
21
22#include <tqpen.h>
23#include <tqbrush.h>
24#include <tqptrlist.h>
25#include <tqpointarray.h>
26#include <KoFilter.h>
27#include "vvisitor.h"
28
29class KoWmfWrite;
30class VPath;
31class VDocument;
32class VSubpath;
33class VText;
34
35class WmfExport : public KoFilter, private VVisitor
36{
37 TQ_OBJECT
38
39
40public:
41 WmfExport( KoFilter *parent, const char *name, const TQStringList&);
42 virtual ~WmfExport();
43
44 virtual KoFilter::ConversionStatus convert( const TQCString& from, const TQCString& to );
45
46private:
47 void visitVPath( VPath& composite );
48 void visitVDocument( VDocument& document );
49 void visitVSubpath( VSubpath& path );
50 void visitVText( VText& text );
51 void getBrush( TQBrush& brush, const VFill *fill );
52 void getPen( TQPen& pen, const VStroke *stroke );
53
54 // coordinate transformation
55 // translate origin from (left,bottom) to (left,top) -> scale to wmf size
56 // Wmf origin is (left,top) corner
57 // Karbon origin is (left,bottom) corner
58 int coordX( double left )
59 { return (int)(left * mScaleX); }
60 int coordY( double top )
61 { return (int)((mDoc->height() - top) * mScaleY); }
62
63private:
64 KoWmfWrite *mWmf;
65 VDocument *mDoc;
66 int mDpi;
67 double mScaleX;
68 double mScaleY;
69 TQPtrList<TQPointArray> mListPa;
70};
71
72#endif