Commit 313e9dc3 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

delete. (sheet_object_set_bounds) : Delete. (sheet_object_set_sheet) : new


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

	* src/sheet-object.c (sheet_object_construct) : delete.
	(sheet_object_set_bounds) : Delete.
	(sheet_object_set_sheet) : new function.
	(sheet_object_clear_sheet) : new function.
	(sheet_object_read_xml) : implement.
	(sheet_object_write_xml) : implement.
	(sheet_object_range_get) : support setting the range without a having
	  a sheet.
	(sheet_relocate_objects) : Use set_sheet & clear_sheet.
	(sheet_object_register) : new function.

	* src/sheet-object-widget.c (sheet_widget_checkbox_set_sheet) : new
	  function.  we need to move the dependent into the new sheet.
	(sheet_widget_checkbox_clear_sheet) :  ditto.

	* src/sheet-object-graphic.c : (sheet_object_graphic_{read,write)_xml) :
	  new functions.
	(sheet_object_filled_{read,write)_xml) : new functions.

	* src/sheet-object-container.c (view_activated_cb) : no more
	  sheet_object_construct.

	* src/sheet-object-cell-comment.c (cell_comment_{read,write)_xml) :
	  new functions.

	* src/sheet-object-bonobo.c (sheet_object_bonobo_{read,write)_xml) :
	  New functions.  These need work.  the 'read_fn' and 'write_fn' do
	  not merge nicely yet.

	* src/main.c (gnumeric_main) : Register the sheet obect types.
	  We need this until the plugin scheme is ready.

	* src/item-grid.c (cb_obj_create_button_release) : Use set_sheet
	  rather than realize.

	* src/bonobo-io.c (gnumeric_bonobo_obj_write) : constness.
parent d96b92ff
2000-12-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.c (sheet_object_construct) : delete.
(sheet_object_set_bounds) : Delete.
(sheet_object_set_sheet) : new function.
(sheet_object_clear_sheet) : new function.
(sheet_object_read_xml) : implement.
(sheet_object_write_xml) : implement.
(sheet_object_range_get) : support setting the range without a having
a sheet.
(sheet_relocate_objects) : Use set_sheet & clear_sheet.
(sheet_object_register) : new function.
* src/sheet-object-widget.c (sheet_widget_checkbox_set_sheet) : new
function. we need to move the dependent into the new sheet.
(sheet_widget_checkbox_clear_sheet) : ditto.
* src/sheet-object-graphic.c : (sheet_object_graphic_{read,write)_xml) :
new functions.
(sheet_object_filled_{read,write)_xml) : new functions.
* src/sheet-object-container.c (view_activated_cb) : no more
sheet_object_construct.
* src/sheet-object-cell-comment.c (cell_comment_{read,write)_xml) :
new functions.
* src/sheet-object-bonobo.c (sheet_object_bonobo_{read,write)_xml) :
New functions. These need work. the 'read_fn' and 'write_fn' do
not merge nicely yet.
* src/main.c (gnumeric_main) : Register the sheet obect types.
We need this until the plugin scheme is ready.
* src/item-grid.c (cb_obj_create_button_release) : Use set_sheet
rather than realize.
* src/bonobo-io.c (gnumeric_bonobo_obj_write) : constness.
2000-12-08 Jody Goldberg <jgoldberg@home.com>
From :Ade Lovett <ade@FreeBSD.org>
......
Gnumeric 0.61
Jody:
* Work on sheet object persistence.
--------------------------------------------------------------------------
Gnumeric 0.60
......
2000-12-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.c (sheet_object_construct) : delete.
(sheet_object_set_bounds) : Delete.
(sheet_object_set_sheet) : new function.
(sheet_object_clear_sheet) : new function.
(sheet_object_read_xml) : implement.
(sheet_object_write_xml) : implement.
(sheet_object_range_get) : support setting the range without a having
a sheet.
(sheet_relocate_objects) : Use set_sheet & clear_sheet.
(sheet_object_register) : new function.
* src/sheet-object-widget.c (sheet_widget_checkbox_set_sheet) : new
function. we need to move the dependent into the new sheet.
(sheet_widget_checkbox_clear_sheet) : ditto.
* src/sheet-object-graphic.c : (sheet_object_graphic_{read,write)_xml) :
new functions.
(sheet_object_filled_{read,write)_xml) : new functions.
* src/sheet-object-container.c (view_activated_cb) : no more
sheet_object_construct.
* src/sheet-object-cell-comment.c (cell_comment_{read,write)_xml) :
new functions.
* src/sheet-object-bonobo.c (sheet_object_bonobo_{read,write)_xml) :
New functions. These need work. the 'read_fn' and 'write_fn' do
not merge nicely yet.
* src/main.c (gnumeric_main) : Register the sheet obect types.
We need this until the plugin scheme is ready.
* src/item-grid.c (cb_obj_create_button_release) : Use set_sheet
rather than realize.
* src/bonobo-io.c (gnumeric_bonobo_obj_write) : constness.
2000-12-08 Jody Goldberg <jgoldberg@home.com>
From :Ade Lovett <ade@FreeBSD.org>
......
2000-12-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.c (sheet_object_construct) : delete.
(sheet_object_set_bounds) : Delete.
(sheet_object_set_sheet) : new function.
(sheet_object_clear_sheet) : new function.
(sheet_object_read_xml) : implement.
(sheet_object_write_xml) : implement.
(sheet_object_range_get) : support setting the range without a having
a sheet.
(sheet_relocate_objects) : Use set_sheet & clear_sheet.
(sheet_object_register) : new function.
* src/sheet-object-widget.c (sheet_widget_checkbox_set_sheet) : new
function. we need to move the dependent into the new sheet.
(sheet_widget_checkbox_clear_sheet) : ditto.
* src/sheet-object-graphic.c : (sheet_object_graphic_{read,write)_xml) :
new functions.
(sheet_object_filled_{read,write)_xml) : new functions.
* src/sheet-object-container.c (view_activated_cb) : no more
sheet_object_construct.
* src/sheet-object-cell-comment.c (cell_comment_{read,write)_xml) :
new functions.
* src/sheet-object-bonobo.c (sheet_object_bonobo_{read,write)_xml) :
New functions. These need work. the 'read_fn' and 'write_fn' do
not merge nicely yet.
* src/main.c (gnumeric_main) : Register the sheet obect types.
We need this until the plugin scheme is ready.
* src/item-grid.c (cb_obj_create_button_release) : Use set_sheet
rather than realize.
* src/bonobo-io.c (gnumeric_bonobo_obj_write) : constness.
2000-12-08 Jody Goldberg <jgoldberg@home.com>
From :Ade Lovett <ade@FreeBSD.org>
......
2000-12-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.c (sheet_object_construct) : delete.
(sheet_object_set_bounds) : Delete.
(sheet_object_set_sheet) : new function.
(sheet_object_clear_sheet) : new function.
(sheet_object_read_xml) : implement.
(sheet_object_write_xml) : implement.
(sheet_object_range_get) : support setting the range without a having
a sheet.
(sheet_relocate_objects) : Use set_sheet & clear_sheet.
(sheet_object_register) : new function.
* src/sheet-object-widget.c (sheet_widget_checkbox_set_sheet) : new
function. we need to move the dependent into the new sheet.
(sheet_widget_checkbox_clear_sheet) : ditto.
* src/sheet-object-graphic.c : (sheet_object_graphic_{read,write)_xml) :
new functions.
(sheet_object_filled_{read,write)_xml) : new functions.
* src/sheet-object-container.c (view_activated_cb) : no more
sheet_object_construct.
* src/sheet-object-cell-comment.c (cell_comment_{read,write)_xml) :
new functions.
* src/sheet-object-bonobo.c (sheet_object_bonobo_{read,write)_xml) :
New functions. These need work. the 'read_fn' and 'write_fn' do
not merge nicely yet.
* src/main.c (gnumeric_main) : Register the sheet obect types.
We need this until the plugin scheme is ready.
* src/item-grid.c (cb_obj_create_button_release) : Use set_sheet
rather than realize.
* src/bonobo-io.c (gnumeric_bonobo_obj_write) : constness.
2000-12-08 Jody Goldberg <jgoldberg@home.com>
From :Ade Lovett <ade@FreeBSD.org>
......
2000-12-09 Jody Goldberg <jgoldberg@home.com>
* src/sheet-object.c (sheet_object_construct) : delete.
(sheet_object_set_bounds) : Delete.
(sheet_object_set_sheet) : new function.
(sheet_object_clear_sheet) : new function.
(sheet_object_read_xml) : implement.
(sheet_object_write_xml) : implement.
(sheet_object_range_get) : support setting the range without a having
a sheet.
(sheet_relocate_objects) : Use set_sheet & clear_sheet.
(sheet_object_register) : new function.
* src/sheet-object-widget.c (sheet_widget_checkbox_set_sheet) : new
function. we need to move the dependent into the new sheet.
(sheet_widget_checkbox_clear_sheet) : ditto.
* src/sheet-object-graphic.c : (sheet_object_graphic_{read,write)_xml) :
new functions.
(sheet_object_filled_{read,write)_xml) : new functions.
* src/sheet-object-container.c (view_activated_cb) : no more
sheet_object_construct.
* src/sheet-object-cell-comment.c (cell_comment_{read,write)_xml) :
new functions.
* src/sheet-object-bonobo.c (sheet_object_bonobo_{read,write)_xml) :
New functions. These need work. the 'read_fn' and 'write_fn' do
not merge nicely yet.
* src/main.c (gnumeric_main) : Register the sheet obect types.
We need this until the plugin scheme is ready.
* src/item-grid.c (cb_obj_create_button_release) : Use set_sheet
rather than realize.
* src/bonobo-io.c (gnumeric_bonobo_obj_write) : constness.
2000-12-08 Jody Goldberg <jgoldberg@home.com>
From :Ade Lovett <ade@FreeBSD.org>
......
2000-12-09 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_sheet_obj_create) : changes to sheet object
constructor arguments.
2000-12-07 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_get_style_from_xf) : enable indent.
......
......@@ -2333,10 +2333,10 @@ ms_sheet_obj_create (MSContainer *container, MSObj *obj)
sheet = ((ExcelSheet *)container)->gnum_sheet;
switch (obj->excel_type) {
case 0x01 : so = sheet_object_line_new (sheet, FALSE); break; /* Line */
case 0x02 : so = sheet_object_box_new (sheet, FALSE); break; /* Box */
case 0x03 : so = sheet_object_box_new (sheet, TRUE); break; /* Oval */
case 0x05 : so = sheet_object_box_new (sheet, FALSE); break; /* Chart */
case 0x01 : so = sheet_object_line_new (FALSE); break; /* Line */
case 0x02 : so = sheet_object_box_new (FALSE); break; /* Box */
case 0x03 : so = sheet_object_box_new (TRUE); break; /* Oval */
case 0x05 : so = sheet_object_box_new (FALSE); break; /* Chart */
case 0x06 : so = sheet_widget_label_new (sheet); break; /* TextBox */
case 0x07 : so = sheet_widget_button_new (sheet); break; /* Button */
case 0x08 :
......
......@@ -76,7 +76,7 @@ write_stream_to_storage (xmlNodePtr cur,
static gboolean
gnumeric_bonobo_obj_write (xmlNodePtr cur,
SheetObject *object,
SheetObject const *object,
gpointer user_data)
{
CORBA_Environment ev;
......
......@@ -662,7 +662,7 @@ cb_obj_create_button_release (GnumericSheet *gsheet, GdkEventButton *event,
}
scg_object_calc_position (scg, so, pts);
sheet_object_realize (so);
sheet_object_set_sheet (so, scg->sheet);
gtk_signal_disconnect_by_func (
GTK_OBJECT (gsheet),
......
......@@ -174,6 +174,7 @@ gnumeric_main (void *closure, int argc, char *argv [])
functions_init ();
expr_name_init ();
print_init ();
sheet_object_register ();
/* The statically linked in file formats */
xml_init ();
......
......@@ -174,6 +174,7 @@ gnumeric_main (void *closure, int argc, char *argv [])
functions_init ();
expr_name_init ();
print_init ();
sheet_object_register ();
/* The statically linked in file formats */
xml_init ();
......
......@@ -26,7 +26,9 @@
#include "sheet.h"
#include "workbook-private.h"
#include "gnumeric-util.h"
#include "gnumeric-type-util.h"
#include "sheet-object-bonobo.h"
#include <bonobo/bonobo-item-container.h>
#include <bonobo/bonobo-view-frame.h>
#include <bonobo/bonobo-client-site.h>
......@@ -261,6 +263,32 @@ sheet_object_bonobo_populate_menu (SheetObject *sheet_object,
populate_menu (sheet_object, obj_view, menu);
}
static gboolean
sheet_object_bonobo_read_xml (SheetObject *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
if (ctxt->read_fn == NULL) {
g_warning ("Internal error, no read fn");
return TRUE;
}
so = ctxt->read_fn (tree, ctxt->sheet, ctxt->user_data);
return FALSE;
}
static gboolean
sheet_object_bonobo_write_xml (SheetObject const *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
if (ctxt->write_fn == NULL ||
!ctxt->write_fn (tree, so, ctxt->user_data)) {
g_warning ("Error serializing bonobo sheet object");
return TRUE;
}
return FALSE;
}
static void
sheet_object_bonobo_class_init (GtkObjectClass *object_class)
{
......@@ -273,30 +301,14 @@ sheet_object_bonobo_class_init (GtkObjectClass *object_class)
sheet_object_class->print = sheet_object_bonobo_print;
sheet_object_class->populate_menu = sheet_object_bonobo_populate_menu;
sheet_object_class->read_xml = sheet_object_bonobo_read_xml;
sheet_object_class->write_xml = sheet_object_bonobo_write_xml;
}
GtkType
sheet_object_bonobo_get_type (void)
{
static GtkType type = 0;
if (!type){
GtkTypeInfo info = {
"SheetObjectBonobo",
sizeof (SheetObjectBonobo),
sizeof (SheetObjectBonoboClass),
(GtkClassInitFunc) sheet_object_bonobo_class_init,
(GtkObjectInitFunc) NULL,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (sheet_object_get_type (), &info);
}
return type;
}
GNUMERIC_MAKE_TYPE (sheet_object_bonobo,
"SheetObjectBonobo", SheetObjectBonobo,
sheet_object_bonobo_class_init, NULL,
sheet_object_get_type ())
SheetObjectBonobo *
sheet_object_bonobo_construct (SheetObjectBonobo *sob, Sheet *sheet,
......@@ -305,8 +317,6 @@ sheet_object_bonobo_construct (SheetObjectBonobo *sob, Sheet *sheet,
g_return_val_if_fail (IS_SHEET (sheet), NULL);
g_return_val_if_fail (IS_SHEET_OBJECT_BONOBO (sob), NULL);
sheet_object_construct (SHEET_OBJECT (sob), sheet, -1, -1);
if (object_id == NULL) {
sob->object_id = NULL;
sob->object_server = NULL;
......
......@@ -170,6 +170,36 @@ cell_comment_new_view (SheetObject *so, SheetControlGUI *scg)
return GTK_OBJECT (item);
}
static gboolean
cell_comment_read_xml (SheetObject *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
CellComment *cc = CELL_COMMENT (so);
char *author = xmlGetProp (tree, "Author");
char *text = xmlGetProp (tree, "Text");
if (author != NULL) {
cell_comment_author_set (cc, author);
xmlFree (author);
}
if (text != NULL) {
cell_comment_text_set (cc, text);
xmlFree (text);
}
return FALSE;
}
static gboolean
cell_comment_write_xml (SheetObject const *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
CellComment const *cc = CELL_COMMENT (so);
xml_set_value_cstr (tree, "Author", cc->author);
xml_set_value_cstr (tree, "Text", cc->text);
return FALSE;
}
static void
cell_comment_print (SheetObject const *so, SheetObjectPrintInfo const *pi)
{
......@@ -188,6 +218,8 @@ cell_comment_class_init (GtkObjectClass *object_class)
/* SheetObject class method overrides */
sheet_object_class->update_bounds = &cell_comment_update_bounds;
sheet_object_class->new_view = &cell_comment_new_view;
sheet_object_class->read_xml = &cell_comment_read_xml;
sheet_object_class->write_xml = &cell_comment_write_xml;
sheet_object_class->print = &cell_comment_print;
}
......@@ -254,13 +286,12 @@ cell_set_comment (Sheet *sheet, CellPos const *pos,
g_return_val_if_fail (pos != NULL, NULL);
cc = gtk_type_new (CELL_COMMENT_TYPE);
sheet_object_construct (SHEET_OBJECT (cc), sheet, 1, 1);
cc->author = author ? g_strdup (author) : NULL;
cc->text = text ? g_strdup (text) : NULL;
r.start = r.end = *pos;
sheet_object_range_set (SHEET_OBJECT (cc), &r, offsets, start);
sheet_object_realize (SHEET_OBJECT (cc));
sheet_object_set_sheet (SHEET_OBJECT (cc), sheet);
return cc;
}
......
......@@ -172,8 +172,6 @@ sheet_object_container_new_bonobo (Sheet *sheet, BonoboClientSite *client_site)
c = gtk_type_new (sheet_object_container_get_type ());
sheet_object_construct (SHEET_OBJECT (c), sheet, -1, -1);
SHEET_OBJECT_BONOBO (c)->object_server =
bonobo_client_site_get_embeddable (client_site);
SHEET_OBJECT_BONOBO (c)->client_site = client_site;
......
......@@ -13,23 +13,20 @@
#include "gnumeric.h"
#include "sheet-control-gui.h"
#include "str.h"
#include "sheet.h"
#include "gnumeric-util.h"
#include "gnumeric-type-util.h"
#include "sheet-object-graphic.h"
#include "sheet-object-impl.h"
/* These are persisted */
typedef enum {
SHEET_OBJECT_LINE,
SHEET_OBJECT_ARROW,
SHEET_OBJECT_BOX,
SHEET_OBJECT_OVAL,
SHEET_OBJECT_LINE = 1,
SHEET_OBJECT_ARROW = 2,
SHEET_OBJECT_BOX = 101,
SHEET_OBJECT_OVAL = 102,
} SheetObjectGraphicType;
#define SHEET_OBJECT_GRAPHIC_TYPE (sheet_object_graphic_get_type ())
#define SHEET_OBJECT_GRAPHIC(obj) (GTK_CHECK_CAST((obj), SHEET_OBJECT_GRAPHIC_TYPE, SheetObjectGraphic))
#define SHEET_OBJECT_GRAPHIC_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SHEET_OBJECT_GRAPHIC_TYPE))
#define IS_SHEET_GRAPHIC_OBJECT(o) (GTK_CHECK_TYPE((o), SHEET_OBJECT_GRAPHIC_TYPE))
typedef struct {
SheetObject parent_object;
......@@ -41,7 +38,6 @@ typedef struct {
SheetObjectClass parent_class;
} SheetObjectGraphicClass;
static SheetObjectClass *sheet_object_graphic_parent_class;
static GtkType sheet_object_graphic_get_type (void);
static void
sheet_object_graphic_color_set (SheetObjectGraphic *sog, char const *color)
......@@ -70,14 +66,12 @@ sheet_object_graphic_width_set (SheetObjectGraphic *sog, int width)
}
SheetObject *
sheet_object_line_new (Sheet *sheet, gboolean is_arrow)
sheet_object_line_new (gboolean is_arrow)
{
SheetObjectGraphic *sog;
SheetObject *so;
so = gtk_type_new (sheet_object_graphic_get_type ());
sheet_object_construct (so, sheet, 40, 40);
sog = SHEET_OBJECT_GRAPHIC (so);
sog->type = is_arrow ? SHEET_OBJECT_ARROW : SHEET_OBJECT_LINE;
sog->color = string_get ("black");
......@@ -148,21 +142,36 @@ sheet_object_graphic_update_bounds (SheetObject *so, GtkObject *view,
}
static gboolean
sheet_object_graphic_read_xml (CommandContext *cc,
SheetObject *so, xmlNodePtr tree)
sheet_object_graphic_read_xml (SheetObject *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
SheetObjectGraphic *sog = SHEET_OBJECT_GRAPHIC (so);
char *color = xmlGetProp (tree, "Color");
int width;
int tmp;
if (xml_get_value_int (tree, "Type", &tmp))
sog->type = tmp;
if (xml_get_value_int (tree, "Width", &tmp))
sheet_object_graphic_width_set (sog, tmp);
if (color != NULL) {
sheet_object_graphic_color_set (sog, color);
xmlFree (color);
}
if (xml_get_value_int (tree, "Width", &width))
sheet_object_graphic_width_set (sog, width);
return TRUE;
return FALSE;
}
static gboolean
sheet_object_graphic_write_xml (SheetObject const *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
SheetObjectGraphic *sog = SHEET_OBJECT_GRAPHIC (so);
xml_set_value_int (tree, "Type", sog->type);
xml_set_value_int (tree, "Width", sog->width);
xml_set_value_string (tree, "Color", sog->color);
return FALSE;
}
static void
......@@ -219,9 +228,17 @@ sheet_object_graphic_class_init (GtkObjectClass *object_class)
sheet_object_class->print = sheet_object_graphic_print;
}
static void
sheet_object_graphic_init (GtkObject *obj)
{
SheetObjectGraphic *sog = SHEET_OBJECT_GRAPHIC (obj);
sog->type = SHEET_OBJECT_LINE;
}
GNUMERIC_MAKE_TYPE (sheet_object_graphic,
"SheetObjectGraphic", SheetObjectGraphic,
sheet_object_graphic_class_init, NULL,
sheet_object_graphic_class_init,
sheet_object_graphic_init,
sheet_object_get_type ())
/************************************************************************/
......@@ -231,10 +248,7 @@ GNUMERIC_MAKE_TYPE (sheet_object_graphic,
*
* Derivative of SheetObjectGraphic, with filled parameter
*/
#define SHEET_OBJECT_FILLED_TYPE (sheet_object_filled_get_type ())
#define SHEET_OBJECT_FILLED(obj) (GTK_CHECK_CAST((obj), SHEET_OBJECT_FILLED_TYPE, SheetObjectFilled))
#define SHEET_OBJECT_FILLED_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), SHEET_OBJECT_FILLED_TYPE, SheetObjectFilledClass))
#define IS_SHEET_FILLED_OBJECT(o) (GTK_CHECK_TYPE((o), SHEET_OBJECT_FILLED_TYPE))
typedef struct {
SheetObjectGraphic parent_object;
......@@ -248,7 +262,6 @@ typedef struct {
} SheetObjectFilledClass;
static SheetObjectGraphicClass *sheet_object_filled_parent_class;
static GtkType sheet_object_filled_get_type (void);
static void
sheet_object_filled_color_set (SheetObjectFilled *sof, char const *fill_color)
......@@ -277,18 +290,13 @@ sheet_object_filled_pattern_set (SheetObjectFilled *sof, int pattern)
}
SheetObject *
sheet_object_box_new (Sheet *sheet, gboolean is_oval)
sheet_object_box_new (gboolean is_oval)
{
SheetObject *so;
SheetObjectFilled *sof;
SheetObjectGraphic *sog;
SheetObject *so;
g_return_val_if_fail (sheet != NULL, NULL);
g_return_val_if_fail (IS_SHEET (sheet), NULL);
so = gtk_type_new (sheet_object_filled_get_type ());
sheet_object_construct (so, sheet, 40, 40);
sog = SHEET_OBJECT_GRAPHIC (so);
sog->type = is_oval ? SHEET_OBJECT_OVAL : SHEET_OBJECT_BOX;
sog->width = 1;
......@@ -355,8 +363,8 @@ sheet_object_filled_new_view (SheetObject *so, SheetControlGUI *scg)
}
static gboolean
sheet_object_filled_read_xml (CommandContext *cc,
SheetObject *so, xmlNodePtr tree)
sheet_object_filled_read_xml (SheetObject *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
SheetObjectFilled *sof = SHEET_OBJECT_FILLED (so);
char *fill_color = xmlGetProp (tree, "FillColor");
......@@ -370,7 +378,19 @@ sheet_object_filled_read_xml (CommandContext *cc,
if (xml_get_value_int (tree, "Pattern", &pattern))
sheet_object_filled_pattern_set (sof, pattern);
return sheet_object_graphic_read_xml (cc, so, tree);
return sheet_object_graphic_read_xml (so, ctxt, tree);
}
static gboolean
sheet_object_filled_write_xml (SheetObject const *so,
XmlParseContext const *ctxt, xmlNodePtr tree)
{
SheetObjectFilled *sof = SHEET_OBJECT_FILLED (so);
if (sof->fill_color != NULL)
xml_set_value_string (tree, "FillColor", sof->fill_color);
xml_set_value_int (tree, "Pattern", sof->pattern);
return sheet_object_graphic_write_xml (so, ctxt, tree);
}
static void
......@@ -383,50 +403,18 @@ sheet_object_filled_class_init (GtkObjectClass *object_class)
sheet_object_class->new_view = sheet_object_filled_new_view;
sheet_object_class->update_bounds = sheet_object_filled_update_bounds;
sheet_object_class->read_xml = sheet_object_filled_read_xml;
sheet_object_class->write_xml = sheet_object_filled_write_xml;
}
#if 0
switch (sog->type) {
case SHEET_OBJECT_BOX: {
SheetObjectFilled *sof = SHEET_OBJECT_FILLED (object);
cur = xmlNewDocNode (ctxt->doc, ctxt->ns, "Rectangle", NULL);
if (sof->fill_color != NULL)
xml_set_value_string (cur, "FillColor", sof->fill_color);
xml_set_value_int (cur, "Pattern", sof->pattern);
break;
}
case SHEET_OBJECT_OVAL: {
SheetObjectFilled *sof = SHEET_OBJECT_FILLED (object);
cur = xmlNewDocNode (ctxt->doc, ctxt->ns, "Ellipse", NULL);
if (sof->fill_color != NULL)
xml_set_value_string (cur, "FillColor", sof->fill_color);
xml_set_value_int (cur, "Pattern", sof->pattern);
break;
}
case SHEET_OBJECT_ARROW:
cur = xmlNewDocNode (ctxt->doc, ctxt->ns, "Arrow", NULL);
break;
case SHEET_OBJECT_LINE:
cur = xmlNewDocNode (ctxt->doc, ctxt->ns, "Line", NULL);
break;
default :
cur = NULL;
}
if (!cur)
return NULL;
xml_set_gnome_canvas_points (cur, "Points", object->bbox_points);
xml_set_value_int (cur, "Width", sog->width);
xml_set_value_string (cur, "Color", sog->color);
#endif
static void
sheet_object_filled_init (GtkObject *obj)
{
SheetObjectGraphic *sog = SHEET_OBJECT_GRAPHIC (obj);
sog->type = SHEET_OBJECT_BOX;
}
GNUMERIC_MAKE_TYPE (sheet_object_filled,
"SheetObjectFilled", SheetObjectFilled,
sheet_object_filled_class_init, NULL,
sheet_object_filled_class_init,
sheet_object_filled_init,
sheet_object_graphic_get_type ())
......@@ -3,7 +3,17 @@
#include "sheet-object.h"
SheetObject *sheet_object_line_new (Sheet *sheet, gboolean with_arrow);
SheetObject *sheet_object_box_new (Sheet *sheet, gboolean is_oval);
SheetObject *sheet_object_line_new (gboolean with_arrow);
SheetObject *sheet_object_box_new (gboolean is_oval);
GtkType sheet_object_graphic_get_type (void);
#define SHEET_OBJECT_GRAPHIC_TYPE (sheet_object_graphic_ge