[gnumeric] Make sure that we are looking for the right styles
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Make sure that we are looking for the right styles
- Date: Wed, 17 Jun 2009 20:28:56 -0400 (EDT)
commit 07b920331aa6391878bb94e2474e02297ef06e2e
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Wed Jun 17 18:28:24 2009 -0600
Make sure that we are looking for the right styles
2009-06-17 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_find_style): give more info in the case
we don't find the style
(odf_save_this_style_with_name): new
(odf_save_this_style): use odf_save_this_style_with_name
(odf_write_content_rows): THe style row contains styles already
adjusted for the values. We can't use that. So access the real
styles.
plugins/openoffice/ChangeLog | 10 +++++
plugins/openoffice/openoffice-write.c | 63 ++++++++++++++++++---------------
2 files changed, 44 insertions(+), 29 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index e5eab35..8ed4575 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,15 @@
2009-06-17 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-write.c (odf_find_style): give more info in the case
+ we don't find the style
+ (odf_save_this_style_with_name): new
+ (odf_save_this_style): use odf_save_this_style_with_name
+ (odf_write_content_rows): THe style row contains styles already
+ adjusted for the values. We can't use that. So access the real
+ styles.
+
+2009-06-17 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (oo_func_map_in): perform some function name
translation
* openoffice-write.c (odf_expr_func_handler): perform some function
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index b517ac3..b5466cc 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -62,7 +62,7 @@
#include <tools/scenarios.h>
#include <gutils.h>
#include <xml-io.h>
-
+#include <style-conditions.h>
#include <gsf/gsf-libxml.h>
#include <gsf/gsf-output.h>
@@ -943,17 +943,12 @@ odf_write_style (GnmOOExport *state, GnmStyle const *style, gboolean is_default)
odf_write_style_goformat_name (state, format);
}
-
odf_write_style_cell_properties (state, style);
odf_write_style_paragraph_properties (state, style);
odf_write_style_text_properties (state, style);
-
-
/* MSTYLE_VALIDATION validations need to be written at a different place and time in ODF */
/* MSTYLE_HLINK hyperlinks can not be attached to styles but need to be attached to the cell content */
-
-/* MSTYLE_CONDITIONS What are we using these for? */
}
#undef UNDERLINESPECS
@@ -965,8 +960,8 @@ odf_find_style (GnmOOExport *state, GnmStyle const *style)
char const *found = g_hash_table_lookup (state->cell_styles, style);
if (found == NULL) {
- g_warning("We forgot to export a required style!");
- return "Missing-Style";
+ g_print ("Could not find style %p\n", style);
+ return NULL;
}
return found;
@@ -1056,16 +1051,42 @@ odf_find_col_style (GnmOOExport *state, ColRowInfo const *ci, gboolean write)
}
static void
-odf_save_this_style (GnmStyle *style, G_GNUC_UNUSED gconstpointer dummy, GnmOOExport *state)
+odf_save_this_style_with_name (GnmStyle *style, GnmOOExport *state, char const *name)
{
- char *name = g_strdup_printf ("ACELL-%p", style);
- g_hash_table_insert (state->cell_styles, style, name);
odf_start_style (state->xml, name, "table-cell");
odf_write_style (state, style, FALSE);
gsf_xml_out_end_element (state->xml); /* </style:style */
}
static void
+odf_save_this_style (GnmStyle *style, G_GNUC_UNUSED gconstpointer dummy, GnmOOExport *state)
+{
+ char *name = g_strdup_printf ("ACELL-%p", style);
+ GnmStyleConditions const *sc;
+
+ g_hash_table_insert (state->cell_styles, style, name);
+
+ if (gnm_style_is_element_set (style, MSTYLE_CONDITIONS) &&
+ NULL != (sc = gnm_style_get_conditions (style))) {
+ GArray const *conds = gnm_style_conditions_details (sc);
+ if (conds != NULL) {
+ guint i;
+ for (i = 0 ; i < conds->len ; i++) {
+ GnmStyleCond const *cond;
+
+ cond = &g_array_index (conds, GnmStyleCond, i);
+ /* When we correctly save contitional styles, then we should in fact */
+ /* stick with the same name! */
+ odf_save_this_style (cond->overlay, NULL, state);
+ }
+ }
+ }
+
+
+ odf_save_this_style_with_name (style, state, name);
+}
+
+static void
odf_write_character_styles (GnmOOExport *state)
{
int i;
@@ -2331,20 +2352,6 @@ odf_write_content_rows (GnmOOExport *state, Sheet const *sheet, int from, int to
GSList **sheet_merges, GnmPageBreaks *pb, G_GNUC_UNUSED GnmStyle **col_styles)
{
int col, row;
- int n;
- GnmStyleRow sr;
-
- n = row_length + 2;
- sr.vertical = g_alloca (n * 4 * sizeof (gpointer));
- sr.vertical += 1;
- sr.top = sr.vertical + n;
- sr.bottom = sr.top + n;
- sr.styles = ((GnmStyle const **) (sr.bottom + n));
- sr.start_col = 0;
- sr.end_col = row_length - 1;
- sr.hide_grid = TRUE;
-
- /* We are currently ignoring col_from and col_to but using them should speed things up.*/
for (row = from; row < to; row++) {
ColRowInfo const *ci = sheet_row_get (sheet, row);
@@ -2355,9 +2362,6 @@ odf_write_content_rows (GnmOOExport *state, Sheet const *sheet, int from, int to
pos.row = row;
- sr.row = row;
- sheet_style_get_row (sheet, &sr);
-
if (gnm_page_breaks_get_break (pb, row) != GNM_PAGE_BREAK_NONE)
gsf_xml_out_simple_element (state->xml,
TEXT "soft-page-break",
@@ -2384,7 +2388,8 @@ odf_write_content_rows (GnmOOExport *state, Sheet const *sheet, int from, int to
}
if ((merge_range == NULL) && (cc == NULL) &&
gnm_cell_is_empty (current_cell)) {
- GnmStyle const *this_style = sr.styles [col];
+ GnmStyle const *this_style= sheet_style_get (sheet, pos.col, pos.row);
+
if ((null_cell == 0) || (null_style == this_style)) {
null_style = this_style;
if (covered_cell > 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]