gnumeric r16854 - in trunk: . component



Author: jbrefort
Date: Sat Oct  4 07:34:42 2008
New Revision: 16854
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16854&view=rev

Log:
2008-10-04  Jean Brefort  <jean brefort normalesup org>

	* component/gnumeric.c: (go_gnm_component_render): also render sheet
	objects.



Modified:
   trunk/ChangeLog
   trunk/component/gnumeric.c

Modified: trunk/component/gnumeric.c
==============================================================================
--- trunk/component/gnumeric.c	(original)
+++ trunk/component/gnumeric.c	Sat Oct  4 07:34:42 2008
@@ -161,10 +161,36 @@
 {
 	GOGnmComponent *gognm = GO_GNM_COMPONENT (component);
 	GnmRange range;
+	double xoffset = 0., yoffset;
+	GSList *l;
+	SheetObject *so;
+	SheetObjectAnchor const *anchor;
 
 	range_init (&range, gognm->col_start, gognm->row_start, gognm->col_end, gognm->row_end);
 	cairo_scale (cr, ((double) width_pixels) / gognm->width, ((double) height_pixels) / gognm->height);
 	gnm_gtk_print_cell_range (NULL, cr, gognm->sheet, &range, 0., 0., TRUE);
+	/* Now render objects */
+	l = gognm->sheet->sheet_objects;
+	while (l) {
+		so = SHEET_OBJECT (l->data);
+		anchor = sheet_object_get_anchor (so);
+		/* test if the object overlaps the exposed range */
+		if ((anchor->cell_bound.start.col <= gognm->col_end) &&
+			(anchor->cell_bound.end.col >= gognm->col_start) &&
+			(anchor->cell_bound.start.row <= gognm->row_end) &&
+			(anchor->cell_bound.end.row >= gognm->row_start)) {
+			/* translate the origin to start cell of object */
+			xoffset = sheet_col_get_distance_pts (gognm->sheet, gognm->col_start,
+				anchor->cell_bound.start.col);
+			yoffset = sheet_row_get_distance_pts (gognm->sheet, gognm->row_start,
+				anchor->cell_bound.start.row);
+			cairo_save (cr);
+			cairo_translate (cr, xoffset, yoffset);
+			sheet_object_draw_cairo (so, cr, TRUE);
+			cairo_restore (cr);
+		}
+		l = l->next;
+	}
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]