static void gnm_soi_prep_sax_parser (SheetObject *so, GsfXMLIn *xin, xmlChar const **attrs, G_GNUC_UNUSED GnmConventions const *convs) { static GsfXMLInNode const dtd[] = { GSF_XML_IN_NODE (CONTENT, CONTENT, -1, "Content", GSF_XML_CONTENT, &content_start, &content_end), GSF_XML_IN_NODE_END }; static GsfXMLInDoc *doc = NULL; SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so); if (NULL == doc) doc = gsf_xml_in_doc_new (dtd, NULL); gsf_xml_in_push_state (xin, doc, NULL, NULL, attrs); for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) { if (gnm_xml_attr_double (attrs, "crop-top", &soi->crop_top)) ; else if (gnm_xml_attr_double (attrs, "crop-bottom", &soi->crop_bottom)) /* Nothing */ ; else if (gnm_xml_attr_double (attrs, "crop-left", &soi->crop_left)) /* Nothing */ ; else if (gnm_xml_attr_double (attrs, "crop-right", &soi->crop_right)) /* Nothing */ ; } }
/** * gog_object_sax_push_parser: * @xin: #GsfXMLIn * @attrs: XML attributes * @handler: (scope call): callback * @user_unserialize: user data for #GOData reading * @user_data: user data for @handler * * Unserializes a #GogObject using @handler when done. **/ void gog_object_sax_push_parser (GsfXMLIn *xin, xmlChar const **attrs, GogObjectSaxHandler handler, gpointer user_unserialize, gpointer user_data) { GogXMLReadState *state; if (NULL == gog_sax_doc) { gog_sax_doc = gsf_xml_in_doc_new (gog_dtd, NULL); go_xml_in_doc_dispose_on_exit (&gog_sax_doc); } state = g_new0 (GogXMLReadState, 1); state->handler = handler; state->user_data = user_data; state->user_unserialize = user_unserialize; gsf_xml_in_push_state (xin, gog_sax_doc, state, (GsfXMLInExtDtor) go_sax_parser_done, attrs); }
static void gnm_so_path_prep_sax_parser (SheetObject *so, GsfXMLIn *xin, xmlChar const **attrs, G_GNUC_UNUSED GnmConventions const *convs) { static GsfXMLInNode const dtd[] = { GSF_XML_IN_NODE (SOPATH, SOPATH, -1, "SheetObjectPath", GSF_XML_NO_CONTENT, NULL, NULL), GSF_XML_IN_NODE (SOPATH, PATH, -1, "Path", GSF_XML_NO_CONTENT, &sop_sax_path, NULL), GSF_XML_IN_NODE (SOPATH, STYLE, -1, "Style", GSF_XML_NO_CONTENT, &sop_sax_style, NULL), GSF_XML_IN_NODE_END }; static GsfXMLInDoc *doc = NULL; GnmSOPath *sop = GNM_SO_PATH(so); if (NULL == doc) { doc = gsf_xml_in_doc_new (dtd, NULL); gnm_xml_in_doc_dispose_on_exit (&doc); } gsf_xml_in_push_state (xin, doc, NULL, NULL, attrs); for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2) if (attr_eq (attrs[0], "Label")) g_object_set (G_OBJECT (sop), "text", attrs[1], NULL); else if (attr_eq (attrs[0], "LabelFormat")) { GOFormat * fmt = go_format_new_from_XL (attrs[1]); if (go_format_is_markup (fmt)) g_object_set (G_OBJECT (sop), "markup", go_format_get_markup (fmt), NULL); go_format_unref (fmt); } else if (attr_eq (attrs[0], "Path")) { GOPath *path = go_path_new_from_svg (attrs[1]); if (path) { g_object_set (G_OBJECT (sop), "path", path, NULL); go_path_free (path); } } }