Back to index

scribus-ng  1.3.4.dfsg+svn20071115
htmlim.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008  *   Copyright (C) 2004 by Riku Leino                                      *
00009  *   tsoots@gmail.com                                                      *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This program is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019  *   GNU General Public License for more details.                          *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU General Public License     *
00022  *   along with this program; if not, write to the                         *
00023  *   Free Software Foundation, Inc.,                                       *
00024  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00025  ***************************************************************************/
00026 
00027 #include "htmlim.h"
00028 //#include "htmlim.moc"
00029 #include <qobject.h>
00030 #include <qstring.h>
00031 #include <qstringlist.h>
00032 
00033 #ifdef HAVE_XML
00034 
00035 #include "scribusstructs.h"
00036 #include "gtparagraphstyle.h" // Style for paragraph based formatting.
00037 #include "gtframestyle.h"
00038 
00039 QString FileFormatName()
00040 {
00041     return QObject::tr("HTML Files");
00042 }
00043 
00044 QStringList FileExtensions()
00045 {
00046     QStringList endings(QObject::tr("html"));
00047        endings << QString("htm");
00048        return endings;
00049 }
00050 
00051 void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer)
00052 {
00053        HTMLIm* him = new HTMLIm(filename, encoding, writer, textOnly);
00054        delete him;
00055 }
00056 
00057 /******** Class HTMLIm ************************************/
00058 
00059 HTMLIm::HTMLIm(QString fname, QString coding, gtWriter *w, bool textOnly)
00060 {
00061        filename = fname;
00062        encoding = coding;
00063        writer = w;
00064        gtFrameStyle *fstyle = writer->getDefaultStyle();
00065        pstyle = new gtParagraphStyle(*fstyle);
00066        pstyle->setName("HTML_default");
00067 //     defaultFontSize = pstyle->getFont()->getSize();
00068        importText(textOnly);
00069        delete pstyle;
00070 }
00071 
00072 void HTMLIm::importText(bool textOnly)
00073 {
00074        HTMLReader* handler = new HTMLReader(pstyle, writer, textOnly);
00075        handler->parse(filename);
00076        delete handler;
00077 }
00078 
00079 HTMLIm::~HTMLIm()
00080 {
00081 
00082 }
00083 
00084 #endif // HAVE_XML