Subversion Repositories Scribus

Rev

Rev 5122 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
403 Franz 7
/***************************************************************************
8
 *   Copyright (C) 2004 by Riku Leino                                      *
1184 tsoots 9
 *   tsoots@gmail.com                                                      *
403 Franz 10
 *                                                                         *
11
 *   This program is free software; you can redistribute it and/or modify  *
12
 *   it under the terms of the GNU General Public License as published by  *
13
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 *   (at your option) any later version.                                   *
15
 *                                                                         *
16
 *   This program is distributed in the hope that it will be useful,       *
17
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19
 *   GNU General Public License for more details.                          *
20
 *                                                                         *
21
 *   You should have received a copy of the GNU General Public License     *
22
 *   along with this program; if not, write to the                         *
23
 *   Free Software Foundation, Inc.,                                       *
24
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
25
 ***************************************************************************/
26
 
364 Franz 27
#include "htmlim.h"
5130 cbradney 28
//#include "htmlim.moc"
838 cbradney 29
#include <qobject.h>
364 Franz 30
#include <qstring.h>
31
#include <qstringlist.h>
32
 
399 Franz 33
#ifdef HAVE_XML
34
 
2986 craig 35
#include "scribusstructs.h"
713 cbradney 36
#include "gtparagraphstyle.h" // Style for paragraph based formatting.
37
#include "gtframestyle.h"
364 Franz 38
 
39
QString FileFormatName()
40
{
41
    return QObject::tr("HTML Files");
42
}
43
 
44
QStringList FileExtensions()
45
{
46
    QStringList endings(QObject::tr("html"));
47
        endings << QString("htm");
48
        return endings;
49
}
50
 
51
void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer)
52
{
456 fschmid 53
        HTMLIm* him = new HTMLIm(filename, encoding, writer, textOnly);
364 Franz 54
        delete him;
55
}
56
 
57
/******** Class HTMLIm ************************************/
58
 
456 fschmid 59
HTMLIm::HTMLIm(QString fname, QString coding, gtWriter *w, bool textOnly)
364 Franz 60
{
61
        filename = fname;
456 fschmid 62
        encoding = coding;
364 Franz 63
        writer = w;
64
        gtFrameStyle *fstyle = writer->getDefaultStyle();
65
        pstyle = new gtParagraphStyle(*fstyle);
66
        pstyle->setName("HTML_default");
403 Franz 67
//      defaultFontSize = pstyle->getFont()->getSize();
68
        importText(textOnly);
364 Franz 69
        delete pstyle;
70
}
71
 
403 Franz 72
void HTMLIm::importText(bool textOnly)
364 Franz 73
{
403 Franz 74
        HTMLReader* handler = new HTMLReader(pstyle, writer, textOnly);
399 Franz 75
        handler->parse(filename);
364 Franz 76
        delete handler;
77
}
78
 
79
HTMLIm::~HTMLIm()
80
{
81
 
82
}
399 Franz 83
 
84
#endif // HAVE_XML