[gnumeric] Improve chart roundtrip through ODF. [#728197]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve chart roundtrip through ODF. [#728197]
- Date: Fri, 18 Apr 2014 05:47:49 +0000 (UTC)
commit a0dd4dfd78e0afe87c9a3b71bdc708a3bdd560bb
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Thu Apr 17 23:47:17 2014 -0600
Improve chart roundtrip through ODF. [#728197]
2014-04-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_apply_style_props): read both
svg:stroke-width and gnm:stroke-width
* openoffice-write.c (od_style_prop_chart): write gnm:stroke-width
to remember line-widhts of 0.
plugins/openoffice/ChangeLog | 7 +++++++
plugins/openoffice/openoffice-read.c | 20 ++++++++++++++++++--
plugins/openoffice/openoffice-write.c | 6 ++++--
3 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index decc029..c8d47ed 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,12 @@
2014-04-17 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-read.c (odf_apply_style_props): read both
+ svg:stroke-width and gnm:stroke-width
+ * openoffice-write.c (od_style_prop_chart): write gnm:stroke-width
+ to remember line-widhts of 0.
+
+2014-04-17 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (od_draw_object): set width-pts and height-pts
* openoffice-write.c (odf_add_pt): write 6 decimals
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 03fb7da..b7a2f9f 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -793,7 +793,8 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
char const *fill_image_name = NULL;
unsigned int gnm_hatch = 0;
int symbol_type = -1, symbol_name = GO_MARKER_DIAMOND;
- double symbol_height = -1., symbol_width = -1.;
+ double symbol_height = -1., symbol_width = -1.,
+ stroke_width = -1., gnm_stroke_width = -1.;
GOMarker *m;
gboolean line_is_not_dash = FALSE;
unsigned int fill_type = OO_FILL_TYPE_UNKNOWN;
@@ -917,7 +918,9 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
else if (0 == strcmp (prop->name, "symbol-width"))
symbol_width = g_value_get_double (&prop->value);
else if (0 == strcmp (prop->name, "stroke-width"))
- style->line.width = g_value_get_double (&prop->value);
+ stroke_width = g_value_get_double (&prop->value);
+ else if (0 == strcmp (prop->name, "gnm-stroke-width"))
+ gnm_stroke_width = g_value_get_double (&prop->value);
else if (0 == strcmp (prop->name, "repeat"))
style->fill.image.type = g_value_get_int (&prop->value);
}
@@ -926,6 +929,13 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
else
pango_font_description_free (desc);
+ if (gnm_stroke_width >= 0)
+ style->line.width = gnm_stroke_width;
+ else if (stroke_width == 0.) {
+ style->line.width = 0.;
+ style->line.dash_type = GO_LINE_NONE;
+ } else if (stroke_width > 0)
+ style->line.width = stroke_width;
switch (fill_type) {
case OO_FILL_TYPE_HATCH:
@@ -6919,6 +6929,12 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
(style->style_props,
oo_prop_new_double ("stroke-width",
ftmp));
+ else if (NULL != oo_attr_distance (xin, attrs, OO_GNUM_NS_EXT,
+ "stroke-width", &ftmp))
+ style->style_props = g_slist_prepend
+ (style->style_props,
+ oo_prop_new_double ("gnm-stroke-width",
+ ftmp));
else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "lines", &btmp)) {
style->style_props = g_slist_prepend
(style->style_props,
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 11d1a7e..c383bdd 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -7100,9 +7100,11 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style)
g_hash_table_insert (state->graph_dashes, g_strdup (dash),
GINT_TO_POINTER (dash_type));
}
- if (style->line.width == 0.0)
+ if (style->line.width == 0.0) {
odf_add_pt (state->xml, SVG "stroke-width", 1.);
- else if (style->line.width > 0.0)
+ if (state->with_extension)
+ odf_add_pt (state->xml, GNMSTYLE "stroke-width", 0.);
+ } else if (style->line.width > 0.0)
odf_add_pt (state->xml, SVG "stroke-width",
style->line.width);
if (!style->line.auto_color) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]