[gnumeric] Extend the addressbook to handle both A1 and R1C1 style addresses. [#650941]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Extend the addressbook to handle both A1 and R1C1 style addresses. [#650941]
- Date: Thu, 26 May 2011 07:36:18 +0000 (UTC)
commit 7989736e22f68aabec8af2aa97636b41b66ec03d
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Thu May 26 01:35:32 2011 -0600
Extend the addressbook to handle both A1 and R1C1 style addresses. [#650941]
2011-05-26 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/parse-util.h (gnm_conventions_dup): new
* src/parse-util.c (gnm_conventions_dup): new
* src/workbook-control.c (wb_control_parse_and_jump): accept both
both A1 and R1C1 style addresses.
ChangeLog | 7 +++++++
NEWS | 2 ++
src/parse-util.c | 7 +++++++
src/parse-util.h | 1 +
src/workbook-control.c | 16 ++++++++++++++++
5 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a3c544a..86b816c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2011-05-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * src/parse-util.h (gnm_conventions_dup): new
+ * src/parse-util.c (gnm_conventions_dup): new
+ * src/workbook-control.c (wb_control_parse_and_jump): accept both
+ both A1 and R1C1 style addresses.
+
+2011-05-26 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* src/workbook-control.h (wb_control_jump): new
* src/workbook-control.c (wb_control_jump): make non-static
diff --git a/NEWS b/NEWS
index b43e382..3ce4031 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ Andreas
* Store some print range information in gnumeric files. [#649714]
* Hide Prefer CLIPBOARD preference under MS Windows. [#649675]
* Extend the goto dialog.
+ * Extend the addressbook to handle both A1 and R1C1 style addresses.
+ [#650941]
Morten:
* Fix leaks in SHEET. [#650761]
diff --git a/src/parse-util.c b/src/parse-util.c
index ac00a83..34584ea 100644
--- a/src/parse-util.c
+++ b/src/parse-util.c
@@ -1399,6 +1399,13 @@ gnm_conventions_new (void)
return gnm_conventions_new_full (sizeof (GnmConventions));
}
+GnmConventions *
+gnm_conventions_dup (GnmConventions const *c)
+{
+ GnmConventions *conv = g_memdup (c, sizeof (GnmConventions));
+ conv->ref_count = 1;
+}
+
/**
* gnm_conventions_unref :
* @c : #GnmConventions
diff --git a/src/parse-util.h b/src/parse-util.h
index 1b0b39c..2dc6dc9 100644
--- a/src/parse-util.h
+++ b/src/parse-util.h
@@ -200,6 +200,7 @@ struct _GnmConventions {
};
GnmConventions *gnm_conventions_new (void);
GnmConventions *gnm_conventions_new_full (unsigned size);
+GnmConventions *gnm_conventions_dup (GnmConventions const*c);
GnmConventions *gnm_conventions_ref (GnmConventions *c);
void gnm_conventions_unref (GnmConventions *c);
diff --git a/src/workbook-control.c b/src/workbook-control.c
index 65b3d19..9697537 100644
--- a/src/workbook-control.c
+++ b/src/workbook-control.c
@@ -281,6 +281,22 @@ wb_control_parse_and_jump (WorkbookControl *wbc, char const *text)
target = value_new_cellrange_parsepos_str (&pp, text,
GNM_EXPR_PARSE_DEFAULT);
if (target == NULL) {
+ GnmExprTop const *texpr;
+ GnmConventions *convs = gnm_conventions_dup
+ (sheet_get_conventions(sv->sheet));
+ convs->r1c1_addresses = !convs->r1c1_addresses;
+
+ texpr = gnm_expr_parse_str
+ (text, &pp, GNM_EXPR_PARSE_DEFAULT, convs, NULL);
+ if (texpr != NULL) {
+ target = gnm_expr_top_get_range (texpr);
+ gnm_expr_top_unref (texpr);
+ }
+
+ gnm_conventions_unref (convs);
+ }
+
+ if (target == NULL) {
/* Not an address; is it a name? */
GnmParsePos pp;
GnmNamedExpr *nexpr = expr_name_lookup (
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]