Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 402 → Rev 403

/trunk/Scribus/ChangeLogCVS
1,16 → 1,18
Changes since 1.2
 
03.09.2004
* bug #1028: Crash when editing a text frame with spaces at the beginning in Block mode
* feature #1024: Added Hyphenation Patterns for Afrikaans
* feature #1026: Danish translation - wrong qm-file
 
29.08.2004
* bug # 869: oriantation setting wrong displayed
* bug # 869: oriantation setting wrong displayed
* bug #1009: SuSE Patches for scribus
* bug #1011: Serious problems with pasting copied content from some applications.
* feature #1010: Update of russian translation. many fixes
* feature #1013: middle mouse button refreshes screen when you use it to paste text
* feature #1017: Norwegian Bokmaal Translation for 1.2
* bug # 869: oriantation setting wrong displayed
 
28.08.2004
* feature # 500: Create new documentation website for 1.2 release
/trunk/Scribus/scribus/gtaction.cpp
228,7 → 228,7
vg.First = pstyle->getFirstLineIndent();
vg.Avor = pstyle->getSpaceAbove();
vg.Anach = pstyle->getSpaceBelow();
vg.Font = font->getName();
vg.Font = validateFont(font);
vg.FontSize = font->getSize();
vg.TabValues.clear();
QValueList<double> *tabs = pstyle->getTabValues();
/trunk/Scribus/scribus/po/scribus.da_DK.ts
3,7 → 3,7
<name>@@translation</name>
<message>
<source>Project-Id-Version: Scribus 1.2</source>
<translation type="obsolete">Revision-Date: 2004-08-17 19:50:00 CET
<translation type="obsolete">Revision-Date: 2004-09-03 09:35:00 CET
Last-Translator: Morten Langlo &lt;mlanglo@mail.dk&gt;</translation>
</message>
</context>
9278,7 → 9278,7
<name>SideBar</name>
<message>
<source>No Style</source>
<translation>Ingen typografier</translation>
<translation>Ingen typografi</translation>
</message>
</context>
<context>
9285,7 → 9285,7
<name>Spalette</name>
<message>
<source>No Style</source>
<translation>Ingen typografier</translation>
<translation>Ingen typografi</translation>
</message>
</context>
<context>
/trunk/Scribus/scribus/qm/scribus.da.qm
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/Scribus/scribus/gtfont.cpp
80,6 → 80,12
weightIndex = 0;
slantIndex = 1;
widthIndex = 2;
smallestIndex = -1;
biggestIndex = - 1;
index = -1;
tmpWeightIndex = -1;
tmpSlantIndex = -1;
tmpWidthIndex = -1;
}
 
gtFont::gtFont(const gtFont& f)
450,27 → 456,37
 
void gtFont::parseName()
{
int smallestIndex = -1;
int biggestIndex = - 1;
int index = -1;
smallestIndex = -1;
biggestIndex = - 1;
index = -1;
tmpWeightIndex = -1;
tmpSlantIndex = -1;
tmpWidthIndex = -1;
parseWeight();
parseSlant();
parseWidth();
parseFamily();
 
 
}
 
void gtFont::parseWeight()
{
bool found = false;
int tmpWeightIndex = -1;
int tmpSlantIndex = -1;
int tmpWidthIndex = -1;
for (int i = 1; i < FontWeightMAX; ++i)
{
index = name.find(fontWeights[i]); // f.e. Demi Bold
index = find(name, fontWeights[i]); // f.e. Demi Bold
QString tmpWeight = "";
if ((index == -1) && (fontWeights[i].find(" ") != -1))
if ((index == -1) && (fontWeights[i].find(" ") != -1) && (fontWeights[i].find(" ") != 1))
{
QString fw2 = fontWeights[i];
fw2.replace(" ", "-"); // f.e. Demi-Bold
index = name.find(fw2);
index = find(name, fw2);
if (index == -1)
{
fw2 = fontWeights[i];
fw2.replace(" ", ""); // f.e. DemiBold
index = name.find(fw2);
index = find(name, fw2);
if (index == -1)
{
fw2 = fontWeights[i];
479,7 → 495,7
fw2.replace(" H", " h");
fw2.replace(" L", " l");
fw2.replace(" ", "");
index = name.find(fw2);
index = find(name, fw2);
if (index != -1)
tmpWeight = fw2;
}
507,11 → 523,14
}
if (!found)
weight = fontWeights[NO_WEIGHT];
}
 
found = false;
void gtFont::parseSlant()
{
bool found = false;
for (int i = 1; i < FontSlantMAX; ++i)
{
index = name.find(fontSlants[i]);
index = find(name, fontSlants[i]);
if (index != -1)
{
slant = fontSlants[i];
526,22 → 545,25
}
if (!found)
slant = fontSlants[NO_SLANT];
}
 
found = false;
void gtFont::parseWidth()
{
bool found = false;
for (int i = 1; i < FontWidthMAX; ++i)
{
index = name.find(fontWidths[i]);
index = find(name, fontWidths[i]);
QString tmpWidth = "";
if ((index == -1) && (fontWidths[i].find(" ") != -1))
if ((index == -1) && (fontWidths[i].find(" ") != -1) && (fontWidths[i].find(" ") != 1))
{
QString fw2 = fontWidths[i];
fw2.replace(" ", "-");
index = name.find(fw2);
index = find(name, fw2);
if (index == -1)
{
fw2 = fontWidths[i];
fw2.replace(" ", "");
index = name.find(fw2);
index = find(name, fw2);
if (index == -1)
{
fw2 = fontWidths[i];
550,7 → 572,7
fw2.replace(" H", " h");
fw2.replace(" L", " l");
fw2.replace(" ", "");
index = name.find(fw2);
index = find(name, fw2);
if (index != -1)
tmpWidth = fw2;
}
578,6 → 600,10
}
if (!found)
width = fontWidths[NO_WIDTH];
}
void gtFont::parseFamily()
{
if (tmpWeightIndex < tmpSlantIndex)
{
weightIndex = 0;
620,6 → 646,7
widthIndex = -1;
slantIndex = 0;
}
 
if (smallestIndex == -1)
family = name;
else
627,10 → 654,29
if (biggestIndex == -1)
append = "";
else
append = name.right(name.length() - biggestIndex);
append = name.right(name.length() - biggestIndex - 1);
family = family.stripWhiteSpace();
}
 
int gtFont::find(const QString& where, const QString& what)
{
QString realWhat = " " + what;
int index = where.find(realWhat); // f.e. Demi Bold
if (index != -1)
{
if (index + realWhat.length() != where.length())
if (where[index + realWhat.length() + 1] != " ")
{
int secIndex = where.find(" ", index + 1);
if (secIndex == -1)
index = -1;
else
index = find(where.right(where.length() - secIndex), what);
}
}
return index;
}
 
gtFont::~gtFont()
{
 
/trunk/Scribus/scribus/libabout/about.cpp
56,7 → 56,7
tabLayout1->addWidget( PixmapLabel1 );
BuildID = new QLabel( tab, "BB" );
BuildID->setAlignment(Qt::AlignCenter);
QString bu = tr("%1. %2 %3 ").arg("02").arg("September").arg("2004");
QString bu = tr("%1. %2 %3 ").arg("03").arg("September").arg("2004");
#ifdef HAVE_CMS
bu += "C";
#else
166,6 → 166,7
"<tr><td> </td><td> </td></tr>" +
"<tr><td><b>" + tr("Norwegian:").utf8() + "</b></td><td></td></tr>" +
"<tr><td>Klaus Ade Johnstad</td><td>klaus@astro.uio.no</td></tr>" +
"<tr><td>Axel Bojer</td><td>axelb@skolelinux.no</td></tr>" +
"<tr><td>Johannes Wilm</td><td>j@indymedia.no</td></tr>" +
"<tr><td> </td><td> </td></tr>" +
"<tr><td><b>" + tr("English:").utf8() + "</b></td><td></td></tr>" +
191,8 → 192,7
"<tr><td><b>" + tr("Basque:").utf8() + "</b></td><td></td></tr>" +
"<tr><td>Pablo Saratxaga</td><td>pablo@mandrakesoft.com</td></tr>" +
"<tr><td> </td><td> </td></tr>" +
"<tr><td> </td><td> </td></tr>" +
"<tr><td><b>Swedish</b></td><td></td></tr>" +
"<tr><td><b>" + tr("Swedish:").utf8() + "</b></td><td></td></tr>" +
"<tr><td>Göran Bondeson</td><td>goran@bondeson.net</td></tr>" +
"<tr><td> </td><td> </td></tr>" +
"</table>"));
/trunk/Scribus/scribus/gtfont.h
102,8 → 102,19
int weightIndex;
int slantIndex;
int widthIndex;
int smallestIndex;
int biggestIndex;
int index;
int tmpWeightIndex;
int tmpSlantIndex;
int tmpWidthIndex;
void initArrays();
void parseName();
void parseWeight();
void parseSlant();
void parseWidth();
void parseFamily();
int find(const QString& where, const QString& what);
public:
static const QString fontWeights[];
static const QString fontSlants[];
/trunk/Scribus/scribus/scribus.cpp
1657,7 → 1657,7
}
else
{
while (b->Ptext.at(b->CPos)->cstyle & 256)
while ((b->Ptext.at(b->CPos)->cstyle & 256) && (b->CPos > 0))
{
b->CPos--;
if (b->CPos == 0)
/trunk/Scribus/scribus/plugins/gettext/htmlim/htmlim.h
1,3 → 1,23
/***************************************************************************
* Copyright (C) 2004 by Riku Leino *
* tsoots@welho.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#ifndef HTMLIM_H
#define HTMLIM_H
 
19,14 → 39,14
class HTMLIm
{
public:
HTMLIm(QString fname, gtWriter *w);
HTMLIm(QString fname, gtWriter *w, bool textOnly);
~HTMLIm();
private:
QString filename;
gtWriter *writer;
gtParagraphStyle *pstyle;
int defaultFontSize;
void importText();
// int defaultFontSize;
void importText(bool textOnly);
};
 
#endif // HAVE_XML
/trunk/Scribus/scribus/plugins/gettext/htmlim/htmlreader.cpp
1,5 → 1,21
/***************************************************************************
* Riku Leino, tsoots@welho.com *
* Copyright (C) 2004 by Riku Leino *
* tsoots@welho.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#include "htmlreader.h"
12,7 → 28,7
 
extern htmlSAXHandlerPtr mySAXHandler;
 
HTMLReader::HTMLReader(gtParagraphStyle *ps, gtWriter *w)
HTMLReader::HTMLReader(gtParagraphStyle *ps, gtWriter *w, bool textOnly)
{
pstyle = ps;
defaultColor = ps->getFont()->getColor();
30,12 → 46,17
inCenter = false;
writer = w;
href = "";
extLinks = "";
extIndex = 1;
listLevel = -1;
inOL = false;
nextItemNumber = 1;
wasInOL = false;
inUL = false;
wasInUL = false;
inLI = false;
addedLI = false;
lastCharWasSpace = false;
noFormatting = textOnly;
hreader = this;
}
 
44,9 → 65,11
pstylec = new gtParagraphStyle(*pstyle);
pstylec->setAlignment(CENTER);
pstylec->setName("HTML_center");
pstyleli = new gtParagraphStyle(*pstyle);
gtParagraphStyle* pstyleli = new gtParagraphStyle(*pstyle);
pstyleli->setIndent(pstyleli->getIndent()+50.0);
pstyleli->setName("HTML_li");
pstyleli->setName("HTML_li_level-0");
listStyles.push_back(pstyleli);
nextItemNumbers.push_back(1);
pstyleh4 = new gtParagraphStyle(*pstyle);
pstyleh4->getFont()->setSize(pstyle->getFont()->getSize() + 10);
pstyleh4->getFont()->setWeight(BOLD);
92,7 → 115,6
attrs->append(QString((char*)*cur), NULL, QString((char*)*cur), QString((char*)*(cur + 1)));
}
hreader->startElement(NULL, NULL, *name, *attrs);
}
 
bool HTMLReader::startElement(const QString&, const QString&, const QString &name, const QXmlAttributes &attrs)
117,9 → 139,29
}
}
else if (name == "ul")
{
++listLevel;
if (static_cast<int>(listStyles.size()) < (listLevel + 1))
createListStyle();
inUL = true;
if (inOL)
{
inOL = false;
wasInOL = true;
}
}
else if (name == "ol")
{
++listLevel;
if (static_cast<int>(listStyles.size()) < (listLevel + 1))
createListStyle();
inOL = true;
if (inUL)
{
inUL = false;
wasInUL = true;
}
}
else if (name == "li")
inLI = true;
else if (name == "h1")
179,27 → 221,25
if (inBody)
{
QString tmp = "";
bool add = true;
/* bool add = true; */
bool fcis = ch.left(1) == " ";
bool lcis = ch.right(1) == " ";
if (inPre)
{
tmp = ch;
if (tmp.left(1) == "\n")
tmp = tmp.right(tmp.length() - 2);
}
else
{
for (uint i = 0; i < ch.length(); ++i)
{
if (ch.at(i) != "\n")
tmp += ch.at(i);
}
tmp = tmp.simplifyWhiteSpace();
}
tmp = ch.simplifyWhiteSpace();
 
if (!lastCharWasSpace)
if (fcis)
tmp = " " + tmp;
 
if (lcis)
tmp = tmp + " ";
bool lastCharWasSpace = lcis;
lastCharWasSpace = lcis;
if ((inLI) && (!addedLI))
{
if (inUL)
206,16 → 246,20
tmp = "- " + tmp;
else if (inOL)
{
tmp = QString("%1. ").arg(nextItemNumber) + tmp;
++nextItemNumber;
tmp = QString("%1. ").arg(nextItemNumbers[listLevel]) + tmp;
++nextItemNumbers[listLevel];
}
addedLI = true;
}
 
if (inP)
if (noFormatting)
writer->append(tmp);
else if (inP)
writer->append(tmp, pstylep);
else if (inLI)
writer->append(tmp, pstyleli);
{
writer->append(tmp, listStyles[listLevel]);
}
else if (inH1)
writer->append(tmp, pstyleh1);
else if (inH2)
258,10 → 302,13
else if (name == "a")
{
toggleEffect(UNDERLINE);
if ((href != "") || (href.find("//") != -1) || (href.find("mailto:") != -1))
if ((href != "") && ((href.find("//") != -1) ||
(href.find("mailto:") != -1) || (href.find("www") != -1)))
{
href = href.remove("mailto:");
writer->append(" ("+href+")", pstyle);
writer->append(QString(" [%1]").arg(extIndex), pstyle);
extLinks += QString("[%1] ").arg(extIndex) + href + "\n";
++extIndex;
}
href = "";
setDefaultColor();
269,14 → 316,66
}
else if (name == "ul")
{
inUL = false;
writer->append("\n");
if (listLevel == 0)
{
inUL = false;
inOL = false;
wasInUL = false;
wasInOL = false;
listLevel = -1;
}
else if (wasInOL)
{
inUL = false;
inOL = true;
wasInOL = false;
--listLevel;
}
else if (wasInUL)
{
inUL = true;
inOL = false;
wasInUL = false;
--listLevel;
}
else
--listLevel;
if (listLevel == -1)
writer->append("\n");
}
else if (name == "ol")
{
inOL = false;
nextItemNumber = 1;
writer->append("\n");
if (listLevel == 0)
{
inUL = false;
inOL = false;
wasInUL = false;
wasInOL = false;
listLevel = -1;
}
else if (wasInUL)
{
inOL = false;
inUL = true;
wasInUL = false;
nextItemNumbers[listLevel] = 1;
--listLevel;
}
else if (wasInOL)
{
inOL = true;
inUL = false;
wasInOL = false;
nextItemNumbers[listLevel] = 1;
--listLevel;
}
else
{
nextItemNumbers[listLevel] = 1;
--listLevel;
}
if (listLevel == -1)
writer->append("\n");
}
else if (name == "li")
{
334,7 → 433,8
{
pstyle->getFont()->toggleEffect(e);
pstylec->getFont()->toggleEffect(e);
pstyleli->getFont()->toggleEffect(e);
for (uint i = 0; i < listStyles.size(); ++i)
listStyles[i]->getFont()->toggleEffect(e);
pstyleh1->getFont()->toggleEffect(e);
pstyleh2->getFont()->toggleEffect(e);
pstyleh3->getFont()->toggleEffect(e);
348,7 → 448,8
{
pstyle->getFont()->setSlant(ITALIC);
pstylec->getFont()->setSlant(ITALIC);
pstyleli->getFont()->setSlant(ITALIC);
for (uint i = 0; i < listStyles.size(); ++i)
listStyles[i]->getFont()->setSlant(ITALIC);
pstyleh1->getFont()->setSlant(ITALIC);
pstyleh2->getFont()->setSlant(ITALIC);
pstyleh3->getFont()->setSlant(ITALIC);
362,7 → 463,8
{
pstyle->getFont()->setSlant(defaultSlant);
pstylec->getFont()->setSlant(defaultSlant);
pstyleli->getFont()->setSlant(defaultSlant);
for (uint i = 0; i < listStyles.size(); ++i)
listStyles[i]->getFont()->setSlant(defaultSlant);
pstyleh1->getFont()->setSlant(defaultSlant);
pstyleh2->getFont()->setSlant(defaultSlant);
pstyleh3->getFont()->setSlant(defaultSlant);
376,7 → 478,8
{
pstyle->getFont()->setColor("Blue");
pstylec->getFont()->setColor("Blue");
pstyleli->getFont()->setColor("Blue");
for (uint i = 0; i < listStyles.size(); ++i)
listStyles[i]->getFont()->setColor("Blue");
pstyleh1->getFont()->setColor("Blue");
pstyleh2->getFont()->setColor("Blue");
pstyleh3->getFont()->setColor("Blue");
390,7 → 493,8
{
pstyle->getFont()->setColor(defaultColor);
pstylec->getFont()->setColor(defaultColor);
pstyleli->getFont()->setColor(defaultColor);
for (uint i = 0; i < listStyles.size(); ++i)
listStyles[i]->getFont()->setColor(defaultColor);
pstyleh1->getFont()->setColor(defaultColor);
pstyleh2->getFont()->setColor(defaultColor);
pstyleh3->getFont()->setColor(defaultColor);
404,7 → 508,8
{
pstyle->getFont()->setWeight(BOLD);
pstylec->getFont()->setWeight(BOLD);
pstyleli->getFont()->setWeight(BOLD);
for (uint i = 0; i < listStyles.size(); ++i)
listStyles[i]->getFont()->setWeight(BOLD);
pstylecode->getFont()->setWeight(BOLD);
pstylep->getFont()->setWeight(BOLD);
pstylepre->getFont()->setWeight(BOLD);
414,7 → 519,8
{
pstyle->getFont()->setWeight(defaultWeight);
pstylec->getFont()->setWeight(defaultWeight);
pstyleli->getFont()->setWeight(defaultWeight);
for (uint i = 0; i < listStyles.size(); ++i)
listStyles[i]->getFont()->setWeight(defaultWeight);
pstylecode->getFont()->setWeight(REGULAR);
pstylep->getFont()->setWeight(defaultWeight);
pstylepre->getFont()->setWeight(defaultWeight);
422,37 → 528,47
 
void HTMLReader::parse(QString filename)
{
// xmlSAXUserParseFile(debugSAXHandler, NULL, filename.latin1());
htmlSAXParseFile(filename.latin1(), NULL, mySAXHandler, NULL);
htmlSAXParseFile(filename.latin1(), NULL, mySAXHandler, NULL);
}
 
void HTMLReader::createListStyle()
{
gtParagraphStyle* tmpStyle = new gtParagraphStyle(*listStyles[0]);
tmpStyle->setName(QString("HTML_li_level-%1").arg(listLevel + 1));
double indent = listStyles[0]->getIndent();
indent += 25 * (listLevel + 1);
tmpStyle->setIndent(indent);
listStyles.push_back(tmpStyle);
nextItemNumbers.push_back(1);
}
 
htmlSAXHandler mySAXHandlerStruct = {
NULL, // internalSubsetDebug,
NULL, // isStandaloneDebug,
NULL, // hasInternalSubsetDebug,
NULL, // hasExternalSubsetDebug,
NULL, // resolveEntityDebug,
NULL, // getEntityDebug,
NULL, // entityDeclDebug,
NULL, // notationDeclDebug,
NULL, // attributeDeclDebug,
NULL, // elementDeclDebug,
NULL, // unparsedEntityDeclDebug,
NULL, // setDocumentLocatorDebug,
NULL, // internalSubset,
NULL, // isStandalone,
NULL, // hasInternalSubset,
NULL, // hasExternalSubset,
NULL, // resolveEntity,
NULL, // getEntity,
NULL, // entityDecl,
NULL, // notationDecl,
NULL, // attributeDecl,
NULL, // elementDecl,
NULL, // unparsedEntityDecl,
NULL, // setDocumentLocator,
NULL, // startDocument,
NULL, // endDocument,
HTMLReader::startElement,
HTMLReader::endElement,
NULL, // referenceDebug,
NULL, // reference,
HTMLReader::characters,
NULL, // ignorableWhitespaceDebug,
NULL, // processingInstructionDebug,
NULL, // commentDebug,
NULL, // warningDebug,
NULL, // errorDebug,
NULL, // fatalErrorDebug,
NULL, // getParameterEntityDebug,
NULL, // cdataDebug,
NULL, // ignorableWhitespace,
NULL, // processingInstruction,
NULL, // comment,
NULL, // warning,
NULL, // error,
NULL, // fatalError,
NULL, // getParameterEntity,
NULL, // cdata,
NULL,
1
#ifdef HAVE_XML26
468,11 → 584,18
 
HTMLReader::~HTMLReader()
{
if (extLinks != "")
{
writer->append(QObject::tr("\nExternal Links\n"), pstyleh4);
writer->append(extLinks, pstyle);
}
for (uint i = 0; i < listStyles.size(); ++i)
delete listStyles[i];
delete pstylec;
delete pstyleli;
delete pstyleh1;
delete pstyleh2;
delete pstyleh3;
delete pstyleh4;
delete pstylecode;
delete pstylep;
delete pstylepre;
/trunk/Scribus/scribus/plugins/gettext/htmlim/htmlim.cpp
1,3 → 1,23
/***************************************************************************
* Copyright (C) 2004 by Riku Leino *
* tsoots@welho.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
 
#include "htmlim.h"
#include <qstring.h>
#include <qstringlist.h>
21,13 → 41,13
 
void GetText(QString filename, QString encoding, bool textOnly, gtWriter *writer)
{
HTMLIm* him = new HTMLIm(filename, writer);
HTMLIm* him = new HTMLIm(filename, writer, textOnly);
delete him;
}
 
/******** Class HTMLIm ************************************/
 
HTMLIm::HTMLIm(QString fname, gtWriter *w)
HTMLIm::HTMLIm(QString fname, gtWriter *w, bool textOnly)
{
filename = fname;
writer = w;
34,14 → 54,14
gtFrameStyle *fstyle = writer->getDefaultStyle();
pstyle = new gtParagraphStyle(*fstyle);
pstyle->setName("HTML_default");
defaultFontSize = pstyle->getFont()->getSize();
importText();
// defaultFontSize = pstyle->getFont()->getSize();
importText(textOnly);
delete pstyle;
}
 
void HTMLIm::importText()
void HTMLIm::importText(bool textOnly)
{
HTMLReader* handler = new HTMLReader(pstyle, writer);
HTMLReader* handler = new HTMLReader(pstyle, writer, textOnly);
handler->parse(filename);
delete handler;
}
/trunk/Scribus/scribus/plugins/gettext/htmlim/htmlreader.h
1,5 → 1,21
/***************************************************************************
* Riku Leino, tsoots@welho.com *
* Copyright (C) 2004 by Riku Leino *
* tsoots@welho.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef HTMLREADER_H
#define HTMLREADER_H
8,22 → 24,17
 
#ifdef HAVE_XML
 
#include <libxml/xmlmemory.h>
#include <vector>
 
#include <libxml/HTMLparser.h>
#include <libxml/HTMLtree.h>
#include <libxml/debugXML.h>
#include <libxml/xmlerror.h>
#include <libxml/globals.h>
 
#include <qobject.h>
#include <qdir.h>
#include <qstring.h>
#include <qxml.h>
#include <qstring.h>
 
#include <gtparagraphstyle.h>
#include <gtwriter.h>
 
class HTMLReader : public QXmlDefaultHandler
class HTMLReader
{
private:
QString currentDir;
33,10 → 44,14
QString defaultSlant;
QString templateCategory;
QString href;
QString extLinks;
int extIndex;
int listLevel;
std::vector<gtParagraphStyle*> listStyles;
std::vector<int> nextItemNumbers;
gtWriter *writer;
gtParagraphStyle *pstyle;
gtParagraphStyle *pstylec;
gtParagraphStyle *pstyleli;
gtParagraphStyle *pstyleh1;
gtParagraphStyle *pstyleh2;
gtParagraphStyle *pstyleh3;
45,8 → 60,9
gtParagraphStyle *pstylep;
gtParagraphStyle *pstylepre;
bool inOL;
int nextItemNumber;
bool wasInOL;
bool inUL;
bool wasInUL;
bool inLI;
bool addedLI;
bool inH1;
60,6 → 76,7
bool inPre;
bool inP;
bool lastCharWasSpace;
bool noFormatting;
void initPStyles();
void toggleEffect(FontEffect e);
void setItalicFont();
68,9 → 85,10
void setDefaultColor();
void setBoldFont();
void unSetBoldFont();
void createListStyle();
static HTMLReader* hreader;
public:
HTMLReader(gtParagraphStyle *ps, gtWriter *w);
HTMLReader(gtParagraphStyle *ps, gtWriter *w, bool textOnly);
~HTMLReader();
void parse(QString filename);
static void startElement(void *user_data, const xmlChar * fullname, const xmlChar ** atts);