filters

xml2latexparser.cpp
1/* TODO : Manage File problems !
2 */
3/*
4** A program to convert the XML rendered by KWord into LATEX.
5**
6** Copyright (C) 2000 Robert JACOLIN
7**
8** This library is free software; you can redistribute it and/or
9** modify it under the terms of the GNU Library General Public
10** License as published by the Free Software Foundation; either
11** version 2 of the License, or (at your option) any later version.
12**
13** This library is distributed in the hope that it will be useful,
14** but WITHOUT ANY WARRANTY; without even the implied warranty of
15** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16** Library General Public License for more details.
17**
18** To receive a copy of the GNU Library General Public License, write to the
19** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21**
22*/
23
24#include <kdebug.h>
25
26#include "xml2latexparser.h"
27
28Xml2LatexParser::Xml2LatexParser(const KoStore* in, TQString fileOut, Config* config):
29 XmlParser(config, in), _file(fileOut), _in( in )
30{
31 //kdDebug(30522) << fileIn.latin1() << endl;
32 kdDebug(30522) << fileOut.latin1() << endl;
33 _filename = fileOut;
34 //setFileHeader(_fileHeader);
35 setRoot(&_document);
36}
37
38void Xml2LatexParser::analyse()
39{
40 TQDomNode balise;
41 balise = init();
42 //balise = getChild(balise, "DOC");
43 kdDebug(30522) <<"HEADER -> PAPER" << endl;
44 FileHeader::instance()->analysePaper(getChild(balise, "PAPER"));
45 kdDebug(30522) <<"HEADER -> ATTRIBUTES" << endl;
46 FileHeader::instance()->analyseAttributs(getChild(balise, "ATTRIBUTES"));
47 kdDebug(30522) <<"HEADER -> FRAMESETS" << endl;
48 _document.analyse(getChild(balise, "FRAMESETS"));
49 kdDebug(30522) <<"HEADER -> END FRAMESETS" << endl;
50 //kdDebug(30522) <<"HEADER -> STYLES" << endl;
51 //
52 kdDebug(30522) <<"HEADER -> PICTURES" << endl;
53 _document.analysePixmaps(getChild(balise, "PICTURES"));
54 //kdDebug(30522) <<"HEADER -> SERIALL" << endl;
55 kdDebug(30522) << "END ANALYSE" << endl;
56}
57
58void Xml2LatexParser::generate()
59{
60 if(_file.open(IO_WriteOnly))
61 {
62 kdDebug(30522) << "GENERATION" << endl;
63 _out.setDevice(&_file);
64 if(!Config::instance()->isEmbeded())
65 FileHeader::instance()->generate(_out);
66 _document.generate(_out, !Config::instance()->isEmbeded());
67 //_out << getDocument();
68 _file.close();
69 }
70 else
71 kdDebug(30522) << "Can't use the file ..." << endl;
72}
This class hold all parameters and configuration from a file or from the filter configuration dialog ...
This class supply some convenients methods to access to a DOM tree.