Commit 3c7b3e07 authored by Jean Bréfort's avatar Jean Bréfort Committed by Jean Bréfort

render sheet objects using gnm_print_sheet_objects, and fixed cap for cell

2008-10-04  Jean Brefort  <jean.brefort@normalesup.org>

	* component/gnumeric.c: render sheet objects using
	gnm_print_sheet_objects, and fixed cap for cell borders.
	* src/print-cell.c: removed the unused GtkPrintContext* argument.
	* src/print-cell.h: ditto.
	* src/print.c: renamed print_sheet_objects to gnm_print_sheet_objects,
	made it public, removed the unused GtkPrintContext* argument, and
	fixed objects position in layout (#554993).
	* src/print.h: ditto.


svn path=/trunk/; revision=16855
parent b1b4199d
2008-10-04 Jean Brefort <jean.brefort@normalesup.org>
* component/gnumeric.c: render sheet objects using
gnm_print_sheet_objects, and fixed cap for cell borders.
* src/print-cell.c: removed the unused GtkPrintContext* argument.
* src/print-cell.h: ditto.
* src/print.c: renamed print_sheet_objects to gnm_print_sheet_objects,
made it public, removed the unused GtkPrintContext* argument, and
fixed objects position in layout (#554993).
* src/print.h: ditto.
2008-10-04 Jean Brefort <jean.brefort@normalesup.org>
* component/gnumeric.c: (go_gnm_component_render): also render sheet
......
......@@ -28,6 +28,7 @@ Andreas:
Jean:
* Fix printing of rotated text. [#539734]
* Fix leakage in histogram tool. [#552596]
* Fix horizontal position of sheet objects in print. [#554993]
* Reimplemented the goffice component.
Jody:
......
......@@ -167,30 +167,15 @@ go_gnm_component_render (GOComponent *component, cairo_t *cr, double width_pixel
SheetObjectAnchor const *anchor;
range_init (&range, gognm->col_start, gognm->row_start, gognm->col_end, gognm->row_end);
cairo_save (cr);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
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);
cairo_rectangle (cr, 0., 0., gognm->width, gognm->height);
cairo_clip (cr); /* not sure it is necessary */
gnm_gtk_print_cell_range (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;
}
gnm_print_sheet_objects (cr, gognm->sheet, &range, 0., 0.);
cairo_restore (cr);
}
static void
......
......@@ -256,7 +256,7 @@ merged_col_cmp (GnmRange const *a, GnmRange const *b)
void
gnm_gtk_print_cell_range (GtkPrintContext *print_context, cairo_t *context,
gnm_gtk_print_cell_range (cairo_t *context,
Sheet const *sheet, GnmRange *range,
double base_x, double base_y,
gboolean hide_grid)
......
......@@ -8,8 +8,7 @@
G_BEGIN_DECLS
void gnm_gtk_print_cell_range (GtkPrintContext *print_context,
cairo_t *context,
void gnm_gtk_print_cell_range (cairo_t *context,
Sheet const *sheet, GnmRange *range,
double base_x, double base_y,
gboolean hide_grid);
......
......@@ -118,18 +118,16 @@ printing_instance_delete (PrintingInstance *pi)
g_free (pi);
}
static void
print_sheet_objects (GtkPrintContext *context,
cairo_t *cr,
Sheet const *sheet,
GnmRange *range,
double base_x, double base_y)
void
gnm_print_sheet_objects (cairo_t *cr,
Sheet const *sheet,
GnmRange *range,
double base_x, double base_y)
{
GSList *ptr, *objects;
double width, height;
g_return_if_fail (IS_SHEET (sheet));
g_return_if_fail (context != NULL);
g_return_if_fail (cr != NULL);
g_return_if_fail (range != NULL);
......@@ -164,22 +162,22 @@ print_sheet_objects (GtkPrintContext *context,
/* move to top left */
if (sheet->text_is_rtl) {
double tr_x, tr_y;
tr_x = base_x
tr_x = base_x - 0.5 /* because of leading gridline */
- sheet_col_get_distance_pts (sheet, 0, r->end.col+1)
+ sheet_col_get_distance_pts (sheet, 0,
range->start.col);
tr_y = - base_y
tr_y = base_y + 0.5
+ sheet_row_get_distance_pts (sheet, 0, r->start.row)
- sheet_row_get_distance_pts (sheet, 0,
range->start.row);
cairo_translate (cr, tr_x, tr_y);
} else
cairo_translate (cr,
- base_x
base_x + 0.5
+ sheet_col_get_distance_pts (sheet, 0, r->start.col)
- sheet_col_get_distance_pts (sheet, 0,
range->start.col),
- base_y
base_y + 0.5
+ sheet_row_get_distance_pts (sheet, 0, r->start.row)
- sheet_row_get_distance_pts (sheet, 0,
range->start.row));
......@@ -199,9 +197,9 @@ print_page_cells (GtkPrintContext *context, PrintingInstance * pi,
double base_x, double base_y)
{ PrintInformation const *pinfo = sheet->print_info;
gnm_gtk_print_cell_range (context, cr, sheet, range,
gnm_gtk_print_cell_range (cr, sheet, range,
base_x, base_y, !pinfo->print_grid_lines);
print_sheet_objects (context, cr, sheet, range, base_x, base_y);
gnm_print_sheet_objects (cr, sheet, range, base_x, base_y);
}
static void
......
......@@ -4,6 +4,7 @@
#include "gnumeric.h"
#include <gsf/gsf-output.h>
#include <cairo.h>
G_BEGIN_DECLS
......@@ -25,6 +26,11 @@ void gnm_print_sheet (WorkbookControl *wbc, Sheet *sheet,
gboolean preview, PrintRange default_range,
GsfOutput *export_dst);
void gnm_print_sheet_objects (cairo_t *cr,
Sheet const *sheet,
GnmRange *range,
double base_x, double base_y);
/* Internal */
extern gboolean gnm_print_debug;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment