[gnumeric] Accept 3D values for vector data. [#722294]



commit c26e73bcf3d54e86acec1d282f943ab560e48314
Author: Jean Brefort <jean brefort normalesup org>
Date:   Fri Jan 17 23:02:54 2014 +0100

    Accept 3D values for vector data. [#722294]

 ChangeLog   |    6 ++++++
 INSTALL     |    4 ++--
 NEWS        |    3 +++
 src/graph.c |   29 +++++++++++++++++++++--------
 4 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0c784fc..877c7ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-01-17  Jean Brefort  <jean brefort normalesup org>
+
+       * src/graph.c (gnm_go_data_vector_load_len),
+       (gnm_go_data_vector_load_values): accept 3D values for vector data.
+       [#722294]
+
 2014-01-16  Morten Welinder  <terra gnome org>
 
        * src/wbc-gtk.c (cb_adjust_foreground_attributes): Renamed from
diff --git a/INSTALL b/INSTALL
index 007e939..2099840 100644
--- a/INSTALL
+++ b/INSTALL
@@ -12,8 +12,8 @@ without warranty of any kind.
 Basic Installation
 ==================
 
-   Briefly, the shell commands `./configure; make; make install' should
-configure, build, and install this package.  The following
+   Briefly, the shell command `./configure && make && make install'
+should configure, build, and install this package.  The following
 more-detailed instructions are generic; see the `README' file for
 instructions specific to this package.  Some packages provide this
 `INSTALL' file but do not implement all of the features documented
diff --git a/NEWS b/NEWS
index 69136ad..c9784d8 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ Andreas:
        * Fix handling of dashes on ODF import. [#719509]
        * Suppress some warnings in xlsx import. [#719680]
 
+Jean:
+       * Accept 3D values for vector data. [#722294]
+
 Mario Rugiero:
        * Fix leaks.  [#720306]
 
diff --git a/src/graph.c b/src/graph.c
index 7f60f0c..a9305e6 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -574,7 +574,7 @@ gnm_go_data_vector_load_len (GODataVector *dat)
                                guint w = range_width (&r);
                                guint h = range_height (&r);
                                vec->as_col = h > w;
-                               new_len = (guint64)h * w;
+                               new_len = (guint64)h * w * (end_sheet->index_in_wb - start_sheet->index_in_wb 
+ 1);
                        }
                        break;
 
@@ -588,7 +588,8 @@ gnm_go_data_vector_load_len (GODataVector *dat)
                                        if (v->type == VALUE_CELLRANGE) {
                                                gnm_rangeref_normalize (&v->v_range.cell, &ep,
                                                        &start_sheet, &end_sheet, &r);
-                                               new_len += (guint64)range_width (&r) * range_height (&r);
+                                               new_len += (guint64)range_width (&r) * range_height (&r)
+                                                       * (end_sheet->index_in_wb - start_sheet->index_in_wb 
+ 1);
                                        } else
                                                new_len++;
                                }
@@ -712,9 +713,15 @@ gnm_go_data_vector_load_values (GODataVector *dat)
                        closure.vals_len = dat->len;
                        closure.last = -1;
                        closure.i = 0;
-                       sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_FILTERED,
-                               r.start.col, r.start.row, r.end.col, r.end.row,
-                               (CellIterFunc)cb_assign_val, &closure);
+                       if (start_sheet != end_sheet)
+                               workbook_foreach_cell_in_range (&ep, vec->val,
+                                                               CELL_ITER_IGNORE_FILTERED,
+                                                               (CellIterFunc)cb_assign_val,
+                                                               &closure);
+                       else
+                               sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_FILTERED,
+                                       r.start.col, r.start.row, r.end.col, r.end.row,
+                                       (CellIterFunc)cb_assign_val, &closure);
                        dat->len = closure.last + 1; /* clip */
                        minimum = closure.minimum;
                        maximum = closure.maximum;
@@ -756,9 +763,15 @@ gnm_go_data_vector_load_values (GODataVector *dat)
                                        closure.vals_len = max;
                                        closure.last = last - 1;
                                        closure.i = last;
-                                       sheet_foreach_cell_in_range (start_sheet, CELL_ITER_IGNORE_FILTERED,
-                                               r.start.col, r.start.row, r.end.col, r.end.row,
-                                               (CellIterFunc)cb_assign_val, &closure);
+                                       if (start_sheet != end_sheet)
+                                               workbook_foreach_cell_in_range (&ep, vec->val,
+                                                                               CELL_ITER_IGNORE_FILTERED,
+                                                                               (CellIterFunc)cb_assign_val,
+                                                                               &closure);
+                                       else
+                                               sheet_foreach_cell_in_range (start_sheet, 
CELL_ITER_IGNORE_FILTERED,
+                                                       r.start.col, r.start.row, r.end.col, r.end.row,
+                                                       (CellIterFunc)cb_assign_val, &closure);
                                        last = dat->len = closure.last + 1; /* clip */
                                        if (minimum > closure.minimum)
                                            minimum = closure.minimum;


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