r15172 by jghali - #9143: incorrect import of SVG files that contain <a> tags

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 7 22:20:27 CEST 2010


Revision: 15172
Author: jghali
Date: 2010-06-07T20:10:36.675779Z
Commit message: #9143: incorrect import of SVG files that contain <a> tags

Changeset: 
M  /trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
M  /trunk/Scribus/scribus/plugins/import/svg/svgplugin.h

Diffs:
Index: scribus/plugins/import/svg/svgplugin.cpp
===================================================================
--- scribus/plugins/import/svg/svgplugin.cpp	(revision 15171)
+++ scribus/plugins/import/svg/svgplugin.cpp	(revision 15172)
@@ -1158,6 +1158,25 @@
 	}
 }
 
+QList<PageItem*> SVGPlug::parseA(const QDomElement &e)
+{
+	QList<PageItem*> aElements;
+	for ( QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling() )
+	{
+		QDomElement b = n.toElement();
+		if( b.isNull() || isIgnorableNode(b) )
+			continue;
+		SvgStyle svgStyle;
+		parseStyle( &svgStyle, b);
+		if (!svgStyle.Display) 
+			continue;
+		QList<PageItem*> el = parseElement(b);
+		for (int ec = 0; ec < el.count(); ++ec)
+			aElements.append(el.at(ec));
+	}
+	return aElements;
+}
+
 QList<PageItem*> SVGPlug::parseGroup(const QDomElement &e)
 {
 	FPointArray clipPath;
@@ -1285,6 +1304,8 @@
 	}
 	if( STag == "defs" )
 		parseDefs(e);
+	else if ( STag == "a" )
+		GElements = parseA(e);
 	else if( STag == "switch" )
 		GElements = parseSwitch(e);
 	else if( STag == "symbol" )
Index: scribus/plugins/import/svg/svgplugin.h
===================================================================
--- scribus/plugins/import/svg/svgplugin.h	(revision 15171)
+++ scribus/plugins/import/svg/svgplugin.h	(revision 15172)
@@ -242,6 +242,7 @@
 	void parseDefs(const QDomElement &e);
 	void parseClipPath(const QDomElement &e);
 	void parseClipPathAttr(const QDomElement &e, FPointArray& clipPath);
+	QList<PageItem*> parseA(const QDomElement &e);
 	QList<PageItem*> parseGroup(const QDomElement &e);
 	QList<PageItem*> parseElement(const QDomElement &e);
 	QList<PageItem*> parseCircle(const QDomElement &e);




More information about the scribus-commit mailing list