[gnumeric] Make imported manual page breaks work
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Make imported manual page breaks work
- Date: Sun, 7 Jun 2009 20:32:30 -0400 (EDT)
commit 68b6adca87a67bdd6a12699e4a06bc91e0133209
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date: Sun Jun 7 18:31:32 2009 -0600
Make imported manual page breaks work
2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/print-info.h (gnm_page_breaks_set_break): new
(gnm_page_breaks_get_break): new
(gnm_page_breaks_get_next_manual_break): new
(gnm_page_breaks_dup_non_auto_breaks): new
* src/print-info.c (gnm_page_breaks_set_break): new
(gnm_page_breaks_get_break): new
(gnm_page_breaks_get_next_manual_break): new
(gnm_page_breaks_dup_non_auto_breaks): new
(gnm_page_break_type_from_str): default to GNM_PAGE_BREAK_NONE
* src/print.h (GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY):
new key
* src/print.c (PrintingInstance): add new fields
(paginate): add arguments and change all callers
(gnm_begin_print_cb): handle ignoring of manual page breaks
(gnm_create_widget_cb): add ignore page break chackbox
(gnm_custom_widget_apply_cb): and handle the checkbox
2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_append_page_break): add argument and
change all callers
(oo_set_page_break): new
(oo_page_break_type): default to NONE (we did that anyways) and
handle column type just in case
2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
* ms-excel-write.c (excel_write_PAGE_BREAK): don't save automatic
page breaks
---
ChangeLog | 19 ++++++
NEWS | 1 +
plugins/excel/ChangeLog | 5 ++
plugins/excel/ms-excel-write.c | 10 ++-
plugins/openoffice/ChangeLog | 8 ++
plugins/openoffice/openoffice-read.c | 41 +++++++++---
src/print-info.c | 110 +++++++++++++++++++++++++++++++-
src/print-info.h | 8 ++
src/print.c | 118 +++++++++++++++++++++++-----------
src/print.h | 1 +
10 files changed, 269 insertions(+), 52 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 38f2b45..8a5be9d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,24 @@
2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * src/print-info.h (gnm_page_breaks_set_break): new
+ (gnm_page_breaks_get_break): new
+ (gnm_page_breaks_get_next_manual_break): new
+ (gnm_page_breaks_dup_non_auto_breaks): new
+ * src/print-info.c (gnm_page_breaks_set_break): new
+ (gnm_page_breaks_get_break): new
+ (gnm_page_breaks_get_next_manual_break): new
+ (gnm_page_breaks_dup_non_auto_breaks): new
+ (gnm_page_break_type_from_str): default to GNM_PAGE_BREAK_NONE
+ * src/print.h (GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY):
+ new key
+ * src/print.c (PrintingInstance): add new fields
+ (paginate): add arguments and change all callers
+ (gnm_begin_print_cb): handle ignoring of manual page breaks
+ (gnm_create_widget_cb): add ignore page break chackbox
+ (gnm_custom_widget_apply_cb): and handle the checkbox
+
+2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* src/GNOME_Gnumeric-gtk.xml.in: add ChiSquareTests
* src/wbc-gtk-actions.c add MenuContingencyTests and
Tools -> Chi Square Tests items
diff --git a/NEWS b/NEWS
index adc9787..a7292cd 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Andreas:
* Improve Fourier transform tool
* New FOURIER function
* Added Tests for Independence and Homogeneity
+ * Make imported manual page breaks work
Morten:
* Add search-for-number.
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index dfa6460..e47a40a 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * ms-excel-write.c (excel_write_PAGE_BREAK): don't save automatic
+ page breaks
+
2009-05-23 Morten Welinder <terra gnome org>
* Release 1.9.8
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index d7866b0..780dc4d 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -4349,17 +4349,18 @@ excel_write_WSBOOL (BiffPut *bp, ExcelWriteSheet *esheet)
static void
excel_write_PAGE_BREAK (BiffPut *bp, GnmPageBreaks const *breaks)
{
- GArray const *details = breaks->details;
unsigned i, n, step = (bp->version < MS_BIFF_V8) ? 2 : 6;
- guint16 const maxima = breaks->is_vert ? XLS_MaxRow_V8 : XLS_MaxCol;
GnmPageBreak const *binfo;
guint8 *data;
+ GnmPageBreaks *manual_pbreaks = gnm_page_breaks_dup_non_auto_breaks (breaks);
+ GArray *details = manual_pbreaks->details;
+ guint16 const maxima = manual_pbreaks->is_vert ? XLS_MaxRow_V8 : XLS_MaxCol;
/* limit size to ensure no CONTINUE (do we need this ? ) */
- if (((n = breaks->details->len)*step + 2 + 2) >= ms_biff_max_record_len (bp))
+ if (((n = details->len)*step + 2 + 2) >= ms_biff_max_record_len (bp))
n = (ms_biff_max_record_len (bp) - 2 - 2) / step;
- data = ms_biff_put_len_next (bp, breaks->is_vert
+ data = ms_biff_put_len_next (bp, manual_pbreaks->is_vert
? BIFF_VERTICALPAGEBREAKS : BIFF_HORIZONTALPAGEBREAKS,
2 + step * n);
@@ -4375,6 +4376,7 @@ excel_write_PAGE_BREAK (BiffPut *bp, GnmPageBreaks const *breaks)
}
ms_biff_put_commit (bp);
+ gnm_page_breaks_free (manual_pbreaks);
}
static void
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index e62bfaa..10bd493 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,11 @@
+2009-06-07 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-read.c (oo_append_page_break): add argument and
+ change all callers
+ (oo_set_page_break): new
+ (oo_page_break_type): default to NONE (we did that anyways) and
+ handle column type just in case
+
2009-06-03 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (oo_cell_content_end): Since we may be
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 3deaa82..03bd140 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -803,7 +803,7 @@ oo_table_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
}
static void
-oo_append_page_break (OOParseState *state, int pos, gboolean is_vert)
+oo_append_page_break (OOParseState *state, int pos, gboolean is_vert, gboolean is_manual)
{
GnmPageBreaks *breaks;
@@ -814,20 +814,41 @@ oo_append_page_break (OOParseState *state, int pos, gboolean is_vert)
if (NULL == (breaks = state->page_breaks.h))
breaks = state->page_breaks.h = gnm_page_breaks_new (FALSE);
}
+
+ gnm_page_breaks_append_break (breaks, pos,
+ is_manual ? GNM_PAGE_BREAK_MANUAL : GNM_PAGE_BREAK_AUTO);
+}
- gnm_page_breaks_append_break (breaks, pos, GNM_PAGE_BREAK_MANUAL);
+static void
+oo_set_page_break (OOParseState *state, int pos, gboolean is_vert, gboolean is_manual)
+{
+ GnmPageBreaks *breaks = (is_vert) ? state->page_breaks.v : state->page_breaks.h;
+
+ switch (gnm_page_breaks_get_break (breaks, pos)) {
+ case GNM_PAGE_BREAK_NONE:
+ oo_append_page_break (state, pos, is_vert, is_manual);
+ return;
+ case GNM_PAGE_BREAK_MANUAL:
+ return;
+ case GNM_PAGE_BREAK_AUTO:
+ default:
+ if (is_manual)
+ gnm_page_breaks_set_break (breaks, pos, GNM_PAGE_BREAK_MANUAL);
+ break;
+ }
}
static void
oo_col_row_style_apply_breaks (OOParseState *state, OOColRowStyle *cr_style,
int pos, gboolean is_vert)
{
- /* AUTO seems to denote the possibility, of a break, rather than an
- * actual break, ignore it*/
- if (cr_style->break_before == OO_PAGE_BREAK_MANUAL)
- oo_append_page_break (state, pos, is_vert);
- if (cr_style->break_after == OO_PAGE_BREAK_MANUAL)
- oo_append_page_break (state, pos+1, is_vert);
+
+ if (cr_style->break_before != OO_PAGE_BREAK_NONE)
+ oo_set_page_break (state, pos, is_vert,
+ cr_style->break_before == OO_PAGE_BREAK_MANUAL);
+ if (cr_style->break_after == OO_PAGE_BREAK_NONE)
+ oo_append_page_break (state, pos+1, is_vert,
+ cr_style->break_after == OO_PAGE_BREAK_MANUAL);
}
static void
@@ -2298,10 +2319,12 @@ oo_page_break_type (GsfXMLIn *xin, xmlChar const *attr)
{
if (!strcmp (attr, "page"))
return OO_PAGE_BREAK_MANUAL;
+ if (!strcmp (attr, "column"))
+ return OO_PAGE_BREAK_MANUAL;
if (!strcmp (attr, "auto"))
return OO_PAGE_BREAK_AUTO;
oo_warning (xin,
- _("Unknown break type '%s' defaulting to Manual"), attr);
+ _("Unknown break type '%s' defaulting to NONE"), attr);
return OO_PAGE_BREAK_NONE;
}
diff --git a/src/print-info.c b/src/print-info.c
index cb08b84..1ba220c 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -1262,6 +1262,27 @@ gnm_page_breaks_free (GnmPageBreaks *breaks)
}
}
+GnmPageBreaks *
+gnm_page_breaks_dup_non_auto_breaks (GnmPageBreaks const *src)
+{
+ if (src != NULL) {
+ GnmPageBreaks *dst = gnm_page_breaks_new (src->is_vert);
+ GArray *d_details = dst->details;
+ GArray const *s_details = src->details;
+ GnmPageBreak *pbreak;
+ unsigned i;
+
+ /* no need to validate through gnm_page_breaks_append_break, just dup */
+ for (i = 0; i < s_details->len ; i++) {
+ pbreak = &g_array_index (s_details, GnmPageBreak, i);
+ if (pbreak->type != GNM_PAGE_BREAK_AUTO)
+ g_array_append_val (d_details, *pbreak);
+ }
+ return dst;
+ } else
+ return NULL;
+}
+
gboolean
gnm_page_breaks_append_break (GnmPageBreaks *breaks,
int pos,
@@ -1272,6 +1293,9 @@ gnm_page_breaks_append_break (GnmPageBreaks *breaks,
g_return_val_if_fail (breaks != NULL, FALSE);
+ if (type == GNM_PAGE_BREAK_NONE)
+ return TRUE;
+
/* Do some simple validation */
if (pos < 0)
return FALSE;
@@ -1289,6 +1313,90 @@ gnm_page_breaks_append_break (GnmPageBreaks *breaks,
return TRUE;
}
+GnmPageBreakType
+gnm_page_breaks_get_break (GnmPageBreaks *breaks,
+ int pos)
+{
+ int i;
+
+ if (breaks == NULL)
+ return GNM_PAGE_BREAK_NONE;
+
+ for (i = breaks->details->len - 1; i >= 0; i--) {
+ GnmPageBreak *pbreak;
+ pbreak = &g_array_index (breaks->details, GnmPageBreak, i);
+ if (pbreak->pos < pos)
+ return GNM_PAGE_BREAK_NONE;
+ if (pbreak->pos == pos)
+ return (pbreak->type);
+ }
+ return GNM_PAGE_BREAK_NONE;
+}
+
+int
+gnm_page_breaks_get_next_manual_break (GnmPageBreaks *breaks,
+ int pos)
+{
+ int i;
+
+ if (breaks == NULL)
+ return -1;
+
+ for (i = 0; i < breaks->details->len; i++) {
+ GnmPageBreak const *pbreak;
+ pbreak = &g_array_index (breaks->details, GnmPageBreak, i);
+ if (pbreak->pos > pos
+ && pbreak->type == GNM_PAGE_BREAK_MANUAL)
+ return pbreak->pos;
+ }
+ return -1;
+}
+
+gboolean
+gnm_page_breaks_set_break (GnmPageBreaks *breaks,
+ int pos,
+ GnmPageBreakType type)
+{
+ GnmPageBreak *pbreak;
+ GnmPageBreak info;
+ int i;
+ int before = -1;
+
+ g_return_val_if_fail (breaks != NULL, FALSE);
+
+ /* Do some simple validation */
+ if (pos < 0)
+ return FALSE;
+
+ if (breaks->details->len == 0 && type != GNM_PAGE_BREAK_NONE)
+ return gnm_page_breaks_append_break (breaks, pos, type);
+
+ for (i = 0; i < breaks->details->len; i++) {
+ pbreak = &g_array_index (breaks->details, GnmPageBreak, i);
+ if (pbreak->pos == pos) {
+ if (type == GNM_PAGE_BREAK_NONE) {
+ g_array_remove_index (breaks->details, i);
+ } else {
+ pbreak->type = type;
+ }
+ return TRUE;
+ } else if (pbreak->pos < pos)
+ before = i;
+ }
+
+ if (type == GNM_PAGE_BREAK_NONE)
+ return TRUE;
+
+ info.pos = pos;
+ info.type = type;
+ if ((before + 1) > breaks->details->len)
+ g_array_append_val (breaks->details, info);
+ else
+ g_array_insert_val (breaks->details, (before + 1), info);
+
+ return TRUE;
+}
+
/**
* gnm_page_break_type_from_str
* @str :
@@ -1303,5 +1411,5 @@ gnm_page_break_type_from_str (char const *str)
return GNM_PAGE_BREAK_AUTO;
if (0 == g_ascii_strcasecmp (str, "data-slice"))
return GNM_PAGE_BREAK_DATA_SLICE;
- return GNM_PAGE_BREAK_AUTO;
+ return GNM_PAGE_BREAK_NONE;
}
diff --git a/src/print-info.h b/src/print-info.h
index 1c291b1..90e349b 100644
--- a/src/print-info.h
+++ b/src/print-info.h
@@ -19,6 +19,7 @@ typedef struct {
} PrintHF;
typedef enum {
+ GNM_PAGE_BREAK_NONE,
GNM_PAGE_BREAK_MANUAL,
GNM_PAGE_BREAK_AUTO,
GNM_PAGE_BREAK_DATA_SLICE
@@ -178,6 +179,13 @@ void gnm_page_breaks_free (GnmPageBreaks *breaks);
gboolean gnm_page_breaks_append_break (GnmPageBreaks *breaks,
int pos,
GnmPageBreakType type);
+gboolean gnm_page_breaks_set_break (GnmPageBreaks *breaks,
+ int pos,
+ GnmPageBreakType type);
+GnmPageBreakType gnm_page_breaks_get_break (GnmPageBreaks *breaks, int pos);
+int gnm_page_breaks_get_next_manual_break (GnmPageBreaks *breaks, int pos);
+GnmPageBreaks * gnm_page_breaks_dup_non_auto_breaks (GnmPageBreaks const *src);
+
/* Formats known */
extern GList *hf_formats;
diff --git a/src/print.c b/src/print.c
index e34ff19..47b7cad 100644
--- a/src/print.c
+++ b/src/print.c
@@ -63,9 +63,11 @@ typedef struct {
GtkWidget *button_all_sheets, *button_selected_sheet,
*button_spec_sheets;
GtkWidget *button_selection, *button_ignore_printarea, *button_print_hidden_sheets;
+ GtkWidget *button_ignore_page_breaks;
GtkWidget *spin_from, *spin_to;
PrintRange pr;
guint to, from;
+ gboolean ignore_pb;
guint last_pagination;
HFRenderInfo *hfi;
} PrintingInstance;
@@ -642,7 +644,8 @@ paginate (GSList **paginationInfo,
gint start, gint end,
gdouble usable, gboolean repeat, gint repeat_start, gint repeat_end,
double (sheet_get_distance_pts) (Sheet const *sheet, int from, int to),
- ColRowInfo const *(get_info)(Sheet const *sheet, int const p))
+ ColRowInfo const *(get_info)(Sheet const *sheet, int const p),
+ GnmPageBreaks *pb, gboolean store_breaks)
{
GSList *list = NULL;
int rc = start;
@@ -657,35 +660,43 @@ paginate (GSList **paginationInfo,
}
while (rc <= end) {
- int count;
- PaginationInfo *item;
-
- gdouble repeating_used = 0.;
- gint n_rep_used = 0, first_rep_used = 0;
-
- adjust_repetition (sheet, rc,
- first_rep, n_rep,
- repeating,
- &first_rep_used, &n_rep_used,
- &repeating_used,
- sheet_get_distance_pts);
-
- count = compute_group (sheet, rc, end,
- usable - repeating_used,
- get_info);
-
- if (paginationInfo) {
- item = g_new (PaginationInfo,1);
- item->rc = rc;
- item->count = count;
- item->first_rep = first_rep_used;
- item->n_rep = n_rep_used;
-
- list = g_slist_prepend (list, item);
+ gint n_end;
+
+ n_end = gnm_page_breaks_get_next_manual_break (pb, rc) - 1;
+ if (n_end < rc)
+ n_end = end;
+
+ while (rc <= n_end) {
+ int count;
+ PaginationInfo *item;
+
+ gdouble repeating_used = 0.;
+ gint n_rep_used = 0, first_rep_used = 0;
+
+ adjust_repetition (sheet, rc,
+ first_rep, n_rep,
+ repeating,
+ &first_rep_used, &n_rep_used,
+ &repeating_used,
+ sheet_get_distance_pts);
+
+ count = compute_group (sheet, rc, n_end,
+ usable - repeating_used,
+ get_info);
+
+ if (paginationInfo) {
+ item = g_new (PaginationInfo,1);
+ item->rc = rc;
+ item->count = count;
+ item->first_rep = first_rep_used;
+ item->n_rep = n_rep_used;
+
+ list = g_slist_prepend (list, item);
+ }
+ page_count++;
+
+ rc += count;
}
- page_count++;
-
- rc += count;
}
if (paginationInfo) {
@@ -711,7 +722,7 @@ compute_scale_fit_to (Sheet const *sheet,
ColRowInfo const *(get_info)(Sheet const *sheet, int const p),
double (get_distance_pts) (Sheet const *sheet, int from, int to),
gint pages, double max_percent, double header,
- gboolean repeat, gint repeat_start, gint repeat_end)
+ gboolean repeat, gint repeat_start, gint repeat_end, GnmPageBreaks *pb)
{
double max_p, min_p;
gint max_pages, min_pages;
@@ -745,7 +756,7 @@ compute_scale_fit_to (Sheet const *sheet,
max_pages = paginate (NULL, sheet, start, end, usable/max_p - header,
repeat, repeat_start, repeat_end,
- get_distance_pts, get_info);
+ get_distance_pts, get_info, pb, FALSE);
if (max_pages == pages)
return max_p;
@@ -758,7 +769,7 @@ compute_scale_fit_to (Sheet const *sheet,
min_pages = paginate (NULL, sheet, start, end, usable/min_p - header,
repeat, repeat_start, repeat_end,
- get_distance_pts, get_info);
+ get_distance_pts, get_info, pb, FALSE);
/* And then we pick the middle until the percentage is within 0.1% of */
@@ -768,7 +779,7 @@ compute_scale_fit_to (Sheet const *sheet,
double cur_p = (max_p + min_p) / 2.;
int cur_pages = paginate (NULL, sheet, start, end, usable/cur_p - header,
repeat, repeat_start, repeat_end,
- get_distance_pts, get_info);
+ get_distance_pts, get_info, pb, FALSE);
if (cur_pages > pages) {
max_pages = cur_pages;
@@ -952,14 +963,16 @@ compute_sheet_pages (GtkPrintContext *context,
pinfo->scaling.dim.rows, 1.,
col_header_height,
repeat_top_use,
- repeat_top_start, repeat_top_end);
+ repeat_top_start, repeat_top_end,
+ pi->ignore_pb ? NULL : pinfo->page_breaks.v);
pxy = compute_scale_fit_to (sheet, r.start.col, r.end.col,
page_width, sheet_col_get_info,
sheet_col_get_distance_pts,
pinfo->scaling.dim.cols, pxy,
row_header_width,
repeat_left_use,
- repeat_left_start, repeat_left_end);
+ repeat_left_start, repeat_left_end,
+ pi->ignore_pb ? NULL : pinfo->page_breaks.h);
pinfo->scaling.percentage.x = pxy * 100.;
pinfo->scaling.percentage.y = pxy * 100.;
@@ -979,11 +992,13 @@ compute_sheet_pages (GtkPrintContext *context,
paginate (&column_pagination, sheet, r.start.col, r.end.col,
usable_x - row_header_width,
repeat_left_use, repeat_left_start, repeat_left_end,
- sheet_col_get_distance_pts, sheet_col_get_info);
+ sheet_col_get_distance_pts, sheet_col_get_info,
+ pi->ignore_pb ? NULL : pinfo->page_breaks.h, !pi->ignore_pb);
paginate (&row_pagination, sheet, r.start.row, r.end.row,
usable_y - col_header_height,
repeat_top_use, repeat_top_start, repeat_top_end,
- sheet_row_get_distance_pts, sheet_row_get_info);
+ sheet_row_get_distance_pts, sheet_row_get_info,
+ pi->ignore_pb ? NULL : pinfo->page_breaks.v, !pi->ignore_pb);
if (sheet->print_info->print_across_then_down)
compute_sheet_pages_across_then_down (pi, sheet,
@@ -1152,6 +1167,7 @@ gnm_begin_print_cb (GtkPrintOperation *operation,
PrintingInstance * pi = (PrintingInstance *) user_data;
PrintRange pr;
guint from, to;
+ gboolean i_pb;
GtkPrintSettings * settings;
settings = gtk_print_operation_get_print_settings (operation);
@@ -1162,6 +1178,8 @@ gnm_begin_print_cb (GtkPrintOperation *operation,
(settings, GNUMERIC_PRINT_SETTING_PRINT_TO_SHEET_KEY, workbook_sheet_count (pi->wb));
pr = gtk_print_settings_get_int_with_default
(settings, GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY, PRINT_ACTIVE_SHEET);
+ i_pb = (1 == gtk_print_settings_get_int_with_default
+ (settings, GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY, 1));
if (from != pi->from || to != pi->to || pr != pi->pr) {
/* g_warning ("Working around gtk+ bug 423484."); */
gtk_print_settings_set_int
@@ -1172,6 +1190,8 @@ gnm_begin_print_cb (GtkPrintOperation *operation,
pi->to);
gtk_print_settings_set_int
(settings, GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY, pi->pr);
+ gtk_print_settings_set_int
+ (settings, GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY, pi->ignore_pb ? 1 : 0);
from = pi->from;
to = pi->to;
pr = pi->pr;
@@ -1285,6 +1305,7 @@ gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
GtkWidget *button_print_hidden_sheets;
GtkWidget *label_from, *label_to;
GtkWidget *spin_from, *spin_to;
+ GtkWidget *button_ignore_page_breaks;
GtkPrintSettings * settings;
guint n_sheets = workbook_visible_sheet_count (pi->wb);
@@ -1292,7 +1313,7 @@ gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
gtk_container_set_border_width (GTK_CONTAINER (frame), 5);
- table = gtk_table_new (7, 7, FALSE);
+ table = gtk_table_new (9, 7, FALSE);
gtk_table_set_col_spacing (GTK_TABLE (table), 1,20);
gtk_container_add (GTK_CONTAINER (frame), table);
@@ -1344,6 +1365,15 @@ gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_to), n_sheets);
+ button_ignore_page_breaks = gtk_hseparator_new ();
+ gtk_table_attach (GTK_TABLE (table), button_ignore_page_breaks, 1, 7, 7, 8,
+ GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,5,5);
+
+ button_ignore_page_breaks = gtk_check_button_new_with_mnemonic ("Ignore all _manual page breaks");
+ gtk_table_attach (GTK_TABLE (table), button_ignore_page_breaks, 1, 7, 8, 9,
+ GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_ignore_page_breaks), TRUE);
+
g_signal_connect_after (G_OBJECT (button_selected_sheet), "toggled",
G_CALLBACK (widget_button_cb), button_selection);
g_signal_connect_after (G_OBJECT (button_selected_sheet), "toggled",
@@ -1401,6 +1431,10 @@ gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
gtk_print_settings_get_int_with_default
(settings, GNUMERIC_PRINT_SETTING_PRINT_TO_SHEET_KEY,
n_sheets));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_ignore_page_breaks),
+ 0 != gtk_print_settings_get_int_with_default
+ (settings, GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY,
+ 1));
}
/* We are sending toggled signals to ensure that all widgets are */
@@ -1419,6 +1453,7 @@ gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
pi->button_print_hidden_sheets = button_print_hidden_sheets;
pi->spin_from = spin_from;
pi->spin_to = spin_to;
+ pi->button_ignore_page_breaks = button_ignore_page_breaks;
return G_OBJECT (frame);
}
@@ -1432,6 +1467,7 @@ gnm_custom_widget_apply_cb (GtkPrintOperation *operation,
GtkPrintSettings * settings;
PrintRange pr = PRINT_ACTIVE_SHEET;
guint from, to;
+ gboolean ignore_pb;
settings = gtk_print_operation_get_print_settings (operation);
@@ -1473,7 +1509,13 @@ gnm_custom_widget_apply_cb (GtkPrintOperation *operation,
gtk_print_settings_set_int (settings,
GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY, pr);
+
pi->pr = pr;
+
+ ignore_pb= gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (pi->button_ignore_page_breaks)) ? 1 : 0;
+ gtk_print_settings_set_int (settings, GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY,
+ ignore_pb);
+ pi->ignore_pb = ignore_pb;
}
void
diff --git a/src/print.h b/src/print.h
index 33e3403..8587766 100644
--- a/src/print.h
+++ b/src/print.h
@@ -11,6 +11,7 @@ G_BEGIN_DECLS
#define GNUMERIC_PRINT_SETTING_PRINTRANGE_KEY "GnumericPrintRange"
#define GNUMERIC_PRINT_SETTING_PRINT_FROM_SHEET_KEY "GnumericPrintFromSheet"
#define GNUMERIC_PRINT_SETTING_PRINT_TO_SHEET_KEY "GnumericPrintToSheet"
+#define GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY "GnumericPrintIgnorePageBreaks"
typedef enum {
PRINT_ACTIVE_SHEET,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]