Commit a62bc21a authored by Jean Bréfort's avatar Jean Bréfort

Fix component references issues. [#680190]

parent a6801ab7
2012-07-26 Jean Brefort <jean.brefort@normalesup.org>
* component/gnumeric.c (go_gnm_component_get_data),
(cb_editor_destroyed): fix references issues. [#680190]
* src/ssgrep.c (main): don't crash for files with components.
* src/ssindex.c (main):
2012-07-25 Morten Welinder <terra@gnome.org>
* src/func.h (GnmFunc): Use "usage" instead of "ref_count".
......
......@@ -4,6 +4,9 @@ Andreas:
* Some documentation updates.
* Fix implicit ')' for array functions. [#680548]
Jean:
* Fix component references issues. [#680190]
Morten:
* Fix xls read crash. [#679992]
* Reduce code duplication for dependents.
......
......@@ -101,6 +101,7 @@ go_gnm_component_get_data (GOComponent *component, gpointer *data, int *length,
*length = gsf_output_size (output);
*clearfunc = g_object_unref;
*user_data = output;
g_object_unref (io_context);
return TRUE;
}
return FALSE;
......@@ -204,7 +205,8 @@ static GtkActionEntry const actions[] = {
static void
cb_editor_destroyed (GOGnmComponent *gognm)
{
g_object_unref (gognm->edited);
if (gognm->edited && G_OBJECT (gognm->edited)->ref_count > 0)
g_object_unref (gognm->edited);
gognm->edited = NULL;
}
......
......@@ -5181,7 +5181,7 @@ excel_read_CF (BiffQuery *q, ExcelReadSheet *esheet, GnmStyleConditions *sc)
cond = gnm_style_cond_new (cop, esheet->sheet);
if (expr0_len > 0) {
GnmExprTop const *texpr =
GnmExprTop const *texpr =
ms_sheet_parse_expr_internal
(esheet,
q->data + q->length - expr0_len - expr1_len,
......@@ -5190,7 +5190,7 @@ excel_read_CF (BiffQuery *q, ExcelReadSheet *esheet, GnmStyleConditions *sc)
gnm_expr_top_unref (texpr);
}
if (expr1_len > 0) {
GnmExprTop const *texpr =
GnmExprTop const *texpr =
ms_sheet_parse_expr_internal
(esheet,
q->data + q->length - expr1_len,
......
......@@ -2261,7 +2261,7 @@ xlsx_cond_fmt_formula_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
parse_pos_init_sheet (&pp, state->sheet);
gnm_style_cond_set_expr (state->cond,
gnm_style_cond_set_expr (state->cond,
xlsx_parse_expr (xin, xin->content->str, &pp),
state->count);
state->count++;
......@@ -3150,8 +3150,8 @@ xlsx_run_color (GsfXMLIn *xin, xmlChar const **attrs)
_("Invalid color '%s' for attribute rgb"),
attrs[1]);
}
attr = pango_attr_foreground_new (CLAMP ((int)r * 257, 0, 65535),
CLAMP ((int)g * 257, 0, 65535),
attr = pango_attr_foreground_new (CLAMP ((int)r * 257, 0, 65535),
CLAMP ((int)g * 257, 0, 65535),
CLAMP ((int)b * 257, 0, 65535));
if (state->run_attrs == NULL)
state->run_attrs = pango_attr_list_new ();
......@@ -3451,7 +3451,7 @@ xlsx_sstitem_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
entry = &g_array_index (state->sst, XLSXStr, state->count);
state->count++;
entry->str = go_string_new_nocopy (text);
if (state->rich_attrs) {
entry->markup = go_format_new_markup (state->rich_attrs, FALSE);
state->rich_attrs = NULL;
......
......@@ -4902,7 +4902,7 @@ gnumeric_adtest (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
value_array_set (result, 0, 0,
value_new_error_VALUE (ei->pos));
value_array_set (result, 0, 1,
value_new_error_VALUE (ei->pos));
value_new_error_VALUE (ei->pos));
} else {
value_array_set (result, 0, 0,
value_new_float (p));
......
......@@ -206,7 +206,7 @@ gnm_compare_strings (const char *cstr1, const char *cstr2)
/* then it is exactly the same. */
while (*a == *b && *a != 0 && *b != 0)
a++, b++;
if (*a == 0)
return (*b == 0);
if (*b == 0)
......@@ -226,17 +226,17 @@ gnm_compare_strings (const char *cstr1, const char *cstr2)
/* are both expanded by NFD (or NFKD) into the sequence */
/*"U+0041 U+030A" (Latin letter "A" and combining ring above "°") */
/* Of course "U+0041 U+030A" is retained in form, so we need to work with */
/* at least the last ASCII character. Performance should nearly be */
/* at least the last ASCII character. Performance should nearly be */
/* identical to using all */
str1 = g_utf8_normalize (cstr1, -1, G_NORMALIZE_DEFAULT);
str2 = g_utf8_normalize (cstr2, -1, G_NORMALIZE_DEFAULT);
val = (g_strcmp0 (str1, str2) == 0);
g_free (str1);
g_free (str2);
return val;
}
......
......@@ -367,7 +367,7 @@ struct _OOParseState {
int col_inc, row_inc;
gboolean content_is_error;
GSList *text_p_stack;
oo_text_p_t text_p_for_cell;
......@@ -1513,7 +1513,7 @@ odf_text_p_apply_pango_attribute (PangoAttribute *attribute, gpointer ptr)
{
odf_text_p_apply_style_t *data = ptr;
PangoAttribute *attr = pango_attribute_copy (attribute);
attr->start_index = data->start;
attr->end_index = data->end;
......@@ -1523,7 +1523,7 @@ odf_text_p_apply_pango_attribute (PangoAttribute *attribute, gpointer ptr)
}
static void
odf_text_p_apply_style (OOParseState *state,
odf_text_p_apply_style (OOParseState *state,
PangoAttrList *attrs,
int start, int end)
{
......@@ -1542,7 +1542,7 @@ odf_text_p_apply_style (OOParseState *state,
data.start = start;
data.end = end;
data.attrs = ptr->attrs;
pango_attr_list_filter (attrs, odf_text_p_apply_pango_attribute, &data);
}
......@@ -1577,7 +1577,7 @@ odf_pop_text_p (OOParseState *state)
GSList *link = state->text_p_stack;
g_return_if_fail (state->text_p_stack != NULL);
ptr = link->data;
g_slist_free_full (ptr->span_style_stack, g_free);
ptr->span_style_stack = NULL;
......@@ -1588,7 +1588,7 @@ odf_pop_text_p (OOParseState *state)
pango_attr_list_unref (ptr->attrs);
g_free (ptr);
}
state->text_p_stack = g_slist_remove_link (state->text_p_stack, link);
g_slist_free_1 (link);
}
......@@ -1612,7 +1612,7 @@ odf_text_content_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
oo_text_p_t *ptr = state->text_p_stack->data;
if (strlen (xin->content->str) > ptr->offset)
odf_text_p_add_text
odf_text_p_add_text
(state, xin->content->str + ptr->offset);
}
......@@ -2326,7 +2326,7 @@ odf_validation_new_list (GsfXMLIn *xin, odf_validation_t *val, guint offset)
GNM_VALIDATION_TYPE_IN_LIST,
GNM_VALIDATION_OP_NONE,
state->pos.sheet,
val->title,
val->title,
val->message ? val->message->str : NULL,
texpr,
NULL,
......@@ -2358,7 +2358,7 @@ odf_validation_new_single_expr (GsfXMLIn *xin, odf_validation_t *val,
val_type,
val_op,
state->pos.sheet,
val->title,
val->title,
val->message ? val->message->str : NULL,
texpr,
NULL,
......@@ -2416,7 +2416,7 @@ odf_validation_new_pair_expr (GsfXMLIn *xin, odf_validation_t *val,
val_type,
val_op,
state->pos.sheet,
val->title,
val->title,
val->message ? val->message->str : NULL,
texpr_a,
texpr_b,
......@@ -2701,7 +2701,7 @@ odf_validation_error_message_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
static void
odf_adjust_offsets_col (OOParseState *state, int *col, double *x, gboolean absolute)
{
ColRowInfo const *cr = sheet_col_get_info (state->pos.sheet,
ColRowInfo const *cr = sheet_col_get_info (state->pos.sheet,
*col);
int last = gnm_sheet_get_last_col (state->pos.sheet);
if (absolute && *col > 0)
......@@ -2722,7 +2722,7 @@ odf_adjust_offsets_col (OOParseState *state, int *col, double *x, gboolean absol
static void
odf_adjust_offsets_row (OOParseState *state, int *row, double *y, gboolean absolute)
{
ColRowInfo const *cr = sheet_row_get_info (state->pos.sheet,
ColRowInfo const *cr = sheet_row_get_info (state->pos.sheet,
*row);
int last = gnm_sheet_get_last_row (state->pos.sheet);
if (absolute && *row > 0)
......@@ -2754,7 +2754,7 @@ oo_table_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
GnmRange r;
int rows, cols;
int max_cols, max_rows;
GSList *l;
GSList *l;
maybe_update_progress (xin);
......@@ -2969,7 +2969,7 @@ odf_oo_cell_style_ref (OOCellStyle *oostyle)
}
static void
odf_oo_cell_style_attach_condition (OOCellStyle *oostyle, OOCellStyle *cstyle,
odf_oo_cell_style_attach_condition (OOCellStyle *oostyle, OOCellStyle *cstyle,
gchar const *condition, gchar const *base)
{
g_return_if_fail (oostyle != NULL);
......@@ -3047,7 +3047,7 @@ odf_style_load_one_value (GsfXMLIn *xin, char *condition, GnmStyleCond *cond, gc
}
static void
odf_style_add_condition (GsfXMLIn *xin, GnmStyle *style, GnmStyle *cstyle,
odf_style_add_condition (GsfXMLIn *xin, GnmStyle *style, GnmStyle *cstyle,
gchar const *condition, gchar const *base)
{
OOParseState *state = (OOParseState *)xin->user_state;
......@@ -3147,7 +3147,7 @@ odf_style_add_condition (GsfXMLIn *xin, GnmStyle *style, GnmStyle *cstyle,
g_free (text);
}
}
if (!success || !cond) {
if (cond)
gnm_style_cond_free (cond);
......@@ -3166,7 +3166,7 @@ odf_style_add_condition (GsfXMLIn *xin, GnmStyle *style, GnmStyle *cstyle,
sc = gnm_style_conditions_new (sheet);
gnm_style_conditions_insert (sc, cond, -1);
gnm_style_set_conditions (style, sc);
}
}
gnm_style_cond_free (cond);
}
......@@ -3636,7 +3636,7 @@ oo_cell_start (GsfXMLIn *xin, xmlChar const **attrs)
}
gnm_style_set_format (oostyle->style, format);
}
}
}
}
if (oostyle != NULL)
style = odf_style_from_oo_cell_style (xin, oostyle);
......@@ -3860,7 +3860,7 @@ oo_cell_content_start (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
}
}
odf_push_text_p (state, TRUE);
odf_push_text_p (state, TRUE);
}
......@@ -3946,7 +3946,7 @@ oo_covered_cell_start (GsfXMLIn *xin, xmlChar const **attrs)
state->col_inc = 1;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (oo_attr_int_range (xin, attrs, OO_NS_TABLE, "number-columns-repeated",
if (oo_attr_int_range (xin, attrs, OO_NS_TABLE, "number-columns-repeated",
&state->col_inc, 0, INT_MAX))
;
#if 0
......@@ -6412,7 +6412,7 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
oo_prop_new_string ("map-name", "Log"));
} else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "link-data-style-to-source", &btmp)) {
if (btmp)
style->other_props = g_slist_prepend
style->other_props = g_slist_prepend
(style->other_props,
oo_prop_new_bool ("ignore-axis-data-style", btmp));
} else if (oo_attr_bool (xin, attrs, OO_NS_CHART, "vertical", &btmp)) {
......@@ -6744,7 +6744,7 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
("marker-end", CXML2C(attrs[1])));
}
if ((stacked_set && !overlap_set) ||
if ((stacked_set && !overlap_set) ||
(percentage_set && !stacked_unset && !overlap_set))
style->plot_props = g_slist_prepend (style->plot_props,
oo_prop_new_int ("overlap-percentage", 100));
......@@ -6856,7 +6856,7 @@ od_style_prop_text (GsfXMLIn *xin, xmlChar const **attrs)
style_color_unref (color);
attr->start_index = 0;
attr->end_index = 0;
pango_attr_list_insert (state->cur_style.text, attr);
pango_attr_list_insert (state->cur_style.text, attr);
} else if ((color = oo_attr_color (xin, attrs, OO_NS_FO, "background-color"))) {
attr = go_color_to_pango (color->go_color, FALSE);
style_color_unref (color);
......@@ -7212,7 +7212,7 @@ od_draw_frame_start (GsfXMLIn *xin, xmlChar const **attrs)
frame_offset[3] = end_y ;
}
odf_draw_frame_store_location (state, frame_offset,
odf_draw_frame_store_location (state, frame_offset,
(height > 0) ? height : go_nan,
(width > 0) ? width : go_nan);
......@@ -7263,7 +7263,7 @@ od_draw_text_frame_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
OOParseState *state = (OOParseState *)xin->user_state;
oo_text_p_t *ptr;
if (state->text_p_stack != NULL && (NULL != (ptr = state->text_p_stack->data))
if (state->text_p_stack != NULL && (NULL != (ptr = state->text_p_stack->data))
&& ptr->gstr != NULL)
g_object_set (state->chart.so, "text", ptr->gstr->str, "markup", ptr->attrs, NULL);
od_draw_frame_end_full (xin, FALSE);
......@@ -7276,7 +7276,7 @@ odf_line_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
OOParseState *state = (OOParseState *)xin->user_state;
oo_text_p_t *ptr;
if (state->text_p_stack != NULL && (NULL != (ptr = state->text_p_stack->data))
if (state->text_p_stack != NULL && (NULL != (ptr = state->text_p_stack->data))
&& ptr->gstr != NULL)
oo_warning (xin, _("Gnumeric's sheet object lines do not support attached text. "
"The text \"%s\" has been dropped."), ptr->gstr->str);
......@@ -7718,7 +7718,7 @@ oo_chart_title (GsfXMLIn *xin, xmlChar const **attrs)
else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
OO_GNUM_NS_EXT, "anchor"))
state->chart.title_anchor = g_strdup (CXML2C (attrs[1]));
else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "is-position-manual",
else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "is-position-manual",
&state->chart.title_manual_pos))
;
else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_SVG, "x"))
......@@ -7730,7 +7730,7 @@ oo_chart_title (GsfXMLIn *xin, xmlChar const **attrs)
if (!(go_finite (state->chart.title_x) && go_finite (state->chart.title_y)))
state->chart.title_manual_pos = FALSE;
if (state->chart.title_position == NULL)
state->chart.title_position = g_strdup ((xin->node->user_data.v_int == 2) ? "bottom" : "top");
state->chart.title_position = g_strdup ((xin->node->user_data.v_int == 2) ? "bottom" : "top");
odf_push_text_p (state, FALSE);
}
......@@ -7745,15 +7745,15 @@ oo_chart_title_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
g_return_if_fail (state->text_p_stack != NULL);
ptr = state->text_p_stack->data;
g_return_if_fail (ptr != NULL);
if (state->chart.title_expr == NULL && ptr->gstr) {
state->chart.title_expr = gnm_expr_top_new_constant
(value_new_string_nocopy
(value_new_string_nocopy
(go_pango_attrs_to_markup (ptr->attrs, ptr->gstr->str)));
use_markup = (ptr->attrs != NULL &&
use_markup = (ptr->attrs != NULL &&
!go_pango_attr_list_is_empty (ptr->attrs));
}
if (state->chart.title_expr) {
GOData *data = gnm_go_data_scalar_new_expr
(state->chart.src_sheet, state->chart.title_expr);
......@@ -7773,7 +7773,7 @@ oo_chart_title_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
} else {
obj = (GogObject *)state->chart.chart;
tag = "Title";
}
}
label = gog_object_add_by_name (obj, tag, NULL);
gog_dataset_set_dim (GOG_DATASET (label), 0, data, NULL);
......@@ -7808,7 +7808,7 @@ oo_chart_title_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
alloc.w = 0;
alloc.y = state->chart.title_y / state->chart.height;
alloc.h = 0;
gog_object_set_position_flags (label, GOG_POSITION_MANUAL, GOG_POSITION_ANY_MANUAL);
gog_object_set_manual_position (label, &alloc);
} else {
......@@ -7818,7 +7818,7 @@ oo_chart_title_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
oo_warning (xin, _("Unable to determine manual position for a chart component!"));
}
}
}
g_free (state->chart.title_position);
state->chart.title_position = NULL;
......@@ -7916,7 +7916,7 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
gboolean has_prop = FALSE;
oo_prop_list_has (style->other_props, &has_prop, "ignore-axis-data-style");
if (!has_prop)
gog_axis_set_format (GOG_AXIS (state->chart.axis),
gog_axis_set_format (GOG_AXIS (state->chart.axis),
go_format_ref (style->fmt));
}
}
......@@ -8826,18 +8826,18 @@ oo_chart_grid (GsfXMLIn *xin, xmlChar const **attrs)
grid = gog_object_add_by_name (state->chart.axis, "MinorGrid", NULL);
} else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_CHART, "style-name"))
style_name = CXML2C (attrs[1]);
if (grid != NULL && style_name != NULL) {
GOStyle *style = NULL;
g_object_get (G_OBJECT (grid), "style", &style, NULL);
if (style) {
OOChartStyle *chart_style = g_hash_table_lookup
(state->chart.graph_styles, style_name);
odf_apply_style_props (xin, chart_style->style_props, style);
g_object_unref (style);
}
}
}
}
static void
......@@ -9074,8 +9074,8 @@ odf_line (GsfXMLIn *xin, xmlChar const **attrs)
height = y1 - y2;
}
odf_draw_frame_store_location (state, frame_offset,
height, width);
odf_draw_frame_store_location (state, frame_offset,
height, width);
col = sheet_col_get_info (state->pos.sheet, cell_base.start.col);
row = sheet_row_get_info (state->pos.sheet, cell_base.start.row);
......@@ -10202,11 +10202,11 @@ static GsfXMLInNode const opendoc_content_dtd [] =
GSF_XML_IN_NODE (TABLE, TABLE_SHAPES, OO_NS_TABLE, "shapes", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (TABLE_SHAPES, DRAW_FRAME, OO_NS_DRAW, "frame", GSF_XML_NO_CONTENT, &od_draw_frame_start, &od_draw_frame_end),
GSF_XML_IN_NODE (TABLE_SHAPES, DRAW_ELLIPSE, OO_NS_DRAW, "ellipse", GSF_XML_NO_CONTENT, &odf_ellipse, &od_draw_text_frame_end),
GSF_XML_IN_NODE (DRAW_ELLIPSE, TEXT_CONTENT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (DRAW_ELLIPSE, TEXT_CONTENT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (TABLE_SHAPES, DRAW_LINE, OO_NS_DRAW, "line", GSF_XML_NO_CONTENT, &odf_line, &odf_line_end),
GSF_XML_IN_NODE (DRAW_LINE, TEXT_CONTENT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (TABLE_SHAPES, DRAW_RECT, OO_NS_DRAW, "rect", GSF_XML_NO_CONTENT, &odf_rect, &od_draw_text_frame_end),
GSF_XML_IN_NODE (DRAW_RECT, TEXT_CONTENT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (DRAW_RECT, TEXT_CONTENT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (TABLE, FORMS, OO_NS_OFFICE, "forms", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (FORMS, FORM, OO_NS_FORM, "form", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (FORM, FORM_PROPERTIES, OO_NS_FORM, "properties", GSF_XML_NO_CONTENT, NULL, NULL),
......
......@@ -1131,8 +1131,8 @@ odf_write_style_cell_properties (GnmOOExport *state, GnmStyle const *style)
/* Background Color */
if (gnm_style_is_element_set (style, MSTYLE_COLOR_BACK))
gnm_xml_out_add_hex_color (state->xml, FOSTYLE "background-color",
gnm_style_get_back_color (style),
gnm_style_is_element_set (style, MSTYLE_PATTERN) ?
gnm_style_get_back_color (style),
gnm_style_is_element_set (style, MSTYLE_PATTERN) ?
gnm_style_get_pattern (style) : 1);
/* Borders */
BORDERSTYLE(MSTYLE_BORDER_TOP,FOSTYLE "border-top", STYLE "border-line-width-top", GNMSTYLE "border-line-style-top");
......@@ -1569,35 +1569,35 @@ odf_save_style_map (GnmOOExport *state, GnmStyleCond const *cond, GnmRange *r)
odf_determine_base (state, r, &pp);
g_string_append (str, "of:is-true-formula(NOT(ISERROR(FIND(");
odf_save_style_map_single_f (state, str, gnm_style_cond_get_expr (cond, 0), &pp);
g_string_append_printf (str, ";[.%s%s]))))",
g_string_append_printf (str, ";[.%s%s]))))",
col_name (pp.eval.col), row_name (pp.eval.row));
break;
case GNM_STYLE_COND_NOT_CONTAINS_STR:
odf_determine_base (state, r, &pp);
g_string_append (str, "of:is-true-formula(ISERROR(FIND(");
odf_save_style_map_single_f (state, str, gnm_style_cond_get_expr (cond, 0), &pp);
g_string_append_printf (str, ";[.%s%s])))",
g_string_append_printf (str, ";[.%s%s])))",
col_name (pp.eval.col), row_name (pp.eval.row));
break;
case GNM_STYLE_COND_BEGINS_WITH_STR:
odf_determine_base (state, r, &pp);
g_string_append (str, "of:is-true-formula(IFERROR(FIND(");
odf_save_style_map_single_f (state, str, gnm_style_cond_get_expr (cond, 0), &pp);
g_string_append_printf (str, ";[.%s%s]);2)=1)",
g_string_append_printf (str, ";[.%s%s]);2)=1)",
col_name (pp.eval.col), row_name (pp.eval.row));
break;
case GNM_STYLE_COND_NOT_BEGINS_WITH_STR:
odf_determine_base (state, r, &pp);
g_string_append (str, "of:is-true-formula(NOT(IFERROR(FIND(");
odf_save_style_map_single_f (state, str, gnm_style_cond_get_expr (cond, 0), &pp);
g_string_append_printf (str, ";[.%s%s]);2)=1))",
g_string_append_printf (str, ";[.%s%s]);2)=1))",
col_name (pp.eval.col), row_name (pp.eval.row));
break;
case GNM_STYLE_COND_ENDS_WITH_STR:
odf_determine_base (state, r, &pp);
g_string_append (str, "of:is-true-formula(EXACT(");
odf_save_style_map_single_f (state, str, gnm_style_cond_get_expr (cond, 0), &pp);
g_string_append_printf (str, ";RIGHT([.%s%s];LEN(",
g_string_append_printf (str, ";RIGHT([.%s%s];LEN(",
col_name (pp.eval.col), row_name (pp.eval.row));
odf_save_style_map_single_f (state, str, gnm_style_cond_get_expr (cond, 0), &pp);
g_string_append (str, ")))");
......@@ -1606,7 +1606,7 @@ odf_save_style_map (GnmOOExport *state, GnmStyleCond const *cond, GnmRange *r)
odf_determine_base (state, r, &pp);
g_string_append (str, "of:is-true-formula(NOT(EXACT(");
odf_save_style_map_single_f (state, str, gnm_style_cond_get_expr (cond, 0), &pp);
g_string_append_printf (str, ";RIGHT([.%s%s];LEN(",
g_string_append_printf (str, ";RIGHT([.%s%s];LEN(",
col_name (pp.eval.col), row_name (pp.eval.row));
odf_save_style_map_single_f (state, str, gnm_style_cond_get_expr (cond, 0), &pp);
g_string_append (str, "))))");
......@@ -1791,7 +1791,7 @@ odf_store_this_named_style (GnmStyle *style, char const *name, GnmRange *r, GnmO
real_name = g_strdup (name);
g_hash_table_insert (state->named_cell_styles, style, real_name);
g_hash_table_insert (state->named_cell_style_regions, gnm_style_region_new (r, style),
g_hash_table_insert (state->named_cell_style_regions, gnm_style_region_new (r, style),
g_strdup (real_name));
if (gnm_style_is_element_set (style, MSTYLE_CONDITIONS) &&
......@@ -2786,7 +2786,7 @@ odf_write_comment (GnmOOExport *state, GnmComment const *cc)
g_free (text);
if (markup != NULL)
pango_attr_list_unref (markup);
}
g_object_set (G_OBJECT (state->xml), "pretty-print", pp, NULL);
gsf_xml_out_end_element (state->xml); /* OFFICE "annotation" */
......@@ -2963,7 +2963,7 @@ odf_write_so_filled (GnmOOExport *state, SheetObject *so)
odf_new_markup (state, markup, text);
gsf_xml_out_end_element (state->xml); /* p */
g_object_set (G_OBJECT (state->xml), "pretty-print", pp, NULL);
g_free (text);
if (markup)
pango_attr_list_unref (markup);
......@@ -3562,7 +3562,7 @@ odf_write_content_rows (GnmOOExport *state, Sheet const *sheet, int from, int to
objects = odf_sheet_objects_get (sheet, &pos);
if ((!(current_cell && gnm_cell_has_expr(current_cell))) &&
if ((!(current_cell && gnm_cell_has_expr(current_cell))) &&
(merge_range == NULL) && (objects == NULL) &&
gnm_cell_is_empty (current_cell) &&
NULL == gnm_style_get_hlink
......@@ -4417,7 +4417,7 @@ odf_print_spreadsheet_content_validations (GnmOOExport *state)
gsf_xml_out_add_cstr_unchecked (state->xml, TABLE "message-type", message_type);
if (val->title != NULL)
gsf_xml_out_add_cstr (state->xml, TABLE "title", val->title->str);
if (val->msg != NULL && go_string_get_len (val->msg) > 0) {
gboolean white_written = TRUE;
gboolean pp = TRUE;
......@@ -5144,7 +5144,7 @@ odf_write_office_styles (GnmOOExport *state)
if (state->default_style_region->style != NULL) {
gsf_xml_out_start_element (state->xml, STYLE "default-style");
gsf_xml_out_add_cstr_unchecked (state->xml, STYLE "family", "table-cell");
odf_write_style (state, state->default_style_region->style,
odf_write_style (state, state->default_style_region->style,
&state->default_style_region->range, TRUE);
gsf_xml_out_end_element (state->xml); /* </style:default-style */
}
......@@ -6469,12 +6469,12 @@ odf_write_axis_style (GnmOOExport *state, G_GNUC_UNUSED GOStyle const *style,
odf_add_bool (state->xml, CHART "logarithmic",
0 != strcmp (type, "Linear"));
}
tmp = gog_axis_get_entry
tmp = gog_axis_get_entry
(GOG_AXIS (axis), GOG_AXIS_ELEM_MIN, &user_defined);
if (user_defined)
gsf_xml_out_add_float (state->xml, CHART "minimum", tmp, -1);
tmp = gog_axis_get_entry
tmp = gog_axis_get_entry
(GOG_AXIS (axis), GOG_AXIS_ELEM_MAX, &user_defined);
if (user_defined)
gsf_xml_out_add_float (state->xml, CHART "maximum", tmp, -1);
......@@ -6647,7 +6647,7 @@ odf_write_title (GnmOOExport *state, GogObject const *title,
{
if (title != NULL && id != NULL) {
GOData const *dat = gog_dataset_get_dim (GOG_DATASET(title),0);
if (dat != NULL) {
GnmExprTop const *texpr = gnm_go_data_get_expr (dat);
if (texpr != NULL) {
......@@ -6658,7 +6658,7 @@ odf_write_title (GnmOOExport *state, GogObject const *title,
g_object_get (G_OBJECT (state->xml), "pretty-print", &pp, NULL);
gsf_xml_out_start_element (state->xml, id);
if (state->with_extension) {
if (position == NULL)
g_object_get (G_OBJECT (title),
......@@ -6699,11 +6699,11 @@ odf_write_title (GnmOOExport *state, GogObject const *title,
g_object_set (G_OBJECT (state->xml), "pretty-print", FALSE, NULL);
gsf_xml_out_start_element (state->xml, TEXT "p");
str = value_peek_string (texpr->expr->constant.value);
if (GOG_IS_TEXT (title) &&
if (GOG_IS_TEXT (title) &&
(text = GOG_TEXT (title))->allow_markup) {
PangoAttrList *attr_list = NULL;
char *text_clean = NULL;
if (pango_parse_markup (str, -1, 0,
if (pango_parse_markup (str, -1, 0,
&attr_list,
&text_clean, NULL, NULL)) {
odf_new_markup (state, attr_list, text_clean);
......@@ -7020,7 +7020,7 @@ odf_write_gog_style_chart (GnmOOExport *state, GOStyle const *style, GogObject c
GOFormat *fmt = gog_axis_get_format (GOG_AXIS (obj));
odf_add_bool (state->xml, CHART "link-data-style-to-source", fmt == NULL);
}
func = g_hash_table_lookup (state->chart_props_hash, type);
if (func != NULL)
......@@ -7226,7 +7226,7 @@ odf_write_generic_axis (GnmOOExport *state,
}
static void
odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *graph,
odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *graph,
GogObject const *chart, GogObject const *plot)
{
char const *plot_type = G_OBJECT_TYPE_NAME (plot);
......@@ -7449,7 +7449,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *graph,
"compass", &position,
NULL);
is_footer = NULL != g_strstr_len (position, -1, "bottom");
odf_write_title (state, title,
odf_write_title (state, title,
is_footer ? CHART "footer" : CHART "subtitle",
TRUE, position);
g_slist_free (subtitles);
......@@ -7617,7 +7617,7 @@ odf_write_graph_content (GnmOOExport *state, GsfOutput *child, SheetObject *so)
graph = sheet_object_graph_get_gog (so);
if (graph != NULL) {
double pos[4];
GogRenderer *renderer;
GogRenderer *renderer;
GogObjectRole const *role =
gog_object_find_role_by_name (GOG_OBJECT (graph), "Chart");
......@@ -7627,7 +7627,7 @@ odf_write_graph_content (GnmOOExport *state, GsfOutput *child, SheetObject *so)
NULL);
gog_renderer_update (renderer, pos[2] - pos[0], pos[3] - pos[1]);
g_object_get (G_OBJECT (renderer), "view", &state->root_view, NULL);
if (role != NULL) {
GSList *charts = gog_object_get_children
(GOG_OBJECT (graph), role);
......@@ -7639,7 +7639,7 @@ odf_write_graph_content (GnmOOExport *state, GsfOutput *child, SheetObject *so)
GSList *plots = gog_object_get_children
(chart, gog_object_find_role_by_name (chart, "Plot"));
if (plots != NULL && plots->data != NULL) {
odf_write_plot (state, so, GOG_OBJECT (graph),
odf_write_plot (state, so, GOG_OBJECT (graph),
chart, plots->data);
plot_written = TRUE;
}
......@@ -8042,7 +8042,7 @@ openoffice_file_save_real (G_GNUC_UNUSED GOFileSaver const *fs, GOIOContext *io
state.named_cell_styles = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) g_free);
state.named_cell_style_regions = g_hash_table_new_full (g_direct_hash, g_direct_equal,
(GDestroyNotify) gnm_style_region_free,
(GDestroyNotify) gnm_style_region_free,
(GDestroyNotify) g_free);
state.cell_styles = g_hash_table_new_full (g_direct_hash, g_direct_equal,
NULL, (GDestroyNotify) g_free);
......@@ -8105,8 +8105,8 @@ openoffice_file_save_real (G_GNUC_UNUSED GOFileSaver const *fs, GOIOContext *io
GnmRange r = {{0,0},{0,0}};
/* We need to make sure any referenced styles are added to the named hash */
state.default_style_region = gnm_style_region_new (&r, style);
odf_store_this_named_style (state.default_style_region->style, "Gnumeric-default",
&state.default_style_region->range,
odf_store_this_named_style (state.default_style_region->style, "Gnumeric-default",
&state.default_style_region->range,
&state);
gnm_style_unref (style);
} else {
......
......@@ -444,7 +444,7 @@ gnm_app_workbook_foreach (GnmWbIterFunc cback, gpointer data)
/**
* gnm_app_workbook_get_by_index:
* @i: index
*
*
* Get nth workbook. Index is zero-based.
* Return value: (transfer none): the nth workbook if any.
*/
......
......@@ -735,32 +735,32 @@ guess_time_format (const char *prefix, gnm_float f)
*/