[gnumeric] xlsx: fix zorder of sheet charts.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xlsx: fix zorder of sheet charts.
- Date: Sun, 18 Jan 2015 21:15:56 +0000 (UTC)
commit 4ed680849480eea15513d9cfca4be2091d99c3bc
Author: Morten Welinder <terra gnome org>
Date: Sun Jan 18 16:14:56 2015 -0500
xlsx: fix zorder of sheet charts.
We assume that the sheet order is the order in the file. That's
consistent with what we do on write.
plugins/excel/xlsx-read-drawing.c | 76 ++++++++++++++++++-----------------
plugins/excel/xlsx-read.c | 10 +++++
plugins/excel/xlsx-write-drawing.c | 4 +-
3 files changed, 52 insertions(+), 38 deletions(-)
---
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 876f65f..4fe1f0d 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -2215,49 +2215,51 @@ xlsx_drawing_twoCellAnchor_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
if (NULL == state->so) {
xlsx_warning (xin,
_("Dropping missing object"));
+ } else if ((state->drawing_pos_flags & 0xFF) != 0xFF) {
+ xlsx_warning (xin,
+ _("Dropping object with incomplete anchor %2x"), state->drawing_pos_flags);
+ g_object_unref (state->so);
} else {
- if ((state->drawing_pos_flags & 0xFF) == 0xFF) {
- SheetObjectAnchor anchor;
- GnmRange r;
- double coords[4];
- double size;
- int i;
-
- range_init (&r,
- state->drawing_pos[COL | FROM],
- state->drawing_pos[ROW | FROM],
- state->drawing_pos[COL | TO],
- state->drawing_pos[ROW | TO]);
-
- for (i = 0; i < 8; i+=2) {
- ColRowInfo const *cri;
- if (i & 2) {
- cri = sheet_row_get (state->sheet, state->drawing_pos[i]);
- size = cri? cri->size_pts: sheet_row_get_default_size_pts
(state->sheet);
- } else {
- cri = sheet_col_get (state->sheet, state->drawing_pos[i]);
- /* FIXME: scaling horizontally just like in xlsx_CT_Col */
- size = cri? cri->size_pts: sheet_col_get_default_size_pts
(state->sheet) * 1.16191275167785;
- }
- coords[i / 2] = (double) state->drawing_pos[i + 1] / 12700. / size;
+ SheetObjectAnchor anchor;
+ GnmRange r;
+ double coords[4];
+ double size;
+ int i;
+
+ range_init (&r,
+ state->drawing_pos[COL | FROM],
+ state->drawing_pos[ROW | FROM],
+ state->drawing_pos[COL | TO],
+ state->drawing_pos[ROW | TO]);
+
+ for (i = 0; i < 8; i+=2) {
+ ColRowInfo const *cri;
+ if (i & 2) {
+ cri = sheet_row_get (state->sheet, state->drawing_pos[i]);
+ size = cri? cri->size_pts: sheet_row_get_default_size_pts (state->sheet);
+ } else {
+ cri = sheet_col_get (state->sheet, state->drawing_pos[i]);
+ /* FIXME: scaling horizontally just like in xlsx_CT_Col */
+ size = cri? cri->size_pts: sheet_col_get_default_size_pts (state->sheet) *
1.16191275167785;
}
- sheet_object_anchor_init (&anchor, &r, coords, GOD_ANCHOR_DIR_DOWN_RIGHT);
- sheet_object_set_anchor (state->so, &anchor);
- sheet_object_set_sheet (state->so, state->sheet);
- } else
- xlsx_warning (xin,
- _("Dropping object with incomplete anchor %2x"), state->drawing_pos_flags);
-
- if (state->cur_style) {
- g_object_set (state->so, "style", state->cur_style, NULL);
- g_object_unref (state->cur_style);
- state->cur_style = NULL;
+ coords[i / 2] = (double) state->drawing_pos[i + 1] / 12700. / size;
}
- g_object_unref (state->so);
- state->so = NULL;
+ sheet_object_anchor_init (&anchor, &r, coords, GOD_ANCHOR_DIR_DOWN_RIGHT);
+ sheet_object_set_anchor (state->so, &anchor);
+ if (state->cur_style)
+ g_object_set (state->so, "style", state->cur_style, NULL);
+
+ state->pending_objects = g_slist_prepend (state->pending_objects, state->so);
}
+
+ if (state->cur_style) {
+ g_object_unref (state->cur_style);
+ state->cur_style = NULL;
+ }
+ state->so = NULL;
}
+
static void
xlsx_drawing_oneCellAnchor_end (GsfXMLIn *xin, GsfXMLBlob *blob)
{
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 4fb8cb6..5eea025 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -233,6 +233,8 @@ typedef struct {
Sheet *defined_name_sheet;
GList *delayed_names;
+ GSList *pending_objects;
+
/* external refs */
Workbook *external_ref;
Sheet *external_ref_sheet;
@@ -3903,6 +3905,14 @@ xlsx_wb_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
end_update_progress (state);
}
+ while (state->pending_objects) {
+ SheetObject *obj = state->pending_objects->data;
+ state->pending_objects = g_slist_delete_link (state->pending_objects,
+ state->pending_objects);
+ sheet_object_set_sheet (obj, state->sheet);
+ g_object_unref (obj);
+ }
+
/* Flag a respan here in case nothing else does */
sheet_flag_recompute_spans (state->sheet);
}
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index ce53c1d..a7fd1ac 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -164,7 +164,9 @@ xlsx_write_go_style (GsfXMLOut *xml, GOStyle *style)
}
if ((style->interesting_fields & (GO_STYLE_LINE | GO_STYLE_OUTLINE)) &&
- !style->line.auto_dash) {/* TODO: add more tests for transparent line */
+ (!style->line.auto_dash ||
+ !style->line.auto_width ||
+ !style->line.auto_color)) {
static const char * const dashes[] = {
NULL, /* GO_LINE_NONE */
"solid", /* GO_LINE_SOLID */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]