r18284 by fschmid - Fixed Bug #11533: PUB import crashes Scribus

scribus-commit scribus-commit at lists.scribus.net
Mon May 20 21:36:27 UTC 2013


Author: fschmid
Date: Mon May 20 21:36:26 2013
New Revision: 18284

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18284
Log:
Fixed Bug #11533: PUB import crashes Scribus

Modified:
    trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
    trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp

Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18284&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.cpp Mon May 20 21:36:26 2013
@@ -191,9 +191,9 @@
 				ite->updateGradientVectors();
 			}
 			Elements->append(ite);
-		}
-		if (groupStack.count() != 0)
-			groupStack.top().Items.append(ite);
+			if (groupStack.count() != 0)
+				groupStack.top().Items.append(ite);
+		}
 		tmpSel->clear();
 	}
 }
@@ -1073,7 +1073,9 @@
 		QString gradMode = "normal";
 		if (m_style["libmspub:shade"])
 			gradMode = QString(m_style["libmspub:shade"]->getStr().cstr());
-		if (gradMode == "normal")
+		else if (m_style["draw:style"])
+			gradMode = QString(m_style["draw:style"]->getStr().cstr());
+		if ((gradMode == "normal") || (gradMode == "linear"))
 		{
 			int angle = 0;
 			if (m_style["draw:angle"])
@@ -1095,6 +1097,38 @@
 			ite->fill_gradient = currentGradient;
 			ite->GrType = 6;
 		}
+		else if (gradMode == "radial")
+		{
+			double h = ite->height();
+			double w = ite->width();
+			double cx = 0.0;
+			double cy = 0.0;
+			if (m_style["svg:cx"])
+				cx = m_style["svg:cx"]->getDouble();
+			if (m_style["svg:cy"])
+				cy = m_style["svg:cy"]->getDouble();
+			ite->setGradientVector(cx, cy, w, h / 2.0, cx, cy, 1, 0);
+			ite->fill_gradient = currentGradient;
+			ite->GrType = 7;
+		}
+		else if (gradMode == "square")
+		{
+			double cx = 0.0;
+			double cy = 0.0;
+			if (m_style["svg:cx"])
+				cx = m_style["svg:cx"]->getDouble();
+			if (m_style["svg:cy"])
+				cy = m_style["svg:cy"]->getDouble();
+			FPoint cp = FPoint(cx, cy);
+			ite->setDiamondGeometry(FPoint(0, 0), FPoint(ite->width(), 0), FPoint(ite->width(), ite->height()), FPoint(0, ite->height()), cp);
+			ite->fill_gradient.clearStops();
+			QList<VColorStop*> colorStops = currentGradient.colorStops();
+			for( int a = 0; a < colorStops.count() ; a++ )
+			{
+				ite->fill_gradient.addStop(colorStops[a]->color, 1.0 - colorStops[a]->rampPoint, colorStops[a]->midPoint, colorStops[a]->opacity, colorStops[a]->name, colorStops[a]->shade);
+			}
+			ite->GrType = 10;
+		}
 		else if (gradMode == "center")
 		{
 			QString center = "top-left";
@@ -1117,7 +1151,6 @@
 				ite->fill_gradient.addStop(colorStops[a]->color, 1.0 - colorStops[a]->rampPoint, colorStops[a]->midPoint, colorStops[a]->opacity, colorStops[a]->name, colorStops[a]->shade);
 			}
 			ite->GrType = 10;
-
 		}
 		else if (gradMode == "shape")
 		{
@@ -1267,7 +1300,7 @@
 		Elements->append(ite);
 		if (groupStack.count() != 0)
 		{
-			groupStack.top().Items.takeAt(z-1);
+			groupStack.top().Items.takeLast();
 			groupStack.top().Items.append(nite);
 			groupStack.top().Items.append(ite);
 		}

Modified: trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18284&path=/trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpubplugin.cpp Mon May 20 21:36:26 2013
@@ -122,7 +122,7 @@
 		flags |= lfInteractive;
 		PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("importpub");
 		QString wdir = prefs->get("wdir", ".");
-		CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.pub *.pub);;All Files (*)");
+		CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), tr("All Supported Formats")+" (*.pub *.PUB);;All Files (*)");
 		if (diaf.exec())
 		{
 			fileName = diaf.selectedFile();




More information about the scribus-commit mailing list