Commit 9da5f392 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

move the type enums here. merge the addVector routines. change immportSpec

2001-09-12  Jody Goldberg <jgoldberg@home.com>

	* idl/GNOME_Gnumeric_Graph.idl : move the type enums here.
	  merge the addVector routines.
	  change immportSpec into an attribute.

	* src/gnumeric-graph.c (gnm_graph_write_xml) : new routine.
	(gnm_graph_read_xml) : new routine.
	(gnm_graph_class_init) : assign them here.
	(gnm_graph_new) : split this into a wrapper for
	(gnm_graph_setup) : this new routine.
	(gnm_graph_vector_seq_scalar) : handle blank cells.
	(gnm_graph_vector_seq_date) : handle blank cells.
	(gnm_graph_vector_seq_string) : handle blank cells.
	(gnm_graph_vector_corba_destroy) : release the subscriber.
	(gnm_graph_subscribe_vector) : adjust to idl changes.
	(gnm_graph_get_spec) : new routine.

	* src/position.c (parse_pos_init_dep) : new utility.
parent ba5eb1c1
2001-09-12 Jody Goldberg <jgoldberg@home.com>
* idl/GNOME_Gnumeric_Graph.idl : move the type enums here.
merge the addVector routines.
change immportSpec into an attribute.
* src/gnumeric-graph.c (gnm_graph_write_xml) : new routine.
(gnm_graph_read_xml) : new routine.
(gnm_graph_class_init) : assign them here.
(gnm_graph_new) : split this into a wrapper for
(gnm_graph_setup) : this new routine.
(gnm_graph_vector_seq_scalar) : handle blank cells.
(gnm_graph_vector_seq_date) : handle blank cells.
(gnm_graph_vector_seq_string) : handle blank cells.
(gnm_graph_vector_corba_destroy) : release the subscriber.
(gnm_graph_subscribe_vector) : adjust to idl changes.
(gnm_graph_get_spec) : new routine.
* src/position.c (parse_pos_init_dep) : new utility.
2001-09-11 Jody Goldberg <jgoldberg@home.com>
* src/style.c (style_font_new_simple) : store the width in pixels as
......
2001-09-12 Jody Goldberg <jgoldberg@home.com>
* idl/GNOME_Gnumeric_Graph.idl : move the type enums here.
merge the addVector routines.
change immportSpec into an attribute.
* src/gnumeric-graph.c (gnm_graph_write_xml) : new routine.
(gnm_graph_read_xml) : new routine.
(gnm_graph_class_init) : assign them here.
(gnm_graph_new) : split this into a wrapper for
(gnm_graph_setup) : this new routine.
(gnm_graph_vector_seq_scalar) : handle blank cells.
(gnm_graph_vector_seq_date) : handle blank cells.
(gnm_graph_vector_seq_string) : handle blank cells.
(gnm_graph_vector_corba_destroy) : release the subscriber.
(gnm_graph_subscribe_vector) : adjust to idl changes.
(gnm_graph_get_spec) : new routine.
* src/position.c (parse_pos_init_dep) : new utility.
2001-09-11 Jody Goldberg <jgoldberg@home.com>
* src/style.c (style_font_new_simple) : store the width in pixels as
......
2001-09-12 Jody Goldberg <jgoldberg@home.com>
* idl/GNOME_Gnumeric_Graph.idl : move the type enums here.
merge the addVector routines.
change immportSpec into an attribute.
* src/gnumeric-graph.c (gnm_graph_write_xml) : new routine.
(gnm_graph_read_xml) : new routine.
(gnm_graph_class_init) : assign them here.
(gnm_graph_new) : split this into a wrapper for
(gnm_graph_setup) : this new routine.
(gnm_graph_vector_seq_scalar) : handle blank cells.
(gnm_graph_vector_seq_date) : handle blank cells.
(gnm_graph_vector_seq_string) : handle blank cells.
(gnm_graph_vector_corba_destroy) : release the subscriber.
(gnm_graph_subscribe_vector) : adjust to idl changes.
(gnm_graph_get_spec) : new routine.
* src/position.c (parse_pos_init_dep) : new utility.
2001-09-11 Jody Goldberg <jgoldberg@home.com>
* src/style.c (style_font_new_simple) : store the width in pixels as
......
2001-09-12 Jody Goldberg <jgoldberg@home.com>
* idl/GNOME_Gnumeric_Graph.idl : move the type enums here.
merge the addVector routines.
change immportSpec into an attribute.
* src/gnumeric-graph.c (gnm_graph_write_xml) : new routine.
(gnm_graph_read_xml) : new routine.
(gnm_graph_class_init) : assign them here.
(gnm_graph_new) : split this into a wrapper for
(gnm_graph_setup) : this new routine.
(gnm_graph_vector_seq_scalar) : handle blank cells.
(gnm_graph_vector_seq_date) : handle blank cells.
(gnm_graph_vector_seq_string) : handle blank cells.
(gnm_graph_vector_corba_destroy) : release the subscriber.
(gnm_graph_subscribe_vector) : adjust to idl changes.
(gnm_graph_get_spec) : new routine.
* src/position.c (parse_pos_init_dep) : new utility.
2001-09-11 Jody Goldberg <jgoldberg@home.com>
* src/style.c (style_font_new_simple) : store the width in pixels as
......
......@@ -12,8 +12,17 @@ module GNOME {
short start;
short end;
};
typedef long VectorID;
typedef sequence<Pair> SeqPair;
typedef sequence<VectorID> VectorIDs;
enum VectorType {
VECTOR_TYPE_SCALAR,
VECTOR_TYPE_DATE,
VECTOR_TYPE_STRING
};
/* This is a place holder */
typedef sequence<Pair> SeqPair;
interface VectorSelection {
oneway void selected (in SeqPair ranges);
};
......@@ -41,13 +50,31 @@ module GNOME {
module Graph {
interface Manager_v2 : Bonobo::Unknown {
typedef long VectorID;
typedef sequence<VectorID> VectorIDs;
typedef sequence<octet> Buffer;
Scalar::Vector addScalarVector (in Scalar::Vector v, in VectorID id);
Date::Vector addDateVector (in Date::Vector v, in VectorID id);
String::Vector addStringVector (in String::Vector v, in VectorID id);
Bonobo::Control configure (in string type);
/**
* Read :
* A full specified document including enough markup
* information to assist in data assignment and for
* persistence.
*
* Write :
* Take a possibly incomplete description of a graph using
* a subset of the dtd used for persistence and initialize
* the graphs state. The document refers to vectors by
* IDs that were assigned previously.
*/
attribute Buffer spec;
/**
* addVector :
*
* Register new vectors and get their callbacks.
*/
VectorSelection addVector (in VectorSelection v,
in VectorType type, in VectorID id);
/**
* clearVectors :
......@@ -66,19 +93,6 @@ module GNOME {
*/
oneway void arrangeVectors (in VectorIDs data,
in VectorIDs optional_headers);
Bonobo::Control getTypeSelectControl ();
/**
* importSpecification :
*
* Take a possibly incomplete description of a
* graph using a subset of the dtd used for
* persistence and initialize the graphs state.
* The document refers to vectors by IDs that
* were assigned previously.
*/
oneway void importSpecification (in Buffer spec);
};
};
};
......
......@@ -33,11 +33,12 @@
#include "ranges.h"
#include "selection.h"
#include "sheet-object-container.h"
#include <idl/GNOME_Gnumeric_Graph.h>
#include <bonobo.h>
#include <liboaf/liboaf.h>
#include <gal/util/e-util.h>
#include <gal/util/e-xml-utils.h>
#include <gnome-xml/parser.h>
#define MANAGER GNOME_Gnumeric_Graph_Manager_v2
#define MANAGER1(suffix) GNOME_Gnumeric_Graph_Manager_v2_ ## suffix
......@@ -51,6 +52,7 @@ struct _GnmGraph {
MANAGER manager;
GPtrArray *vectors;
xmlDoc *xml_doc;
};
typedef struct {
......@@ -133,7 +135,9 @@ gnm_graph_vector_seq_scalar (GnmGraphVector *vector)
Value const *elem = vector->is_column
? value_area_get_x_y (&pos, v, 0, i)
: value_area_get_x_y (&pos, v, i, 0);
values->_buffer [i] = value_get_as_float (elem);
/* TODO : do we want to handle ignoring blanks at this level ? */
values->_buffer [i] = elem ? value_get_as_float (elem) : 0.;
}
return values;
......@@ -157,7 +161,8 @@ gnm_graph_vector_seq_date (GnmGraphVector *vector)
Value const *elem = vector->is_column
? value_area_get_x_y (&pos, v, 0, i)
: value_area_get_x_y (&pos, v, i, 0);
values->_buffer [i] = value_get_as_int (elem);
/* TODO : do we want to handle ignoring blanks at this level ? */
values->_buffer [i] = elem ? value_get_as_int (elem) : 0;
}
return values;
......@@ -181,7 +186,8 @@ gnm_graph_vector_seq_string (GnmGraphVector *vector)
Value const *elem = vector->is_column
? value_area_get_x_y (&pos, v, 0, i)
: value_area_get_x_y (&pos, v, i, 0);
char const *tmp = value_peek_string (elem);
/* TODO : do we want to handle ignoring blanks at this level ? */
char const *tmp = elem ? value_peek_string (elem) : "";
values->_buffer[i] = CORBA_string_dup (tmp);
}
......@@ -434,6 +440,14 @@ gnm_graph_vector_corba_destroy (GnmGraphVector *vector)
CORBA_Environment ev;
CORBA_exception_init (&ev);
if (vector->subscriber.any != CORBA_OBJECT_NIL) {
CORBA_Object_release(vector->subscriber.any, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("'%s' : while releasing a vector",
bonobo_exception_get_text (&ev));
}
vector->subscriber.any = CORBA_OBJECT_NIL;
}
if (vector->activated) {
PortableServer_ObjectId *oid;
PortableServer_POA poa = bonobo_poa ();
......@@ -602,25 +616,8 @@ gnm_graph_subscribe_vector (GnmGraph *graph, GnmGraphVector *vector)
CORBA_exception_init (&ev);
id = graph->vectors->len;
switch (vector->type) {
case GNM_VECTOR_SCALAR :
vector->subscriber.scalar = MANAGER1 (addScalarVector) (
graph->manager, vector->corba_obj, id, &ev);
break;
case GNM_VECTOR_DATE :
vector->subscriber.date = MANAGER1 (addDateVector) (
graph->manager, vector->corba_obj, id, &ev);
break;
case GNM_VECTOR_STRING :
vector->subscriber.string = MANAGER1 (addStringVector) (
graph->manager, vector->corba_obj, id, &ev);
break;
default :
g_assert_not_reached();
}
vector->subscriber.any = MANAGER1 (addVector) (
graph->manager, vector->corba_obj, vector->type, id, &ev);
if ((ok = ev._major == CORBA_NO_EXCEPTION)) {
g_ptr_array_add (graph->vectors, vector);
......@@ -669,7 +666,7 @@ gnm_graph_add_vector (GnmGraph *graph, ExprTree *expr,
char *expr_str;
parse_pos_init (&pos, NULL, sheet, 0, 0);
expr_str = expr_tree_as_string (expr, &pos);
printf ("vector::ref (%d) @ 0x%p = %s\n", vector->type, vector, expr_str);
printf ("vector::ref (%d) @ %p = %s\n", vector->type, vector, expr_str);
g_free (expr_str);
#endif
return vector->id;
......@@ -717,7 +714,7 @@ gnm_graph_add_vector (GnmGraph *graph, ExprTree *expr,
char *expr_str;
parse_pos_init (&pos, NULL, sheet, 0, 0);
expr_str = expr_tree_as_string (expr, &pos);
printf ("vector::new (%d) @ 0x%p = %s\n", type, vector, expr_str);
printf ("vector::new (%d) @ %p = %s\n", type, vector, expr_str);
g_free (expr_str);
}
#endif
......@@ -745,15 +742,11 @@ oaf_exception_id (CORBA_Environment *ev)
}
}
/* FIXME : Should we take a CommandContext to report errors to ? */
GnmGraph *
gnm_graph_new (Workbook *wb)
static gboolean
gnm_graph_setup (GnmGraph *graph, Workbook *wb)
{
CORBA_Environment ev;
Bonobo_Unknown o;
GnmGraph *graph = NULL;
g_return_val_if_fail (IS_WORKBOOK (wb), NULL);
CORBA_exception_init (&ev);
......@@ -766,16 +759,9 @@ gnm_graph_new (Workbook *wb)
g_warning ("No graphing component is installed. Oaf has nothing registered that implements the required interface.\n"
"oaf-query 'repo_ids.has('" MANAGER_OAF "')\nshould return a value.");
} else {
graph = gtk_type_new (GNUMERIC_GRAPH_TYPE);
#ifdef DEBUG_GRAPHS
printf ("gnumeric : graph new %p\n", graph);
#endif
graph->vectors = g_ptr_array_new ();
graph->manager = Bonobo_Unknown_queryInterface (o, MANAGER_OAF, &ev);
g_return_val_if_fail (graph->manager != NULL, NULL);
g_return_val_if_fail (graph->manager != NULL, TRUE);
graph->manager_client = bonobo_object_client_from_corba (graph->manager);
bonobo_object_release_unref (o, &ev);
......@@ -791,6 +777,23 @@ gnm_graph_new (Workbook *wb)
CORBA_exception_free (&ev);
return graph == NULL;
}
/* FIXME : Should we take a CommandContext to report errors to ? */
GnmGraph *
gnm_graph_new (Workbook *wb)
{
GnmGraph *graph = gtk_type_new (GNUMERIC_GRAPH_TYPE);
#ifdef DEBUG_GRAPHS
printf ("gnumeric : graph new %p\n", graph);
#endif
if (gnm_graph_setup (graph, wb)) {
gtk_object_destroy (GTK_OBJECT (graph));
return NULL;
}
return graph;
}
......@@ -802,7 +805,7 @@ gnm_graph_type_selector (GnmGraph *graph)
Bonobo_Control control;
CORBA_exception_init (&ev);
control = MANAGER1 (getTypeSelectControl) (graph->manager, &ev);
control = MANAGER1 (configure) (graph->manager, "Type", &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("'%s' : while attempting to activate a graphing component",
bonobo_exception_get_text (&ev));
......@@ -825,8 +828,7 @@ void
gnm_graph_arrange_vectors (GnmGraph *graph)
{
CORBA_Environment ev;
MANAGER1(VectorIDs) *data, *headers;
GNOME_Gnumeric_VectorIDs *data, *headers;
unsigned i, len = 0;
g_return_if_fail (IS_GNUMERIC_GRAPH (graph));
......@@ -837,13 +839,13 @@ gnm_graph_arrange_vectors (GnmGraph *graph)
len++;
}
data = MANAGER1(VectorIDs__alloc) ();
data = GNOME_Gnumeric_VectorIDs__alloc ();
data->_length = data->_maximum = len;
data->_buffer = CMANAGER1(VectorID_allocbuf) (len);
data->_buffer = CORBA_sequence_GNOME_Gnumeric_VectorID_allocbuf (len);
data->_release = CORBA_TRUE;
headers = MANAGER1(VectorIDs__alloc) ();
headers = GNOME_Gnumeric_VectorIDs__alloc ();
headers->_length = data->_maximum = len;
headers->_buffer = CMANAGER1(VectorID_allocbuf) (len);
headers->_buffer = CORBA_sequence_GNOME_Gnumeric_VectorID_allocbuf (len);
headers->_release = CORBA_TRUE;
len = 0;
......@@ -919,6 +921,40 @@ gnm_graph_range_to_vectors (GnmGraph *graph,
}
}
static void
gnm_graph_get_spec (GnmGraph *graph)
{
CORBA_Environment ev;
MANAGER1(Buffer) *spec;
CORBA_exception_init (&ev);
spec = MANAGER1 (_get_spec) (graph->manager, &ev);
if (ev._major == CORBA_NO_EXCEPTION) {
xmlParserCtxtPtr pctxt;
/* A limit in libxml */
g_return_if_fail (spec->_length >= 4);
pctxt = xmlCreatePushParserCtxt (NULL, NULL,
spec->_buffer, spec->_length, NULL);
xmlParseChunk (pctxt, "", 0, TRUE);
if (graph->xml_doc != NULL)
xmlFreeDoc (graph->xml_doc);
graph->xml_doc = pctxt->myDoc;
#if DEBUG_INFO > 0
xmlDocDump (stdout, graph->xml_doc);
#endif
xmlFreeParserCtxt (pctxt);
} else {
g_warning ("'%s' : retrieving the specification for graph %p",
bonobo_exception_get_text (&ev), graph);
}
CORBA_exception_free (&ev);
}
/**
* gnm_graph_import_specification :
*
......@@ -932,20 +968,22 @@ void
gnm_graph_import_specification (GnmGraph *graph, xmlDocPtr spec)
{
CORBA_Environment ev;
MANAGER1(Buffer) *buffer;
MANAGER1(Buffer) *partial;
xmlChar *mem;
int size;
xmlDocDumpMemory (spec, &mem, &size);
buffer = MANAGER1(Buffer__alloc) ();
buffer->_length = buffer->_maximum = size;
buffer->_buffer = mem;
buffer->_release = CORBA_FALSE;
partial = MANAGER1(Buffer__alloc) ();
partial->_length = partial->_maximum = size;
partial->_buffer = mem;
partial->_release = CORBA_FALSE;
CORBA_exception_init (&ev);
MANAGER1 (importSpecification) (graph->manager, buffer, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
MANAGER1 (_set_spec) (graph->manager, partial, &ev);
if (ev._major == CORBA_NO_EXCEPTION)
gnm_graph_get_spec (graph);
else {
g_warning ("'%s' : importing the specification for graph %p",
bonobo_exception_get_text (&ev), graph);
}
......@@ -959,7 +997,9 @@ gnm_graph_init (GtkObject *obj)
graph->vectors = NULL;
graph->manager = CORBA_OBJECT_NIL;
graph->xml_doc = NULL;
graph->manager_client = NULL;
graph->vectors = g_ptr_array_new ();
}
static void
......@@ -981,6 +1021,10 @@ gnm_graph_destroy (GtkObject *obj)
g_ptr_array_free (graph->vectors, TRUE);
graph->vectors = NULL;
}
if (graph->xml_doc != NULL) {
xmlFreeDoc (graph->xml_doc);
graph->xml_doc = NULL;
}
if (gnm_graph_parent_class->destroy)
gnm_graph_parent_class->destroy (obj);
......@@ -1017,6 +1061,89 @@ gnm_graph_user_config (SheetObject *sheet_object,
{
}
static gboolean
gnm_graph_read_xml (SheetObject *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
GnmGraph *graph = GNUMERIC_GRAPH (so);
xmlNode *tmp;
xmlDoc *doc;
if (gnm_graph_setup (graph, ctxt->wb))
return TRUE;
tmp = e_xml_get_child_by_name (tree, "Vectors");
for (tmp = tmp->xmlChildrenNode; tmp; tmp = tmp->next) {
int id, new_id, type;
ParsePos pos;
ExprTree *expr;
xmlChar *content;
if (strcmp (tmp->name, "Vector"))
continue;
content = xmlNodeGetContent (tmp);
expr = expr_parse_string (content,
parse_pos_init (&pos, NULL, ctxt->sheet, 0, 0),
NULL, NULL);
xmlFree (content);
g_return_val_if_fail (expr != NULL, TRUE);
xml_node_get_int (tmp, "ID", &id);
xml_node_get_int (tmp, "Type", &type);
new_id = gnm_graph_add_vector (graph, expr, type, ctxt->sheet);
g_return_val_if_fail (id == new_id, TRUE);
}
doc = xmlNewDoc ("1.0");
doc->xmlRootNode = xmlCopyNode (
e_xml_get_child_by_name (tree, "Graph"), TRUE);
gnm_graph_import_specification (graph, doc);
xmlFreeDoc (doc);
return FALSE;
}
static gboolean
gnm_graph_write_xml (SheetObject const *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
GnmGraph *graph = GNUMERIC_GRAPH (so);
xmlNode *vectors;
ParsePos pp;
unsigned i;
vectors = xmlNewChild (tree, ctxt->ns, "Vectors", NULL);
for (i = 0 ; i < graph->vectors->len; i++) {
GnmGraphVector *vector = g_ptr_array_index (graph->vectors, i);
xmlNode *node;
xmlChar *encoded_expr_str;
char *expr_str;
if (vector == NULL)
continue;
expr_str = expr_tree_as_string (vector->dep.expression,
parse_pos_init_dep (&pp, &vector->dep));
encoded_expr_str = xmlEncodeEntitiesReentrant (ctxt->doc,
expr_str);
node = xmlNewChild (vectors, ctxt->ns, "Vector",
encoded_expr_str);
g_free (expr_str);
xmlFree (encoded_expr_str);
xml_node_set_int (node, "ID", i);
xml_node_set_int (node, "Type", vector->type);
}
if (graph->xml_doc == NULL)
gnm_graph_get_spec (graph);
xmlAddChild (tree, xmlCopyNode (graph->xml_doc->xmlRootNode, TRUE));
return FALSE;
}
static void
gnm_graph_class_init (GtkObjectClass *object_class)
{
......@@ -1027,8 +1154,10 @@ gnm_graph_class_init (GtkObjectClass *object_class)
object_class->destroy = &gnm_graph_destroy;
sheet_object_class = SHEET_OBJECT_CLASS (object_class);
sheet_object_class->populate_menu = &gnm_graph_populate_menu;
sheet_object_class->user_config = &gnm_graph_user_config;
sheet_object_class->populate_menu = gnm_graph_populate_menu;
sheet_object_class->user_config = gnm_graph_user_config;
sheet_object_class->read_xml = gnm_graph_read_xml;
sheet_object_class->write_xml = gnm_graph_write_xml;
}
E_MAKE_TYPE (gnm_graph, "GnmGraph", GnmGraph,
......
......@@ -4,12 +4,13 @@
#include "gnumeric.h"
#include <gtk/gtkwidget.h>
#include <gnome-xml/tree.h>
#include <idl/GNOME_Gnumeric_Graph.h>
typedef enum {
GNM_VECTOR_AUTO = 0,
GNM_VECTOR_SCALAR = 1,
GNM_VECTOR_DATE = 2,
GNM_VECTOR_STRING = 3
GNM_VECTOR_SCALAR = GNOME_Gnumeric_VECTOR_TYPE_SCALAR,
GNM_VECTOR_DATE = GNOME_Gnumeric_VECTOR_TYPE_DATE,
GNM_VECTOR_STRING = GNOME_Gnumeric_VECTOR_TYPE_STRING,
GNM_VECTOR_AUTO = 99
} GnmGraphVectorType;
#define GNUMERIC_GRAPH_TYPE (gnm_graph_get_type ())
......
......@@ -93,6 +93,24 @@ parse_pos_init (ParsePos *pp, Workbook *wb, Sheet *sheet, int col, int row)
return pp;
}
/*
* parse_pos_init_dep :
*
* @pp : The position to init.
* @dep : The dependent
*/
ParsePos *
parse_pos_init_dep (ParsePos *pp, Dependent const *dep)
{
g_return_val_if_fail (pp != NULL, NULL);
pp->sheet = dep->sheet;
pp->wb = dep->sheet->workbook;
pp->eval.col = pp->eval.row = 0;
return pp;
}
ParsePos *
parse_pos_init_cell (ParsePos *pp, Cell const *cell)
{
......
......@@ -28,6 +28,7 @@ EvalPos *eval_pos_init_cell (EvalPos *pp, Cell const *cell);
/* Initialization routines for Parse Positions */
ParsePos *parse_pos_init (ParsePos *pp, Workbook *wb,
Sheet *sheet, int col, int row);
ParsePos *parse_pos_init_dep (ParsePos *pp, Dependent const *dep);
ParsePos *parse_pos_init_cell (ParsePos *pp, Cell const *cell);
ParsePos *parse_pos_init_evalpos (ParsePos *pp, EvalPos const *pos);
......
......@@ -933,19 +933,20 @@ sheet_widget_checkbox_read_xml (SheetObject *so,
xmlFree (label);
if (input_txt) {
ParsePos pos, *pp;
ExprTree *tree;
ParsePos pos;
ExprTree *expr;
pp = parse_pos_init (&pos, NULL, context->sheet, 0, 0);
tree = expr_parse_string (input_txt, pp, NULL, NULL);
expr = expr_parse_string (input_txt,
parse_pos_init (&pos, NULL, context->sheet, 0, 0),
NULL, NULL);
if (tree == NULL) {
g_warning ("Could not read checkbox widget object. Could not parse expr tree\n");
if (expr == NULL) {
g_warning ("Could not read checkbox widget object. Could not parse expr\n");
xmlFree (input_txt);
return TRUE;
}
swc->dep.expression = tree;
swc->dep.expression = expr;
xmlFree (input_txt);
} else {
......
......@@ -28,6 +28,7 @@
#include "sheet-object-widget.h"
#ifdef ENABLE_BONOBO
#include "sheet-object-bonobo.h"
#include "gnumeric-graph.h"
#endif
#include <gal/util/e-util.h>
......@@ -772,6 +773,7 @@ sheet_object_register (void)
CELL_COMMENT_TYPE;
#ifdef ENABLE_BONOBO
SHEET_OBJECT_BONOBO_TYPE;
GNUMERIC_GRAPH_TYPE;
#endif
sheet_object_widget_register ();
}
......
......@@ -208,14 +208,14 @@ xml_arg_get (GtkArg *arg)
* result must be xmlFree
*/
xmlChar *
xml_node_get_cstr (xmlNodePtr node, const char *name)
xml_node_get_cstr (xmlNodePtr node, char const *name)
{
return name ? xmlGetProp (node, name) : xmlNodeGetContent (node);
}
/* Set a string value for a node carried as an attibute */
void
xml_node_set_cstr (xmlNodePtr node, const char *name, const char *val)
xml_node_set_cstr (xmlNodePtr node, char const *name, char const *val)
{
if (name)
xmlSetProp (node, name, val);
......@@ -225,7 +225,7 @@ xml_node_set_cstr (xmlNodePtr node, const char *name, const char *val)
/* Get an integer value for a node carried as an attibute */
gboolean
xml_node_get_int (xmlNodePtr node, const char *name, int *val)
xml_node_get_int (xmlNodePtr node, char const *name, int *val)
{
xmlChar *buf;
int res;
......@@ -241,7 +241,7 @@ xml_node_get_int (xmlNodePtr node, const char *name, int *val)
/* Set an integer value for a node carried as an attibute */
void
xml_node_set_int (xmlNodePtr node, const char *name, int val)
xml_node_set_int (xmlNodePtr node, char const *name, int val)
{
char str[4 * sizeof (int)];
sprintf (str, "%d", val);
......@@ -250,7 +250,7 @@ xml_node_set_int (xmlNodePtr node, const char *name, int val)
/* Get a double value for a node carried as an attibute */
gboolean
xml_node_get_double (xmlNodePtr node, const char *name, double *val)
xml_node_get_double (xmlNodePtr node, char const *name, double *val)
{
int res;
xmlChar *buf;
......@@ -269,7 +269,7 @@ xml_node_get_double (xmlNodePtr node, const char *name, double *val)
* the content of a child.
*/
void
xml_node_set_double (xmlNodePtr node, const char *name, double val,
xml_node_set_double (xmlNodePtr node, char const *name, double val,
int precision)
{
char str[101 + DBL_DIG];
......@@ -310,7 +310,7 @@ xml_node_set_cellpos (xmlNodePtr node, char const *name, CellPos const *val)
* Set a double value for a node with POINT_SIZE_PRECISION digits precision.
*/
static void
xml_node_set_points (xmlNodePtr node, const char *name, double val)
xml_node_set_points (xmlNodePtr node, char const *name, double val)
{
xml_node_set_double (node, name, val, POINT_SIZE_PRECISION);
}
......@@ -452,7 +452,7 @@ xml_write_selection_info (XmlParseContext *ctxt, Sheet const *sheet, xmlNodePtr
* option ...
*/
static int
xml_get_color_value (xmlNodePtr node, const char *name, StyleColor **color)
xml_get_color_value (xmlNodePtr node, char const *name, StyleColor **color)
{
char *ret;
int red, green, blue;
......@@ -469,7 +469,7 @@ xml_get_color_value (xmlNodePtr node, const char *name, StyleColor **color)
}
GdkColor *
xml_node_get_gdkcolor (xmlNodePtr node, const char *name)
xml_node_get_gdkcolor (xmlNodePtr node, char const *name)