[gnumeric] Fix data labels when the source is a range with several rows and columns. [#761048]



commit fbe5bab56a7c800e592611ee25c12a7658098ba6
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Jan 28 14:49:20 2016 +0100

    Fix data labels when the source is a range with several rows and columns. [#761048]

 ChangeLog   |    4 ++++
 NEWS        |    6 +++---
 src/graph.c |   22 ++++++++++++++++++++++
 3 files changed, 29 insertions(+), 3 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b878469..678f382 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2016-01-28  Jean Brefort  <jean brefort normalesup org>
+
+       * src/graph.c (gnm_go_data_vector_get_str): fix for a range value. [#761048]
+
 2016-01-27  Morten Welinder  <terra gnome org>
 
        * src/wbc-gtk.c (cb_add_menus_toolbars): Work around gtk+ bug with
diff --git a/NEWS b/NEWS
index 4cf7764..1e382b0 100644
--- a/NEWS
+++ b/NEWS
@@ -7,7 +7,9 @@ Andreas:
        * Fix NETWORKDAYS. [#760576]
 
 Jean:
-       * Fuzzed file fixes.  [#760546]
+       * Fuzzed file fix.  [#760546]
+       * Fix data labels when the source is a range with several rows and
+        columns. [#761048]
 
 Morten:
        * Teach ssconvert to split sheets into separate .txt files [#694408]
@@ -15,11 +17,9 @@ Morten:
        * Fuzzed file fixes.  [#760046] [#760085] [#760087] [#760089]
          [#760043] [#760103] [#760102] [#760101] [#760105] [#760106]
          [#760104] [#760229] [#760231] [#760232] [#760544] [#760545]
-         [#761023]
        * Fix R.DBINOM extreme-value case.  [#760230]
        * New function AGM.
        * Fix canvas problem leaving grab in place.  [#760639]
-       * Work around gtk+ bug causing growing windows.  [#761142]
 
 --------------------------------------------------------------------------
 Gnumeric 1.12.26
diff --git a/src/graph.c b/src/graph.c
index 1eaf171..0775be0 100644
--- a/src/graph.c
+++ b/src/graph.c
@@ -929,6 +929,28 @@ gnm_go_data_vector_get_str (GODataVector *dat, unsigned i)
                }
                if (vec->strs && vec->strs->len > i)
                        v = g_ptr_array_index (vec->strs, i);
+       } else if (VALUE_IS_CELLRANGE (vec->val)) {
+               Sheet *start_sheet, *end_sheet;
+               GnmRange r;
+               if (vec->strs == NULL)
+                       vec->strs = g_ptr_array_new ();
+               gnm_rangeref_normalize (&vec->val->v_range.cell,
+                       eval_pos_init_dep (&ep, &vec->dep),
+                       &start_sheet, &end_sheet, &r);
+
+               /* clip here rather than relying on sheet_foreach
+                * because that only clips if we ignore blanks */
+               if (r.end.row > start_sheet->rows.max_used)
+                       r.end.row = start_sheet->rows.max_used;
+               if (r.end.col > start_sheet->cols.max_used)
+                       r.end.col = start_sheet->cols.max_used;
+
+               if (r.start.col <= r.end.col && r.start.row <= r.end.row)
+                       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_string, vec->strs);
+               if (vec->strs && vec->strs->len > i)
+                       v = g_ptr_array_index (vec->strs, i);
        }
        if (vec->as_col)
                j = 0;


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