Beispiel #1
0
static void
sop_sax_style (GsfXMLIn *xin, xmlChar const **attrs)
{
	SheetObject *so = gnm_xml_in_cur_obj (xin);
	GnmSOPath *sop = GNM_SO_PATH (so);
	go_persist_prep_sax (GO_PERSIST (sop->style), xin, attrs);
}
static void
content_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
{
	SheetObject *so = gnm_xml_in_cur_obj (xin);
	SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);

	soi->bytes.len  = gsf_base64_decode_simple (
		xin->content->str, xin->content->len);
	soi->bytes.data = g_memdup (xin->content->str, soi->bytes.len);
}
static void
content_start (GsfXMLIn *xin, xmlChar const **attrs)
{
	SheetObject *so = gnm_xml_in_cur_obj (xin);
	SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);
	char const *image_type = NULL;

	for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
		if (attr_eq (attrs[0], "image-type"))
			image_type = CXML2C (attrs[1]);

	soi->type = g_strdup (image_type);
}
Beispiel #4
0
static void
content_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
{
	SheetObject *so = gnm_xml_in_cur_obj (xin);
	SheetObjectImage *soi = GNM_SO_IMAGE (so);
	GString *data = xin->content;

	if (data->len >= 4) {
		size_t len = gsf_base64_decode_simple (data->str, data->len);
		if (soi->image)
			g_object_unref (soi->image);
		soi->image = go_image_new_from_data (soi->type, data->str, len,
						     NULL, NULL);
	}
}
Beispiel #5
0
static void
content_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *unknown)
{
	SheetObject *so = gnm_xml_in_cur_obj (xin);
	SheetObjectImage *soi = SHEET_OBJECT_IMAGE (so);
	GString *data = xin->content;

	if (data->len >= 4) {
		size_t len = gsf_base64_decode_simple (data->str, data->len);
		soi->bytes.len = len;
		soi->bytes.data = g_memdup (data->str, len);
		soi->image = go_image_new_from_data (soi->type,
						     soi->bytes.data,
						     len, NULL, NULL);
	}
}
Beispiel #6
0
static void
content_start (GsfXMLIn *xin, xmlChar const **attrs)
{
	SheetObject *so = gnm_xml_in_cur_obj (xin);
	SheetObjectImage *soi = GNM_SO_IMAGE (so);
	char const *image_type = NULL, *image_name = NULL;

	for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
		if (attr_eq (attrs[0], "image-type"))
			image_type = CXML2C (attrs[1]);
	else if (attr_eq (attrs[0], "name"))
			image_name = CXML2C (attrs[1]);

	g_free (soi->type);
	soi->type = g_strdup (image_type);
	if (image_name)
		soi->name = g_strdup (image_name);
}
Beispiel #7
0
static void
sop_sax_path (GsfXMLIn *xin, xmlChar const **attrs)
{
	SheetObject *so = gnm_xml_in_cur_obj (xin);
	GnmSOPath *sop = GNM_SO_PATH (so);
	GOPath *path;
	g_return_if_fail (sop->path == NULL);
	if (sop->paths == NULL)
		sop->paths = g_ptr_array_new_with_free_func ((GDestroyNotify) go_path_free);
	for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
		if (attr_eq (attrs[0], "Path")) {
			path = go_path_new_from_svg (attrs[1]);
			if (path)
				g_ptr_array_add (sop->paths, path);
			/* we need to update the extents, not optimal */
			g_ptr_array_ref (sop->paths);
			g_object_set (G_OBJECT (sop), "paths", sop->paths, NULL);
			g_ptr_array_unref (sop->paths);
			return;
		}
}