filters

document.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, 2003 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 "document.h"
00027 
00028 Document::Document(const KoStore* in, QString fileOut):
00029         XmlParser(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     Config::instance()->setEmbeded(false);
00037     //analyse_config(config);
00038 }
00039 
00040 Document::~Document()
00041 {
00042     
00043 }
00044 
00045 void Document::analyse()
00046 {
00047     QDomNode balise;
00048     balise = init();
00049     kdDebug(30522) << "ANALYSE A DOC" << endl;
00050     _document.analyse(balise);
00051     kdDebug(30522) << "END ANALYSE" << endl;
00052 }
00053 
00054 void Document::generate()
00055 {
00056     if(_file.open(IO_WriteOnly))
00057     {
00058         kdDebug(30522) << "GENERATION" << endl;
00059         _out.setDevice(&_file);
00060         _document.generate(_out, !isEmbeded());
00061         //_out << getDocument();
00062         _file.close();
00063     }
00064     else
00065         kdDebug(30522) << "Can't use the file ..." << endl;
00066 }
KDE Home | KDE Accessibility Home | Description of Access Keys