[gnumeric] On ODF import of stacked column charts, set LibreOffice's default overlap. [#670692]



commit 9c81adb10a73ba9e28f09d45ff6f1ff4e8cf79c9
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Thu Feb 23 11:39:22 2012 -0700

    On ODF import of stacked column charts, set LibreOffice's default overlap. [#670692]
    
    2012-02-23  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (od_style_prop_chart): LO does not write overlap
    	values when writing stacked charts. For percentage-stacked charts it does
    	not write "stacked" either.

 NEWS                                 |    2 ++
 plugins/openoffice/ChangeLog         |    6 ++++++
 plugins/openoffice/openoffice-read.c |   20 +++++++++++++++++---
 3 files changed, 25 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index 4ad9767..abfa363 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ Andreas:
 	* Fix editing of decimals. [#670558]
 	* Fix edit line display. [#555519]
 	* Avoid recalculation on pure comment deletion. [#670603]
+	* On ODF import of stacked column charts, set LibreOffice's default overlap.
+	[#670692] 
 
 Jean:
 	* Fix formula interpretation in plot series (with Morten's help). [#662237]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 65c3227..3a89d12 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,9 @@
+2012-02-23  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-read.c (od_style_prop_chart): LO does not write overlap
+	values when writing stacked charts. For percentage-stacked charts it does
+	not write "stacked" either.
+
 2012-03-02  Morten Welinder <terra gnome org>
 
 	* Release 1.11.2
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 6d962f0..bc8643a 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -5974,6 +5974,10 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 	gboolean default_style_has_lines_set = FALSE;
 	gboolean draw_stroke_set = FALSE;
 	gboolean draw_stroke = FALSE; /* to avoid a warning only */
+	gboolean stacked_set = FALSE;
+	gboolean stacked_unset = FALSE;
+	gboolean overlap_set = FALSE;
+	gboolean percentage_set = FALSE;
 
 	g_return_if_fail (style != NULL ||
 			  state->default_style.cells != NULL);
@@ -6060,22 +6064,28 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 				oo_prop_new_bool ("invert-axis", btmp));
 		} else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "stacked",
 					 &btmp)) {
-			if (btmp)
+			if (btmp) {
 				style->plot_props = g_slist_prepend
 					(style->plot_props,
 					 oo_prop_new_string ("type",
 							     "stacked"));
+				stacked_set = TRUE;
+			} else
+				stacked_unset = TRUE;
 		} else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "percentage",
 					 &btmp)) {
-			if (btmp)
+			if (btmp) {
 				style->plot_props = g_slist_prepend
 					(style->plot_props,
 					oo_prop_new_string ("type",
 							    "as_percentage"));
+				percentage_set = TRUE;
+			}
 		} else if (oo_attr_int_range (xin, attrs, OO_NS_CHART,
 					      "overlap", &tmp, -150, 150)) {
 			style->plot_props = g_slist_prepend (style->plot_props,
 				oo_prop_new_int ("overlap-percentage", tmp));
+			overlap_set = TRUE;
 		} else if (oo_attr_int_range (xin, attrs, OO_NS_CHART,
 						"gap-width", &tmp, 0, 500))
 			style->plot_props = g_slist_prepend (style->plot_props,
@@ -6301,9 +6311,13 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 				(style->other_props,
 				 oo_prop_new_string
 				 ("marker-end", CXML2C(attrs[1])));
-
 	}
 
+	if ((stacked_set && !overlap_set) || 
+	    (percentage_set && !stacked_unset && !overlap_set))
+		style->plot_props = g_slist_prepend (style->plot_props,
+						     oo_prop_new_int ("overlap-percentage", 100));
+
 	if (draw_stroke_set && !default_style_has_lines_set)
 		style->plot_props = g_slist_prepend
 			(style->plot_props,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]