[gnumeric] Export all sheet objects to ODF files.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Export all sheet objects to ODF files.
- Date: Sun, 12 Sep 2010 09:12:02 +0000 (UTC)
commit 6033f34b6f73a730826f9719f3f9c21839afcad5
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sun Sep 12 03:11:17 2010 -0600
Export all sheet objects to ODF files.
2010-09-10 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (opendoc_content_dtd): add more elements
* openoffice-write.c (odf_write_frame_size): new (and use it where
appropriate)
(odf_write_image): new
(odf_write_graph): new
(odf_write_frame): restrict to frames
(odf_write_control): new
(odf_write_so_filled): new
(odf_write_line): new
(odf_write_objects): call the above
(odf_write_sheet_control_frame): new
(odf_write_sheet_controls): write frames
2010-09-12 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-object-widget.c (sheet_widget_frame_*et_property): new
ChangeLog | 4 +
NEWS | 1 +
plugins/openoffice/ChangeLog | 15 ++
plugins/openoffice/openoffice-read.c | 7 +
plugins/openoffice/openoffice-write.c | 283 ++++++++++++++++++++++++---------
src/sheet-object-widget.c | 58 ++++++-
6 files changed, 288 insertions(+), 80 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e0bb7ce..e4fcf2f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2010-09-12 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * src/sheet-object-widget.c (sheet_widget_frame_*et_property): new
+
2010-09-09 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/sheet-object-widget.c: add "value" property to radio_button
diff --git a/NEWS b/NEWS
index b8c9ea5..1f8bb7c 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Andreas:
* Read tab colors from OOo config in ODF files.
* Improve some ODF chart import/export.
* Import/export various form controls from and to ODF files.
+ * Export all sheet objects to ODF files.
--------------------------------------------------------------------------
Gnumeric 1.10.10
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 28110c7..21ffc20 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,20 @@
2010-09-10 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-read.c (opendoc_content_dtd): add more elements
+ * openoffice-write.c (odf_write_frame_size): new (and use it where
+ appropriate)
+ (odf_write_image): new
+ (odf_write_graph): new
+ (odf_write_frame): restrict to frames
+ (odf_write_control): new
+ (odf_write_so_filled): new
+ (odf_write_line): new
+ (odf_write_objects): call the above
+ (odf_write_sheet_control_frame): new
+ (odf_write_sheet_controls): write frames
+
+2010-09-10 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (od_draw_control_start): handle button
(odf_form_control): save OOControl for subelements
(odf_form_button): new
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 8d2e176..daf0499 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -6938,6 +6938,8 @@ static GsfXMLInNode const opendoc_content_dtd [] =
GSF_XML_IN_NODE (FORM_LISTBOX, FORM_PROPERTIES, OO_NS_FORM, "properties", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
GSF_XML_IN_NODE (FORM, FORM_COMBOBOX, OO_NS_FORM, "combobox", GSF_XML_NO_CONTENT, &odf_form_combobox, NULL),
GSF_XML_IN_NODE (FORM_COMBOBOX, FORM_PROPERTIES, OO_NS_FORM, "properties", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
+ GSF_XML_IN_NODE (FORM, FORM_GENERIC, OO_NS_FORM, "generic-control", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (FORM_GENERIC, FORM_PROPERTIES, OO_NS_FORM, "properties", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
GSF_XML_IN_NODE (TABLE, TABLE_ROWS, OO_NS_TABLE, "table-rows", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (TABLE, TABLE_COL, OO_NS_TABLE, "table-column", GSF_XML_NO_CONTENT, &oo_col_start, NULL),
GSF_XML_IN_NODE (TABLE, TABLE_ROW, OO_NS_TABLE, "table-row", GSF_XML_NO_CONTENT, &oo_row_start, &oo_row_end),
@@ -6962,6 +6964,11 @@ static GsfXMLInNode const opendoc_content_dtd [] =
GSF_XML_IN_NODE (CELL_GRAPHIC, CELL_GRAPHIC, OO_NS_DRAW, "g", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (CELL_GRAPHIC, DRAW_POLYLINE, OO_NS_DRAW, "polyline", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (TABLE_CELL, DRAW_CONTROL, OO_NS_DRAW, "control", GSF_XML_NO_CONTENT, &od_draw_control_start, NULL),
+ GSF_XML_IN_NODE (TABLE_CELL, DRAW_RECT, OO_NS_DRAW, "rect", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (DRAW_RECT, SHEET_OBJECT_TEXT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (TABLE_CELL, DRAW_LINE, OO_NS_DRAW, "line", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (TABLE_CELL, DRAW_ELLIPSE, OO_NS_DRAW, "ellipse", GSF_XML_NO_CONTENT, NULL, NULL),
+ GSF_XML_IN_NODE (DRAW_ELLIPSE, SHEET_OBJECT_TEXT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd def */
GSF_XML_IN_NODE (TABLE_CELL, DRAW_FRAME, OO_NS_DRAW, "frame", GSF_XML_NO_CONTENT, &od_draw_frame_start, &od_draw_frame_end),
GSF_XML_IN_NODE (DRAW_FRAME, DRAW_OBJECT, OO_NS_DRAW, "object", GSF_XML_NO_CONTENT, &od_draw_object, NULL),
GSF_XML_IN_NODE (DRAW_OBJECT, DRAW_OBJECT_TEXT, OO_NS_TEXT, "p", GSF_XML_CONTENT, NULL, NULL),
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 94b0fb8..1a0c58d 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -64,6 +64,7 @@
#include <sheet-object-image.h>
#include <sheet-object-widget.h>
#include <gnm-so-filled.h>
+#include <gnm-so-line.h>
#include <sheet-filter-combo.h>
#include <gsf/gsf-libxml.h>
@@ -2391,20 +2392,18 @@ odf_graph_get_series (GnmOOExport *state, GogGraph *sog, GnmParsePos *pp)
}
static void
-odf_write_frame (GnmOOExport *state, SheetObject *so)
+odf_write_frame_size (GnmOOExport *state, SheetObject *so)
{
SheetObjectAnchor const *anchor = sheet_object_get_anchor (so);
double res_pts[4] = {0.,0.,0.,0.};
- GnmCellRef ref;
GnmRange const *r = &anchor->cell_bound;
+ GnmCellRef ref;
GnmExprTop const *texpr;
GnmParsePos pp;
char *formula;
- char const *id = g_hash_table_lookup (state->controls, so);
-
+
sheet_object_anchor_to_offset_pts (anchor, state->sheet, res_pts);
- gsf_xml_out_start_element (state->xml, id ? DRAW "control" : DRAW "frame");
odf_add_pt (state->xml, SVG "x", res_pts[0]);
odf_add_pt (state->xml, SVG "y", res_pts[1]);
odf_add_pt (state->xml, TABLE "end-x", res_pts[2]);
@@ -2421,79 +2420,89 @@ odf_write_frame (GnmOOExport *state, SheetObject *so)
parse_pos_init_sheet (&pp, state->sheet);
formula = gnm_expr_top_as_string (texpr, &pp, state->conv);
gnm_expr_top_unref (texpr);
- gsf_xml_out_add_cstr (state->xml, TABLE "end-cell-address", odf_strip_brackets (formula));
+ gsf_xml_out_add_cstr (state->xml, TABLE "end-cell-address",
+ odf_strip_brackets (formula));
g_free (formula);
+}
- if (id != NULL) {
- gsf_xml_out_add_cstr (state->xml, DRAW "control", id);
- } else if (IS_SHEET_OBJECT_GRAPH (so)) {
- char const *name = g_hash_table_lookup (state->graphs, so);
- if (name != NULL) {
- char *full_name = g_strdup_printf ("%s/", name);
- gsf_xml_out_start_element (state->xml, DRAW "object");
- gsf_xml_out_add_cstr (state->xml, XLINK "href", full_name);
- g_free (full_name);
- gsf_xml_out_add_cstr (state->xml, XLINK "type", "simple");
- gsf_xml_out_add_cstr (state->xml, XLINK "show", "embed");
- gsf_xml_out_add_cstr (state->xml, XLINK "actuate", "onLoad");
- full_name = odf_graph_get_series (state, sheet_object_graph_get_gog (so), &pp);
- gsf_xml_out_add_cstr (state->xml, DRAW "notify-on-update-of-ranges",
- full_name);
- g_free (full_name);
- gsf_xml_out_end_element (state->xml); /* DRAW "object" */
- full_name = g_strdup_printf ("Pictures/%s", name);
- gsf_xml_out_start_element (state->xml, DRAW "image");
- gsf_xml_out_add_cstr (state->xml, XLINK "href", full_name);
- g_free (full_name);
- gsf_xml_out_add_cstr (state->xml, XLINK "type", "simple");
- gsf_xml_out_add_cstr (state->xml, XLINK "show", "embed");
- gsf_xml_out_add_cstr (state->xml, XLINK "actuate", "onLoad");
- gsf_xml_out_end_element (state->xml); /* DRAW "image" */
- full_name = g_strdup_printf ("Pictures/%s.png", name);
- gsf_xml_out_start_element (state->xml, DRAW "image");
- gsf_xml_out_add_cstr (state->xml, XLINK "href", full_name);
- g_free (full_name);
- gsf_xml_out_add_cstr (state->xml, XLINK "type", "simple");
- gsf_xml_out_add_cstr (state->xml, XLINK "show", "embed");
- gsf_xml_out_add_cstr (state->xml, XLINK "actuate", "onLoad");
- gsf_xml_out_end_element (state->xml); /* DRAW "image" */
- } else
- g_warning ("Graph is missing from hash.");
- } else if (IS_GNM_SO_FILLED (so)) {
- gchar *text = NULL;
-
- g_object_get (G_OBJECT (so), "text", &text, NULL);
+static void
+odf_write_graph (GnmOOExport *state, SheetObject *so, char const *name)
+{
+ GnmParsePos pp;
+ parse_pos_init_sheet (&pp, state->sheet);
- gsf_xml_out_start_element (state->xml, DRAW "text-box");
- gsf_xml_out_simple_element (state->xml, TEXT "p", text);
- gsf_xml_out_end_element (state->xml); /* DRAW "text-box" */
+ if (name != NULL) {
+ char *full_name = g_strdup_printf ("%s/", name);
+ gsf_xml_out_start_element (state->xml, DRAW "object");
+ gsf_xml_out_add_cstr (state->xml, XLINK "href", full_name);
+ g_free (full_name);
+ gsf_xml_out_add_cstr (state->xml, XLINK "type", "simple");
+ gsf_xml_out_add_cstr (state->xml, XLINK "show", "embed");
+ gsf_xml_out_add_cstr (state->xml, XLINK "actuate", "onLoad");
+ full_name = odf_graph_get_series (state, sheet_object_graph_get_gog (so), &pp);
+ gsf_xml_out_add_cstr (state->xml, DRAW "notify-on-update-of-ranges",
+ full_name);
+ g_free (full_name);
+ gsf_xml_out_end_element (state->xml); /* DRAW "object" */
+ full_name = g_strdup_printf ("Pictures/%s", name);
+ gsf_xml_out_start_element (state->xml, DRAW "image");
+ gsf_xml_out_add_cstr (state->xml, XLINK "href", full_name);
+ g_free (full_name);
+ gsf_xml_out_add_cstr (state->xml, XLINK "type", "simple");
+ gsf_xml_out_add_cstr (state->xml, XLINK "show", "embed");
+ gsf_xml_out_add_cstr (state->xml, XLINK "actuate", "onLoad");
+ gsf_xml_out_end_element (state->xml); /* DRAW "image" */
+ full_name = g_strdup_printf ("Pictures/%s.png", name);
+ gsf_xml_out_start_element (state->xml, DRAW "image");
+ gsf_xml_out_add_cstr (state->xml, XLINK "href", full_name);
+ g_free (full_name);
+ gsf_xml_out_add_cstr (state->xml, XLINK "type", "simple");
+ gsf_xml_out_add_cstr (state->xml, XLINK "show", "embed");
+ gsf_xml_out_add_cstr (state->xml, XLINK "actuate", "onLoad");
+ gsf_xml_out_end_element (state->xml); /* DRAW "image" */
+ } else
+ g_warning ("Graph is missing from hash.");
+}
- g_free (text);
- } else if (IS_SHEET_OBJECT_IMAGE (so)) {
- char const *name = g_hash_table_lookup (state->images, so);
- if (name != NULL) {
- char *image_type;
- char *fullname;
- g_object_get (G_OBJECT (so),
- "image-type", &image_type,
- NULL);
- fullname = g_strdup_printf ("Pictures/%s.%s", name, image_type);
-
- gsf_xml_out_start_element (state->xml, DRAW "image");
- gsf_xml_out_add_cstr (state->xml, XLINK "href", fullname);
- gsf_xml_out_add_cstr (state->xml, XLINK "type", "simple");
- gsf_xml_out_add_cstr (state->xml, XLINK "show", "embed");
- gsf_xml_out_add_cstr (state->xml, XLINK "actuate", "onLoad");
- gsf_xml_out_end_element (state->xml); /* DRAW "image" */
+static void
+odf_write_image (GnmOOExport *state, SheetObject *so, char const *name)
+{
+ if (name != NULL) {
+ char *image_type;
+ char *fullname;
+ g_object_get (G_OBJECT (so),
+ "image-type", &image_type,
+ NULL);
+ fullname = g_strdup_printf ("Pictures/%s.%s", name, image_type);
+
+ gsf_xml_out_start_element (state->xml, DRAW "image");
+ gsf_xml_out_add_cstr (state->xml, XLINK "href", fullname);
+ gsf_xml_out_add_cstr (state->xml, XLINK "type", "simple");
+ gsf_xml_out_add_cstr (state->xml, XLINK "show", "embed");
+ gsf_xml_out_add_cstr (state->xml, XLINK "actuate", "onLoad");
+ gsf_xml_out_end_element (state->xml); /* DRAW "image" */
- g_free(fullname);
- g_free (image_type);
- } else
- g_warning ("Image is missing from hash.");
-
- } else {
+ g_free(fullname);
+ g_free (image_type);
+ } else
+ g_warning ("Image is missing from hash.");
+}
+
+static void
+odf_write_frame (GnmOOExport *state, SheetObject *so)
+{
+ gsf_xml_out_start_element (state->xml, DRAW "frame");
+
+ odf_write_frame_size (state, so);
+
+ if (IS_SHEET_OBJECT_GRAPH (so))
+ odf_write_graph (state, so, g_hash_table_lookup (state->graphs, so));
+ else if (IS_SHEET_OBJECT_IMAGE (so))
+ odf_write_image (state, so, g_hash_table_lookup (state->images, so));
+ else {
gsf_xml_out_start_element (state->xml, DRAW "text-box");
- gsf_xml_out_simple_element (state->xml, TEXT "p", "Missing Sheet Object");
+ gsf_xml_out_simple_element (state->xml, TEXT "p",
+ "Missing Framed Sheet Object");
gsf_xml_out_end_element (state->xml); /* DRAW "text-box" */
}
@@ -2501,20 +2510,120 @@ odf_write_frame (GnmOOExport *state, SheetObject *so)
}
static void
+odf_write_control (GnmOOExport *state, SheetObject *so, char const *id)
+{
+ gsf_xml_out_start_element (state->xml, DRAW "control");
+ odf_write_frame_size (state, so);
+ gsf_xml_out_add_cstr (state->xml, DRAW "control", id);
+ gsf_xml_out_end_element (state->xml); /* DRAW "control" */
+}
+
+static void
+odf_write_so_filled (GnmOOExport *state, SheetObject *so)
+{
+ char const *element;
+ gboolean is_oval = FALSE;
+ gchar *text = NULL;
+
+ g_object_get (G_OBJECT (so), "is-oval", &is_oval, "text", &text, NULL);
+ element = is_oval ? DRAW "ellipse" : DRAW "rect";
+
+ gsf_xml_out_start_element (state->xml, element);
+ odf_write_frame_size (state, so);
+ gsf_xml_out_simple_element (state->xml, TEXT "p", text);
+ g_free (text);
+ gsf_xml_out_end_element (state->xml); /* DRAW "rect" or "ellipse" */
+}
+
+static void
+odf_write_line (GnmOOExport *state, SheetObject *so)
+{
+ SheetObjectAnchor const *anchor = sheet_object_get_anchor (so);
+ double res_pts[4] = {0.,0.,0.,0.};
+ GnmRange const *r = &anchor->cell_bound;
+ GnmCellRef ref;
+ GnmExprTop const *texpr;
+ GnmParsePos pp;
+ char *formula;
+ double x1, y1, x2, y2;
+
+ gsf_xml_out_start_element (state->xml, DRAW "line");
+
+ sheet_object_anchor_to_offset_pts (anchor, state->sheet, res_pts);
+ odf_add_pt (state->xml, TABLE "end-x", res_pts[2]);
+ odf_add_pt (state->xml, TABLE "end-y", res_pts[3]);
+ sheet_object_anchor_to_pts (anchor, state->sheet, res_pts);
+
+ switch (anchor->base.direction) {
+ case GOD_ANCHOR_DIR_UNKNOWN:
+ case GOD_ANCHOR_DIR_UP_RIGHT:
+ x1 = res_pts[0];
+ x2 = res_pts[2];
+ y1 = res_pts[3];
+ y2 = res_pts[1];
+ break;
+ case GOD_ANCHOR_DIR_DOWN_RIGHT:
+ x1 = res_pts[0];
+ x2 = res_pts[2];
+ y1 = res_pts[1];
+ y2 = res_pts[3];
+ break;
+ case GOD_ANCHOR_DIR_UP_LEFT:
+ x1 = res_pts[2];
+ x2 = res_pts[1];
+ y1 = res_pts[3];
+ y2 = res_pts[1];
+ break;
+ case GOD_ANCHOR_DIR_DOWN_LEFT:
+ x1 = res_pts[2];
+ x2 = res_pts[1];
+ y1 = res_pts[1];
+ y2 = res_pts[3];
+ break;
+ }
+
+ odf_add_pt (state->xml, SVG "x1", x1);
+ odf_add_pt (state->xml, SVG "y1", y1);
+ odf_add_pt (state->xml, SVG "x2", x2);
+ odf_add_pt (state->xml, SVG "y2", y2);
+
+ gnm_cellref_init (&ref, (Sheet *) state->sheet, r->end.col, r->end.row, TRUE);
+ texpr = gnm_expr_top_new (gnm_expr_new_cellref (&ref));
+ parse_pos_init_sheet (&pp, state->sheet);
+ formula = gnm_expr_top_as_string (texpr, &pp, state->conv);
+ gnm_expr_top_unref (texpr);
+ gsf_xml_out_add_cstr (state->xml, TABLE "end-cell-address",
+ odf_strip_brackets (formula));
+ g_free (formula);
+
+ gsf_xml_out_end_element (state->xml); /* DRAW "line" */
+}
+
+static void
odf_write_objects (GnmOOExport *state, GSList *objects)
{
GSList *l;
for (l = objects; l != NULL; l = l->next) {
SheetObject *so = l->data;
+ char const *id = g_hash_table_lookup (state->controls, so);
if (so == NULL) {
g_warning ("NULL sheet object encountered.");
continue;
}
- if (IS_CELL_COMMENT (so))
+ if (IS_GNM_FILTER_COMBO (so))
+ continue;
+ if (id != NULL)
+ odf_write_control (state, so, id);
+ else if (IS_CELL_COMMENT (so))
odf_write_comment (state, CELL_COMMENT (so));
- else if (!IS_GNM_FILTER_COMBO (so))
+ else if (IS_GNM_SO_FILLED (so))
+ odf_write_so_filled (state, so);
+ else if (IS_GNM_SO_LINE (so))
+ odf_write_line (state, so);
+ else
odf_write_frame (state, so);
+
}
}
@@ -3194,6 +3303,32 @@ odf_write_sheet_control_checkbox (GnmOOExport *state, SheetObject *so)
}
static void
+odf_write_sheet_control_frame (GnmOOExport *state, SheetObject *so)
+{
+ char *label = NULL;
+
+ g_object_get (G_OBJECT (so), "text", &label, NULL);
+
+ odf_sheet_control_start_element (state, so, FORM "generic-control");
+ gsf_xml_out_add_cstr_unchecked (state->xml,
+ FORM "control-implementation",
+ GNMSTYLE "frame");
+
+ gsf_xml_out_start_element (state->xml, FORM "properties");
+ gsf_xml_out_start_element (state->xml, FORM "property");
+
+ gsf_xml_out_add_cstr_unchecked (state->xml, FORM "property-name", GNMSTYLE "label");
+ gsf_xml_out_add_cstr_unchecked (state->xml, OFFICE "value-type", "string");
+ gsf_xml_out_add_cstr (state->xml, OFFICE "string-value", label);
+ gsf_xml_out_end_element (state->xml); /* form:property */
+ gsf_xml_out_end_element (state->xml); /* form:properties */
+
+ gsf_xml_out_end_element (state->xml); /* form:generic-control */
+
+ g_free (label);
+}
+
+static void
odf_write_sheet_control_list (GnmOOExport *state, SheetObject *so,
char const *element)
{
@@ -3363,6 +3498,8 @@ odf_write_sheet_controls (GnmOOExport *state)
FORM "combobox");
else if (GNM_IS_SOW_BUTTON (so))
odf_write_sheet_control_button (state, so);
+ else if (GNM_IS_SOW_FRAME (so))
+ odf_write_sheet_control_frame (state, so);
}
gsf_xml_out_end_element (state->xml); /* form:form */
diff --git a/src/sheet-object-widget.c b/src/sheet-object-widget.c
index 48f9d8b..cb8a674 100644
--- a/src/sheet-object-widget.c
+++ b/src/sheet-object-widget.c
@@ -323,6 +323,45 @@ typedef struct {
} SheetWidgetFrame;
typedef SheetObjectWidgetClass SheetWidgetFrameClass;
+enum {
+ SOF_PROP_0 = 0,
+ SOF_PROP_TEXT
+};
+
+static void
+sheet_widget_frame_get_property (GObject *obj, guint param_id,
+ GValue *value, GParamSpec *pspec)
+{
+ SheetWidgetFrame *swf = SHEET_WIDGET_FRAME (obj);
+
+ switch (param_id) {
+ case SOF_PROP_TEXT:
+ g_value_set_string (value, swf->label);
+ break;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+ break;
+ }
+}
+
+static void
+sheet_widget_frame_set_property (GObject *obj, guint param_id,
+ GValue const *value, GParamSpec *pspec)
+{
+ SheetWidgetFrame *swf = SHEET_WIDGET_FRAME (obj);
+
+ switch (param_id) {
+ case SOF_PROP_TEXT:
+ sheet_widget_frame_set_label (SHEET_OBJECT (swf),
+ g_value_get_string (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec);
+ return;
+ }
+}
+
+
static void
sheet_widget_frame_init_full (SheetWidgetFrame *swf, char const *text)
{
@@ -518,16 +557,21 @@ sheet_widget_frame_user_config (SheetObject *so, SheetControl *sc)
}
SOW_MAKE_TYPE (frame, Frame,
- &sheet_widget_frame_user_config,
- NULL,
+ sheet_widget_frame_user_config,
NULL,
NULL,
- &sheet_widget_frame_copy,
- &sheet_widget_frame_write_xml_sax,
- &sheet_widget_frame_prep_sax_parser,
NULL,
- NULL,
- {})
+ sheet_widget_frame_copy,
+ sheet_widget_frame_write_xml_sax,
+ sheet_widget_frame_prep_sax_parser,
+ sheet_widget_frame_get_property,
+ sheet_widget_frame_set_property,
+ {
+ g_object_class_install_property
+ (object_class, SOF_PROP_TEXT,
+ g_param_spec_string ("text", NULL, NULL, NULL,
+ GSF_PARAM_STATIC | G_PARAM_READWRITE));
+ })
/****************************************************************************/
#define SHEET_WIDGET_BUTTON_TYPE (sheet_widget_button_get_type ())
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]