[gnumeric] Fix writing of colours to ODF



commit ecc7c23c22f2a073eda3de96cb713bc9ffea49c4
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue Sep 1 10:40:39 2009 -0600

    Fix writing of colours to ODF
    
    2009-09-01  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (gnm_xml_out_add_hex_color): compare with
    	  automatic background to see whether we have transparency

 plugins/openoffice/ChangeLog          |    5 +++++
 plugins/openoffice/openoffice-write.c |   16 +++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index fc91de5..dc62f34 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-01  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-write.c (gnm_xml_out_add_hex_color): compare with
+	  automatic background to see whether we have transparency
+
 2009-09-01  Morten Welinder  <terra gnome org>
 
 	* openoffice-read.c (oo_parse_color): Don't change color fields we
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 2b8ff18..1e45fb9 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -406,17 +406,18 @@ odf_add_pt (GsfXMLOut *xml, char const *id, float l)
 static void
 gnm_xml_out_add_hex_color (GsfXMLOut *o, char const *id, GnmColor const *c)
 {
-	char *color;
+	GnmColor *back_colour;
 	g_return_if_fail (c != NULL);
 
-/* FIXME! there should be a difference between white and transparent */
-
-	if ((GO_UINT_RGBA_A (c->go_color) == 0) &&
-	    c->gdk_color.red/256 == 0xFF &&
-	    c->gdk_color.green/256 == 0xFF &&
-	    c->gdk_color.blue/256 == 0xFF)
+	back_colour = style_color_auto_back ();
+/* The background colour of a new sheet is strangely not set as expected */
+/* 	if (style_color_equal (back_colour, c)) */
+	if (c->gdk_color.red   == back_colour->gdk_color.red &&
+	    c->gdk_color.green == back_colour->gdk_color.green &&
+	    c->gdk_color.blue  == back_colour->gdk_color.blue)
 		gsf_xml_out_add_cstr_unchecked (o, id, "transparent");
 	else {
+		char *color;
 		color = g_strdup_printf ("#%.2x%.2x%.2x", 
 					 c->gdk_color.red/256, 
 					 c->gdk_color.green/256, 
@@ -424,6 +425,7 @@ gnm_xml_out_add_hex_color (GsfXMLOut *o, char const *id, GnmColor const *c)
 		gsf_xml_out_add_cstr_unchecked (o, id, color);
 		g_free (color);
 	}
+	style_color_unref (back_colour);
 }
 
 static void



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