Commit 605d9902 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Add some const.

2005-05-18  Jody Goldberg <jody@gnome.org>

	http://bugzilla.gnome.org/show_bug.cgi?id=166611
	* ms-formula-read.c (excel_parse_formula) : Create a fwd declaration
	  of a NAME record that has not been read yet being used in a PTG_NAME.

	* ms-excel-read.c (excel_read_NAME) : keep a count of the name
	  records and use fwd declaration if they exist.
	(excel_workbook_destroy) : move the names array into the workbook from
	  the container.
	(excel_workbook_new) : ditto.

2005-05-18  Jody Goldberg <jody@gnome.org>

	http://bugzilla.gnome.org/show_bug.cgi?id=304528
	* ms-chart.c (ms_excel_chart_read) : don't leak the array for invalid
	  series (Analysis.xls).  Handle missing siindex record (chap03-1.xls).

2005-05-18  Jody Goldberg <jody@gnome.org>

	* src/expr-name.c (expr_name_new) : make public
	(expr_name_add) : accept a stub object.

2005-05-17  Jody Goldberg <jody@gnome.org>

	* src/workbook.c (workbook_focus_other_sheet) : fix
parent 402f0316
......@@ -10,14 +10,15 @@ Release Critical
: tie the custom ui into action sensitivity pools
: support array evaluation for =LARGE and friends
: TRIMEAN is a list function ?
: ISREF is a list function ?
: http://bugzilla.gnome.org/show_bug.cgi?id=159581
: http://bugzilla.gnome.org/show_bug.cgi?id=162951 : trivial
: Add a note to the SUMPRODUCT docs that
sumproduct(A1:A5>4,B1:B4) will not work and that they will
need
sumproduct(--(A1:A5>4),B1:B4)
: fix the row/col separators problem in array formula
: Using expr_name_set_expr in cb_nexpr_remove is wasteful
Worries
-------
......
......@@ -33,6 +33,15 @@
(link_expr_dep, unlink_expr_dep, dependents_unrelocate_free,
dependents_unrelocate): Avoid cast.
2005-05-18 Jody Goldberg <jody@gnome.org>
* src/expr-name.c (expr_name_new) : make public
(expr_name_add) : accept a stub object.
2005-05-17 Jody Goldberg <jody@gnome.org>
* src/workbook.c (workbook_focus_other_sheet) : fix
2005-05-17 Morten Welinder <terra@gnome.org>
* src/expr-name.c (expr_name_set_expr): Don't relink deps for
......
......@@ -10,6 +10,8 @@ Jody:
* Stub for MS Excel's ASC function, which is unncessary in gnumeric.
* Make range clipping more efficient. [#164950]
* Fix advanced filter for inputs that do not start at col A. [#165734]
* Fix xls import of names calling fwd declared names. [#166611]
* Fix string generation for arrays.
* Don't hide columns < 4pts wide on import. [#304558]
Jon Kåre:
......
......@@ -33,6 +33,15 @@
(link_expr_dep, unlink_expr_dep, dependents_unrelocate_free,
dependents_unrelocate): Avoid cast.
2005-05-18 Jody Goldberg <jody@gnome.org>
* src/expr-name.c (expr_name_new) : make public
(expr_name_add) : accept a stub object.
2005-05-17 Jody Goldberg <jody@gnome.org>
* src/workbook.c (workbook_focus_other_sheet) : fix
2005-05-17 Morten Welinder <terra@gnome.org>
* src/expr-name.c (expr_name_set_expr): Don't relink deps for
......
......@@ -1268,7 +1268,7 @@ applix_read_absolute_name (ApplixReadState *state, char *buffer)
ref.a.row_relative = ref.b.row_relative = FALSE;
expr = gnm_expr_new_constant (value_new_cellrange_unsafe (&ref.a, &ref.b));
expr_name_add (&pp, buffer, expr, NULL, TRUE);
expr_name_add (&pp, buffer, expr, NULL, TRUE, NULL);
return FALSE;
}
......@@ -1306,7 +1306,7 @@ applix_read_relative_name (ApplixReadState *state, char *buffer)
expr = gnm_expr_new_constant (value_new_cellrange_unsafe (&ref.a, &ref.b));
parse_pos_init (&pp, state->wb, NULL,
MAX (-ref.a.col, 0), MAX (-ref.a.row, 0));
expr_name_add (&pp, buffer, expr, NULL, TRUE);
expr_name_add (&pp, buffer, expr, NULL, TRUE, NULL);
return FALSE;
}
......
......@@ -140,7 +140,7 @@ y[j] - b1) + 2.0 * rho * (y[i] - a1) * (y[j] - b1));
}
static GnmValue *
cum_biv_norm_dist(FunctionEvalInfo *ei, GnmValue *argv[])
cum_biv_norm_dist(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
gnm_float a = value_get_as_float (argv[0]);
gnm_float b = value_get_as_float (argv[1]);
......@@ -202,7 +202,7 @@ opt_bs1 (OptionSide side,
static GnmValue *
opt_bs (FunctionEvalInfo *ei, GnmValue *argv[])
opt_bs (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -270,7 +270,7 @@ opt_bs_delta1 (OptionSide side,
static GnmValue *
opt_bs_delta (FunctionEvalInfo *ei, GnmValue *argv[])
opt_bs_delta (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -330,7 +330,7 @@ opt_bs_gamma1 (gnm_float s,gnm_float x,gnm_float t,gnm_float r,gnm_float v,gnm_f
static GnmValue *
opt_bs_gamma (FunctionEvalInfo *ei, GnmValue *argv[])
opt_bs_gamma (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
gnm_float s = value_get_as_float (argv[0]);
gnm_float x = value_get_as_float (argv[1]);
......@@ -396,7 +396,7 @@ opt_bs_theta1 (OptionSide side,
}
static GnmValue *
opt_bs_theta (FunctionEvalInfo *ei, GnmValue *argv[])
opt_bs_theta (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -456,7 +456,7 @@ opt_bs_vega1 (gnm_float s,gnm_float x,gnm_float t,gnm_float r,gnm_float v,gnm_fl
}
static GnmValue *
opt_bs_vega (FunctionEvalInfo *ei, GnmValue *argv[])
opt_bs_vega (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
gnm_float s = value_get_as_float (argv[0]);
gnm_float x = value_get_as_float (argv[1]);
......@@ -526,7 +526,7 @@ opt_bs_rho1 (OptionSide side, gnm_float s, gnm_float x, gnm_float t, gnm_float r
static GnmValue *
opt_bs_rho (FunctionEvalInfo *ei, GnmValue *argv[])
opt_bs_rho (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -592,7 +592,7 @@ opt_bs_carrycost1 (OptionSide side, gnm_float s, gnm_float x, gnm_float t, gnm_f
}
static GnmValue *
opt_bs_carrycost (FunctionEvalInfo *ei, GnmValue *argv[])
opt_bs_carrycost (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -663,7 +663,7 @@ opt_garman_kohlhagen1 (OptionSide side,
}
static GnmValue *
opt_garman_kohlhagen (FunctionEvalInfo *ei, GnmValue *argv[])
opt_garman_kohlhagen (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -734,7 +734,7 @@ opt_french1 (OptionSide side, gnm_float s, gnm_float x, gnm_float trading_t, gn
static GnmValue *
opt_french (FunctionEvalInfo *ei, GnmValue *argv[])
opt_french (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -803,7 +803,7 @@ opt_jump_diff1 (OptionSide side, gnm_float s, gnm_float x, gnm_float t, gnm_floa
}
static GnmValue *
opt_jump_diff (FunctionEvalInfo *ei, GnmValue *argv[])
opt_jump_diff (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -889,7 +889,7 @@ opt_miltersen_schwartz1 (OptionSide side, gnm_float p_t, gnm_float f_t, gnm_floa
}
static GnmValue *
opt_miltersen_schwartz (FunctionEvalInfo *ei, GnmValue *argv[])
opt_miltersen_schwartz (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float p_t = value_get_as_float (argv[1]);
......@@ -1012,7 +1012,7 @@ static gnm_float opt_rgw1 (gnm_float s, gnm_float x, gnm_float t1, gnm_float t2,
static GnmValue *
opt_rgw(FunctionEvalInfo *ei, GnmValue *argv[])
opt_rgw(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
gnm_float s = value_get_as_float (argv[0]);
gnm_float x = value_get_as_float (argv[1]);
......@@ -1057,7 +1057,7 @@ static GnmFuncHelp const help_opt_rgw[] = {
/* the Barone-Adesi and Whaley (1987) American approximation */
static GnmValue *
opt_baw_amer (FunctionEvalInfo *ei, GnmValue *argv[])
opt_baw_amer (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -1256,7 +1256,7 @@ opt_bjer_stens1 (OptionSide side, gnm_float s, gnm_float x, gnm_float t, gnm_flo
}
static GnmValue *
opt_bjer_stens (FunctionEvalInfo *ei, GnmValue *argv[])
opt_bjer_stens (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -1342,7 +1342,7 @@ phi (gnm_float s, gnm_float t, gnm_float gamma, gnm_float H, gnm_float I, gnm_fl
/* Executive stock options */
static GnmValue *
opt_exec (FunctionEvalInfo *ei, GnmValue *argv[])
opt_exec (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -1392,7 +1392,7 @@ static GnmFuncHelp const help_opt_exec[] = {
/* Forward start options */
static GnmValue *
opt_forward_start(FunctionEvalInfo *ei, GnmValue *argv[])
opt_forward_start(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -1440,7 +1440,7 @@ static GnmFuncHelp const help_opt_forward_start[] = {
/* time switch options (discrete) */
static GnmValue *
opt_time_switch (FunctionEvalInfo *ei, GnmValue *argv[])
opt_time_switch (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -1510,7 +1510,7 @@ static GnmFuncHelp const help_opt_time_switch[] = {
/* simple chooser options */
static GnmValue *
opt_simple_chooser(FunctionEvalInfo *ei, GnmValue *argv[])
opt_simple_chooser(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
gnm_float s = value_get_as_float (argv[0]);
......@@ -1565,7 +1565,7 @@ static GnmFuncHelp const help_opt_simple_chooser[] = {
/* Complex chooser options */
static GnmValue *
opt_complex_chooser(FunctionEvalInfo *ei, GnmValue *argv[])
opt_complex_chooser(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
gnm_float s = value_get_as_float (argv[0]);
......@@ -1667,7 +1667,7 @@ opt_crit_val_chooser (gnm_float s,gnm_float xc,gnm_float xp,gnm_float t,
/* Options on options */
static GnmValue *
opt_on_options (FunctionEvalInfo *ei, GnmValue *argv[])
opt_on_options (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
char *type_flag = value_get_as_string (argv[0]);
gnm_float s = value_get_as_float (argv[1]);
......@@ -1769,7 +1769,7 @@ CriticalValueOptionsOnOptions (OptionSide side, gnm_float x1, gnm_float x2, gnm_
/* Writer extendible options */
static GnmValue *
opt_extendible_writer (FunctionEvalInfo *ei, GnmValue *argv[])
opt_extendible_writer (FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side (value_peek_string (argv[0]));
gnm_float s = value_get_as_float (argv[1]);
......@@ -1840,7 +1840,7 @@ static GnmFuncHelp const help_opt_extendible_writer[] = {
/* Two asset correlation options */
static GnmValue *
opt_2_asset_correlation(FunctionEvalInfo *ei, GnmValue *argv[])
opt_2_asset_correlation(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put = option_side(value_peek_string(argv[0]));
gnm_float s1 = value_get_as_float(argv[1]);
......@@ -1904,7 +1904,7 @@ static GnmFuncHelp const help_opt_2_asset_correlation[] = {
/* European option to exchange one asset for another */
static GnmValue *
opt_euro_exchange(FunctionEvalInfo *ei, GnmValue *argv[])
opt_euro_exchange(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
gnm_float s1 = value_get_as_float(argv[0]);
gnm_float s2 = value_get_as_float(argv[1]);
......@@ -1955,7 +1955,7 @@ static GnmFuncHelp const help_opt_euro_exchange[] = {
/* American option to exchange one asset for another */
static GnmValue *
opt_amer_exchange(FunctionEvalInfo *ei, GnmValue *argv[])
opt_amer_exchange(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
gnm_float s1 = value_get_as_float(argv[0]);
gnm_float s2 = value_get_as_float(argv[1]);
......@@ -1999,7 +1999,7 @@ static GnmFuncHelp const help_opt_amer_exchange[] = {
/* Spread option approximation */
static GnmValue *
opt_spread_approx(FunctionEvalInfo *ei, GnmValue *argv[])
opt_spread_approx(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put_flag = option_side(value_peek_string(argv[0]));
gnm_float f1 = value_get_as_float(argv[1]);
......@@ -2043,7 +2043,8 @@ static GnmFuncHelp const help_opt_spread_approx[] = {
/* Floating strike lookback options */
static GnmValue * opt_float_strk_lkbk(FunctionEvalInfo *ei, GnmValue *argv[])
static GnmValue *
opt_float_strk_lkbk(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put_flag = option_side(value_peek_string(argv[0]));
gnm_float s = value_get_as_float(argv[1]);
......@@ -2103,7 +2104,7 @@ static GnmFuncHelp const help_opt_float_strk_lkbk[] = {
/* Fixed strike lookback options */
static GnmValue *
opt_fixed_strk_lkbk(FunctionEvalInfo *ei, GnmValue *argv[])
opt_fixed_strk_lkbk(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionSide call_put_flag = option_side(value_peek_string(argv[0]));
gnm_float s = value_get_as_float(argv[1]);
......@@ -2174,7 +2175,7 @@ static GnmFuncHelp const help_opt_fixed_strk_lkbk[] = {
/* Binomial Tree valuation */
static GnmValue *
opt_binomial(FunctionEvalInfo *ei, GnmValue *argv[])
opt_binomial(FunctionEvalInfo *ei, GnmValue const * const *argv)
{
OptionType amer_euro_flag = option_type(value_peek_string(argv[0]));
OptionSide call_put_flag = option_side(value_peek_string(argv[1]));
......
2005-05-18 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=166611
* ms-formula-read.c (excel_parse_formula) : Create a fwd declaration
of a NAME record that has not been read yet being used in a PTG_NAME.
* ms-excel-read.c (excel_read_NAME) : keep a count of the name
records and use fwd declaration if they exist.
(excel_workbook_destroy) : move the names array into the workbook from
the container.
(excel_workbook_new) : ditto.
2005-05-18 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=304528
* ms-chart.c (ms_excel_chart_read) : don't leak the array for invalid
series (Analysis.xls). Handle missing siindex record (chap03-1.xls).
2005-05-19 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=304558
......
......@@ -312,10 +312,9 @@ BC_R(ai)(XLChartHandler const *handle,
: gnm_go_data_vector_new_expr (sheet, expr);
}
} else if (ref_type == 1 && purpose != GOG_MS_DIM_LABELS &&
s->currentSeries->data [purpose].num_elements > 0) {
s->currentSeries->data [purpose].num_elements > 0) {
s->currentSeries->data [purpose].value = (GnmValueArray *)
value_new_array (1,
s->currentSeries->data [purpose].num_elements);
value_new_array (1, s->currentSeries->data [purpose].num_elements);
} else {
g_return_val_if_fail (length == 0, TRUE);
}
......@@ -397,7 +396,7 @@ BC_R(areaformat)(XLChartHandler const *handle,
fputs ("Swap fore and back colours when displaying negatives;\n", stderr);
});
#if 0
#if 0
/* 18 */ "5%"
#endif
BC_R(get_style) (s);
......@@ -933,7 +932,7 @@ BC_R(gelframe) (XLChartHandler const *handle,
MS_OBJ_ATTR_FILL_PRESET, 0);
s->style->fill.type = GOG_FILL_STYLE_GRADIENT;
s->style->fill.pattern.fore =
s->style->fill.pattern.fore =
ms_chart_map_color (s, fill_color, fill_alpha);
/* FIXME : make presets the same as 2 color for now */
......@@ -1070,7 +1069,7 @@ BC_R(legend)(XLChartHandler const *handle,
case 3: pos = GOG_POSITION_E | GOG_POSITION_ALIGN_CENTER; break;
case 4: pos = GOG_POSITION_W | GOG_POSITION_ALIGN_CENTER; break;
case 7: /* treat floating legends as being on east */
pos = GOG_POSITION_E | GOG_POSITION_ALIGN_CENTER; break;
pos = GOG_POSITION_E | GOG_POSITION_ALIGN_CENTER; break;
};
s->legend = gog_object_add_by_name (GOG_OBJECT (s->chart), "Legend", NULL);
......@@ -1218,9 +1217,9 @@ BC_R(markerformat)(XLChartHandler const *handle,
shape = 1; /* square */
go_marker_set_shape (marker, shape_map [shape]);
go_marker_set_outline_color (marker,
go_marker_set_outline_color (marker,
(flags & 0x20) ? 0 : BC_R(color) (q->data + 0, "MarkerFore"));
go_marker_set_fill_color (marker,
go_marker_set_fill_color (marker,
(flags & 0x10) ? 0 : BC_R(color) (q->data + 4, "MarkerBack"));
s->style->marker.auto_shape = shape > 0;
......@@ -1246,7 +1245,7 @@ BC_R(objectlink)(XLChartHandler const *handle,
{
guint16 const purpose = GSF_LE_GET_GUINT16 (q->data);
GogObject *label = NULL;
if (s->text == NULL)
return FALSE;
......@@ -1459,7 +1458,7 @@ BC_R(scatter)(XLChartHandler const *handle,
s->plot = gog_plot_new_by_name ("GogBubblePlot");
g_return_val_if_fail (s->plot != NULL, TRUE);
g_object_set (G_OBJECT (s->plot),
"in-3d", in_3d,
"in-3d", in_3d,
"show-negatives", show_negatives,
"size-as-area", size_as_area,
"bubble-scale", scale,
......@@ -1584,7 +1583,7 @@ BC_R(seriestext)(XLChartHandler const *handle,
if (expr)
s->currentSeries->data [GOG_MS_DIM_LABELS].data =
gnm_go_data_scalar_new_expr (sheet, expr);
else
else
value_release (value);
} else if (BC_R(top_state) (s) == BIFF_CHART_text) {
if (s->text != NULL) {
......@@ -1676,12 +1675,10 @@ static gboolean
BC_R(siindex)(XLChartHandler const *handle,
XLChartReadState *s, BiffQuery *q)
{
s->cur_role = GSF_LE_GET_GUINT16 (q->data);
d (1, {
/* UNDOCUMENTED : Docs says this is long
* Biff record is only length 2
*/
fprintf (stderr, "Series %d is %hd\n", s->series->len, s->cur_role);});
* Biff record is only length 2 */
s->cur_role = GSF_LE_GET_GUINT16 (q->data);
d (1, fprintf (stderr, "Series %d is %hd\n", s->series->len, s->cur_role););
return FALSE;
}
/****************************************************************************/
......@@ -2075,7 +2072,7 @@ BC_R(end)(XLChartHandler const *handle,
is_matrix = FALSE;
break;
}
expr = gnm_go_data_get_expr (cur);
expr = gnm_go_data_get_expr (cur);
if (!gnm_expr_is_rangeref (expr))
goto not_a_matrix;
......@@ -2100,7 +2097,7 @@ BC_R(end)(XLChartHandler const *handle,
}
if (is_matrix) {
Sheet *sheet = ms_container_sheet (s->container.parent);
s->plot = gog_plot_new_by_name ((s->is_contour)?
s->plot = gog_plot_new_by_name ((s->is_contour)?
"GogContourPlot": "GogSurfacePlot");
/* build the series */
......@@ -2165,7 +2162,7 @@ BC_R(end)(XLChartHandler const *handle,
} else {
not_a_matrix:
s->is_surface = FALSE;
s->plot = gog_plot_new_by_name ((s->is_contour)?
s->plot = gog_plot_new_by_name ((s->is_contour)?
"XLContourPlot": "XLSurfacePlot");
}
}
......@@ -2179,7 +2176,7 @@ not_a_matrix:
if (s->default_plot_style != NULL) {
char const *type = G_OBJECT_TYPE_NAME (s->plot);
GogStyle const *style = s->default_plot_style;
if (type != NULL && style->marker.mark != NULL &&
(!strcmp (type, "GogXYPlot") ||
!strcmp (type, "GogLinePlot") ||
......@@ -2473,7 +2470,8 @@ ms_excel_chart_read (BiffQuery *q, MSContainer *container, MsBiffVersion ver,
state.plot_counter = -1;
state.has_a_grid = FALSE;
state.text = NULL;
state.is_surface = FALSE;
state.is_surface = FALSE;
state.cur_role = -1;
if (NULL != (state.sog = sog)) {
GogStyle *style = gog_style_new ();
......@@ -2549,16 +2547,16 @@ ms_excel_chart_read (BiffQuery *q, MSContainer *container, MsBiffVersion ver,
double val = gsf_le_get_double (q->data + offset);
XLChartSeries *series;
if (state.series == NULL || sernum >= state.series->len) {
g_warning ("Invalid series num %u", sernum);
} else {
series = g_ptr_array_index (state.series, sernum);
if (series->data[state.cur_role].value != NULL) {
value_release (series->data[state.cur_role].value->vals[0][row]);
series->data[state.cur_role].value->vals[0][row] = value_new_float (val);
}
d (10, fprintf (stderr, "series %d, index %d, value %f\n", sernum, row, val););
if (state.cur_role < 0 ||
state.series == NULL || sernum >= state.series->len ||
NULL == (series = g_ptr_array_index (state.series, sernum)))
break;
if (series->data[state.cur_role].value != NULL) {
value_release (series->data[state.cur_role].value->vals[0][row]);
series->data[state.cur_role].value->vals[0][row] = value_new_float (val);
}
d (10, fprintf (stderr, "series %d, index %d, value %f\n", sernum, row, val););
break;
}
......@@ -2568,19 +2566,21 @@ ms_excel_chart_read (BiffQuery *q, MSContainer *container, MsBiffVersion ver,
guint16 sernum = GSF_LE_GET_GUINT16 (q->data + 2);
/* guint16 xf = GSF_LE_GET_GUINT16 (q->data + 4); */ /* not used */
guint16 len = GSF_LE_GET_GUINT16 (q->data + 6);
char *label = biff_get_text (q->data + 8, len, NULL, ver);
char *label;
XLChartSeries *series;
if (state.series == NULL || sernum >= state.series->len) {
g_warning ("Invalid series num %u", sernum);
} else {
series = g_ptr_array_index (state.series, sernum);
if (series->data[state.cur_role].value != NULL) {
value_release (series->data[state.cur_role].value->vals[0][row]);
series->data[state.cur_role].value->vals[0][row] = value_new_string (label);
}
d (10, {fprintf (stderr, "'%s' row = %d, series = %d\n", label, row, sernum);});
if (state.cur_role < 0 ||
state.series == NULL || sernum >= state.series->len ||
NULL == (series = g_ptr_array_index (state.series, sernum)))
break;
label = biff_get_text (q->data + 8, len, NULL, ver);
if (label != NULL &&
series->data[state.cur_role].value != NULL) {
value_release (series->data[state.cur_role].value->vals[0][row]);
series->data[state.cur_role].value->vals[0][row] = value_new_string (label);
}
d (10, {fprintf (stderr, "'%s' row = %d, series = %d\n", label, row, sernum);});
g_free (label);
break;
}
......@@ -2644,27 +2644,28 @@ ms_excel_chart_read (BiffQuery *q, MSContainer *container, MsBiffVersion ver,
/* Cleanup */
for (i = state.series->len; i-- > 0 ; ) {
int j;
Sheet *sheet = ms_container_sheet (state.container.parent);
XLChartSeries *series = g_ptr_array_index (state.series, i);
GOData *data;
if (series != NULL) {
for (j = GOG_MS_DIM_VALUES ; j < GOG_MS_DIM_TYPES; j++ )
if (series->data [j].value != NULL) {
GnmExpr const * expr = gnm_expr_new_constant ((GnmValue *)series->data [j].value);
if (expr != NULL) {
Sheet *sheet = ms_container_sheet (state.container.parent);
if (sheet == NULL || series->data [j].series == NULL)
continue;
data = gnm_go_data_vector_new_expr (sheet, expr);
XL_gog_series_set_dim (series->data [j].series, j, data);
}
}
GnmValue *v;
int j;
if (series) {
for (j = GOG_MS_DIM_VALUES ; j < GOG_MS_DIM_TYPES; j++ ) {
if (NULL == (v = (GnmValue *)series->data [j].value))
continue;
if (sheet && series->data [j].series)
XL_gog_series_set_dim (series->data [j].series, j,
gnm_go_data_vector_new_expr (sheet,
gnm_expr_new_constant (v)));
else
value_release (v);
}
excel_chart_series_delete (series);
}
}
g_array_free (state.stack, TRUE);
g_ptr_array_free (state.series, TRUE);
g_array_free (state.stack, TRUE);
ms_container_finalize (&state.container);
if (full_page != NULL) {
......@@ -3092,7 +3093,7 @@ chart_write_text (XLChartWriteState *s, GOData const *src, GogStyle const *style
guint8 *data;
guint16 color_index = 0x4d;
unsigned const len = (s->bp->version >= MS_BIFF_V8) ? 32: 26;
/* TEXT */
data = ms_biff_put_len_next (s->bp, BIFF_CHART_text, len);
memcpy (data, default_text, len);
......@@ -3452,7 +3453,7 @@ chart_write_plot (XLChartWriteState *s, GogPlot const *plot)
data = ms_biff_put_len_next (s->bp, BIFF_CHART_bar, 6);
GSF_LE_SET_GINT16 (data, -overlap_percentage); /* dipsticks */
GSF_LE_SET_GINT16 (data+2, gap_percentage);
GSF_LE_SET_GINT16 (data+2, gap_percentage);
GSF_LE_SET_GUINT16 (data+4, flags);
ms_biff_put_commit (s->bp);
} else if (0 == strcmp (type, "GogLinePlot")) {
......@@ -3524,7 +3525,7 @@ chart_write_plot (XLChartWriteState *s, GogPlot const *plot)
GSF_LE_SET_GUINT16 (data + 4, flags);
}
ms_biff_put_commit (s->bp);
} else
} else
ms_biff_put_empty (s->bp, BIFF_CHART_scatter);
} else if (0 == strcmp (type, "GogContourPlot") ||
0 == strcmp (type, "XLContourPlot")) {
......@@ -3925,7 +3926,7 @@ ms_excel_chart_write (ExcelWriteState *ewb, SheetObject *so)
} else {
val = value_new_array (m, 1);
for (j = 0; j < m; j++) {
value_array_set (val, j, 0,
value_array_set (val, j, 0,
value_dup((as_col)? matval->v_array.vals[i][j]:
matval->v_array.vals[j][i]));
}
......
......@@ -35,7 +35,6 @@ ms_container_init (MSContainer *container, MSContainerClass const *vtbl,
container->obj_queue = NULL;
container->parent = parent;
container->names = NULL;
container->v7.externsheets = NULL;
container->v7.externnames = NULL;
}
......@@ -86,21 +85,7 @@ ms_container_finalize (MSContainer *container)
g_ptr_array_free (container->v7.externnames, TRUE);
container->v7.externnames = NULL;
}
if (container->names != NULL) {
for (i = container->names->len; i-- > 0 ; )
if (g_ptr_array_index (container->names, i) != NULL) {
GnmNamedExpr *nexpr = g_ptr_array_index (container->names, i);
if (nexpr != NULL) {
/* NAME placeholders need removal, EXTERNNAME placeholders
* will no be active */
if (nexpr->active && nexpr->is_placeholder && nexpr->ref_count == 2)
expr_name_remove (nexpr);
expr_name_unref (nexpr);
}
}
g_ptr_array_free (container->names, TRUE);
container->names = NULL;
}
}
void
......
......@@ -41,7 +41,6 @@ struct _MSContainer {
GPtrArray *blips;
GSList *obj_queue;
GPtrArray *names;
struct {
GPtrArray *externsheets;
GPtrArray *externnames;
......
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/**
* ms-excel.c: MS Excel import
* ms-excel-read.c: MS Excel import
*
* Authors:
* Jody Goldberg (jody@gnome.org)
......@@ -197,7 +197,7 @@ ms_sheet_parse_expr_internal (ExcelReadSheet *esheet, guint8 const *data, int le
char *tmp;
GnmParsePos pp;
Sheet *sheet = esheet->sheet;
Workbook *wb = (sheet == NULL) ? esheet->container.ewb->gnum_wb : NULL;
Workbook *wb = (sheet == NULL) ? esheet->container.ewb->wb : NULL;
tmp = gnm_expr_as_string (expr, parse_pos_init (&pp, wb, sheet, 0, 0), gnm_expr_conventions_default);
puts (tmp);
......@@ -524,7 +524,7 @@ ms_sheet_create_obj (MSContainer *container, MSObj *obj)
g_return_val_if_fail (container != NULL, NULL);
esheet = (ExcelReadSheet *)container;
wb = esheet->container.ewb->gnum_wb;
wb = esheet->container.ewb->wb;
switch (obj->excel_type) {
case 0x01: /* Line */
......@@ -664,10 +664,10 @@ excel_sheet_new (ExcelWorkbook *ewb, char const *sheet_name, GnmSheetType type)
ExcelReadSheet *esheet = g_new (ExcelReadSheet, 1);
Sheet *sheet;
sheet = workbook_sheet_by_name (ewb->gnum_wb, sheet_name);
sheet = workbook_sheet_by_name (ewb->wb, sheet_name);
if (sheet == NULL) {
sheet = sheet_new_with_type (ewb->gnum_wb, sheet_name, type);
workbook_sheet_attach (ewb->gnum_wb, sheet);
sheet = sheet_new_with_type (ewb->wb, sheet_name, type);
workbook_sheet_attach (ewb->wb, sheet);
d (1, fprintf (stderr,"Adding sheet '%s'\n", sheet_name););
}