[gnumeric] Add GET.LINK. [#128534]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] Add GET.LINK. [#128534]
- Date: Wed, 30 Dec 2009 22:43:40 +0000 (UTC)
commit f654d4b2b7cc0fd3a828468c6a0b437917b39e9b
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Wed Dec 30 15:42:57 2009 -0700
Add GET.LINK. [#128534]
2009-12-30 Andreas J. Guelzow <aguelzow pyrshep ca>
* functions.c (help_get_link): new
(gnumeric_get_link): new
(info_functions): add GET.LINK
* plugin.xml.in: add GET.LINK
NEWS | 1 +
plugins/fn-info/ChangeLog | 7 ++++++
plugins/fn-info/functions.c | 42 +++++++++++++++++++++++++++++++++++++++++
plugins/fn-info/plugin.xml.in | 1 +
4 files changed, 51 insertions(+), 0 deletions(-)
---
diff --git a/NEWS b/NEWS
index f8e673b..869798e 100644
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ Andreas:
whole sheet below the selection. [#141313]
* Have the formula guru auto-quote unparsable expressions. [#442941]
* Create default tip for hyperlinks. [#316974]
+ * Add GET.LINK. [#128534]
Jean
* Fix import export of line type in scatter plots. [#605043]
diff --git a/plugins/fn-info/ChangeLog b/plugins/fn-info/ChangeLog
index 9948cae..c13c042 100644
--- a/plugins/fn-info/ChangeLog
+++ b/plugins/fn-info/ChangeLog
@@ -1,5 +1,12 @@
2009-12-30 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * functions.c (help_get_link): new
+ (gnumeric_get_link): new
+ (info_functions): add GET.LINK
+ * plugin.xml.in: add GET.LINK
+
+2009-12-30 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* functions.c (help_expression): fix formatting
2009-12-15 Morten Welinder <terra gnome org>
diff --git a/plugins/fn-info/functions.c b/plugins/fn-info/functions.c
index 7416213..425bb3e 100644
--- a/plugins/fn-info/functions.c
+++ b/plugins/fn-info/functions.c
@@ -48,6 +48,7 @@
#include <sheet-style.h>
#include <number-match.h>
#include <gnm-i18n.h>
+#include <hlink.h>
#include <goffice/goffice.h>
#include <gnm-plugin.h>
@@ -1810,6 +1811,44 @@ gnumeric_getenv (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
/***************************************************************************/
+static GnmFuncHelp const help_get_link[] = {
+ { GNM_FUNC_HELP_NAME, F_("GET.LINK:The target of the hyperlink attached to @{cell} as a string.")},
+ { GNM_FUNC_HELP_ARG, F_("cell:the referenced cell")},
+ { GNM_FUNC_HELP_NOTE, F_("The value return is not updated automatically when "
+ "the link attached to @{cell} changes but requires a"
+ " recalculation.")},
+ { GNM_FUNC_HELP_SEEALSO, "HYPERLINK"},
+ { GNM_FUNC_HELP_END }
+};
+
+static GnmValue *
+gnumeric_get_link (GnmFuncEvalInfo *ei, GnmValue const * const *argv)
+{
+ GnmValue const * const v = argv[0];
+
+ if (v->type == VALUE_CELLRANGE) {
+ GnmCellRef const * a = &v->v_range.cell.a;
+ GnmCellRef const * b = &v->v_range.cell.b;
+ Sheet *sheet;
+ GnmHLink *link;
+ GnmCellPos pos;
+
+ if (a->col != b->col || a->row != b->row || a->sheet !=b->sheet)
+ return value_new_error_REF (ei->pos);
+
+ sheet = (a->sheet == NULL) ? ei->pos->sheet : a->sheet;
+ gnm_cellpos_init_cellref (&pos, a, &(ei->pos->eval), sheet);
+ link = sheet_hlink_find (sheet, &pos);
+
+ if (link)
+ return value_new_string (gnm_hlink_get_target (link));
+ }
+
+ return value_new_empty ();
+}
+
+/***************************************************************************/
+
GnmFuncDescriptor const info_functions[] = {
{ "cell", "sr", help_cell,
gnumeric_cell, NULL, NULL, NULL, NULL,
@@ -1879,6 +1918,9 @@ GnmFuncDescriptor const info_functions[] = {
{ "get.formula", "r", help_get_formula,
gnumeric_get_formula, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_COMPLETE, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
+ { "get.link", "r", help_get_link,
+ gnumeric_get_link, NULL, NULL, NULL, NULL,
+ GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE },
{ "isformula", "r", help_isformula,
gnumeric_isformula, NULL, NULL, NULL, NULL,
GNM_FUNC_SIMPLE, GNM_FUNC_IMPL_STATUS_UNIQUE_TO_GNUMERIC, GNM_FUNC_TEST_STATUS_NO_TESTSUITE},
diff --git a/plugins/fn-info/plugin.xml.in b/plugins/fn-info/plugin.xml.in
index 923da51..6877e7a 100644
--- a/plugins/fn-info/plugin.xml.in
+++ b/plugins/fn-info/plugin.xml.in
@@ -17,6 +17,7 @@
<function name="error.type"/>
<function name="expression"/>
<function name="get.formula"/>
+ <function name="get.link"/>
<function name="info"/>
<function name="isblank"/>
<function name="iserr"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]