GNOME Bugzilla – Bug 581953
Array partitioning is not verified!
Last modified: 2009-05-09 07:15:37 UTC
When an ods file (created by gnumeric or OOo) contains an array formula over 2 or more cells, the formula is only imported in the first cell. the otehrs only show the stored value.
Hmm, the problem is that while in oo_cell_start we are setting the formula for the whole array, when we encounter the values for the non-corner cells gnm_cell_is_nonsingleton_array (cell) returns FALSE when it should be TRUE. THis causes the expressions in those cells to be destroyed.
Wow. I don't really understand everything about our expressions, but: GnmExprArrayCorner const * gnm_expr_top_get_array_corner (GnmExprTop const *texpr) { g_return_val_if_fail (IS_GNM_EXPR_TOP (texpr), NULL); return GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_ARRAY_CORNER ? &texpr->expr->array_corner : NULL; } from expr.c looks wrong to me. Shouldn't this be: GnmExprArrayCorner const * gnm_expr_top_get_array_corner (GnmExprTop const *texpr) { g_return_val_if_fail (IS_GNM_EXPR_TOP (texpr), NULL); return ((GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_ARRAY_CORNER) || (GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_ARRAY_ELEM)) ? &texpr->expr->array_corner : NULL; } at least as we use it in GnmExprArrayCorner const * gnm_cell_is_array_corner (GnmCell const *cell) { return cell && gnm_cell_has_expr (cell) ? gnm_expr_top_get_array_corner (cell->base.texpr) : NULL; } which according to the use in /** * gnm_cell_is_nonsingleton_array : * @cell : #GnmCell const * * * Return TRUE is @cell is part of an array larger than 1x1 **/ gboolean gnm_cell_is_nonsingleton_array (GnmCell const *cell) { GnmExprArrayCorner const *corner = gnm_cell_is_array_corner (cell); return corner && (corner->cols > 1 || corner->rows > 1); } should yield the corner of the array containing the given cell.
Looking at the other uses of gnm_cell_is_array_corner, it is clear that that function and gnm_expr_top_get_array_corner are correct. It is gnm_cell_is_nonsingleton_array that has a problem.
It is defintiely gnm_cell_is_nonsingleton_array that is wrong since we are having other related problems: Create any non 1 by 1 array. Change the value of the non-corner cell. THis should not be possible but it is now allowed!!!
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.