[gnumeric] Import/Export marker size from/to ODF. Part of [#671461]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Import/Export marker size from/to ODF. Part of [#671461]
- Date: Thu, 22 Mar 2012 04:28:12 +0000 (UTC)
commit b41dee4aaf4aad963a9463afe42dd4a9831d57d6
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Mar 21 22:26:41 2012 -0600
Import/Export marker size from/to ODF. Part of [#671461]
2012-03-21 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_apply_style_props): handle symbol-width and
symbol-height
(od_style_prop_chart) read symbol-width and symbol-height
* openoffice-write.c (odf_write_gog_style_chart): write
symbol-width and symbol-height
NEWS | 1 +
plugins/openoffice/ChangeLog | 8 ++++++++
plugins/openoffice/openoffice-read.c | 25 +++++++++++++++++++++++++
plugins/openoffice/openoffice-write.c | 8 ++++++--
4 files changed, 40 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index df04905..069e48e 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Andreas:
Part of [#671461]
* Improve annotation import from ODF.
* Fix conditional number format import from ODF. [#672489]
+ * Import/Export marker size from/to ODF. Part of [#671461]
Jean:
* Fixed crash with sheet object. [#671617]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 32e263c..663e03a 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -4,6 +4,14 @@
2012-03-21 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-read.c (odf_apply_style_props): handle symbol-width and
+ symbol-height
+ (od_style_prop_chart) read symbol-width and symbol-height
+ * openoffice-write.c (odf_write_gog_style_chart): write
+ symbol-width and symbol-height
+
+2012-03-21 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (odf_number_style_end): skip the condition
for the second part if we skipped it for the first and it is the
default
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 25c586e..7866e55 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -695,6 +695,7 @@ 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.;
GOMarker *m;
gboolean line_is_not_dash = FALSE;
unsigned int fill_type = OO_FILL_TYPE_UNKNOWN;
@@ -807,6 +808,10 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
symbol_type = g_value_get_int (&prop->value);
else if (0 == strcmp (prop->name, "symbol-name"))
symbol_name = g_value_get_int (&prop->value);
+ else if (0 == strcmp (prop->name, "symbol-height"))
+ symbol_height = g_value_get_double (&prop->value);
+ 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);
else if (0 == strcmp (prop->name, "repeat"))
@@ -942,6 +947,16 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
style->marker.auto_shape = FALSE;
m = go_marker_new ();
go_marker_set_shape (m, symbol_name);
+ if (symbol_height >= 0. || symbol_width >= 0.) {
+ int size;
+ if (symbol_height >= 0. && symbol_width >= 0.)
+ size = (symbol_height+symbol_width+1.)/2;
+ else if (symbol_height >= 0.)
+ size = symbol_height + 0.5;
+ else
+ size = symbol_width+ 0.5;
+ go_marker_set_size (m, size);
+ }
go_style_set_marker (style, m);
break;
default:
@@ -6120,6 +6135,16 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
style->style_props = g_slist_prepend
(style->style_props,
oo_prop_new_int ("symbol-name", tmp));
+ } else if (oo_attr_distance (xin, attrs, OO_NS_CHART, "symbol-width",
+ &ftmp)) {
+ style->style_props = g_slist_prepend
+ (style->style_props,
+ oo_prop_new_double ("symbol-width", ftmp));
+ } else if (oo_attr_distance (xin, attrs, OO_NS_CHART, "symbol-height",
+ &ftmp)) {
+ style->style_props = g_slist_prepend
+ (style->style_props,
+ oo_prop_new_double ("symbol-height", ftmp));
} else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
OO_NS_CHART, "interpolation")) {
char const *interpolation = NULL;
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 72d3170..7ecef73 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -6811,16 +6811,20 @@ odf_write_gog_style_chart (GnmOOExport *state, GOStyle const *style, GogObject c
"none");
}
} else {
- GOMarkerShape m
- = go_marker_get_shape (go_style_get_marker ((GOStyle *)style));
+ GOMarker const *marker = go_style_get_marker ((GOStyle *)style);
+ GOMarkerShape m = go_marker_get_shape (marker);
+
if (m == GO_MARKER_NONE)
gsf_xml_out_add_cstr (state->xml, CHART "symbol-type",
"none");
else {
+ int size = go_marker_get_size (marker);
gsf_xml_out_add_cstr (state->xml, CHART "symbol-type",
"named-symbol");
gsf_xml_out_add_cstr
(state->xml, CHART "symbol-name", odf_get_marker (m));
+ odf_add_pt (state->xml, CHART "symbol-width", size);
+ odf_add_pt (state->xml, CHART "symbol-height", size);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]