Commit 9fcbba84 authored by Morten Welinder's avatar Morten Welinder

Sheet Objects: in one-cell anchor mode, save only one cell.

Save A1 for absolute mode because we need something there.
parent 70c76b9a
2015-04-04 Morten Welinder <terra@gnome.org>
* src/xml-sax-write.c (xml_write_objects): Save only relevant
parts of the cell bound.
* src/sheet-control-gui.c (scg_object_coords_to_anchor):
Initialize parts of cell_bound not used.
2015-04-01 Morten Welinder <terra@gnome.org>
* src/sheet-object-graph.c (gnm_sogg_prep_sax_parser): Use
......
......@@ -3002,11 +3002,13 @@ scg_object_coords_to_anchor (SheetControlGUI const *scg,
in_out->offset + 0);
in_out->cell_bound.start.row = calc_obj_place (pane, tmp[1], FALSE,
in_out->offset + 1);
in_out->cell_bound.end = in_out->cell_bound.start;
in_out->offset[2] = (tmp[2] - tmp[0]) / colrow_compute_pixel_scale (sheet, TRUE);
in_out->offset[3] = (tmp[3] - tmp[1]) / colrow_compute_pixel_scale (sheet, FALSE);
break;
case GNM_SO_ANCHOR_ABSOLUTE: {
double h, v;
range_init (&in_out->cell_bound, 0, 0, 0, 0);
h = colrow_compute_pixel_scale (sheet, TRUE);
v = colrow_compute_pixel_scale (sheet, FALSE);
in_out->offset[0] = tmp[0] / h;
......
......@@ -1248,6 +1248,20 @@ xml_write_objects (GnmOutputXML *state, GSList *objects)
for (ptr = objects ;ptr != NULL ; ptr = ptr->next) {
SheetObject *so = ptr->data;
SheetObjectClass *klass = GNM_SO_CLASS (G_OBJECT_GET_CLASS (so));
GnmRange cell_bound = so->anchor.cell_bound;
switch (so->anchor.mode) {
case GNM_SO_ANCHOR_TWO_CELLS:
break;
case GNM_SO_ANCHOR_ONE_CELL:
cell_bound.end = cell_bound.start;
break;
case GNM_SO_ANCHOR_ABSOLUTE:
range_init (&cell_bound, 0, 0, 0, 0);
break;
default:
g_assert_not_reached ();
}
if (needs_container) {
needs_container = FALSE;
......@@ -1264,7 +1278,7 @@ xml_write_objects (GnmOutputXML *state, GSList *objects)
if (so->name)
gsf_xml_out_add_cstr (state->output, "Name", so->name);
if (so->anchor.mode != GNM_SO_ANCHOR_ABSOLUTE)
gsf_xml_out_add_cstr (state->output, "ObjectBound", range_as_string (&so->anchor.cell_bound));
gsf_xml_out_add_cstr (state->output, "ObjectBound", range_as_string (&cell_bound));
if (so->anchor.mode != GNM_SO_ANCHOR_TWO_CELLS)
gsf_xml_out_add_enum (state->output,
"AnchorMode",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment