Commit 35571faa authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

if nothing matches for numbers use the first fmt, other types == general.

2004-05-15  Jody Goldberg <jody@gnome.org>

	* src/format.c (format_value_gstring) : if nothing matches for numbers
	  use the first fmt, other types == general.
	(style_format_condition) : errors do not match strings, but bools do
	(format_compile) : assign std conditions to any element without one,
	  even the last.

2004-05-15  Jody Goldberg <jody@gnome.org>

	* ms-excel-write.c (excel_write_BOF) : init the len for bifftypes
	  before biff8.
	http://bugzilla.gnome.org/show_bug.cgi?id=103054
	(write_sheet_head) : put externsheet tables in every sheet for biff7
	(excel_write_externsheets_v8) : The self reference is for the addin,
	  not the others.  Fixes 103054 for XL97
	(excel_write_workbook) : NAME records start at 0, not at the end of
	  the externname table

	* boot.c (excel_file_open) : 95 in should export as 95
	(find_content_stream) : keep track of what type of stream this is.

	* ms-chart.c (BC_R(axislineformat)) : deleted axis still exist, and
	  they hide their labels here rather than in tick.  Don't apply grid
	  line styles to the axis.


2004-05-13  Jody Goldberg <jody@gnome.org>

	* graph/gog-renderer-svg.c (gog_renderer_svg_measure_text) : use
	  logical rather than ink extents.
	(gog_renderer_pixbuf_draw_text) : ditto.
	* graph/gog-renderer-pixbuf.c (gog_renderer_pixbuf_draw_text) : ditto.
	(gog_renderer_pixbuf_draw_text) : ditto.

	* graph/gog-axis.c (gog_axis_view_size_request) : tick labels for
	  discrete axes are below the line not the major tick marks.
	(gog_axis_view_render) : ditto

	* graph/gog-renderer-svg.c (make_layout) : cache the context.
	(gog_renderer_pixbuf_finalize) : unref cached contexts.
	(gog_renderer_pixbuf_class_init) : connect the new finalize.

	* graph/gog-style.c (gog_style_is_different_size) : line width change
	  for axis changes size.

	* graph/gog-axis.c (gog_axis_view_render) : don't allocate size for
	  ticks if the lines are invisible.

	* graph/gog-plot.c (gog_plot_get_axis_bounds) : add some safety.
          This will be called for things like a pie when adding one while
	  something with an still exists.

	* graph/gog-guru.c (cb_attr_tree_selection_change) : be more forgiving
	  about when a user can go back to select a plot.  If there is only
	  one chart, or one plot things are unambiguous.

	* drawing/god-property-table.h : sync with the extensions in the xls
	  importer to handle gradients and richtext.

	* drawing/god-property-table.c (god_property_table_get_markup) : new.
	(god_property_table_set_markup) : ditto.
parent ded0bed5
......@@ -9,13 +9,14 @@ Release Critical
----------------
http://bugzilla.gnome.org/show_bug.cgi?id=136546
: about box i18n
: about box i18n (use go_data_vector_str_translation_domain)
http://bugzilla.gnome.org/show_bug.cgi?id=140820
: undo of tab colour change
http://bugzilla.gnome.org/show_bug.cgi?id=127203 [x axis child pos]
: X axis label seperation
: Delete grid then edit and see a new grid
: xls loading of things with deleted axis
: Delete grid then edit chart and see a new grid
http://bugzilla.gnome.org/show_bug.cgi?id=142212
: missing values in line/area
Worries
http://bugzilla.gnome.org/show_bug.cgi?id=123403
......
2004-05-15 Jody Goldberg <jody@gnome.org>
* src/format.c (format_value_gstring) : if nothing matches for numbers
use the first fmt, other types == general.
(style_format_condition) : errors do not match strings, but bools do
(format_compile) : assign std conditions to any element without one,
even the last.
2004-05-12 Jody Goldberg <jody@gnome.org>
* src/sheet-control-gui.c (sheet_control_gui_new) : add a weak ref to
the wbcg in case it is destroyed before the scg.
2004-05-10 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=142267
* src/item-grid.c (item_grid_draw) : when we land on an active merge
that ended in a hidden row above us we still need to draw our
background. A quick kludge that uses goto.
2004-05-11 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/workbook-view.c (wbv_save_to_file): add omitted declaration
......
......@@ -26,6 +26,9 @@ Jody:
* Fix crash when undoing a cut from a different workbook
* Fix MS XL crash when there are too many strings
* MS XL import for chart gradient backgrounds
* Support series without legend entries, including xls import
* Started on an OOo exporter
* Tweak XL export for named expressions and addins
Morten:
* Fix crash related to database functions (#138600). [backported]
......
2004-05-15 Jody Goldberg <jody@gnome.org>
* src/format.c (format_value_gstring) : if nothing matches for numbers
use the first fmt, other types == general.
(style_format_condition) : errors do not match strings, but bools do
(format_compile) : assign std conditions to any element without one,
even the last.
2004-05-12 Jody Goldberg <jody@gnome.org>
* src/sheet-control-gui.c (sheet_control_gui_new) : add a weak ref to
the wbcg in case it is destroyed before the scg.
2004-05-10 Jody Goldberg <jody@gnome.org>
http://bugzilla.gnome.org/show_bug.cgi?id=142267
* src/item-grid.c (item_grid_draw) : when we land on an active merge
that ended in a hidden row above us we still need to draw our
background. A quick kludge that uses goto.
2004-05-11 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/workbook-view.c (wbv_save_to_file): add omitted declaration
......
......@@ -18,7 +18,7 @@ You need: Debian package name
gtk+ >= 2.4.0 libgtk2.0-dev
libgnomeprint >= 2.5.2 libgnomeprint2.2-dev
libgnomeprintui >= 2.5.2 libgnomeprintui2.2-dev
libgsf >= 1.9.0 libgsf-1-dev + libgsf-gnome-1-dev
libgsf >= 1.9.1 libgsf-1-dev
libglade >= 2.0.0 libglade2-dev
intltool >= 0.27.2 intltool
gnome-xml >= 2.4.12 libxml2-dev
......@@ -26,6 +26,7 @@ You need: Debian package name
NOTE : gnome-xml is also known as libxml
Optionally:
libgsf-gnome >= 1.9.1 libgsf-gnome-1-dev
libgnome >= 2.0.0 libgnome2-dev
libgnomeui >= 2.0.0 libgnomeui-dev
libbonobo >= 2.0.0 libbonobo2-dev
......
......@@ -47,7 +47,7 @@ gnumeric_reqs="
glib-2.0 >= 2.4.0
gobject-2.0 >= 2.4.0
gmodule-2.0 >= 2.4.0
libgsf-1 >= 1.9.0
libgsf-1 >= 1.9.1
gtk+-2.0 >= 2.4.0
libxml-2.0 >= 2.4.12
libglade-2.0 >= 2.0.0
......@@ -90,26 +90,6 @@ else
fi
AM_CONDITIONAL(WITH_GNOME, $gnumeric_with_gnome)
dnl ************************************************
dnl If we have GNOME do we want the bonobo component
dnl ************************************************
bonobo_component_msg="disabled until it compiles"
gnumeric_enable_bonobo_component=false
AC_ARG_ENABLE(bonobo-component,
[--{enable,disable}-bonobo-component Build the optional bonobo component requires --with-gnome],
if test "x$enableval" = xyes; then
if test "x$gnome_msg" = "xyes"; then
# gnumeric_enable_bonobo_component=true
bonobo_component_msg="yes but DISABLED UNTIL IT COMPILES"
else
bonobo_component_msg="disabled. requires gnome"
fi
else
bonobo_component_msg="disabled by user"
fi
)
AM_CONDITIONAL(ENABLE_BONOBO_COMPONENT, $gnumeric_enable_bonobo_component)
dnl ****************************
dnl now that we have selected out libraries the whole collection in one
dnl shot so that we can have a nice neat compile/link line
......@@ -843,7 +823,6 @@ Configuration:
Python Support: ${python_msg}
Guile Support: ${guile_msg}
GNOME Support: ${gnome_msg}
Bonobo Component ${bonobo_component_msg}
GDA support: ${gda_msg}
GNOME-DB support: ${gnomedb_msg}
"
......
2004-05-15 Jody Goldberg <jody@gnome.org>
* ms-excel-write.c (excel_write_BOF) : init the len for bifftypes
before biff8.
http://bugzilla.gnome.org/show_bug.cgi?id=103054
(write_sheet_head) : put externsheet tables in every sheet for biff7
(excel_write_externsheets_v8) : The self reference is for the addin,
not the others. Fixes 103054 for XL97
(excel_write_workbook) : NAME records start at 0, not at the end of
the externname table
* boot.c (excel_file_open) : 95 in should export as 95
(find_content_stream) : keep track of what type of stream this is.
* ms-chart.c (BC_R(axislineformat)) : deleted axis still exist, and
they hide their labels here rather than in tick. Don't apply grid
line styles to the axis.
2004-05-10 Jody Goldberg <jody@gnome.org>
* ms-chart.c (BC_R(end)) : doh! Use the ExcelSeries::has_legend to
......
......@@ -68,7 +68,7 @@ void excel_dsf_file_save (GnmFileSaver const *fs, IOContext *context, Workbook
void plugin_cleanup (void);
static GsfInput *
find_content_stream (GsfInfile *ole)
find_content_stream (GsfInfile *ole, gboolean *is_97)
{
static char const * const stream_names[] = {
"Workbook", "WORKBOOK", "workbook",
......@@ -79,8 +79,11 @@ find_content_stream (GsfInfile *ole)
for (i = 0 ; i < G_N_ELEMENTS (stream_names) ; i++) {
stream = gsf_infile_child_by_name (ole, stream_names[i]);
if (stream != NULL)
if (stream != NULL) {
if (is_97 != NULL)
*is_97 = (i < 3);
return stream;
}
}
return NULL;
......@@ -103,7 +106,7 @@ excel_file_probe (GnmFileOpener const *fo, GsfInput *input, FileProbeLevel pl)
return data && data[0] == 0x09 && (data[1] & 0xf1) == 0;
}
stream = find_content_stream (GSF_INFILE (ole));
stream = find_content_stream (GSF_INFILE (ole), NULL);
if (stream != NULL) {
g_object_unref (G_OBJECT (stream));
res = TRUE;
......@@ -150,8 +153,7 @@ excel_file_open (GnmFileOpener const *fo, IOContext *context,
GError *err = NULL;
GsfInfileMSOle *ole = gsf_infile_msole_new (input, &err);
Workbook *wb = wb_view_workbook (wbv);
gboolean is_double_stream_file;
unsigned i = 0;
gboolean is_double_stream_file, is_97;
if (ole == NULL) {
guint8 const *data;
......@@ -175,7 +177,7 @@ excel_file_open (GnmFileOpener const *fo, IOContext *context,
return;
}
stream = find_content_stream (GSF_INFILE (ole));
stream = find_content_stream (GSF_INFILE (ole), &is_97);
if (stream == NULL) {
gnm_cmd_context_error_import (GNM_CMD_CONTEXT (context),
_("No Workbook or Book streams found."));
......@@ -209,7 +211,7 @@ excel_file_open (GnmFileOpener const *fo, IOContext *context,
if (is_double_stream_file)
workbook_set_saveinfo (wb, FILE_FL_AUTO,
gnm_file_saver_for_id ("Gnumeric_Excel:excel_dsf"));
else if (i < 3)
else if (is_97)
workbook_set_saveinfo (wb, FILE_FL_AUTO,
gnm_file_saver_for_id ("Gnumeric_Excel:excel_biff8"));
else
......
......@@ -217,13 +217,13 @@ BC_R(3d)(XLChartHandler const *handle,
fprintf (stderr, "Gap = %hu\n", gap);
if (use_perspective)
fputs ("Use perspective", stderr);
fputs ("Use perspective;\n", stderr);
if (cluster)
fputs ("Cluster", stderr);
fputs ("Cluster;\n", stderr);
if (auto_scale)
fputs ("Auto Scale", stderr);
fputs ("Auto Scale;\n", stderr);
if (walls_2d)
fputs ("2D Walls", stderr);
fputs ("2D Walls;\n", stderr);
});
return FALSE;
......@@ -259,24 +259,24 @@ BC_R(ai)(XLChartHandler const *handle,
style_format_unref (fmt);
}
} else {
d (2, fputs ("Uses number format from data source", stderr););
d (2, fputs ("Uses number format from data source;\n", stderr););
}
g_return_val_if_fail (purpose < GOG_MS_DIM_TYPES, TRUE);
d (0, {
switch (purpose) {
case GOG_MS_DIM_LABELS : fputs ("Linking labels", stderr); break;
case GOG_MS_DIM_VALUES : fputs ("Linking values", stderr); break;
case GOG_MS_DIM_CATEGORIES : fputs ("Linking categories", stderr); break;
case GOG_MS_DIM_BUBBLES : fputs ("Linking bubbles", stderr); break;
case GOG_MS_DIM_LABELS : fputs ("Linking labels;\n", stderr); break;
case GOG_MS_DIM_VALUES : fputs ("Linking values;\n", stderr); break;
case GOG_MS_DIM_CATEGORIES : fputs ("Linking categories;\n", stderr); break;
case GOG_MS_DIM_BUBBLES : fputs ("Linking bubbles;\n", stderr); break;
default :
g_assert_not_reached ();
};
switch (ref_type) {
case 0 : fputs ("Use default categories", stderr); break;
case 1 : fputs ("Text/Value entered directly", stderr); break;
case 2 : fputs ("Linked to Container", stderr); break;
case 4 : fputs ("'Error reported' what the heck is this ??", stderr); break;
case 0 : fputs ("Use default categories;\n", stderr); break;
case 1 : fputs ("Text/Value entered directly;\n", stderr); break;
case 2 : fputs ("Linked to Container;\n", stderr); break;
case 4 : fputs ("'Error reported' what the heck is this ??;\n", stderr); break;
default :
fprintf (stderr, "UKNOWN : reference type (%x)\n", ref_type);
};
......@@ -421,21 +421,21 @@ BC_R(attachedlabel)(XLChartHandler const *handle,
gboolean const show_label = (flags&0x10) ? TRUE : FALSE;
if (show_value)
fputs ("Show Value", stderr);
fputs ("Show Value;\n", stderr);
if (show_percent)
fputs ("Show as Percentage", stderr);
fputs ("Show as Percentage;\n", stderr);
if (show_label_prercent)
fputs ("Show as Label Percentage", stderr);
fputs ("Show as Label Percentage;\n", stderr);
if (smooth_line)
fputs ("Smooth line", stderr);
fputs ("Smooth line;\n", stderr);
if (show_label)
fputs ("Show the label", stderr);
fputs ("Show the label;\n", stderr);
if (s->container.ver >= MS_BIFF_V8)
{
gboolean const show_bubble_size = (flags&0x20) ? TRUE : FALSE;
if (show_bubble_size)
fputs ("Show bubble size", stderr);
fputs ("Show bubble size;\n", stderr);
}
});
return FALSE;
......@@ -486,25 +486,51 @@ BC_R(axcext)(XLChartHandler const *handle,
/****************************************************************************/
static gboolean
BC_R(lineformat)(XLChartHandler const *handle,
XLChartReadState *s, BiffQuery *q);
static gboolean
BC_R(axislineformat)(XLChartHandler const *handle,
XLChartReadState *s, BiffQuery *q)
{
d (0, {
guint16 opcode;
guint16 const type = GSF_LE_GET_GUINT16 (q->data);
d (0, {
fprintf (stderr, "Axisline is ");
switch (type)
{
case 0 : fputs ("the axis line.", stderr); break;
case 1 : fputs ("a major grid along the axis.", stderr); break;
case 2 : fputs ("a minor grid along the axis.", stderr); break;
case 0 : fputs ("the axis line.\n", stderr); break;
case 1 : fputs ("a major grid along the axis.\n", stderr); break;
case 2 : fputs ("a minor grid along the axis.\n", stderr); break;
/* TODO TODO : floor vs wall */
case 3 : fputs ("a floor/wall along the axis.", stderr); break;
case 3 : fputs ("a floor/wall along the axis.\n", stderr); break;
default : fprintf (stderr, "an ERROR. unkown type (%x).\n", type);
};
});
if (!ms_biff_query_peek_next (q, &opcode) || opcode != BIFF_CHART_lineformat) {
g_warning ("I had hoped that a lineformat would always follow an axislineformat");
return FALSE;
}
ms_biff_query_next (q);
if (BC_R(lineformat)(handle, s, q))
return TRUE;
if (type == 0 && s->axis != NULL) {
g_object_set (G_OBJECT (s->axis),
"style", s->style,
NULL);
/* deleted axis sets flag here, rather than in TICK */
if (0 == (0x4 & GSF_LE_GET_GUINT16 (q->data+8)))
g_object_set (G_OBJECT (s->axis),
"major-tick-labeled", FALSE,
NULL);
}
g_object_unref (s->style);
s->style = NULL;
return FALSE;
}
......@@ -1514,7 +1540,7 @@ BC_R(seriestext)(XLChartHandler const *handle,
return FALSE;
str = biff_get_text (q->data + 3, slen, NULL, s->container.ver);
d (2, fputs (str, stderr););
d (2, fprintf (stderr, "'%s';\n", str););
/* A quick heuristic */
if (s->currentSeries != NULL &&
......@@ -1587,7 +1613,7 @@ BC_R(shtprops)(XLChartHandler const *handle,
g_return_val_if_fail (tmp < MS_CHART_BLANK_MAX, TRUE);
blanks = tmp;
d (2, fputs (ms_chart_blank[blanks], stderr););
d (2, fprintf (stderr, "%s;", ms_chart_blank[blanks]););
if (s->container.ver >= MS_BIFF_V8)
ignore_pos_record = (flags&0x10) ? TRUE : FALSE;
......@@ -1637,7 +1663,7 @@ BC_R(text)(XLChartHandler const *handle,
XLChartReadState *s, BiffQuery *q)
{
if (s->prev_opcode == BIFF_CHART_defaulttext) {
d (4, fputs ("Text follows defaulttext", stderr););
d (4, fputs ("Text follows defaulttext;\n", stderr););
} else {
}
BC_R(get_style) (s);
......@@ -1645,10 +1671,10 @@ BC_R(text)(XLChartHandler const *handle,
#if 0
case BIFF_CHART_chart :
fputs ("Text follows chart", stderr);
fputs ("Text follows chart;\n", stderr);
break;
case BIFF_CHART_legend :
fputs ("Text follows legend", stderr);
fputs ("Text follows legend;\n", stderr);
break;
default :
fprintf (stderr, "BIFF ERROR : A Text record follows a %x\n",
......@@ -1682,25 +1708,25 @@ BC_R(tick)(XLChartHandler const *handle,
guint16 const flags = GSF_LE_GET_GUINT8 (q->data+24);
switch (major) {
case 0: fputs ("no major tick;", stderr); break;
case 1: fputs ("major tick inside axis;", stderr); break;
case 2: fputs ("major tick outside axis;", stderr); break;
case 3: fputs ("major tick across axis;", stderr); break;
default : fputs ("unknown major tick type", stderr);
case 0: fputs ("no major tick;\n", stderr); break;
case 1: fputs ("major tick inside axis;\n", stderr); break;
case 2: fputs ("major tick outside axis;\n", stderr); break;
case 3: fputs ("major tick across axis;\n", stderr); break;
default : fputs ("unknown major tick type;\n", stderr);
}
switch (minor) {
case 0: fputs ("no minor tick;", stderr); break;
case 1: fputs ("minor tick inside axis;", stderr); break;
case 2: fputs ("minor tick outside axis;", stderr); break;
case 3: fputs ("minor tick across axis;", stderr); break;
default : fputs ("unknown minor tick type", stderr);
case 0: fputs ("no minor tick;\n", stderr); break;
case 1: fputs ("minor tick inside axis;\n", stderr); break;
case 2: fputs ("minor tick outside axis;\n", stderr); break;
case 3: fputs ("minor tick across axis;\n", stderr); break;
default : fputs ("unknown minor tick type;\n", stderr);
}
switch (label) {
case 0: fputs ("no tick label;", stderr); break;
case 1: fputs ("tick label at low end (NOTE mapped to near axis);", stderr); break;
case 2: fputs ("tick label at high end (NOTE mapped to near axis);", stderr); break;
case 3: fputs ("tick label near axis;", stderr); break;
default : fputs ("unknown tick label position", stderr);
case 0: fputs ("no tick label;\n", stderr); break;
case 1: fputs ("tick label at low end (NOTE mapped to near axis);\n", stderr); break;
case 2: fputs ("tick label at high end (NOTE mapped to near axis);\n", stderr); break;
case 3: fputs ("tick label near axis;\n", stderr); break;
default : fputs ("unknown tick label position;\n", stderr);
}
/*
......@@ -1716,15 +1742,15 @@ BC_R(tick)(XLChartHandler const *handle,
fprintf (stderr, "background mode = %d\n", (unsigned)GSF_LE_GET_GUINT8 (q->data+3));
switch (flags&0x1c) {
case 0: fputs ("no rotation;", stderr); break;
case 1: fputs ("top to bottom letters upright;", stderr); break;
case 2: fputs ("rotate 90deg counter-clockwise;", stderr); break;
case 3: fputs ("rotate 90deg clockwise;", stderr); break;
default : fputs ("unknown rotation", stderr);
case 0: fputs ("no rotation;\n", stderr); break;
case 1: fputs ("top to bottom letters upright;\n", stderr); break;
case 2: fputs ("rotate 90deg counter-clockwise;\n", stderr); break;
case 3: fputs ("rotate 90deg clockwise;\n", stderr); break;
default : fputs ("unknown rotation;\n", stderr);
}
if (flags&0x20)
fputs ("Auto rotate", stderr);
fputs ("Auto rotate;\n", stderr);
});
return FALSE;
......@@ -1775,15 +1801,15 @@ BC_R(valuerange)(XLChartHandler const *handle,
if (flags & 0x20) {
g_object_set (s->axis, "log-scale", TRUE, NULL);
d (1, fputs ("Log scaled", stderr););
d (1, fputs ("Log scaled;\n", stderr););
}
if (flags & 0x40) {
g_object_set (s->axis, "invert-axis", TRUE, NULL);
d (1, fputs ("Values in reverse order", stderr););
d (1, fputs ("Values in reverse order;\n", stderr););
}
if (flags & 0x80) {
g_object_set (s->axis, "pos_str", "high", NULL);
d (1, fputs ("Cross over at max value", stderr););
d (1, fputs ("Cross over at max value;\n", stderr););
}
return FALSE;
......@@ -1826,13 +1852,6 @@ BC_R(end)(XLChartHandler const *handle,
switch (popped_state) {
case BIFF_CHART_axis :
if (s->style != NULL) {
g_object_set (G_OBJECT (s->axis),
"style", s->style,
NULL);
g_object_unref (s->style);
s->style = NULL;
}
s->axis = NULL;
break;
......@@ -2149,7 +2168,7 @@ ms_excel_read_chart (BiffQuery *q, MSContainer *container, MsBiffVersion ver,
state.axis = NULL;
state.style = NULL;
d (0, fputs ("{ CHART", stderr););
d (0, fputs ("{ /* CHART */\n", stderr););
while (!done && ms_biff_query_next (q)) {
int const lsb = q->opcode & 0xff;
......@@ -2181,7 +2200,7 @@ ms_excel_read_chart (BiffQuery *q, MSContainer *container, MsBiffVersion ver,
switch (lsb) {
case BIFF_EOF:
done = TRUE;
d (0, fputs ("}; /* CHART */", stderr););
d (0, fputs ("}; /* CHART */\n", stderr););
g_return_val_if_fail(state.stack->len == 0, TRUE);
break;
......@@ -2209,9 +2228,8 @@ ms_excel_read_chart (BiffQuery *q, MSContainer *container, MsBiffVersion ver,
guint16 xf = GSF_LE_GET_GUINT16 (q->data + 4);
guint16 len = GSF_LE_GET_GUINT16 (q->data + 6);
char *label = biff_get_text (q->data + 8, len, NULL, ver);
d (10, {fputs (label, stderr);
fprintf (stderr, "hmm, what are these values for a chart ???\n"
"row = %d, col = %d, xf = %d\n", row, col, xf);});
d (10, {fprintf (stderr, "'%s'\n;hmm, what are these values for a chart ???\n"
"row = %d, col = %d, xf = %d\n", label, row, col, xf);});
g_free (label);
break;
}
......
......@@ -36,7 +36,8 @@ ms_container_init (MSContainer *container, MSContainerClass const *vtbl,
container->parent = parent;
container->names = NULL;
container->v7.externsheet = NULL;
container->v7.externsheets = NULL;
container->v7.externnames = NULL;
}
void
......@@ -66,9 +67,24 @@ ms_container_finalize (MSContainer *container)
container->obj_queue = NULL;
}
if (container->v7.externsheet != NULL) {
g_ptr_array_free (container->v7.externsheet, TRUE);
container->v7.externsheet = NULL;
if (container->v7.externsheets != NULL) {
g_ptr_array_free (container->v7.externsheets, TRUE);
container->v7.externsheets = NULL;
}
if (container->v7.externnames != NULL) {
for (i = container->v7.externnames->len; i-- > 0 ; )
if (g_ptr_array_index (container->v7.externnames, i) != NULL) {
GnmNamedExpr *nexpr = g_ptr_array_index (container->v7.externnames, 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->v7.externnames, TRUE);
container->v7.externnames = NULL;
}
if (container->names != NULL) {
for (i = container->names->len; i-- > 0 ; )
......
......@@ -9,7 +9,6 @@
typedef struct _MSContainer MSContainer;
typedef struct _ExcelWorkbook ExcelWorkbook;
typedef struct _MSEscherBlip MSEscherBlip;
typedef struct _MSEscherShape MSEscherShape;
typedef struct _MSObj MSObj;
typedef struct {
......@@ -33,7 +32,8 @@ struct _MSContainer {
GPtrArray *names;
struct {
GPtrArray *externsheet;
GPtrArray *externsheets;
GPtrArray *externnames;
} v7; /* biff7 does this at the container level */
/* This is the container containing this container */
......
......@@ -21,9 +21,6 @@ struct _MSEscherBlip {
guint32 data_len;
gboolean needs_free;
};
struct _MSEscherShape {
MSObjAttrBag *attrs;
};
MSObjAttrBag *ms_escher_parse (BiffQuery *q, MSContainer *container,
gboolean return_attrs);
......
......@@ -3113,9 +3113,9 @@ excel_read_EXTERNNAME (BiffQuery *q, MSContainer *container)
ewb->v8.supbook->len-1));
g_ptr_array_add (sup->externname, nexpr);
} else {
GPtrArray *a = container->names;
GPtrArray *a = container->v7.externnames;
if (a == NULL)
a = container->names = g_ptr_array_new ();
a = container->v7.externnames = g_ptr_array_new ();
g_ptr_array_add (a, nexpr);
}
}
......@@ -3226,7 +3226,7 @@ excel_read_NAME (BiffQuery *q, ExcelWorkbook *ewb, ExcelReadSheet *esheet)
name, expr_data, expr_len, TRUE);
/* Add a ref to keep it around after the excel-sheet/wb goes
* away. externames do not get references and are unrefed
* away. externnames do not get references and are unrefed
* after import finishes, which destroys them if they are not
* in use. */
if (nexpr != NULL) {
......@@ -4886,7 +4886,7 @@ excel_externsheet_v7 (MSContainer const *container, gint16 idx)
d (2, fprintf (stderr, "externv7 %hd\n", idx););
externsheets = container->v7.externsheet;
externsheets = container->v7.externsheets;
g_return_val_if_fail (externsheets != NULL, NULL);
g_return_val_if_fail (idx > 0, NULL);
g_return_val_if_fail (idx <= (int)externsheets->len, NULL);
......@@ -4969,9 +4969,9 @@ excel_read_EXTERNSHEET_v7 (BiffQuery const *q, MSContainer *container)
_("external references"));
}
if (container->v7.externsheet == NULL)
container->v7.externsheet = g_ptr_array_new ();
g_ptr_array_add (container->v7.externsheet, sheet);
if (container->v7.externsheets == NULL)
container->v7.externsheets = g_ptr_array_new ();
g_ptr_array_add (container->v7.externsheets, sheet);
}
/* FILEPASS, ask the user for a password if necessary
......
......@@ -204,7 +204,7 @@ excel_write_BOF (BiffPut *bp, MsBiffFileType type)
{
guint8 *data;
unsigned ans;
guint len;
guint len = 8;
guint16 record = BIFF_BOF;
......@@ -406,7 +406,7 @@ excel_write_externsheets_v8 (ExcelWriteState *ewb)
static guint8 const magic_addin[] = { 0x01, 0x00, 0x01, 0x3a };
static guint8 const magic_self[] = { 0x03, 0x00, 0x01, 0x4 };
unsigned i;
guint8 data [6];
guint8 data [8];
GnmFunc *func;
/* XL appears to get irrate if we export an addin SUPBOOK with
......@@ -435,17 +435,22 @@ excel_write_externsheets_v8 (ExcelWriteState *ewb)
ms_biff_put_commit (ewb->bp);
/* Now do the EXTERNSHEET */
i = g_hash_table_size (ewb->sheet_pairs) + 1; /* the magic self we're about to add */
ms_biff_put_var_next (ewb->bp, BIFF_EXTERNSHEET);
GSF_LE_SET_GUINT16 (data + 0, i);
i = g_hash_table_size (ewb->sheet_pairs);
ms_biff_put_var_write (ewb->bp, data, 2);
GSF_LE_SET_GUINT16 (data + 0, ewb->supbook_idx); /* magic self */
GSF_LE_SET_GUINT16 (data + 2, 0xfffe);
GSF_LE_SET_GUINT16 (data + 4, 0xfffe);
ms_biff_put_var_write (ewb->bp, data, 6);
if (ewb->externnames->len > 0) {
GSF_LE_SET_GUINT16 (data + 0, i+1); /* the magic self we're about to add */
GSF_LE_SET_GUINT16 (data + 2, 0); /* magic self */
GSF_LE_SET_GUINT16 (data + 4, 0xfffe);
GSF_LE_SET_GUINT16 (data + 6, 0xfffe);
ms_biff_put_var_write (ewb->bp, data, 8);
ewb->tmp_counter = 1;
} else {
GSF_LE_SET_GUINT16 (data + 0, i);
ms_biff_put_var_write (ewb->bp, data, 2);
ewb->tmp_counter = 0;
}
ewb->tmp_counter = 1; /* 0 == the 0xfffe we just put out */
g_hash_table_foreach (ewb->sheet_pairs,
(GHFunc) cb_write_sheet_pairs, ewb);
ms_biff_put_commit (ewb->bp);
......@@ -3467,6 +3472,11 @@ write_sheet_head (BiffPut *bp, ExcelWriteSheet *esheet)
excel_write_margin (bp, BIFF_BOTTOM_MARGIN, pi->margins.bottom.points);
excel_write_SETUP (bp, esheet);
if (bp->version < MS_BIFF_V8) {
/* write externsheets for every sheet in the workbook
* to make our lives easier */
excel_write_externsheets_v7 (esheet->ewb);
}
excel_write_DEFCOLWIDTH (bp, esheet);
excel_write_colinfos (bp, esheet);
excel_write_AUTOFILTERINFO (bp, esheet);
......@@ -4276,7 +4286,7 @@ excel_write_workbook (ExcelWriteState *ewb)
excel_write_externsheets_v7 (ewb);
/* assign indicies to the names before we export */
ewb->tmp_counter = ewb->externnames->len;
ewb->tmp_counter = 0;
excel_write_names (ewb);
}
......
......@@ -1499,7 +1499,7 @@ excel_parse_formula (MSContainer const *container,
a = container->ewb->container.names;
sheet_idx = -sheet_idx;
} else
a = container->names;
a = container->v7.externnames;
sheet = excel_externsheet_v7 (container, sheet_idx);
ptg_length = 24;
}
......
......@@ -510,8 +510,9 @@ write_funcall (PolishData *pd, GnmExpr const *expr,
push_guint8 (pd, FORMULA_PTG_NAME_X);
if (pd->ewb->bp->version <= MS_BIFF_V7) {
/* The Magic Addin entry is after the real sheets
* at the workbook level. */
push_gint16 (pd, -(pd->ewb->sheets->len + 1));
* for globals (names that call addins) and
* for locals (fomulas that call addins) */
push_gint16 (pd, pd->ewb->sheets->len + 1);
ms_biff_put_var_write (pd->ewb->bp, zeros, 8);
push_guint16 (pd, ef->idx);
ms_biff_put_var_write (pd->ewb->bp, zeros, 12);
......