filters

xfigimport.h
1/*
2 Copyright (C) 1998 Kai-Uwe Sattler <kus@iti.cs.uni-magdeburg.de>
3 Copyright (C) 2001, Rob Buis <rwlbuis@wanadoo.nl>
4 Copyright (C) 2003, Rob Buis <buis@kde.org>
5 This file is part of the KDE project
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21
22DESCRIPTION
23*/
24
25#ifndef XFIGIMPORT_H
26#define XFIGIMPORT_H
27
28#include <tqintdict.h>
29#include <tqvaluelist.h>
30#include <iostream.h>
31
32class GDocument;
33class GObject;
34class TQColor;
35
36#include <KoFilter.h>
37#include <tqobject.h>
38#include <tqstring.h>
39
40class XFIGImport : public KoFilter
41{
42 TQ_OBJECT
43
44
45public:
46 XFIGImport( KoFilter *parent, const char *name );
47 virtual ~XFIGImport();
48
49 virtual bool filterImport( const TQString &file, KoDocument *,
50 const TQString &from, const TQString &to,
51 const TQString &config=TQString() );
52
53private:
54 void parseColorObject (istream& fin);
55 void parseArc (istream& fin, GDocument* doc);
56 void parseEllipse (istream& fin, GDocument* doc);
57 void parsePolyline (istream& fin, GDocument* doc);
58 void parseSpline (istream& fin, GDocument* doc);
59 void parseText (istream& fin, GDocument* doc);
60 void parseCompoundObject (istream& fin, GDocument* doc);
61 void buildDocument (GDocument *doc);
62
63 void setProperties (GObject* obj, int pen_color, int style, int thickness,
64 int area_fill, int fill_color);
65
66 float fig_resolution;
67 int coordinate_system;
68 int version;
69 TQIntDict<TQColor> colorTable;
70
71 // An object and the depth. Used for sorting objects
72 // in the object list
73 struct GObjectListItem
74 {
75 GObjectListItem() : object(0L) {} // for TQValueList
76
77 GObjectListItem( int d, GObject * obj ) :
78 object(obj), depth(d) {}
79
80 GObject * object;
81 int depth;
82 bool operator < (const GObjectListItem & item ) const
83 {
84 // We want to sort by decreasing depths
85 return depth > item.depth;
86 }
87 bool operator == (const GObjectListItem & item ) const
88 {
89 return depth == item.depth;
90 }
91 };
92 TQValueList<GObjectListItem> objList;
93};
94
95#endif