[gnumeric] Improve ODF export of manually positioned charts in multi-chart graphs. [#743789]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Improve ODF export of manually positioned charts in multi-chart graphs. [#743789]
- Date: Sun, 8 Feb 2015 20:37:14 +0000 (UTC)
commit 43ff18d0369cb41bf7cbc2e9587a70c3cc507efe
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Sun Feb 8 13:35:10 2015 -0700
Improve ODF export of manually positioned charts in multi-chart graphs. [#743789]
2015-02-08 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_multi_chart_frame_size): For manually positioned
charts we may have 0 columns and/or rows.
NEWS | 2 ++
plugins/openoffice/ChangeLog | 5 +++++
plugins/openoffice/openoffice-write.c | 23 ++++++++++++-----------
3 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9be5703..d4b4ec8 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ Andreas:
* Fix ODF import of stroke colours of sheet objects.
* Fix ODF import/export of fill colour and type. [#744051]
* Fix ODF import/export of marker fill and outline colours.
+ * Improve ODF export of manually positioned charts in multi-chart
+ graphs. [#743789]
Morten:
* Initial xlsx import of sheet widgets.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 8ca0fba..7394b1d 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
2015-02-08 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-write.c (odf_write_multi_chart_frame_size): For manually positioned
+ charts we may have 0 columns and/or rows.
+
+2015-02-08 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (odf_apply_style_props): handle marker-fill-colour,
gnm-auto-marker-outline-colour & gnm-auto-marker-fill-colour
(od_style_prop_chart): read the above
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index fbd998d..ee9ae7d 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -2880,23 +2880,24 @@ odf_write_multi_chart_frame_size (GnmOOExport *state, SheetObject *so, GogObject
GnmParsePos pp;
char *formula;
Sheet const *sheet = state->sheet;
- int xpos = 0, ypos = 0, columns = 1, rows = 1;
+ unsigned int xpos = 0, ypos = 0, columns = 1, rows = 1;
double height, width;
- g_object_get (G_OBJECT (obj),
- "xpos", &xpos,
- "ypos", &ypos,
- "columns", &columns,
- "rows", &rows,
- NULL);
+ if (!gog_chart_get_position (GOG_CHART (obj),
+ &xpos, &ypos, &columns, &rows)) {
+ odf_write_frame_size (state, so);
+ return;
+ }
sheet_object_anchor_to_pts (anchor, sheet, abs_pts);
sheet_object_anchor_to_offset_pts (anchor, sheet, off_pts);
- res_pts[0] = off_pts[0] + xpos * (abs_pts[2]-abs_pts[0])/tc;
- res_pts[1] = off_pts[1] + ypos * (abs_pts[3]-abs_pts[1])/tr;
- res_pts[2] = off_pts[0] + (xpos + columns) * (abs_pts[2]-abs_pts[0])/tc;
- res_pts[3] = off_pts[1] + (ypos + rows) * (abs_pts[3]-abs_pts[1])/tr;
+ res_pts[0] = off_pts[0] + (tc == 0) ? 0 : (xpos * (abs_pts[2]-abs_pts[0])/tc);
+ res_pts[1] = off_pts[1] + (tr == 0) ? 0 : (ypos * (abs_pts[3]-abs_pts[1])/tr);
+ res_pts[2] = off_pts[0] + (tc == 0) ? (abs_pts[2]-abs_pts[0]) :
+ ((xpos + columns) * (abs_pts[2]-abs_pts[0])/tc);
+ res_pts[3] = off_pts[1] + (tr == 0) ? (abs_pts[3]-abs_pts[1]) :
+ ((ypos + rows) * (abs_pts[3]-abs_pts[1])/tr);
width = res_pts[2] - res_pts[0];
height = res_pts[3] - res_pts[1];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]