[gnumeric] xlsx: improve arrow size export.



commit b7c095c749e6f999fa21621a8a44407df44b30a5
Author: Morten Welinder <terra gnome org>
Date:   Thu Feb 12 17:49:40 2015 -0500

    xlsx: improve arrow size export.

 plugins/excel/ChangeLog            |    3 +++
 plugins/excel/xlsx-write-drawing.c |   24 +++++++++++++-----------
 2 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index b4166d6..d991a9b 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,8 @@
 2015-02-12  Morten Welinder  <terra gnome org>
 
+       * xlsx-write-drawing.c (xlsx_write_go_style_full): Improve arrow
+       export with xls_arrow_to_xl.
+
        * ms-excel-util.c (xls_arrow_to_xl): New function extraced from...
        * ms-excel-write.c (write_arrow): ...here
 
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index 79d2914..a750def 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -360,21 +360,23 @@ xlsx_write_go_style_full (GsfXMLOut *xml, GOStyle *style, const XLSXStyleContext
 
                for (i = 0; i < 2; i++) {
                        GOArrow const *arr = i ? sctx->end_arrow : sctx->start_arrow;
-                       const char *typ;
+                       XLArrowType typ;
+                       int l, w;
+                       static const char *types[] = {
+                               "none", "triangle", "stealth",
+                               "diamond", "oval", "arrow"
+                       };
+                       static const char *sizes[] = { "sm", "med", "lg" };
 
                        if (!arr) continue;
 
-                       switch (arr->typ) {
-                       case GO_ARROW_NONE: typ = "none"; break;
-                       default:
-                       case GO_ARROW_KITE: typ = "arrow"; break;
-                       case GO_ARROW_OVAL: typ = "oval"; break;
-                       }
-
+                       xls_arrow_to_xl (arr, &typ, &l, &w);
                        gsf_xml_out_start_element (xml, i ? "a:tailEnd" : "a:headEnd");
-                       gsf_xml_out_add_cstr_unchecked (xml, "type", typ);
-                       /* "w" */
-                       /* "len" */
+                       gsf_xml_out_add_cstr_unchecked (xml, "type", types[typ]);
+                       if (typ) {
+                               gsf_xml_out_add_cstr_unchecked (xml, "w", sizes[CLAMP(w,0,2)]);
+                               gsf_xml_out_add_cstr_unchecked (xml, "len", sizes[CLAMP(l,0,2)]);
+                       }
                        gsf_xml_out_end_element (xml);
                }
 


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