Subversion Repositories Scribus

Rev

Rev 11918 | Rev 19105 | Go to most recent revision | 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.,                                       *
18122 mrdocs 24
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
403 Franz 25
 ***************************************************************************/
26
 
364 Franz 27
#include "htmlim.h"
5130 cbradney 28
//#include "htmlim.moc"
10223 cbradney 29
#include <QObject>
30
#include <QString>
31
#include <QStringList>
364 Franz 32
 
11918 jghali 33
#ifndef HAVE_XML
34
#error The htmlim plugin requires libxml to build
35
#endif
399 Franz 36
 
2986 craig 37
#include "scribusstructs.h"
713 cbradney 38
#include "gtparagraphstyle.h" // Style for paragraph based formatting.
39
#include "gtframestyle.h"
364 Franz 40
 
41
QString FileFormatName()
42
{
43
    return QObject::tr("HTML Files");
44
}
45
 
46
QStringList FileExtensions()
47
{
48
    QStringList endings(QObject::tr("html"));
49
        endings << QString("htm");
50
        return endings;
51
}
52
 
53
void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer)
54
{
456 fschmid 55
        HTMLIm* him = new HTMLIm(filename, encoding, writer, textOnly);
364 Franz 56
        delete him;
57
}
58
 
59
/******** Class HTMLIm ************************************/
60
 
456 fschmid 61
HTMLIm::HTMLIm(QString fname, QString coding, gtWriter *w, bool textOnly)
364 Franz 62
{
63
        filename = fname;
456 fschmid 64
        encoding = coding;
364 Franz 65
        writer = w;
66
        gtFrameStyle *fstyle = writer->getDefaultStyle();
67
        pstyle = new gtParagraphStyle(*fstyle);
68
        pstyle->setName("HTML_default");
403 Franz 69
//      defaultFontSize = pstyle->getFont()->getSize();
70
        importText(textOnly);
364 Franz 71
        delete pstyle;
72
}
73
 
403 Franz 74
void HTMLIm::importText(bool textOnly)
364 Franz 75
{
403 Franz 76
        HTMLReader* handler = new HTMLReader(pstyle, writer, textOnly);
399 Franz 77
        handler->parse(filename);
364 Franz 78
        delete handler;
79
}
80
 
81
HTMLIm::~HTMLIm()
82
{
83
 
84
}
399 Franz 85