filters

xfigimport.h

00001 /*
00002     Copyright (C) 1998 Kai-Uwe Sattler <kus@iti.cs.uni-magdeburg.de>
00003     Copyright (C) 2001, Rob Buis <rwlbuis@wanadoo.nl>
00004     Copyright (C) 2003, Rob Buis <buis@kde.org>
00005     This file is part of the KDE project
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021 
00022 DESCRIPTION
00023 */
00024 
00025 #ifndef XFIGIMPORT_H
00026 #define XFIGIMPORT_H
00027 
00028 #include <qintdict.h>
00029 #include <qvaluelist.h>
00030 #include <iostream.h>
00031 
00032 class GDocument;
00033 class GObject;
00034 class QColor;
00035 
00036 #include <KoFilter.h>
00037 #include <qobject.h>
00038 #include <qstring.h>
00039 
00040 class XFIGImport : public KoFilter
00041 {
00042     Q_OBJECT
00043 
00044 public:
00045     XFIGImport( KoFilter *parent, const char *name );
00046     virtual ~XFIGImport();
00047 
00048     virtual bool filterImport( const QString &file, KoDocument *,
00049                                const QString &from, const QString &to,
00050                                const QString &config=QString::null );
00051 
00052 private:
00053   void parseColorObject (istream& fin);
00054   void parseArc (istream& fin, GDocument* doc);
00055   void parseEllipse (istream& fin, GDocument* doc);
00056   void parsePolyline (istream& fin, GDocument* doc);
00057   void parseSpline (istream& fin, GDocument* doc);
00058   void parseText (istream& fin, GDocument* doc);
00059   void parseCompoundObject (istream& fin, GDocument* doc);
00060   void buildDocument (GDocument *doc);
00061 
00062   void setProperties (GObject* obj, int pen_color, int style, int thickness,
00063                       int area_fill, int fill_color);
00064 
00065   float fig_resolution;
00066   int coordinate_system;
00067   int version;
00068   QIntDict<QColor> colorTable;
00069 
00070   // An object and the depth. Used for sorting objects
00071   // in the object list
00072   struct GObjectListItem
00073   {
00074       GObjectListItem() : object(0L) {} // for QValueList
00075 
00076       GObjectListItem( int d, GObject * obj ) :
00077           object(obj), depth(d) {}
00078 
00079       GObject * object;
00080       int depth;
00081       bool operator < (const GObjectListItem & item ) const
00082       {
00083           // We want to sort by decreasing depths
00084           return depth > item.depth;
00085       }
00086       bool operator == (const GObjectListItem & item ) const
00087       {
00088           return depth == item.depth;
00089       }
00090   };
00091   QValueList<GObjectListItem> objList;
00092 };
00093 
00094 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys