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



commit 9fcbba84f8a0b28824e05c81ae9b844aba35e042
Author: Morten Welinder <terra gnome org>
Date:   Sat Apr 4 21:32:55 2015 -0400

    Sheet Objects: in one-cell anchor mode, save only one cell.
    
    Save A1 for absolute mode because we need something there.

 ChangeLog               |    8 ++++++++
 src/sheet-control-gui.c |    2 ++
 src/xml-sax-write.c     |   16 +++++++++++++++-
 3 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 36070e5..778179c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+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
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 1e01bfb..9fbb768 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -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;
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index 6e85b1a..13e9cc5 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -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",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]