moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kmplot / kmplot / kmplotio.h
blob238f3480e0308d29b23e4c407b10683b9db20059
1 /*
2 * KmPlot - a math. function plotter for the KDE-Desktop
4 * Copyright (C) 1998, 1999 Klaus-Dieter Möler
5 * 2000, 2002 kd.moeller@t-online.de
7 * This file is part of the KDE Project.
8 * KmPlot is part of the KDE-EDU Project.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #ifndef KMPLOTIO_H
27 #define KMPLOTIO_H
29 #include <kurl.h>
30 #include "xparser.h"
32 class QString;
33 class XParser;
35 /** @short This class manages the file operations load and save.
37 * @author Klaus-Dieter Möller & Matthias Meßmer
39 class KmPlotIO
41 public:
42 /// Nothing to do here; only static functions needed.
43 KmPlotIO( XParser *parser);
44 /// Empty.
45 ~KmPlotIO();
47 /**
48 * Store all information about the current saved plot in a xml file with the .fkt extension
49 * in the filename file.
50 * @param parser points to the parser instance.
51 * @param filename Name of the file which will be saved.
53 bool save( const KURL &url );
55 /**
56 * Read a kmpdoc xml file to restaure the settings of a previously saved plot
57 * @param parser points to the parser instance.
58 * @param filename name of file which will be opened
60 bool load( const KURL &url );
62 private:
63 /** Esay way to add a tag to the Dom tree
64 * @param &doc The document.
65 * @param parentTag The parent tag to support encapsulated tags.
66 * @param tagName The Name of the tag.
67 * @param tagValue The data between the opening and cloding tag.
69 void addTag( QDomDocument &doc, QDomElement &parentTag, const QString tagName, const QString tagValue );
70 /// Reads axes parameters from the node @a n.
71 /// @param n Node containing the options.
72 void parseAxes( const QDomElement &n );
73 /// Reads grid parameters from the node @a n.
74 /// @param n Node containing the options.
75 void parseGrid( const QDomElement &n );
76 /// Reads scale parameters from the node @a n.
77 /// @param n Node containing the options.
78 void parseScale( const QDomElement &n );
79 /// Reads function parameters from the node @a n.
80 /// @param parser points to the parser instance.
81 /// @param n Node containing the options.
82 void parseFunction( XParser *parser, const QDomElement &n );
83 /// Reads parameter values for a function from the node @a n.
84 /// @param parser points to the parser instance.
85 /// @param n Node containing the options.
86 /// @param ix Function index in the parser instance
87 void parseParameters( XParser *parser, const QDomElement &n, Ufkt &ufkt);
89 /// For KDE 3.3
90 void parseThreeDotThreeParameters( XParser *parser, const QDomElement &n, Ufkt &ufkt);
92 ///For KDE <3.3
93 /// This is the same as parseScale but is made for old Kmplot-files
94 void oldParseScale( const QDomElement & n );
95 /// This is the same as parseFunction but is made for old Kmplot-files
96 void oldParseFunction( XParser *parser, const QDomElement &n );
97 /// This is the same as parseAxes but is made for old Kmplot-files
98 void oldParseAxes( const QDomElement &n );
100 XParser *m_parser;
104 #endif