[gnumeric] Export/import opacity of fill-colours to/from ODF. [Part of #681009]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Export/import opacity of fill-colours to/from ODF. [Part of #681009]
- Date: Thu, 2 Aug 2012 05:56:30 +0000 (UTC)
commit 8428ece251b806247ee3db7d5feb8da8d10b8bbe
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Wed Aug 1 23:55:35 2012 -0600
Export/import opacity of fill-colours to/from ODF. [Part of #681009]
2012-08-02 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_apply_style_props): handle opacity
(od_style_prop_chart): save opacity
NEWS | 2 +-
plugins/openoffice/ChangeLog | 5 +++++
plugins/openoffice/openoffice-read.c | 28 +++++++++++++++++++---------
3 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/NEWS b/NEWS
index 693e2e1..c4d287b 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +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]
+ * Export/import opacity of fill-colours to/from ODF. [Part of #681009]
Jean:
* Fix component references issues. [#680190]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 50fb696..ac88869 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,8 @@
+2012-08-02 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (odf_apply_style_props): handle opacity
+ (od_style_prop_chart): save opacity
+
2012-08-01 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_go_color_opacity): new
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 95b18cd..d604a67 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -756,6 +756,9 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
unsigned int fill_type = OO_FILL_TYPE_UNKNOWN;
gboolean stroke_colour_set = FALSE;
+ gchar const *fill_color = NULL;
+ gnm_float opacity = 1;
+
desc = pango_font_description_copy (style->font.font->desc);
for (l = props; l != NULL; l = l->next) {
OOProp *prop = l->data;
@@ -783,14 +786,11 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
style->fill.auto_type = FALSE;
fill_type = OO_FILL_TYPE_NONE;
}
- } else if (0 == strcmp (prop->name, "fill-color")) {
- GdkRGBA rgba;
- gchar const *color = g_value_get_string (&prop->value);
- if (gdk_rgba_parse (&rgba, color)) {
- go_color_from_gdk_rgba (&rgba, &style->fill.pattern.back);
- style->fill.auto_back = FALSE;
- }
- } else if (0 == strcmp (prop->name, "stroke-color")) {
+ } else if (0 == strcmp (prop->name, "fill-color"))
+ fill_color = g_value_get_string (&prop->value);
+ else if (0 == strcmp (prop->name, "opacity"))
+ opacity = g_value_get_double (&prop->value);
+ else if (0 == strcmp (prop->name, "stroke-color")) {
GdkRGBA rgba;
gchar const *color = g_value_get_string (&prop->value);
if (gdk_rgba_parse (&rgba, color)) {
@@ -870,7 +870,14 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
style->line.width = g_value_get_double (&prop->value);
else if (0 == strcmp (prop->name, "repeat"))
style->fill.image.type = g_value_get_int (&prop->value);
-
+ }
+ if (fill_color) {
+ GdkRGBA rgba;
+ if (gdk_rgba_parse (&rgba, fill_color)) {
+ rgba.alpha = opacity;
+ go_color_from_gdk_rgba (&rgba, &style->fill.pattern.back);
+ style->fill.auto_back = FALSE;
+ }
}
if (desc_changed)
go_style_set_font_desc (style, desc);
@@ -6657,6 +6664,9 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
(style->style_props,
oo_prop_new_string ("fill-color",
CXML2C(attrs[1])));
+ else if (oo_attr_percent (xin, attrs, OO_NS_DRAW, "opacity", &ftmp))
+ style->style_props = g_slist_prepend (style->style_props,
+ oo_prop_new_double ("opacity", ftmp));
else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_DRAW, "fill-hatch-name"))
style->style_props = g_slist_prepend
(style->style_props,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]