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

Use goc_canvas_invalidate_region() for ants walking.

parent d660a287
2014-10-27 Jean Brefort <jean.brefort@normalesup.org>
* src/item-cursor.c (cb_item_cursor_animation): use
goc_canvas_invalidate_region() for ants walking. Avoid drawing outside of a
draw event.
2014-10-26 Morten Welinder <terra@gnome.org>
* src/value.h (VALUE_IS_CELLRANGE, VALUE_IS_ARRAY): New macros.
......
2014-10-27 Jean Brefort <jean.brefort@normalesup.org>
* xlsx-read-drawing.c (xlsx_axis_format): add some support for axis format.
* xlsx-write-drawing.c (xlsx_write_one_plot): ditto.
2014-10-24 Morten Welinder <terra@gnome.org>
* ms-excel-read.c (excel_get_chars): Plug leak.
......
......@@ -508,7 +508,7 @@ ms_biff_query_next (BiffQuery *q)
* I am guessing that we should always handle BIFF_CONTINUE here,
* except for the few record types exempt from encryption. For
* now, however, do the bare minimum.
*/
*/
switch (q->opcode) {
case BIFF_BG_PIC:
case BIFF_BOUNDSHEET:
......
......@@ -2117,10 +2117,10 @@ BC_R(shtprops)(XLChartHandler const *handle,
d (1, {
g_printerr ("%sesize chart with window.\n",
dont_size_with_window ? "Don't r": "R");
if (has_pos_record && !ignore_pos_record)
g_printerr ("There should be a POS record around here soon\n");
if (manual_format)
g_printerr ("Manually formated\n");
if (only_plot_visible_cells)
......
......@@ -5294,7 +5294,7 @@ excel_read_CF (BiffQuery *q, ExcelReadSheet *esheet, GnmStyleConditions *sc,
}
data += 64;
if (0xFFFFFFFF != (size = GSF_LE_GET_GUINT32 (data)))
gnm_style_set_font_size (overlay, size / 20.);
if (0xFFFFFFFF != (colour = GSF_LE_GET_GUINT32 (data + 16)))
......
......@@ -591,6 +591,22 @@ xlsx_axis_orientation (GsfXMLIn *xin, xmlChar const **attrs)
g_object_set (G_OBJECT (state->axis.obj),
"invert-axis", orient, NULL);
}
static void
xlsx_axis_format (GsfXMLIn *xin, xmlChar const **attrs)
{
XLSXReadState *state = (XLSXReadState *)xin->user_state;
gboolean shared = TRUE;
char const *fmt = NULL;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (0 == strcmp (attrs[0], "sourceLinked"))
attr_bool (xin, attrs, "sourceLinked", &shared);
else if (0 == strcmp (attrs[0], "formatCode"))
fmt = attrs[1];
if (fmt && !shared)
g_object_set (G_OBJECT (state->axis.obj),
"assigned-format-string-XL", fmt, NULL);
}
static void
xlsx_chart_logbase (GsfXMLIn *xin, xmlChar const **attrs)
{
......@@ -815,11 +831,11 @@ xlsx_scatter_style (GsfXMLIn *xin, xmlChar const **attrs)
}
}
static void
static void
xlsx_chart_bubble (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
{ xlsx_chart_add_plot (xin, "GogBubblePlot"); }
static void
static void
xlsx_chart_radar (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
{ xlsx_chart_add_plot (xin, "GogRadarPlot"); }
......@@ -1666,7 +1682,7 @@ GSF_XML_IN_NODE_FULL (START, CHART_SPACE, XL_NS_CHART, "chartSpace", GSF_XML_NO_
GSF_XML_IN_NODE (CAT_AXIS, AXIS_AXID, XL_NS_CHART, "axId", GSF_XML_NO_CONTENT, &xlsx_axis_id, NULL),
GSF_XML_IN_NODE (CAT_AXIS, AXIS_DELETE, XL_NS_CHART, "delete", GSF_XML_NO_CONTENT, &xlsx_axis_delete, NULL),
GSF_XML_IN_NODE (CAT_AXIS, SHAPE_PR, XL_NS_CHART, "spPr", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
GSF_XML_IN_NODE (CAT_AXIS, AXIS_NUMFMT, XL_NS_CHART, "numFmt", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (CAT_AXIS, AXIS_NUMFMT, XL_NS_CHART, "numFmt", GSF_XML_NO_CONTENT, &xlsx_axis_format, NULL),
GSF_XML_IN_NODE (CAT_AXIS, AXIS_DELETE, XL_NS_CHART, "delete", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE_FULL (CAT_AXIS, AXIS_MAJORTICKMARK, XL_NS_CHART, "majorTickMark", GSF_XML_NO_CONTENT, FALSE, TRUE, &xlsx_axis_mark, NULL, 1),
GSF_XML_IN_NODE_FULL (CAT_AXIS, AXIS_MINORTICKMARK, XL_NS_CHART, "minorTickMark", GSF_XML_NO_CONTENT, FALSE, TRUE, &xlsx_axis_mark, NULL, 0),
......@@ -2142,7 +2158,7 @@ xlsx_read_chart (GsfXMLIn *xin, xmlChar const **attrs)
if (ds)
dat = gog_dataset_get_dim (ds, -1);
if (dat)
gog_dataset_set_dim (GOG_DATASET (title), 0,
gog_dataset_set_dim (GOG_DATASET (title), 0,
GO_DATA (g_object_ref (dat)), &err);
if (err)
g_error_free (err);
......
......@@ -1676,7 +1676,7 @@ xlsx_sheet_page_setup (G_GNUC_UNUSED GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (attr_bool (xin, attrs, "fitToPage", &tmp))
pi->scaling.type = tmp ? PRINT_SCALE_FIT_PAGES : PRINT_SCALE_PERCENTAGE;
pi->scaling.type = tmp ? PRINT_SCALE_FIT_PAGES : PRINT_SCALE_PERCENTAGE;
}
static void
......@@ -1707,7 +1707,7 @@ xlsx_paper_size (gdouble width, gdouble height, GtkUnit unit, int code)
if (code == 0) {
name = g_strdup_printf ("xlsx_%ix%i", (int)width, (int)height);
display_name = g_strdup_printf (_("Paper from XLSX file: %ipt\xE2\xA8\x89%ipt"),
display_name = g_strdup_printf (_("Paper from XLSX file: %ipt\xE2\xA8\x89%ipt"),
(int)width, (int)height);
} else {
name = g_strdup_printf ("xlsx_%i", code);
......@@ -1859,7 +1859,7 @@ xlsx_set_paper_from_code (PrintInformation *pi, int code)
if (ps != NULL) {
gtk_page_setup_set_paper_size (pi->page_setup, ps);
return TRUE;
}
}
}
return FALSE;
......@@ -1897,7 +1897,7 @@ xlsx_CT_PageSetup (GsfXMLIn *xin, xmlChar const **attrs)
{ "downThenOver", 0 },
{ NULL, 0 }
};
if (pi->page_setup == NULL)
print_info_load_defaults (pi);
......@@ -1938,7 +1938,7 @@ xlsx_CT_PageSetup (GsfXMLIn *xin, xmlChar const **attrs)
pi->start_page = -1;
if (!xlsx_set_paper_from_code (pi, paper_code) && width > 0.0 && height > 0.0)
gtk_page_setup_set_paper_size (pi->page_setup,
gtk_page_setup_set_paper_size (pi->page_setup,
xlsx_paper_size (width, height, GTK_UNIT_POINTS, 0));
if (orient_set)
print_info_set_paper_orientation (pi, orient);
......@@ -3680,7 +3680,7 @@ xlsx_read_external_book (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"
"externalLink");
if (rel == NULL)
rel = gsf_open_pkg_lookup_rel_by_type
rel = gsf_open_pkg_lookup_rel_by_type
(gsf_xml_in_get_input (xin),
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"
"externalLinkPath");
......@@ -3703,9 +3703,9 @@ xlsx_read_external_sheetname (GsfXMLIn *xin, xmlChar const **attrs)
if (state->external_ref)
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (0 == strcmp (attrs[0], "val"))
workbook_sheet_attach
workbook_sheet_attach
(state->external_ref,
state->external_ref_sheet =
state->external_ref_sheet =
sheet_new (state->external_ref, attrs[1], 256, 65536));
}
static void
......@@ -4035,7 +4035,7 @@ xlsx_numfmt_common (GsfXMLIn *xin, xmlChar const **attrs, gboolean apply)
}
static void
xlsx_style_numfmt (GsfXMLIn *xin, xmlChar const **attrs)
xlsx_style_numfmt (GsfXMLIn *xin, xmlChar const **attrs)
{
xlsx_numfmt_common (xin, attrs, FALSE);
}
......@@ -4605,7 +4605,7 @@ xlsx_dxf_end (GsfXMLIn *xin, GsfXMLBlob *blob)
}
static void
xlsx_dxf_numfmt (GsfXMLIn *xin, xmlChar const **attrs)
xlsx_dxf_numfmt (GsfXMLIn *xin, xmlChar const **attrs)
{
xlsx_numfmt_common (xin, attrs, TRUE);
}
......
......@@ -131,16 +131,16 @@ xlsx_conventions_add_extern_ref (GnmConventions *convs, char const *path)
}
static GnmExpr const *
xlsx_func_map_in (GnmConventions const *convs,
xlsx_func_map_in (GnmConventions const *convs,
G_GNUC_UNUSED Workbook *scope,
char const *name, GnmExprList *args)
{
XLSXExprConventions const *xconv = (XLSXExprConventions const *)convs;
GnmExpr const * (*handler) (GnmConventions const *convs, Workbook *scope,
GnmExpr const * (*handler) (GnmConventions const *convs, Workbook *scope,
GnmExprList *args);
GnmFunc *f;
char const *new_name;
if (0 == g_ascii_strncasecmp (name, "_xlfn.", 6)) {
if (NULL != xconv->xlfn_map &&
NULL != (new_name = g_hash_table_lookup (xconv->xlfn_map, name + 6)))
......@@ -163,7 +163,7 @@ xlsx_func_map_in (GnmConventions const *convs,
f = gnm_func_lookup_or_add_placeholder (name);
return gnm_expr_new_funcall (f, args);
return gnm_expr_new_funcall (f, args);
}
static void
......@@ -182,7 +182,7 @@ xlsx_func_map_out (GnmConventionsOut *out, GnmExprFunction const *func)
if (new_name == NULL) {
char *new_u_name;
new_u_name = g_ascii_strup (name, -1);
if (func->func->impl_status ==
if (func->func->impl_status ==
GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC)
g_string_append (target, "_xlfngnumeric.");
/* LO & friends use _xlfnodf */
......@@ -206,7 +206,7 @@ xlsx_func_binominv_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UN
{
GnmFunc *f = gnm_func_lookup_or_add_placeholder ("r.qbinom");
GnmExprList *arg;
arg = g_slist_nth (args, 2);
args = g_slist_remove_link (args, arg);
args = g_slist_concat (arg, args);
......@@ -234,15 +234,15 @@ xlsx_func_dist_handler (GnmExprList *args, guint n_args, char const *name, char
gnm_expr_list_free (arg_cum);
constant = gnm_expr_get_constant (cum);
if (constant == NULL || !VALUE_IS_NUMBER (constant)) {
args_c = gnm_expr_list_copy (args);
return gnm_expr_new_funcall3
return gnm_expr_new_funcall3
(f_if, cum,
gnm_expr_new_funcall (f_p, args),
gnm_expr_new_funcall (f_d, args_c));
} else if (value_is_zero (constant)) {
gnm_expr_free (cum);
return gnm_expr_new_funcall (f_d, args);
......@@ -254,35 +254,35 @@ xlsx_func_dist_handler (GnmExprList *args, guint n_args, char const *name, char
}
static GnmExpr const *
xlsx_func_chisqdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope,
xlsx_func_chisqdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope,
GnmExprList *args)
{
return xlsx_func_dist_handler (args, 3, "chisq.dist", "r.pchisq", "r.dchisq");
}
static GnmExpr const *
xlsx_func_fdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope,
xlsx_func_fdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope,
GnmExprList *args)
{
return xlsx_func_dist_handler (args, 4, "f.dist", "r.pf", "r.df");
}
static GnmExpr const *
xlsx_func_lognormdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope,
xlsx_func_lognormdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope,
GnmExprList *args)
{
return xlsx_func_dist_handler (args, 4, "lognorm.dist", "r.plnorm", "r.dlnorm");
}
static GnmExpr const *
xlsx_func_negbinomdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope,
xlsx_func_negbinomdist_handler (G_GNUC_UNUSED GnmConventions const *convs, G_GNUC_UNUSED Workbook *scope,
GnmExprList *args)
{
return xlsx_func_dist_handler (args, 4, "negbinom.dist", "r.pnbinom", "r.dnbinom");
}
static void
xlsx_write_r_q_func (GnmConventionsOut *out, char const *name, char const *name_rt,
xlsx_write_r_q_func (GnmConventionsOut *out, char const *name, char const *name_rt,
GnmExprConstPtr const *ptr, int n, int n_p,
gboolean use_lower_tail, gboolean use_log)
{
......@@ -295,9 +295,9 @@ xlsx_write_r_q_func (GnmConventionsOut *out, char const *name, char const *name_
g_string_append (target, name_rt);
} else
g_string_append (target, name);
g_string_append_c (target, '(');
for (i = 1; i<=n_p; i++) {
gnm_expr_as_gstring (ptr[i], out);
g_string_append_c (target, ',');
......@@ -327,22 +327,22 @@ xlsx_write_r_q_func (GnmConventionsOut *out, char const *name, char const *name_
* xlsx_func_r_q_output_handler:
*
* @out: #GnmConventionsOut
* @func: #GnmExprFunction
* @func: #GnmExprFunction
* @n: last index used for a parameter
* @n_p: index of the probability argument, usually 0
* @n_p: index of the probability argument, usually 0
* @name:
*
* Print the appropriate simple function call
*/
static gboolean
xlsx_func_r_q_output_handler (GnmConventionsOut *out, GnmExprFunction const *func, int n, int n_p,
xlsx_func_r_q_output_handler (GnmConventionsOut *out, GnmExprFunction const *func, int n, int n_p,
char const *name, char const *name_rt)
{
GnmExprConstPtr const *ptr = func->argv;
GString *target = out->accum;
int use_lower_tail; /* 0: never; 1: always; 2: sometimes */
int use_log; /* 0: never; 1: always; 2: sometimes */
if (func->argc <= n || func->argc > (n+3))
return FALSE;
......@@ -358,13 +358,13 @@ xlsx_func_r_q_output_handler (GnmConventionsOut *out, GnmExprFunction const *fun
GnmValue const *constant = gnm_expr_get_constant (ptr[n+2]);
if (constant == NULL || !VALUE_IS_NUMBER (constant))
use_log = 2;
else
else
use_log = value_is_zero (constant) ? 0 : 1;
} else
use_log = 0;
if (use_lower_tail < 2 && use_log == 0) {
/* R.Qx(a,b,c) --> name(a,b,c) */
/* R.Qx(a,b,c) --> name(a,b,c) */
/* R.Qx(a,b,c) --> name(1-a,b,c) */
xlsx_write_r_q_func (out, name, name_rt, ptr, n, n_p, use_lower_tail, 0);
return TRUE;
......@@ -510,7 +510,7 @@ xlsx_string_parser (char const *in, GString *target,
g_string_append_c (target, quote);
in += 2;
} else
return in + 1;
return in + 1;
} else
g_string_append_c (target, *in++);
}
......@@ -565,7 +565,7 @@ xlsx_conventions_new (gboolean output)
{"FLOOR", xlsx_func_floor_output_handler},
{NULL, NULL}
};
static struct {
char const *xlsx_name;
char const *gnm_name;
......@@ -608,7 +608,7 @@ xlsx_conventions_new (gboolean output)
{ "WEIBULL.DIST", "WEIBULL" },
{ "Z.TEST", "ZTEST" },
{ NULL, NULL }
};
};
GnmConventions *convs = gnm_conventions_new_full (
sizeof (XLSXExprConventions));
XLSXExprConventions *xconv = (XLSXExprConventions *)convs;
......
......@@ -341,6 +341,7 @@ xlsx_write_one_plot (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *cha
GogAxis *crossed = gog_axis_base_get_crossed_axis (GOG_AXIS_BASE (ptr->data));
GogAxisPosition pos;
GogGridLine *grid;
GOFormat *format;
if (gog_axis_is_discrete (ptr->data))
gsf_xml_out_start_element (xml, "c:catAx");
else
......@@ -386,6 +387,12 @@ xlsx_write_one_plot (XLSXWriteState *state, GsfXMLOut *xml, GogObject const *cha
xlsx_write_go_style (xml, go_styled_object_get_style (GO_STYLED_OBJECT (grid)));
gsf_xml_out_end_element (xml);
}
gsf_xml_out_start_element (xml, "c:numFmt");
format = gog_axis_get_format (GOG_AXIS (ptr->data));
gsf_xml_out_add_bool (xml, "sourceLinked", format == NULL || go_format_is_general (format));
format = gog_axis_get_effective_format (GOG_AXIS (ptr->data));
gsf_xml_out_add_cstr (xml, "formatCode", (format)? go_format_as_XL (format): "General");
gsf_xml_out_end_element (xml);
/* finished with axis */
gsf_xml_out_end_element (xml);
......@@ -474,7 +481,7 @@ xlsx_write_object_anchor (GsfXMLOut *xml, GnmCellPos const *pos, char const *ele
/* FIXME: scaling horizontally just like in xlsx_CT_Col */
gsf_xml_out_start_element (xml, element);
gsf_xml_out_simple_int_element (xml, "xdr:col", pos->col);
gsf_xml_out_simple_int_element (xml, "xdr:colOff",
gsf_xml_out_simple_int_element (xml, "xdr:colOff",
xlsx_pts_to_emu (col_off_pts * 1.16191275167785));
gsf_xml_out_simple_int_element (xml, "xdr:row", pos->row);
gsf_xml_out_simple_int_element (xml, "xdr:rowOff",
......
......@@ -208,7 +208,7 @@ static char const * const pats[] = {
"lightGrid", /* 17 */
"lightTrellis", /* 18 */
/* Not in Excel */
"lightVertical", /* 19 */
"lightVertical", /* 19 */
"darkHorizontal", /* 20 */
"lightGray", /* 21 */
"lightGray", /* 22 */
......@@ -2438,14 +2438,14 @@ xlsx_find_paper_code (GtkPaperSize *psize)
return 5;
width_mm = (int) gtk_paper_size_get_width (psize, GTK_UNIT_MM);
for (paper_defs = paper; paper_defs->code > 0; paper_defs++) {
if (width_mm < paper_defs->width_mm)
return 0;
if (width_mm == paper_defs->width_mm) {
gdouble width = gtk_paper_size_get_width (psize, paper_defs->unit);
gdouble height = gtk_paper_size_get_height (psize, paper_defs->unit);
if (width == paper_defs->width && height == paper_defs->height)
return paper_defs->code;
}
......@@ -2553,10 +2553,10 @@ xlsx_write_print_info (XLSXWriteState *state, GsfXMLOut *xml)
} else
gsf_xml_out_add_cstr_unchecked (xml, "orientation", "default");
gsf_xml_out_add_cstr_unchecked
(xml, "pageOrder",
gsf_xml_out_add_cstr_unchecked
(xml, "pageOrder",
pi->print_across_then_down ? "overThenDown" : "downThenOver");
if (pi->page_setup) {
GtkPaperSize *psize;
int paper_code;
......@@ -2569,14 +2569,14 @@ xlsx_write_print_info (XLSXWriteState *state, GsfXMLOut *xml)
else {
gdouble width = gtk_paper_size_get_width (psize, GTK_UNIT_POINTS);
gdouble height = gtk_paper_size_get_height (psize, GTK_UNIT_POINTS);
xlsx_add_pt (xml, "paperHeight", height);
xlsx_add_pt (xml, "paperWidth", width);
}
}
if (pi->scaling.percentage.x > 0)
gsf_xml_out_add_int (xml, "scale",
if (pi->scaling.percentage.x > 0)
gsf_xml_out_add_int (xml, "scale",
(int)CLAMP (pi->scaling.percentage.x, 10, 400));
xlsx_add_bool (xml, "useFirstPageNumber", (pi->start_page >= 0));
/* usePrinterDefaults skipped */
......@@ -2712,7 +2712,7 @@ xlsx_write_sheet (XLSXWriteState *state, GsfOutfile *dir, GsfOutfile *wb_part, u
/* element sheetPr { CT_SheetPr }?, */
gsf_xml_out_start_element (xml, "sheetPr");
pi = state->sheet->print_info;
if (pi != NULL) {
gsf_xml_out_start_element (xml, "pageSetUpPr");
......@@ -2726,7 +2726,7 @@ xlsx_write_sheet (XLSXWriteState *state, GsfOutfile *dir, GsfOutfile *wb_part, u
gsf_xml_out_end_element (xml); /* </tabColor> */
}
gsf_xml_out_end_element (xml); /* </sheetPr> */
/* element dimension { CT_SheetDimension }?, */
gsf_xml_out_start_element (xml, "dimension");
xlsx_add_range (xml, "ref", &extent);
......
......@@ -476,7 +476,7 @@ html_write_border_style_40 (GsfOutput *output, GnmStyle const *style)
}
static void
html_write_border_style_40_for_merged_cell (GsfOutput *output, GnmStyle const *style,
html_write_border_style_40_for_merged_cell (GsfOutput *output, GnmStyle const *style,
Sheet *sheet, gint row, gint col)
{
GnmBorder *border;
......
......@@ -758,7 +758,7 @@ latex2e_find_vline (int col, int row, Sheet *sheet, GnmStyleElement which_border
if (result == GNM_STYLE_BORDER_NONE)
return GNM_STYLE_BORDER_NONE;
pos.col = col;
pos.row = row;
range = gnm_sheet_merge_contains_pos (sheet, &pos);
......@@ -768,7 +768,7 @@ latex2e_find_vline (int col, int row, Sheet *sheet, GnmStyleElement which_border
|| (which_border == MSTYLE_BORDER_RIGHT&& col == range->end.col))
return result;
else
return GNM_STYLE_BORDER_NONE;
return GNM_STYLE_BORDER_NONE;
}
return result;
}
......@@ -1194,7 +1194,7 @@ latex2e_find_hhlines (GnmStyleBorderType *clines, G_GNUC_UNUSED int length, int
return FALSE;
}
}
return TRUE;
}
......
......@@ -286,13 +286,13 @@ typedef struct {
gint z_index;
/* Plot Area */
gnm_float plot_area_x;
gnm_float plot_area_x;
gnm_float plot_area_y;
gnm_float plot_area_width;
gnm_float plot_area_width;
gnm_float plot_area_height;
/* Legend */
gnm_float legend_x;
gnm_float legend_x;
gnm_float legend_y;
GogObjectPosition legend_flag;
......@@ -1183,13 +1183,13 @@ oo_parse_spec_distance (char const *str, gnm_float *pts)
} else if (0 == strncmp (end, "in", 2)) {
num = GO_IN_TO_PT (num);
end += 2;
} else
} else
return GINT_TO_POINTER(1);
} else return NULL;
*pts = num;
return end;
}
/* returns pts */
......@@ -2511,7 +2511,7 @@ odf_validation_new_single_expr (GsfXMLIn *xin, odf_validation_t *val,
odf_init_pp (&pp, xin, val->base_cell_address);
flag = (pp.sheet == NULL || state->pos.sheet == pp.sheet)
? GNM_EXPR_PARSE_DEFAULT
? GNM_EXPR_PARSE_DEFAULT
: GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES;
texpr = oo_expr_parse_str (xin, start, &pp, flag, val->f_type);
......@@ -2552,7 +2552,7 @@ odf_validation_new_pair_expr (GsfXMLIn *xin, odf_validation_t *val,
odf_init_pp (&pp, xin, val->base_cell_address);
flag = (pp.sheet == NULL || state->pos.sheet == pp.sheet)
? GNM_EXPR_PARSE_DEFAULT
? GNM_EXPR_PARSE_DEFAULT
: GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES;
while (1) {
......@@ -2716,7 +2716,7 @@ odf_validation_get_input_message (GsfXMLIn *xin, char const *name)
{
OOParseState *state = (OOParseState *)xin->user_state;
odf_validation_t *val = g_hash_table_lookup (state->validations, name);
if (val == NULL)
return NULL;
......@@ -2764,7 +2764,7 @@ odf_validations_translate (GsfXMLIn *xin, char const *name)
oo_warning (xin, _("Unsupported validation condition "
"encountered: \"%s\" with base address: \"%s\""),
val->condition, val->base_cell_address);
return NULL;
}
......@@ -3809,7 +3809,7 @@ oo_cell_start (GsfXMLIn *xin, xmlChar const **attrs)
texpr = oo_expr_parse_str
(xin, expr_string,
&state->pos, GNM_EXPR_PARSE_DEFAULT, f_type);
if (possible_error_constant && texpr != NULL &&
if (possible_error_constant && texpr != NULL &&
GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_CONSTANT) {
GnmValue const *eval = gnm_expr_get_constant (texpr->expr);
if (VALUE_IS_ERROR (eval)) {
......@@ -3901,7 +3901,7 @@ oo_cell_start (GsfXMLIn *xin, xmlChar const **attrs)
"content-validation-name"))
validation_name = attrs[1];
}
if (columns_spanned_fake)
merge_cols = 1;
......@@ -4690,8 +4690,8 @@ oo_style_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
switch (state->cur_style.type) {
case OO_STYLE_CELL :
if (state->cur_style.cells != NULL) {
odf_style_set_align_h (state->cur_style.cells->style,
state->h_align_is_valid,
odf_style_set_align_h (state->cur_style.cells->style,
state->h_align_is_valid,
state->repeat_content,
state->text_align, state->gnm_halign);
odf_oo_cell_style_unref (state->cur_style.cells);
......@@ -5088,7 +5088,7 @@ oo_date_text_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
if (xin->content->len > state->cur_format.offset)
oo_date_text_append (state, xin->content->str + state->cur_format.offset,
xin->content->len - state->cur_format.offset);
if (state->cur_format.string_opened) {
g_string_append_c (state->cur_format.accum, '"');
state->cur_format.string_opened = FALSE;
......@@ -5308,10 +5308,10 @@ odf_number (GsfXMLIn *xin, xmlChar const **attrs)
*zero = '?';
min_i_chars--;
}
} else
} else
go_format_generate_number_str (state->cur_format.accum, min_i_digits, decimal_places,
grouping, FALSE, FALSE, NULL, NULL);
} else
g_string_append (state->cur_format.accum, go_format_as_XL (go_format_general ()));
}
......@@ -5415,16 +5415,16 @@ odf_format_invisible_text (GsfXMLIn *xin, xmlChar const **attrs)
if (cnt_len == 1) {
state->cur_format.offset += 1;
} else if (cnt_len > 1) {
oo_date_text_append (state, cnt, cnt_len - 1);
state->cur_format.offset += cnt_len;
}
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_GNUM_NS_EXT, "char"))
text = CXML2C (attrs[1]);
if (text != NULL) {
if (state->cur_format.string_opened) {
g_string_append_c (state->cur_format.accum, '"');
......@@ -5846,7 +5846,7 @@ odf_page_layout (GsfXMLIn *xin, xmlChar const **attrs)
name = "Missing page layout identifier";
}
state->print.cur_pi = print_information_new (TRUE);
g_hash_table_insert (state->styles.page_layouts, g_strdup (name),
g_hash_table_insert (state->styles.page_layouts, g_strdup (name),
state->print.cur_pi);
}
......@@ -5908,7 +5908,7 @@ odf_master_page (GsfXMLIn *xin, xmlChar const **attrs)
print_hf_free (state->print.cur_pi->footer);
state->print.cur_pi->header = print_hf_new (NULL, NULL, NULL);
state->print.cur_pi->footer = print_hf_new (NULL, NULL, NULL);
g_hash_table_insert (state->styles.master_pages, g_strdup (name), state->print.cur_pi);
}
......@@ -6014,7 +6014,7 @@ odf_hf_item_start (GsfXMLIn *xin)
oo_text_p_t *ptr = state->text_p_stack->data;
odf_text_p_add_text (state, xin->content->str + ptr->offset);
ptr->offset = strlen (xin->content->str);
}
}
}
static void
......@@ -6200,8 +6200,8 @@ oo_set_gnm_border (G_GNUC_UNUSED GsfXMLIn *xin, GnmStyle *style,
old_border = gnm_style_get_border (style, location);
new_border = gnm_style_border_fetch (border_style,
old_border ?
style_color_ref(old_border->color)
old_border ?
style_color_ref(old_border->color)
: style_color_black (),
gnm_style_border_get_orientation (loc));
gnm_style_set_border (style, location, new_border);
......@@ -6251,7 +6251,7 @@ oo_parse_border (GsfXMLIn *xin, GnmStyle *style,
border_style = GNM_STYLE_BORDER_DOTTED;
else
border_style = GNM_STYLE_BORDER_DOUBLE;
border = gnm_style_border_fetch (border_style, color,
gnm_style_border_get_orientation (loc));
border->width = pts;
......@@ -6472,14 +6472,14 @@ oo_style_prop_cell (GsfXMLIn *xin, xmlChar const **attrs)
gnm_style_set_font_script (style, GO_FONT_SCRIPT_SUPER);
else if (g_str_has_prefix (attrs[1], "sub"))
gnm_style_set_font_script (style, GO_FONT_SCRIPT_SUB);
else
else
gnm_style_set_font_script (style, GO_FONT_SCRIPT_STANDARD);
} else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_FO, "margin-left")) {
tmp_f = 0.;
oo_parse_distance (xin, attrs[1], "margin-left", &tmp_f);
gnm_style_set_indent (style, tmp_f);
}
if (strike_through_style != -1 || strike_through_type != -1)
gnm_style_set_font_strike (style, strike_through_style > 0 ||
(strike_through_type > 0 && strike_through_style == -1));
......@@ -6497,7 +6497,7 @@ oo_style_prop_cell (GsfXMLIn *xin, xmlChar const **attrs)
underline = UNDERLINE_DOUBLE_LOW;
} else {
underline = UNDERLINE_DOUBLE;
}
}
break;
case 1:
default:
......@@ -6511,7 +6511,7 @@ oo_style_prop_cell (GsfXMLIn *xin, xmlChar const **attrs)
}
gnm_style_set_font_uline (style, underline);
}