r18822 by fschmid - ODG-Importer: compleded support for Arrows

scribus-commit scribus-commit at lists.scribus.net
Tue Feb 18 19:46:56 UTC 2014


Author: fschmid
Date: Tue Feb 18 19:46:56 2014
New Revision: 18822

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18822
Log:
ODG-Importer: compleded support for Arrows

Modified:
    trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
    trunk/Scribus/scribus/plugins/import/odg/importodg.h

Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18822&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Tue Feb 18 19:46:56 2014
@@ -1324,8 +1324,10 @@
 					currStyle.dashName = AttributeValue(spe.attribute("draw:stroke-dash", ""));
 					currStyle.startMarkerName = AttributeValue(spe.attribute("draw:marker-start", ""));
 					currStyle.startMarkerWidth = AttributeValue(spe.attribute("draw:marker-start-width", ""));
+					currStyle.startMarkerCentered = AttributeValue(spe.attribute("draw:marker-start-center", ""));
 					currStyle.endMarkerName = AttributeValue(spe.attribute("draw:marker-end", ""));
 					currStyle.endMarkerWidth = AttributeValue(spe.attribute("draw:marker-end-width", ""));
+					currStyle.endMarkerCentered = AttributeValue(spe.attribute("draw:marker-end-center", ""));
 				}
 				else if (spe.tagName() == "style:paragraph-properties")
 				{
@@ -1401,10 +1403,14 @@
 					actStyle.startMarkerName = AttributeValue(currStyle.startMarkerName.value);
 				if (currStyle.startMarkerWidth.valid)
 					actStyle.startMarkerWidth = AttributeValue(currStyle.startMarkerWidth.value);
+				if (currStyle.startMarkerCentered.valid)
+					actStyle.startMarkerCentered = AttributeValue(currStyle.startMarkerCentered.value);
 				if (currStyle.endMarkerName.valid)
 					actStyle.endMarkerName = AttributeValue(currStyle.endMarkerName.value);
 				if (currStyle.endMarkerWidth.valid)
 					actStyle.endMarkerWidth = AttributeValue(currStyle.endMarkerWidth.value);
+				if (currStyle.endMarkerCentered.valid)
+					actStyle.endMarkerCentered = AttributeValue(currStyle.endMarkerCentered.value);
 				if (currStyle.stroke_dash_distance.valid)
 					actStyle.stroke_dash_distance = AttributeValue(currStyle.stroke_dash_distance.value);
 				if (currStyle.stroke_dash_dots1.valid)
@@ -1692,10 +1698,14 @@
 			tmpOStyle.startMarkerName = actStyle.startMarkerName.value;
 		if (actStyle.startMarkerWidth.valid)
 			tmpOStyle.startMarkerWidth = parseUnit(actStyle.startMarkerWidth.value);
+		if (actStyle.startMarkerCentered.valid)
+			tmpOStyle.startMarkerCentered = actStyle.startMarkerCentered.value == "true";
 		if (actStyle.endMarkerName.valid)
 			tmpOStyle.endMarkerName = actStyle.endMarkerName.value;
 		if (actStyle.endMarkerWidth.valid)
 			tmpOStyle.endMarkerWidth = parseUnit(actStyle.endMarkerWidth.value);
+		if (actStyle.endMarkerCentered.valid)
+			tmpOStyle.endMarkerCentered = actStyle.endMarkerCentered.value == "true";
 	}
 }
 
@@ -1920,7 +1930,11 @@
 				if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
 				{
 					double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
-					QPointF refP = QPointF(br.width() / 2.0, 0);
+					QPointF refP;
+					if (obState.startMarkerCentered)
+						refP = QPointF(br.width() / 2.0, br.height() / 2.0);
+					else
+						refP = QPointF(br.width() / 2.0, 0);
 					QTransform m;
 					m.translate(br.width() / 2.0, br.height() / 2.0);
 					m.rotate(r + 90);
@@ -1985,7 +1999,11 @@
 				if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
 				{
 					double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
-					QPointF refP = QPointF(br.width() / 2.0, 0);
+					QPointF refP;
+					if (obState.endMarkerCentered)
+						refP = QPointF(br.width() / 2.0, br.height() / 2.0);
+					else
+						refP = QPointF(br.width() / 2.0, 0);
 					QTransform m;
 					m.translate(br.width() / 2.0, br.height() / 2.0);
 					m.rotate(r + 90);

Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18822&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.h (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.h Tue Feb 18 19:46:56 2014
@@ -42,8 +42,10 @@
 	  markerPath(),
 	  startMarkerName(""),
 	  startMarkerWidth(0.0),
+	  startMarkerCentered(false),
 	  endMarkerName(""),
 	  endMarkerWidth(0.0),
+	  endMarkerCentered(false),
 	  stroke_dash_distance(0.0),
 	  stroke_dash_dots1(1),
 	  stroke_dash_dots1_length(0.0),
@@ -92,8 +94,10 @@
 	QPainterPath					markerPath;
 	QString							startMarkerName;
 	double							startMarkerWidth;
+	bool							startMarkerCentered;
 	QString							endMarkerName;
 	double							endMarkerWidth;
+	bool							endMarkerCentered;
 	double							stroke_dash_distance;
 	int								stroke_dash_dots1;
 	double							stroke_dash_dots1_length;
@@ -177,8 +181,10 @@
 		AttributeValue markerPath;
 		AttributeValue startMarkerName;
 		AttributeValue startMarkerWidth;
+		AttributeValue startMarkerCentered;
 		AttributeValue endMarkerName;
 		AttributeValue endMarkerWidth;
+		AttributeValue endMarkerCentered;
 		AttributeValue stroke_dash_distance;
 		AttributeValue stroke_dash_dots1;
 		AttributeValue stroke_dash_dots1_length;




More information about the scribus-commit mailing list