filters

xml2latexparser.cc

00001 /* TODO : Manage File problems !
00002  */
00003 /*
00004 ** A program to convert the XML rendered by KWord into LATEX.
00005 **
00006 ** Copyright (C) 2000 Robert JACOLIN
00007 **
00008 ** This library is free software; you can redistribute it and/or
00009 ** modify it under the terms of the GNU Library General Public
00010 ** License as published by the Free Software Foundation; either
00011 ** version 2 of the License, or (at your option) any later version.
00012 **
00013 ** This library is distributed in the hope that it will be useful,
00014 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 ** Library General Public License for more details.
00017 **
00018 ** To receive a copy of the GNU Library General Public License, write to the
00019 ** Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020  * Boston, MA 02110-1301, USA.
00021 **
00022 */
00023 
00024 #include <kdebug.h>
00025 
00026 #include "xml2latexparser.h"
00027 
00028 Xml2LatexParser::Xml2LatexParser(const KoStore* in, QString fileOut, Config* config):
00029         XmlParser(config, in), _file(fileOut), _in( in )
00030 {
00031     //kdDebug(30522) << fileIn.latin1() << endl;
00032     kdDebug(30522) << fileOut.latin1() << endl;
00033     _filename = fileOut;
00034     //setFileHeader(_fileHeader);
00035     setRoot(&_document);
00036 }
00037 
00038 void Xml2LatexParser::analyse()
00039 {
00040     QDomNode balise;
00041     balise = init();
00042     //balise = getChild(balise, "DOC");
00043     kdDebug(30522) <<"HEADER -> PAPER" << endl;
00044     FileHeader::instance()->analysePaper(getChild(balise, "PAPER"));
00045     kdDebug(30522) <<"HEADER -> ATTRIBUTES" << endl;
00046     FileHeader::instance()->analyseAttributs(getChild(balise, "ATTRIBUTES"));
00047     kdDebug(30522) <<"HEADER -> FRAMESETS" << endl;
00048     _document.analyse(getChild(balise, "FRAMESETS"));
00049     kdDebug(30522) <<"HEADER -> END FRAMESETS" << endl;
00050     //kdDebug(30522) <<"HEADER -> STYLES" << endl;
00051     //
00052     kdDebug(30522) <<"HEADER -> PICTURES" << endl;
00053     _document.analysePixmaps(getChild(balise, "PICTURES"));
00054     //kdDebug(30522) <<"HEADER -> SERIALL" << endl;
00055     kdDebug(30522) << "END ANALYSE" << endl;
00056 }
00057 
00058 void Xml2LatexParser::generate()
00059 {
00060     if(_file.open(IO_WriteOnly))
00061     {
00062         kdDebug(30522) << "GENERATION" << endl;
00063         _out.setDevice(&_file);
00064         if(!Config::instance()->isEmbeded())
00065             FileHeader::instance()->generate(_out);
00066         _document.generate(_out, !Config::instance()->isEmbeded());
00067         //_out << getDocument();
00068         _file.close();
00069     }
00070     else
00071         kdDebug(30522) << "Can't use the file ..." << endl;
00072 }
KDE Home | KDE Accessibility Home | Description of Access Keys