static void cb_index_name (G_GNUC_UNUSED gconstpointer key, GnmNamedExpr const *nexpr, IndexerState *state) { gsf_xml_out_simple_element (state->output, "data", expr_name_name (nexpr)); }
static void cb_load_names (G_GNUC_UNUSED gpointer key, GnmNamedExpr *nexpr, LoadNames *user) { GtkTreeIter iter; gboolean is_address = gnm_expr_top_is_rangeref (nexpr->texpr); if (expr_name_is_placeholder (nexpr)) return; if (is_address) { gtk_tree_store_append (user->state->model, &iter, &user->iter); gtk_tree_store_set (user->state->model, &iter, ITEM_NAME, expr_name_name (nexpr), SHEET_POINTER, nexpr->pos.sheet, EXPRESSION, nexpr, -1); } }
void expr_name_set_is_placeholder (GnmNamedExpr *nexpr, gboolean is_placeholder) { g_return_if_fail (nexpr != NULL); is_placeholder = !!is_placeholder; if (nexpr->is_placeholder == is_placeholder) return; nexpr->is_placeholder = is_placeholder; if (nexpr->scope) { const char *name = expr_name_name (nexpr); g_hash_table_steal (is_placeholder ? nexpr->scope->names : nexpr->scope->placeholders, name); gnm_named_expr_collection_insert (nexpr->scope, nexpr); } }
static void dump_names (Workbook *wb) { GSList *l, *names = NULL; workbook_foreach_name (wb, FALSE, (GHFunc)cb_collect_names, &names); names = g_slist_sort (names, (GCompareFunc)expr_name_cmp_by_name); g_printerr ("Dumping names...\n"); for (l = names; l; l = l->next) { GnmNamedExpr *nexpr = l->data; GnmConventionsOut out; out.accum = g_string_new (NULL); out.pp = &nexpr->pos; out.convs = gnm_conventions_default; g_string_append (out.accum, "Scope="); if (out.pp->sheet) g_string_append (out.accum, out.pp->sheet->name_quoted); else g_string_append (out.accum, "Global"); g_string_append (out.accum, " Name="); go_strescape (out.accum, expr_name_name (nexpr)); g_string_append (out.accum, " Expr="); gnm_expr_top_as_gstring (nexpr->texpr, &out); g_printerr ("%s\n", out.accum->str); g_string_free (out.accum, TRUE); } g_printerr ("Dumping names... Done\n"); g_slist_free (names); }