[gnumeric] Save axis format to xls. [#736656]



commit 0fcbeaefe469ee6304003581d0ccbe5e8bfddbd1
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Sep 18 19:59:52 2014 +0200

    Save axis format to xls. [#736656]

 NEWS                           |    1 +
 plugins/excel/ChangeLog        |    6 ++++++
 plugins/excel/ms-chart.c       |    7 +++++++
 plugins/excel/ms-excel-write.c |   17 +++++++++++++++++
 plugins/excel/ms-excel-write.h |    2 ++
 5 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 425fe6e..b812577 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Andreas:
 
 Jean:
        * Fix dialogs behavior in full screen mode. [#736395]
+       * Save axis format to xls. [#736656]
 
 Morten:
        * Fix xls export problem.  [#733771]
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index faa6667..7f500eb 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,9 @@
+2014-09-18  Jean Brefort  <jean brefort normalesup org>
+
+       * ms-chart.c (chart_write_axis): save axis format. [#736656]
+       * ms-excel-write.c (set_ifmt), (excel_write_add_object_format):
+       * ms-excel-write.h:
+
 2014-09-10  Morten Welinder  <terra gnome org>
 
        * xlsx-read.c: Factor out rich text nodes into a macro.  This
diff --git a/plugins/excel/ms-chart.c b/plugins/excel/ms-chart.c
index f838fa5..91fddee 100644
--- a/plugins/excel/ms-chart.c
+++ b/plugins/excel/ms-chart.c
@@ -4947,6 +4947,13 @@ chart_write_axis (XLChartWriteState *s, GogAxis const *axis,
        if (axis != NULL) {
                GOStyle *style = GOG_STYLED_OBJECT (axis)->style;
                int font;
+               GOFormat *fmt = gog_axis_get_format (axis);
+               if (fmt) {
+                       int ifmt = excel_write_add_object_format (s->ewb, fmt);
+                       data = ms_biff_put_len_next (s->bp, BIFF_CHART_ifmt, 2);
+                       GSF_LE_SET_GUINT16 (data, ifmt);
+                       ms_biff_put_commit (s->bp);
+               }
                data = ms_biff_put_len_next (s->bp, BIFF_CHART_tick,
                        (s->bp->version >= MS_BIFF_V8) ? 30 : 26);
                g_object_get (G_OBJECT (axis),
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 64b49cb..9bbd6a5 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -2638,6 +2638,23 @@ put_format (ExcelStyleVariant const *esv, gpointer dummy, XLExportBase *xle)
 }
 
 static void
+set_ifmt (G_GNUC_UNUSED GOFormat *format, G_GNUC_UNUSED gboolean was_added,
+          gint index, int *tmpl)
+{
+               *tmpl = index;
+}
+
+int
+excel_write_add_object_format (ExcelWriteState *ewb, GOFormat *format)
+{
+       int ifmt;
+       two_way_table_put (ewb->base.formats.two_way_table,
+                          /* cast the int* to char* until the API accepts void* there */
+                          format, TRUE, (AfterPutFunc) set_ifmt, (char*) &ifmt);
+       return ifmt;
+}
+
+static void
 excel_write_FORMAT (ExcelWriteState *ewb, int fidx)
 {
        guint8 data[64];
diff --git a/plugins/excel/ms-excel-write.h b/plugins/excel/ms-excel-write.h
index 7627674..32862b9 100644
--- a/plugins/excel/ms-excel-write.h
+++ b/plugins/excel/ms-excel-write.h
@@ -178,4 +178,6 @@ int excel_font_from_go_font (XLExportBase *ewb, GOFont const *font);
 void xls_write_pivot_caches (ExcelWriteState *ewb, GsfOutfile *outfile,
                             MsBiffVersion version, int codepage);
 
+int excel_write_add_object_format (ExcelWriteState *ewb, GOFormat *format);
+
 #endif /* GNM_MS_EXCEL_WRITE_H */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]