[gnumeric] ssindex: index more parts of styles.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] ssindex: index more parts of styles.
- Date: Mon, 11 May 2009 11:20:58 -0400 (EDT)
commit 70f2e3f0fec89dd166bd899b3ee54fac30005eaa
Author: Morten Welinder <terra gnome org>
Date: Mon May 11 11:19:52 2009 -0400
ssindex: index more parts of styles.
---
ChangeLog | 4 +++
NEWS | 1 +
src/ssindex.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++----------
3 files changed, 65 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 709969d..8d25532 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-05-11 Morten Welinder <terra gnome org>
+
+ * src/ssindex.c (cb_index_styles): Index validation stuff too.
+
2009-05-09 Morten Welinder <terra gnome org>
* src/collect.c (collect_floats): Introduce a cache for the
diff --git a/NEWS b/NEWS
index 3c4a2a8..f23d625 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,7 @@ Morten:
* Respect the sheet size prefs for new blank workbooks.
* Cache large ranges, possibly sorted.
* Add progress display for OO import.
+ * Improve ssindex' coverage.
--------------------------------------------------------------------------
Gnumeric 1.9.7
diff --git a/src/ssindex.c b/src/ssindex.c
index 1dbff4f..5aa14fc 100644
--- a/src/ssindex.c
+++ b/src/ssindex.c
@@ -27,6 +27,8 @@
#include "mstyle.h"
#include "sheet-style.h"
#include "hlink.h"
+#include "validation.h"
+#include "str.h"
#include "sheet-object-graph.h"
#include "gnm-plugin.h"
@@ -36,7 +38,6 @@
#include <gsf/gsf-utils.h>
#include <gsf/gsf-libxml.h>
#include <gsf/gsf-output-stdio.h>
-#include <string.h>
static gboolean ssindex_show_version = FALSE;
static gboolean ssindex_list_mime_types = FALSE;
@@ -87,14 +88,41 @@ typedef struct {
} IndexerState;
static void
+ssindex_hlink (IndexerState *state, GnmHLink const *lnk)
+{
+ gchar const *str;
+
+ str = gnm_hlink_get_target (lnk);
+ if (str)
+ gsf_xml_out_simple_element (state->output, "data", str);
+
+ str = gnm_hlink_get_tip (lnk);
+ if (str)
+ gsf_xml_out_simple_element (state->output, "data", str);
+}
+
+static void
+ssindex_validation (IndexerState *state, GnmValidation const *valid)
+{
+ gchar const *str;
+
+ str = valid->title->str;
+ if (*str)
+ gsf_xml_out_simple_element (state->output, "data", str);
+
+ str = valid->msg->str;
+ if (*str)
+ gsf_xml_out_simple_element (state->output, "data", str);
+}
+
+static void
cb_index_cell (G_GNUC_UNUSED gpointer ignore,
GnmCell const *cell, IndexerState *state)
{
if (cell->value != NULL && VALUE_IS_STRING (cell->value)) {
char const *str = value_peek_string (cell->value);
if (str != NULL && *str)
- gsf_xml_out_simple_element (state->output,
- "data", value_peek_string (cell->value));
+ gsf_xml_out_simple_element (state->output, "data", str);
}
}
@@ -102,15 +130,18 @@ static void
cb_index_styles (GnmStyle *style, gconstpointer dummy, IndexerState *state)
{
if (gnm_style_is_element_set (style, MSTYLE_HLINK)) {
- gchar const *str;
GnmHLink const *lnk = gnm_style_get_hlink (style);
- if (lnk != NULL) {
- if (NULL != (str = gnm_hlink_get_target (lnk)))
- gsf_xml_out_simple_element (state->output, "data", str);
- if (NULL != (str = gnm_hlink_get_tip (lnk)))
- gsf_xml_out_simple_element (state->output, "data", str);
- }
+ if (lnk != NULL)
+ ssindex_hlink (state, lnk);
}
+
+ if (gnm_style_is_element_set (style, MSTYLE_VALIDATION)) {
+ GnmValidation const *valid = gnm_style_get_validation (style);
+ if (valid)
+ ssindex_validation (state, valid);
+ }
+
+ /* Input Msg? */
}
static void
@@ -123,6 +154,13 @@ ssindex_chart (IndexerState *state, GogObject *obj)
ssindex_chart (state, ptr->data);
}
+static void
+cb_index_name (const char *name, GnmExprName const *nexpr, IndexerState *state)
+{
+ gsf_xml_out_simple_element (state->output, "data", name);
+}
+
+
/**
* Other things we could index
* - The names of external refernces
@@ -147,11 +185,16 @@ ssindex (char const *file, IOContext *ioc)
if (state.wb_view == NULL)
return 1;
+ state.sheet = NULL;
+
gsf_stdout = gsf_output_stdio_new_FILE ("<stdout>", stdout, TRUE);
state.output = gsf_xml_out_new (gsf_stdout);
gsf_xml_out_start_element (state.output, "gnumeric");
state.wb = wb = wb_view_get_workbook (state.wb_view);
- for (i = 0 ; i < workbook_sheet_count (wb); i++) {
+
+ workbook_foreach_name (wb, TRUE, (GHFunc)cb_index_name, &state);
+
+ for (i = 0; i < workbook_sheet_count (wb); i++) {
state.sheet = workbook_sheet_by_index (wb, i);
gsf_xml_out_simple_element (state.output,
"data", state.sheet->name_unquoted);
@@ -177,9 +220,13 @@ ssindex (char const *file, IOContext *ioc)
}
g_slist_free (objs);
- /* and finally the hyper-links */
+ /* Various stuff in styles. */
sheet_style_foreach (state.sheet,
- (GHFunc)&cb_index_styles, &state);
+ (GHFunc)&cb_index_styles, &state);
+
+ /* Local names. */
+ gnm_sheet_foreach_name (state.sheet,
+ (GHFunc)cb_index_name, &state);
}
gsf_xml_out_end_element (state.output); /* </gnumeric> */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]