Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 20005 → Rev 20004

/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
247,7 → 247,7
QDir::setCurrent(efp.path());
SvgStyle *gc = new SvgStyle;
QDomElement docElem = inpdoc.documentElement();
QSizeF wh = parseWidthHeight(docElem);
QSize wh = parseWidthHeight(docElem);
m_Doc = new ScribusDoc();
m_Doc->setup(0, 1, 1, 1, 1, "Custom", "Custom");
m_Doc->setPage(wh.width(), wh.height(), 0, 0, 0, 0, 0, 0, false, false);
271,7 → 271,7
if (points.size() > 3)
{
QTransform matrix;
QSizeF wh2 = parseWidthHeight(docElem);
QSize wh2 = parseWidthHeight(docElem);
double w2 = wh2.width();
double h2 = wh2.height();
addGraphicContext();
366,7 → 366,7
bool ret = false;
SvgStyle *gc = new SvgStyle;
QDomElement docElem = inpdoc.documentElement();
QSizeF wh = parseWidthHeight(docElem);
QSize wh = parseWidthHeight(docElem);
double width = wh.width();
double height = wh.height();
if (!interactive || (flags & LoadSavePlugin::lfInsertPage))
418,7 → 418,7
if (points.size() > 3)
{
QTransform matrix;
QSizeF wh2 = parseWidthHeight(docElem);
QSize wh2 = parseWidthHeight(docElem);
double w2 = wh2.width();
double h2 = wh2.height();
addGraphicContext();
964,9 → 964,9
return FPoint(x, y);
}
 
QSizeF SVGPlug::parseWidthHeight(const QDomElement &e)
QSize SVGPlug::parseWidthHeight(const QDomElement &e)
{
QSizeF size(550, 841);
QSize size(550, 841);
QString sw = e.attribute("width", "100%");
QString sh = e.attribute("height", "100%");
double w = 550, h = 841;
976,7 → 976,7
h = sh.endsWith("%") ? fromPercentage(sh) : parseUnit(sh);
if (!e.attribute("viewBox").isEmpty())
{
QRectF viewBox = parseViewBox(e);
QRect viewBox = parseViewBox(e);
double scw = (viewBox.width() > 0 && viewBox.height() > 0) ? viewBox.width() : size.width();
double sch = (viewBox.width() > 0 && viewBox.height() > 0) ? viewBox.height() : size.height();
w *= (sw.endsWith("%") ? scw : 1.0);
994,14 → 994,14
w = w / m * 842;
h = h / m * 842;
}
size.setWidth(w);
size.setHeight(h);
size.setWidth(qRound(w));
size.setHeight(qRound(h));
return size;
}
 
QRectF SVGPlug::parseViewBox(const QDomElement &e)
QRect SVGPlug::parseViewBox(const QDomElement &e)
{
QRectF box(0, 0, 0, 0);
QRect box(0, 0, 0, 0);
if ( !e.attribute( "viewBox" ).isEmpty() )
{
QString viewbox( e.attribute( "viewBox" ) );
/trunk/Scribus/scribus/plugins/import/svg/svgplugin.h
10,8 → 10,7
#include <QDomElement>
#include <QFont>
#include <QList>
#include <QRectF>
#include <QSizeF>
#include <QSize>
#include <QStack>
#include "pluginapi.h"
#include "loadsaveplugin.h"
244,8 → 243,8
bool isIgnorableNode( const QDomElement &e );
bool isIgnorableNodeName( const QString &n );
FPoint parseTextPosition(const QDomElement &e, const FPoint* pos = NULL);
QSizeF parseWidthHeight(const QDomElement &e);
QRectF parseViewBox(const QDomElement &e);
QSize parseWidthHeight(const QDomElement &e);
QRect parseViewBox(const QDomElement &e);
void parseDefs(const QDomElement &e);
void parseClipPath(const QDomElement &e);
void parseClipPathAttr(const QDomElement &e, FPointArray& clipPath);