[gnumeric] xls: export graph object header with new escher code. Export name.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: export graph object header with new escher code. Export name.
- Date: Mon, 12 Mar 2012 20:45:47 +0000 (UTC)
commit e47203e6a88c9bdbff02ea61135ecf45ecb280f9
Author: Morten Welinder <terra gnome org>
Date: Mon Mar 12 16:45:07 2012 -0400
xls: export graph object header with new escher code. Export name.
plugins/excel/ChangeLog | 3 ++
plugins/excel/ms-escher.h | 4 ++
plugins/excel/ms-excel-write.c | 77 ++++++++++++++++++++++++---------------
3 files changed, 54 insertions(+), 30 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 4ee1f0f..b3c23c8 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,8 @@
2012-03-12 Morten Welinder <terra gnome org>
+ * ms-excel-write.c (excel_write_chart_v8): Regularlize code and
+ output object name too.
+
* ms-chart.c (chart_write_LEGEND): Include the style when writing
text.
diff --git a/plugins/excel/ms-escher.h b/plugins/excel/ms-escher.h
index 3f0b673..0c980f7 100644
--- a/plugins/excel/ms-escher.h
+++ b/plugins/excel/ms-escher.h
@@ -32,6 +32,7 @@ enum {
MSEP_TXDIR = 0x008b,
MSEP_SELECTTEXT = 0x00bb,
MSEP_AUTOTEXTMARGIN = 0x00bc,
+ MSEP_FITTEXTTOSHAPE = 0x00bf,
MSEP_BLIPINDEX = 0x0104,
MSEP_SHAPEPATH = 0x0144,
MSEP_SHADOWOK = 0x017a,
@@ -39,6 +40,7 @@ enum {
MSEP_FILLOK = 0x017f,
MSEP_FILLTYPE = 0x0180,
MSEP_FILLCOLOR = 0x0181,
+ MSEP_FILLBACKCOLOR = 0x0183,
MSEP_FILLED = 0x01bb,
MSEP_NOFILLHITTEST = 0x01bf,
MSEP_LINECOLOR = 0x01c0,
@@ -52,6 +54,8 @@ enum {
MSEP_LINEENDARROWLENGTH = 0x01d5,
MSEP_ARROWHEADSOK = 0x01fb,
MSEP_LINE = 0x01fc,
+ MSEP_NOLINEDRAWDASH = 0x01ff,
+ MSEP_SHADOWOBSCURED = 0x023f,
MSEP_NAME = 0x0380,
MSEP_ISBUTTON = 0x03bc
};
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index c27380e..d1ddba5 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -4048,47 +4048,64 @@ excel_write_autofilter_objs (ExcelWriteSheet *esheet)
static gsize
excel_write_chart_v8 (ExcelWriteSheet *esheet, SheetObject *so)
{
- static guint8 const obj_v8[] = {
-/* SpContainer */ 0xf, 0, 4, 0xf0, 0x6a, 0, 0, 0,
-/* Sp */ 0x92, 0xc, 0xa, 0xf0, 8, 0, 0, 0,
- 0, 0, 0, 0, /* fill in spid */
- 0, 0xa, 0, 0,
-
-/* OPT */ 0x83, 0, 0xb, 0xf0, 0x30, 0, 0, 0,
- 0x7f, 0, 4, 1, 4, 1, /* bool LockAgainstGrouping 127 = 0x1040104; */
- 0xbf, 0, 8, 0, 8, 0, /* bool fFitTextToShape 191 = 0x0080008; */
- 0x81, 1, 0x4e, 0, 0, 8, /* Colour fillColor 385 = 0x800004e; */
- 0x83, 1, 0x4d, 0, 0, 8, /* Colour fillBackColor 387 = 0x800004d; */
- 0xbf, 1, 0x10, 0,0x10,0, /* bool fNoFillHitTest 447 = 0x0100010; */
- 0xc0, 1, 0x4d, 0, 0, 8, /* Colour lineColor 448 = 0x800004d; */
- 0xff, 1, 8, 0, 8, 0, /* bool fNoLineDrawDash 511 = 0x0080008; */
- 0x3f, 2, 0, 0, 2, 0, /* bool fshadowObscured 575 = 0x0020000; */
-
-/* ClientAnchor */ 0, 0, 0x10, 0xf0, 0x12, 0, 0, 0, 0,0,
- 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0,
-/* ClientData */ 0, 0, 0x11, 0xf0, 0, 0, 0, 0
- };
-
- guint8 buf [sizeof obj_v8];
BiffPut *bp = esheet->ewb->bp;
+ GString *escher = g_string_new (NULL);
+ GString *extra;
+ guint32 spflags;
+ gsize spmark, optmark;
guint32 id = excel_write_start_drawing (esheet);
+ char *name;
+ guint8 zero[4] = { 0, 0, 0, 0 };
gsize draw_len = 0;
+ guint16 shape = 0x92;
+
+ g_object_get (so,
+ "name", &name,
+ NULL);
+
+ spmark = ms_escher_spcontainer_start (escher);
+ spflags = 0x00000a00; /* fHaveAnchor+fHaveSpt */
+ ms_escher_sp (escher, id, shape, spflags);
+
+ optmark = ms_escher_opt_start (escher);
+ extra = g_string_new (NULL);
+ ms_escher_opt_add_bool (escher, optmark, MSEP_LOCKAGAINSTGROUPING, TRUE);
+ ms_escher_opt_add_bool (escher, optmark, MSEP_FITTEXTTOSHAPE, TRUE);
+ ms_escher_opt_add_color (escher, optmark, MSEP_FILLCOLOR, 0x0800004);
+ ms_escher_opt_add_color (escher, optmark, MSEP_FILLBACKCOLOR, 0x0800004d);
+ ms_escher_opt_add_bool (escher, optmark, MSEP_NOFILLHITTEST, TRUE);
+ ms_escher_opt_add_color (escher, optmark, MSEP_LINECOLOR, 0x0800004d);
+ ms_escher_opt_add_bool (escher, optmark, MSEP_NOLINEDRAWDASH, TRUE);
+ ms_escher_opt_add_bool (escher, optmark, MSEP_SHADOWOBSCURED, TRUE);
+ if (name)
+ ms_escher_opt_add_str_wchar (escher, optmark, extra,
+ MSEP_NAME, name);
+
+ go_string_append_gstring (escher, extra);
+ ms_escher_opt_end (escher, optmark);
+ g_string_free (extra, TRUE);
+
+ ms_escher_clientanchor (escher, sheet_object_get_anchor (so));
+
+ ms_escher_clientdata (escher);
+
+ ms_escher_spcontainer_end (escher, spmark);
- memcpy (buf, obj_v8, sizeof obj_v8);
- GSF_LE_SET_GUINT32 (buf + 16, id);
- excel_write_anchor (buf + 0x5a, sheet_object_get_anchor (so));
- ms_biff_put_var_write (bp, buf, sizeof obj_v8);
- draw_len += sizeof (obj_v8);
+ ms_biff_put_var_write (bp, escher->str, escher->len);
ms_biff_put_commit (bp);
+ draw_len += escher->len;
+
+ g_string_free (escher, TRUE);
ms_biff_put_var_next (bp, BIFF_OBJ);
ms_objv8_write_common (bp, esheet->cur_obj, MSOT_CHART, 0x6011);
- GSF_LE_SET_GUINT32 (buf, 0); /* end */
- ms_biff_put_var_write (bp, buf, 4);
-
+ ms_biff_put_var_write (bp, zero, 4);
ms_biff_put_commit (bp);
+
ms_excel_chart_write (esheet->ewb, so);
+ g_free (name);
+
return draw_len;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]