[gnumeric] export legend position to ODF



commit 6e57e371dc21d2303002c81d07517f7f4520673c
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Aug 16 02:05:24 2010 -0600

    export legend position to ODF
    
    2010-08-16  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_write_plot): export legend position

 plugins/openoffice/ChangeLog          |    4 ++++
 plugins/openoffice/openoffice-write.c |   29 ++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index e0ce76e..c350a1f 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,9 @@
 2010-08-16  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-write.c (odf_write_plot): export legend position
+
+2010-08-16  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-write.c (odf_write_plot): export legend
 
 2010-08-15  Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 0256019..b0c9a6c 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3977,8 +3977,35 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 	/* Set up legend if appropriate*/
 
 	if (legend != NULL) {
+		GogObjectPosition flags;
+
+		flags = gog_object_get_position_flags 
+			(legend, GOG_POSITION_COMPASS);
+
 		gsf_xml_out_start_element (state->xml, CHART "legend");
-		
+
+		if (flags) {
+			GString *compass = g_string_new (NULL);
+			
+			if (flags & GOG_POSITION_N)
+				g_string_append (compass, "top");
+			if (flags & GOG_POSITION_S)
+				g_string_append (compass, "bottom");
+			if ((flags & (GOG_POSITION_S | GOG_POSITION_N)) && 
+			    (flags & (GOG_POSITION_E | GOG_POSITION_W)))
+				g_string_append (compass, "-");
+			if (flags & GOG_POSITION_E)
+				g_string_append (compass, "end");
+			if (flags & GOG_POSITION_W)
+				g_string_append (compass, "start");
+			
+			gsf_xml_out_add_cstr (state->xml, 
+					      CHART "legend-position", 
+					      compass->str);
+
+			g_string_free (compass, TRUE);
+		}
+
 		gsf_xml_out_end_element (state->xml); /* </chart:legend> */
 	}
 



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