[gnumeric] New xlsx_write_layout() to export manual positions in charts.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] New xlsx_write_layout() to export manual positions in charts.
- Date: Thu, 16 Feb 2017 06:58:03 +0000 (UTC)
commit 8f483bb72b26a8804cb16e9ec707b57d7abfdaed
Author: Jean Brefort <jean brefort normalesup org>
Date: Thu Feb 16 07:57:07 2017 +0100
New xlsx_write_layout() to export manual positions in charts.
plugins/excel/ChangeLog | 5 +++++
plugins/excel/xlsx-write-drawing.c | 24 +++++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 64a9517..c83c4b3 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2017-02-16 Jean Brefort <jean brefort normalesup org>
+
+ * xlsx-write-drawing.c (xlsx_write_layout), (xlsx_write_one_chart): first
+ attempt to export a manual position.
+
2017-02-15 Jean Brefort <jean brefort normalesup org>
* xlsx-read-drawing.c (xlsx_chart_text), (xlsx_text_value),
diff --git a/plugins/excel/xlsx-write-drawing.c b/plugins/excel/xlsx-write-drawing.c
index 24bdd5d..4a00881 100644
--- a/plugins/excel/xlsx-write-drawing.c
+++ b/plugins/excel/xlsx-write-drawing.c
@@ -694,6 +694,27 @@ xlsx_write_chart_text (XLSXWriteState *state, GsfXMLOut *xml,
g_free (text);
}
+static void
+xlsx_write_layout (GsfXMLOut *xml, GogObject const *obj)
+{
+ unsigned pos = gog_object_get_position_flags (obj, GOG_POSITION_ANY_MANUAL);
+ if (pos & GOG_POSITION_MANUAL) {
+ /* FIXME: we suppose that the position is relative to start, and not absolute */
+ GogViewAllocation alloc;
+ gsf_xml_out_start_element (xml, "c:layout");
+ gsf_xml_out_start_element (xml, "c:manualLayout");
+ gog_object_get_manual_position ((GogObject *) obj, &alloc);
+ xlsx_write_chart_cstr_unchecked (xml, "c:xMode", "edge");
+ xlsx_write_chart_cstr_unchecked (xml, "c:yMode", "edge");
+ xlsx_write_chart_float (xml, "c:x", alloc.x);
+ xlsx_write_chart_float (xml, "c:y", alloc.y);
+ xlsx_write_chart_float (xml, "c:w", alloc.w);
+ xlsx_write_chart_float (xml, "c:h", alloc.h);
+ gsf_xml_out_end_element (xml); /* </c:manualLayout> */
+ gsf_xml_out_end_element (xml); /* </c:layout> */
+ }
+}
+
static unsigned
xlsx_get_axid (XLSXWriteState *state, GogAxis *axis)
{
@@ -1270,8 +1291,8 @@ xlsx_write_one_chart (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *ch
case GOG_POSITION_W:
str = "l";
break;
- case GOG_POSITION_E:
default:
+ case GOG_POSITION_E:
str = "r";
break;
case GOG_POSITION_N | GOG_POSITION_E:
@@ -1288,6 +1309,7 @@ xlsx_write_one_chart (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *ch
break;
}
xlsx_write_chart_cstr_unchecked (xml, "c:legendPos", str);
+ xlsx_write_layout (xml, obj);
gsf_xml_out_end_element (xml); /* </c:legend> */
}
gsf_xml_out_end_element (xml); /* </c:chart> */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]