Commit 5212ffa1 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Improve pattern fill round trip through ODF.

2015-04-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* ods-ext-schema.patch: add gnm:foreground-solid

2015-04-12  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* openoffice-read.c (odf_apply_style_props): read and obey the
	new foreground-solid flag
	* openoffice-write.c (odf_write_gog_style_graphic): write the
	new foreground-solid flag
parent 0e52cbfd
......@@ -7,6 +7,7 @@ Andreas:
* Harden ODF import against fuzzed files. [#747447][#747448]
* Fix ODF import/export of unlinked checkboxes and radio buttons.
* Plug leak in ODF import and export. [#747590]
* Improve pattern fill round trip through ODF.
Jean:
* Fix signal handling while running Python. [#744638]
......
2015-04-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* openoffice-read.c (odf_apply_style_props): read and obey the
new foreground-solid flag
* openoffice-write.c (odf_write_gog_style_graphic): write the
new foreground-solid flag
2015-04-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* openoffice-write.c (odf_write_image): don't keep image ref
......
......@@ -554,6 +554,7 @@ static OOFormula odf_get_formula_type (GsfXMLIn *xin, char const **str);
static char const *odf_strunescape (char const *string, GString *target,
G_GNUC_UNUSED GnmConventions const *convs);
static void odf_sheet_suggest_size (GsfXMLIn *xin, int *cols, int *rows);
static void oo_prop_list_has (GSList *props, gboolean *threed, char const *tag);
/* Implementations */
......@@ -847,7 +848,9 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
char const *marker_fill_colour = NULL;
gboolean gnm_auto_font_set = FALSE;
gboolean gnm_auto_font = FALSE;
gboolean gnm_foreground_solid = FALSE;
oo_prop_list_has (props, &gnm_foreground_solid, "gnm-foreground-solid");
style->line.auto_dash = TRUE;
desc = pango_font_description_copy (style->font.font->desc);
......@@ -858,7 +861,8 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
if (0 == strcmp (val_string, "solid")) {
style->fill.type = GO_STYLE_FILL_PATTERN;
style->fill.auto_type = FALSE;
style->fill.pattern.pattern = GO_PATTERN_SOLID;
style->fill.pattern.pattern = (gnm_foreground_solid) ?
GO_PATTERN_FOREGROUND_SOLID : GO_PATTERN_SOLID;
fill_type = OO_FILL_TYPE_SOLID;
} else if (0 == strcmp (val_string, "hatch")) {
style->fill.type = GO_STYLE_FILL_PATTERN;
......@@ -881,12 +885,20 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
GdkRGBA rgba;
gchar const *color = g_value_get_string (&prop->value);
if (gdk_rgba_parse (&rgba, color)) {
guint a = GO_COLOR_UINT_A (style->fill.pattern.back);
go_color_from_gdk_rgba (&rgba, &style->fill.pattern.back);
style->fill.auto_back = FALSE;
style->fill.pattern.back = GO_COLOR_CHANGE_A (style->fill.pattern.back, a);
guint a;
if (gnm_foreground_solid) {
a = GO_COLOR_UINT_A (style->fill.pattern.fore);
go_color_from_gdk_rgba (&rgba, &style->fill.pattern.fore);
style->fill.auto_fore = FALSE;
style->fill.pattern.fore = GO_COLOR_CHANGE_A (style->fill.pattern.fore, a);
} else {
a = GO_COLOR_UINT_A (style->fill.pattern.back);
go_color_from_gdk_rgba (&rgba, &style->fill.pattern.back);
style->fill.auto_back = FALSE;
style->fill.pattern.back = GO_COLOR_CHANGE_A (style->fill.pattern.back, a);
}
}
} else if (0 == strcmp (prop->name, "opacity")) {
}else if (0 == strcmp (prop->name, "opacity")) {
guint a = 255 * g_value_get_double (&prop->value);
style->fill.pattern.back = GO_COLOR_CHANGE_A (style->fill.pattern.back, a);
} else if (0 == strcmp (prop->name, "stroke-color")) {
......@@ -1008,6 +1020,7 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
gnm_auto_font = g_value_get_boolean (&prop->value);
}
}
if (desc_changed)
go_style_set_font_desc (style, desc);
else
......@@ -7311,6 +7324,10 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
(style->style_props,
oo_prop_new_string ("fill",
CXML2C(attrs[1])));
else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "foreground-solid", &btmp))
style->style_props = g_slist_prepend
(style->style_props,
oo_prop_new_bool ("gnm-foreground-solid", btmp));
else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "auto-type", &btmp))
style->style_props = g_slist_prepend
(style->style_props,
......
......@@ -7455,6 +7455,8 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style, gboolean
g_free (color);
}
} else if (style->fill.pattern.pattern == GO_PATTERN_FOREGROUND_SOLID) {
if (state->with_extension)
odf_add_bool (state->xml, GNMSTYLE "foreground-solid", TRUE);
gsf_xml_out_add_cstr (state->xml, DRAW "fill", "solid");
if (!style->fill.auto_fore) {
char *color = odf_go_color_to_string (style->fill.pattern.fore);
......
2015-04-12 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* ods-ext-schema.patch: add gnm:foreground-solid
2015-04-12 Morten Welinder <terra@gnome.org>
* t6150-ods-syntax.pl: Use default full corpos.
......
--- ods-schema/OpenDocument-v1.2-os-schema.rng 2015-01-28 18:46:19.155715877 -0500
+++ ods-schema/OpenDocument-v1.2-os-ext-schema.rng 2015-04-12 14:14:37.624042609 -0400
--- ods-schema/OpenDocument-v1.2-os-schema.rng 2015-04-08 21:49:54.058918977 -0600
+++ ods-schema/OpenDocument-v1.2-os-ext-schema.rng 2015-04-12 12:20:51.420486277 -0600
@@ -62,6 +62,9 @@
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
......@@ -358,7 +358,7 @@
<attribute name="style:diagonal-tl-br">
<ref name="string"/>
</attribute>
@@ -17060,6 +17207,41 @@
@@ -17060,6 +17207,46 @@
<ref name="nonNegativeInteger"/>
</attribute>
</optional>
......@@ -383,6 +383,11 @@
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="gnm:foreground-solid">
+ <ref name="boolean"/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="gnm:pattern">
+ <ref name="integer"/>
+ </attribute>
......@@ -400,7 +405,7 @@
</interleave>
</define>
<define name="style-graphic-fill-properties-attlist">
@@ -18124,4 +18306,78 @@
@@ -18124,4 +18311,78 @@
</element>
</zeroOrMore>
</define>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment