[gnumeric] ODF: some dash handling
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] ODF: some dash handling
- Date: Wed, 18 Aug 2010 22:53:39 +0000 (UTC)
commit 4b812a8601b40bc5daeec2e27f3494a6027d4c80
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Aug 18 16:52:49 2010 -0600
ODF: some dash handling
2010-08-18 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_scatter_series_style_graphic): write
dash info
* openoffice-read.c (odf_match_dash_type): new (stub)
(oo_prop_list_to_series): handle dashes, add argument and change all
callers
plugins/openoffice/ChangeLog | 8 ++++++++
plugins/openoffice/openoffice-read.c | 30 +++++++++++++++++++++++++++---
plugins/openoffice/openoffice-write.c | 14 +++++++++++++-
3 files changed, 48 insertions(+), 4 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 4d62c47..46cff61 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,13 @@
2010-08-18 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-write.c (odf_write_scatter_series_style_graphic): write
+ dash info
+ * openoffice-read.c (odf_match_dash_type): new (stub)
+ (oo_prop_list_to_series): handle dashes, add argument and change all
+ callers
+
+2010-08-18 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-write.c (odf_write_scatter_chart_style): split into
odf_write_scatter_chart_style and odf_write_scatter_chart_style_graphic
(odf_write_scatter_series_style): split into
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index c80e602..f719e51 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3031,13 +3031,21 @@ oo_prop_list_apply (GSList *props, GObject *obj)
}
}
+static GOLineDashType
+odf_match_dash_type (OOParseState *state, gchar const *dash_style)
+{
+ GOLineDashType t = go_line_dash_from_str (dash_style);
+ return ((t == GO_LINE_NONE)? GO_LINE_DOT : t );
+}
+
static void
-oo_prop_list_to_series (GSList *props, GObject *obj)
+oo_prop_list_to_series (OOParseState *state, GSList *props, GObject *obj)
{
GOStyle *style = NULL;
GSList *l;
int symbol_type = -1, symbol_name = GO_MARKER_DIAMOND;
GOMarker *m;
+ gboolean line_is_not_dash = FALSE;
oo_prop_list_apply (props, obj);
@@ -3054,12 +3062,22 @@ oo_prop_list_to_series (GSList *props, GObject *obj)
if (0 == strcmp (g_value_get_string (&prop->value), "solid")) {
style->line.dash_type = GO_LINE_SOLID;
style->line.auto_dash = FALSE;
+ line_is_not_dash = TRUE;
+ } else if (0 == strcmp (g_value_get_string (&prop->value), "dash")) {
+ style->line.auto_dash = FALSE;
+ line_is_not_dash = FALSE;
+ } else {
+ style->line.dash_type = GO_LINE_NONE;
+ style->line.auto_dash = FALSE;
+ line_is_not_dash = TRUE;
}
+ } else if (0 == strcmp (prop->name, "stroke-dash") && !line_is_not_dash) {
+ style->line.dash_type = odf_match_dash_type
+ (state, g_value_get_string (&prop->value));
} else if (0 == strcmp (prop->name, "symbol-type"))
symbol_type = g_value_get_int (&prop->value);
else if (0 == strcmp (prop->name, "symbol-name"))
symbol_name = g_value_get_int (&prop->value);
-
}
switch (symbol_type) {
@@ -3259,6 +3277,12 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
(style->series_props,
oo_prop_new_string ("stroke",
CXML2C(attrs[1])));
+ } else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
+ OO_NS_DRAW, "stroke-dash")) {
+ style->series_props = g_slist_prepend
+ (style->series_props,
+ oo_prop_new_string ("stroke-dash",
+ CXML2C(attrs[1])));
} else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "lines", &btmp)) {
style->series_props = g_slist_prepend
(style->series_props,
@@ -4237,7 +4261,7 @@ oo_plot_series (GsfXMLIn *xin, xmlChar const **attrs)
OOChartStyle *style = NULL;
style = g_hash_table_lookup
(state->chart.graph_styles, CXML2C (attrs[1]));
- oo_prop_list_to_series (style->series_props, G_OBJECT (state->chart.series));
+ oo_prop_list_to_series (state, style->series_props, G_OBJECT (state->chart.series));
}
}
}
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 31fe33a..ee4082e 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3802,7 +3802,19 @@ odf_write_scatter_series_style_graphic (GnmOOExport *state, GogObject const *plo
g_object_get (G_OBJECT (series), "style", &style, NULL);
if (go_style_is_line_visible (style)) {
- gsf_xml_out_add_cstr (state->xml, DRAW "stroke", "solid");
+ GOLineDashType dash_type = style->line.dash_type;
+
+ if (dash_type == GO_LINE_SOLID)
+ gsf_xml_out_add_cstr (state->xml,
+ DRAW "stroke", "solid");
+ else {
+ gsf_xml_out_add_cstr (state->xml,
+ DRAW "stroke", "dash");
+ gsf_xml_out_add_cstr
+ (state->xml,
+ DRAW "stroke-dash",
+ go_line_dash_as_str (dash_type));
+ }
} else {
gsf_xml_out_add_cstr (state->xml, DRAW "stroke", "none");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]