[gnumeric] Write manual legend position to ODF. [#703362]



commit 325c8611f3766feeea41c40a5ca06906497a57d1
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Jul 1 17:32:24 2013 -0600

    Write manual legend position to ODF. [#703362]
    
    2013-07-01  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-write.c (odf_write_regression_curve): write
        location
        (odf_write_plot): write manual legend position

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    6 ++++
 plugins/openoffice/openoffice-write.c |   54 +++++++++++++++++++-------------
 3 files changed, 39 insertions(+), 22 deletions(-)
---
diff --git a/NEWS b/NEWS
index c4ba93f..d2dc7df 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,7 @@ Andreas:
        * Fix crash on corrupted files. [#703149] [#703215]
        * Fix import of sxc files. [#703249]
        * Fix TDIST Import/Export from/to ODF.
+       * Write manual legend position to ODF. [#703362]
 
 Jean:
        * Don't attempt to add a path item when there is no path object. [#703052]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index e85fedc..b6e175f 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,9 @@
+2013-07-01  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-write.c (odf_write_regression_curve): write
+       location
+       (odf_write_plot): write manual legend position
+
 2013-06-30  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-read.c (oo_chart_title_end): distinguisg axis
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 05654e8..eb4d094 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -6049,6 +6049,7 @@ odf_write_regression_curve (GnmOOExport *state, GogObjectRole const *role, GogOb
                                (GOG_OBJECT (equation));
                        gsf_xml_out_add_cstr (state->xml, CHART "style-name", str);
                        odf_write_gog_position (state, equation);
+                       odf_write_gog_position_pts (state, equation);
                        gsf_xml_out_end_element (state->xml); /* </chart:equation> */
                }
 
@@ -7491,9 +7492,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *graph,
                GSList *ltitles = gog_object_get_children
                        (legend, gog_object_find_role_by_name
                         (legend, "Title"));
-
-               flags = gog_object_get_position_flags
-                       (legend, GOG_POSITION_COMPASS);
+               gboolean is_position_manual = FALSE;
 
                gsf_xml_out_start_element (state->xml, CHART "legend");
                gsf_xml_out_add_cstr (state->xml,
@@ -7501,26 +7500,37 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *graph,
                                              style_name);
                g_free (style_name);
 
-               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);
+               odf_write_gog_position (state, legend); /* gnumeric extensions */
 
-                       g_string_free (compass, TRUE);
+               g_object_get (G_OBJECT (legend),
+                             "is-position-manual", &is_position_manual,
+                             NULL);
+               if (is_position_manual) 
+                       odf_write_gog_position_pts (state, legend);
+               else {
+                       flags = gog_object_get_position_flags
+                               (legend, GOG_POSITION_COMPASS);
+                       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);
+                       }
                }
 
                if (ltitles != NULL) {


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