[gnumeric] Export opacity of sheet objects to ODF. [Part of #681009]



commit 106ec0ab1b638208a06a45f3ed55efae6e72148f
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Aug 1 22:38:20 2012 -0600

    Export opacity of sheet objects to ODF. [Part of #681009]
    
    2012-08-01  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (odf_go_color_opacity): new
    	(odf_write_gog_style_graphic): write draw:opacity

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-write.c |   12 ++++++++++++
 3 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index 55ea09b..693e2e1 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Andreas:
 	[Part of #680718]
 	* Fix layering of sheet objects in ODF export and import. 
 	[Part of #681009]
+	* Export opacity of sheet objects to ODF. [Part of #681009]
 
 Jean:
 	* Fix component references issues. [#680190]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 08f06b5..50fb696 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2012-08-01  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-write.c (odf_go_color_opacity): new
+	(odf_write_gog_style_graphic): write draw:opacity
+
+2012-08-01  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (odf_set_z_index ): new
 	(odf_z_idx_compare): new
 	(oo_table_end): sort the objects by z-index
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 4d8fd5b..2862879 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -570,6 +570,12 @@ odf_go_color_to_string (GOColor color)
 					 GO_COLOR_UINT_B (color));
 }
 
+static double
+odf_go_color_opacity (GOColor color)
+{
+	return (GO_COLOR_UINT_A (color)/255.);
+}
+
 static void
 gnm_xml_out_add_hex_color (GsfXMLOut *o, char const *id, GnmColor const *c, int pattern)
 {
@@ -6866,12 +6872,16 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style)
 				if (!style->fill.auto_back) {
 					color = odf_go_color_to_string (style->fill.pattern.back);
 					gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
+					odf_add_percent (state->xml, DRAW "opacity", 
+							 odf_go_color_opacity (style->fill.pattern.back));
 				}
 			} else if (style->fill.pattern.pattern == GO_PATTERN_FOREGROUND_SOLID) {
 				gsf_xml_out_add_cstr (state->xml, DRAW "fill", "solid");
 				if (!style->fill.auto_fore) {
 					color = odf_go_color_to_string (style->fill.pattern.fore);
 					gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
+					odf_add_percent (state->xml, DRAW "opacity", 
+							 odf_go_color_opacity (style->fill.pattern.fore));
 				}
 			} else {
 				gchar *hatch = odf_get_pattern_name (state, style);
@@ -6881,6 +6891,8 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style)
 				if (!style->fill.auto_back) {
 					color = odf_go_color_to_string (style->fill.pattern.back);
 					gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
+					odf_add_percent (state->xml, DRAW "opacity", 
+							 odf_go_color_opacity (style->fill.pattern.back));
 				}
 				g_free (hatch);
 				odf_add_bool (state->xml, DRAW "fill-hatch-solid", TRUE);



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