[gnumeric: 1/2] Fix line end marker roundtrip through strict ODF



commit c39e3cc36d984a6ec2cd7e5f0d79a96d1c29747f
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sun May 10 11:23:20 2020 -0600

    Fix line end marker roundtrip through strict ODF
    
    2020-05-10  Andreas J. Guelzow <aguelzow pyrshep ca>
    
            * openoffice-read.c (oo_marker): for strict ODF use teh info encoded in the
            marker name

 NEWS                                  | 1 +
 plugins/openoffice/ChangeLog          | 5 +++++
 plugins/openoffice/openoffice-read.c  | 7 ++++++-
 plugins/openoffice/openoffice-write.c | 1 +
 4 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/NEWS b/NEWS
index de0a8f78c..e543f093e 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ Gnumeric 1.12.48
 
 Andreas:
        * Add axis title to chart in histogram tool. [#408]
+       * Fix line end marker roundtrip through strict ODF
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.47
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index d3f9a5191..4bf3a9659 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-10  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (oo_marker): for strict ODF use teh info encoded in the
+       marker name
+
 2020-05-09  Morten Welinder <terra gnome org>
 
        * Release 1.12.47
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index b779c92b2..5a11ee959 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -11715,6 +11715,7 @@ oo_marker (GsfXMLIn *xin, xmlChar const **attrs)
         int type = GO_ARROW_NONE;
        double a = 0., b = 0., c = 0.;
        char const *name = NULL;
+       gboolean read_gnum_marker_info = FALSE;
 
        for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
                if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
@@ -11727,13 +11728,17 @@ oo_marker (GsfXMLIn *xin, xmlChar const **attrs)
                                             OO_NS_SVG, "d"))
                        marker->d = g_strdup (CXML2C (attrs[1]));
                else if (oo_attr_int_range (xin, attrs, OO_GNUM_NS_EXT, "arrow-type", &type,
-                                           GO_ARROW_KITE, GO_ARROW_OVAL));
+                                           GO_ARROW_KITE, GO_ARROW_OVAL))
+                       read_gnum_marker_info = TRUE;
                else if (oo_attr_float (xin, attrs, OO_GNUM_NS_EXT,
                                        "arrow-a", &a));
                else if (oo_attr_float (xin, attrs, OO_GNUM_NS_EXT,
                                        "arrow-b", &b));
                else if (oo_attr_float (xin, attrs, OO_GNUM_NS_EXT,
                                        "arrow-c", &c));
+       if (!read_gnum_marker_info && g_str_has_prefix (name, "gnm-arrow-"))
+               sscanf (name, "gnm-arrow-%d-%lf-%lf-%lf", &type, &a, &b, &c);
+
        if (type != GO_ARROW_NONE) {
                marker->arrow = g_new0 (GOArrow, 1);
                go_arrow_init (marker->arrow, type, a, b, c);
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index e90565ae9..906ccd17d 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -5877,6 +5877,7 @@ odf_write_arrow_marker_info (GOArrow const *arrow, char const *name, GnmOOExport
        }
 
        gsf_xml_out_add_cstr (state->xml, SVG "viewBox", "0 0 20 30");
+       /* FIXME: We should be writing the correct arow head shape rather than a standard fixed one */
        gsf_xml_out_add_cstr (state->xml, SVG "d", "m10 0-10 30h20z");
 
        gsf_xml_out_end_element (state->xml); /* </draw:marker> */


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