[gnumeric] Fix name round trip for lines



commit cdb3a43b36ea0dca555a0cfa16ebfc692cb76532
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sat May 9 01:27:42 2020 -0600

    Fix name round trip for lines
    
    2020-05-09  Andreas J. Guelzow <aguelzow pyrshep ca>
    
            * openoffice-read.c (odf_line): read and set name
            * openoffice-write.c (odf_write_line): write name

 plugins/openoffice/ChangeLog          | 5 +++++
 plugins/openoffice/openoffice-read.c  | 6 ++++++
 plugins/openoffice/openoffice-write.c | 4 ++++
 3 files changed, 15 insertions(+)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index a811d0623..069cf7c0b 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-09  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (odf_line): read and set name
+       * openoffice-write.c (odf_write_line): write name
+
 2020-05-09  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-write.c (odf_write_image): do not write two names
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 41fee4d11..b779c92b2 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -10903,6 +10903,7 @@ odf_line (GsfXMLIn *xin, xmlChar const **attrs)
        GnmRange cell_base;
        double frame_offset[4];
        char const *style_name = NULL;
+       char const *name = NULL;
        gdouble height, width;
        int z = -1;
        GnmSOAnchorMode mode;
@@ -10914,6 +10915,8 @@ odf_line (GsfXMLIn *xin, xmlChar const **attrs)
                if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
                                        OO_NS_DRAW, "style-name"))
                        style_name = CXML2C (attrs[1]);
+               else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_DRAW, "name"))
+                       name = CXML2C (attrs[1]);
                else if (NULL != oo_attr_distance (xin, attrs,
                                              OO_NS_SVG, "x1",
                                              &x1));
@@ -10997,6 +11000,9 @@ odf_line (GsfXMLIn *xin, xmlChar const **attrs)
                                  mode);
        state->chart.so = g_object_new (GNM_SO_LINE_TYPE, NULL);
 
+       if (name)
+               sheet_object_set_name (state->chart.so, name);
+
        if (style_name != NULL) {
                OOChartStyle *oostyle = g_hash_table_lookup
                        (state->chart.graph_styles, style_name);
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 61936097b..e90565ae9 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3230,8 +3230,12 @@ odf_write_line (GnmOOExport *state, SheetObject *so)
        double x1, y1, x2, y2;
        gchar const *style_name = g_hash_table_lookup (state->so_styles, so);
        int z;
+       char const *name = NULL;
 
        gsf_xml_out_start_element (state->xml, DRAW "line");
+       g_object_get (G_OBJECT (so), "name", &name, NULL);
+       if (name)
+               gsf_xml_out_add_cstr_unchecked (state->xml, DRAW "name", name);
        if (style_name != NULL)
                gsf_xml_out_add_cstr (state->xml, DRAW "style-name", style_name);
        z = g_slist_length (state->sheet->sheet_objects) -


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