[gnumeric] xls: export paper size.



commit 3c4f804fad42bbef7b0e130675323d4afec8dea6
Author: Morten Welinder <terra gnome org>
Date:   Sun Mar 11 18:00:30 2012 -0400

    xls: export paper size.

 ChangeLog                      |    4 +
 NEWS                           |    1 +
 plugins/excel/ChangeLog        |    5 +
 plugins/excel/ms-excel-read.c  |  139 ++-------------------------------
 plugins/excel/ms-excel-util.c  |  171 ++++++++++++++++++++++++++++++++++++++++
 plugins/excel/ms-excel-util.h  |    9 ++
 plugins/excel/ms-excel-write.c |   12 +++-
 src/print-info.c               |   10 +++
 src/print-info.h               |    1 +
 9 files changed, 218 insertions(+), 134 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 78018d4..208f386 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-11  Morten Welinder  <terra gnome org>
+
+	* src/print-info.c (print_info_get_paper_size): New function.
+
 2012-03-11  Morten Welinder  <mwelinder gmail com>
 
 	* test/GnumericTest.pm (test_importer): Survive non-compressed
diff --git a/NEWS b/NEWS
index 10c38e5..def1810 100644
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ Morten:
 	* Export only needed col/row styles to .gnumeric.
 	* Fix export of colours to .gnumeric.
 	* Fix row height xls export rounding issue.  [Part of #671513]
+	* Export paper size to xls.
 
 --------------------------------------------------------------------------
 Gnumeric 1.11.2
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 939180b..4686671 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,10 @@
 2012-03-11  Morten Welinder  <terra gnome org>
 
+	* ms-excel-write.c (excel_write_SETUP): Export paper size.
+
+	* ms-excel-util.c (xls_paper_name): Extract from ms-excel-read.c
+	(xls_paper_size): New pseudo-inverse of above.
+
 	* ms-excel-write.c (excel_write_obj_v8): Handle graphs here too.
 	(excel_sheet_new): Put graphs into the regular object queue too.
 
diff --git a/plugins/excel/ms-excel-read.c b/plugins/excel/ms-excel-read.c
index 588867d..6eb04ca 100644
--- a/plugins/excel/ms-excel-read.c
+++ b/plugins/excel/ms-excel-read.c
@@ -4592,130 +4592,6 @@ excel_read_GUTS (BiffQuery *q, ExcelReadSheet *esheet)
 	sheet_colrow_gutter (esheet->sheet, FALSE, row_gut);
 }
 
-/*
- * This mapping was derived from http://sc.openoffice.org/excelfileformat.pdf
- * and from the documentation for the Spreadsheet::WriteExcel perl module
- * (http://freshmeat.net/projects/writeexcel/).
- */
-typedef struct {
-	/* PWG 5101.1-2002 name for a physical paper size,
-	 * and a boolean to indicate the paper is turned */
-	char const *gp_name;
-	gboolean const rotated;
-} paper_size_table_entry;
-
-static paper_size_table_entry const paper_size_table[] = {
-	{ NULL, FALSE},		/* printer default / undefined */
-
-	{ "na_letter_8.5x11in", FALSE },
-	{ "na_letter_8.5x11in", FALSE },	/* Letter small */
-	{ "na_ledger_11x17in", FALSE  },	/* Tabloid */
-	{ "na_ledger_11x17in", TRUE },	/* Ledger ROTATED*/
-	{ "na_legal_8.5x14in", FALSE },	/* Legal */
-
-	{ "na_invoice_5.5x8.5in", FALSE },	/* Statement */
-	{ "na_executive_7.25x10.5in", FALSE },	/* Executive */
-	{ "iso_a3_297x420mm", FALSE },
-	{ "iso_a4_210x297mm", FALSE },
-	{ "iso_a4_210x297mm", FALSE },		/* A4 small */
-
-	{ "iso_a5_148x210mm", FALSE },
-	{ "iso_b4_250x353mm", FALSE },
-	{ "iso_b5_176x250mm", FALSE },
-	{ "na_foolscap_8.5x13in", FALSE },	/* Folio */
-	{ "na_quarto_8.5x10.83in", FALSE },	/* Quarto */
-
-	{ "na_10x14_10x14in",  FALSE },	/* 10x14 */
-	{ "na_ledger_11x17in", FALSE },	/* 11x17 */
-	{ "na_letter_8.5x11in", FALSE },	/* Note */
-	{ "na_number-9_3.875x8.875in", FALSE},	/* Envelope #9 */
-	{ "na_number-10_4.125x9.5in", FALSE},	/* Envelope #10 */
-	{ "na_number-11_4.5x10.375in", FALSE},	/* Envelope #11 */
-	{ "na_number-12_4.75x11in", FALSE },	/* Envelope #12 */
-	{ "na_number-14_5x11.5in", FALSE },	/* Envelope #14 */
-	{ "na_c_17x22in", FALSE },	/* C */
-	{ "na_d_22x34in", FALSE },	/* D */
-	{ "na_e_34x44in", FALSE },	/* E */
-
-	{ "iso_dl_110x220mm", FALSE },		/* Envelope DL */
-	{ "iso_c5_162x229mm", FALSE },		/* Envelope C5 */
-	{ "iso_c3_324x458mm", FALSE },		/* Envelope C3 */
-	{ "iso_c4_229x324mm", FALSE },		/* Envelope C4 */
-
-	{ "iso_c6_114x162mm", FALSE },		/* Envelope C6 */
-	{ "iso_c6c5_114x229mm", FALSE },	/* Envelope C6/C5 */
-	{ "iso_b4_250x353mm", FALSE },
-	{ "iso_b5_176x250mm", FALSE },
-	{ "iso_b6_125x176mm", FALSE },
-
-	{ "om_italian_110x230mm", FALSE },	/* Envelope Italy */
-	{ "na_monarch_3.875x7.5in", FALSE },	/* Envelope Monarch */
-	{ "na_personal_3.625x6.5in", FALSE },	/* 6 1/2 Envelope */
-	{ "na_fanfold-us_11x14.875in", TRUE },	/* US Standard Fanfold ROTATED */
-	{ "na_fanfold-eur_8.5x12in", FALSE },	/* German Std Fanfold */
-
-	{ "na_foolscap_8.5x13in", FALSE },	/* German Legal Fanfold */
-	{ "iso_b4_250x353mm", FALSE },		/* Yes, twice... */
-	{ "jpn_hagaki_100x148mm", FALSE },	/* Japanese Postcard */
-	{ "na_9x11_9x11in", FALSE },	/* 9x11 */
-	{ "na_10x11_10x11in", FALSE },	/* 10x11 */
-
-	{ "na_11x15_11x15in", FALSE },	/* 15x11 switch landscape */
-	{ "om_invite_220x220mm", FALSE },	/* Envelope Invite */
-	{ NULL, FALSE},		/* undefined */
-	{ NULL, FALSE },		/* undefined */
-	{ "na_letter-extra_9.5x12in", FALSE },	/* Letter Extra */
-
-	{ "na_legal-extra_9.5x15in", FALSE },	/* Legal Extra */
-	{ "na_arch-b_12x18in", FALSE },	/* Tabloid Extra */
-	{ "iso_a4_extra_235.5x322.3mm", FALSE },	/* A4 Extra */
-	{ "na_letter_8.5x11in", FALSE },	/* Letter Transverse */
-	{ "iso_a4_210x297mm", FALSE },		/* A4 Transverse */
-
-	{ "na_letter-extra_9.5x12in", FALSE },	/* Letter Extra Transverse */
-	{ "custom_super-aa4_227x356mm", FALSE },	/* Super A/A4 */
-	{ "custom_super-ba3_305x487mm", FALSE },	/* Super B/A3 */
-	{ "na_letter-plus_8.5x12.69in", FALSE },	/* Letter Plus */
-	{ "om_folio_210x330mm", FALSE },	/* A4 Plus */
-
-	{ "iso_a5_148x210mm", FALSE },		/* A5 Transverse */
-	{ "jis_b5_182x257mm", FALSE },		/* B5 (JIS) Transverse */
-	{ "iso_a3-extra_322x455mm", FALSE },	/* A3 Extra */
-	{ "iso_a5-extra_174x235mm", FALSE },	/* A5 Extra */
-	{ "iso_b5-extra_201x276mm", FALSE },	/* B5 (ISO) Extra */
-
-	{ "iso_a2_420x594mm", FALSE },
-	{ "iso_a3_297x420mm", FALSE },		/* A3 Transverse */
-	{ "iso_a3-extra_322x455mm", FALSE },	/* A3 Extra Transverse */
-	{ "jpn_oufuku_148x200mm", TRUE },	/* Dbl. Japanese Postcard ROTATED */
-	{ "iso_a6_105x148mm", FALSE },
-
-	{ NULL, FALSE },		/* FIXME: No documentation found */
-	{ NULL, FALSE },		/* FIXME: No documentation found */
-	{ NULL, FALSE },		/* FIXME: No documentation found */
-	{ NULL, FALSE },		/* FIXME: No documentation found */
-	{ "na_letter_8.5x11in", TRUE },	/* Letter Rotated */
-
-	{ "iso_a3_297x420mm", TRUE },	/* A3 Rotated */
-	{ "iso_a4_210x297mm", TRUE },	/* A4 Rotated */
-	{ "iso_a5_148x210mm", TRUE },	/* A5 Rotated */
-	{ "jis_b4_257x364mm", TRUE },	/* B4 (JIS) Rotated */
-	{ "jis_b5_182x257mm", TRUE },	/* B5 (JIS) Rotated */
-
-	{ "jpn_hagaki_100x148mm", TRUE },	/* Japanese Postcard Rotated */
-	{ "jpn_oufuku_148x200mm", FALSE },	/* Dbl. Jap. Postcard*/
-	{ "iso_a6_105x148mm", TRUE },	/* A6 Rotated */
-	{ NULL, FALSE },		/* FIXME: No documentation found */
-	{ NULL, FALSE },		/* FIXME: No documentation found */
-
-
-	{ NULL, FALSE },		/* FIXME: No documentation found */
-	{ NULL, FALSE },		/* FIXME: No documentation found */
-	{ "jis_b6_128x182mm", FALSE },		/* B6 (JIS) */
-	{ "jis_b6_128x182mm", TRUE },	/* B6 (JIS) Rotated */
-	{ "na_11x12_11x12in", TRUE },	/* 12x11 ROTATED */
-};
-
 static void
 excel_read_SETUP (BiffQuery *q, ExcelReadSheet *esheet)
 {
@@ -4732,16 +4608,15 @@ excel_read_SETUP (BiffQuery *q, ExcelReadSheet *esheet)
 
 	if (0 == (flags & 0x4)) {
 		guint16 papersize = GSF_LE_GET_GUINT16 (q->data + 0);
+		const char *paper_name =
+			xls_paper_name (papersize, &rotate_paper);
 
-		d (2, g_printerr ("Paper size %hu\n", papersize););
+		d (2, g_printerr ("Paper size %hu --> %s\n",
+				  papersize,
+				  paper_name ? paper_name : "-"););
 
-		if (papersize < G_N_ELEMENTS (paper_size_table)) {
-			guchar *paper_name = (guchar *)paper_size_table[papersize].gp_name;
-			rotate_paper = paper_size_table[papersize].rotated;
-			if (paper_name != NULL) {
-				print_info_set_paper (pi, paper_name);
-			}
-		}
+		if (paper_name != NULL)
+			print_info_set_paper (pi, paper_name);
 
 		pi->scaling.percentage.x = pi->scaling.percentage.y =
 			GSF_LE_GET_GUINT16 (q->data + 2);
diff --git a/plugins/excel/ms-excel-util.c b/plugins/excel/ms-excel-util.c
index 1d0fb13..8b320f9 100644
--- a/plugins/excel/ms-excel-util.c
+++ b/plugins/excel/ms-excel-util.c
@@ -488,3 +488,174 @@ xl_lookup_font_specs (char const *name)
 	return &unknown_spec;
 }
 
+/*
+ * This mapping was derived from http://sc.openoffice.org/excelfileformat.pdf
+ * and from the documentation for the Spreadsheet::WriteExcel perl module
+ * (http://freshmeat.net/projects/writeexcel/).
+ */
+typedef struct {
+	/* PWG 5101.1-2002 name for a physical paper size,
+	 * and a boolean to indicate the paper is turned */
+	char const *gp_name;
+	gboolean const rotated;
+} paper_size_table_entry;
+
+static paper_size_table_entry const paper_size_table[] = {
+	{ NULL, FALSE},		/* printer default / undefined */
+
+	{ "na_letter_8.5x11in", FALSE },
+	{ "na_letter_8.5x11in", FALSE },	/* Letter small */
+	{ "na_ledger_11x17in", FALSE  },	/* Tabloid */
+	{ "na_ledger_11x17in", TRUE },	/* Ledger ROTATED*/
+	{ "na_legal_8.5x14in", FALSE },	/* Legal */
+
+	{ "na_invoice_5.5x8.5in", FALSE },	/* Statement */
+	{ "na_executive_7.25x10.5in", FALSE },	/* Executive */
+	{ "iso_a3_297x420mm", FALSE },
+	{ "iso_a4_210x297mm", FALSE },
+	{ "iso_a4_210x297mm", FALSE },		/* A4 small */
+
+	{ "iso_a5_148x210mm", FALSE },
+	{ "iso_b4_250x353mm", FALSE },
+	{ "iso_b5_176x250mm", FALSE },
+	{ "na_foolscap_8.5x13in", FALSE },	/* Folio */
+	{ "na_quarto_8.5x10.83in", FALSE },	/* Quarto */
+
+	{ "na_10x14_10x14in",  FALSE },	/* 10x14 */
+	{ "na_ledger_11x17in", FALSE },	/* 11x17 */
+	{ "na_letter_8.5x11in", FALSE },	/* Note */
+	{ "na_number-9_3.875x8.875in", FALSE},	/* Envelope #9 */
+	{ "na_number-10_4.125x9.5in", FALSE},	/* Envelope #10 */
+	{ "na_number-11_4.5x10.375in", FALSE},	/* Envelope #11 */
+	{ "na_number-12_4.75x11in", FALSE },	/* Envelope #12 */
+	{ "na_number-14_5x11.5in", FALSE },	/* Envelope #14 */
+	{ "na_c_17x22in", FALSE },	/* C */
+	{ "na_d_22x34in", FALSE },	/* D */
+	{ "na_e_34x44in", FALSE },	/* E */
+
+	{ "iso_dl_110x220mm", FALSE },		/* Envelope DL */
+	{ "iso_c5_162x229mm", FALSE },		/* Envelope C5 */
+	{ "iso_c3_324x458mm", FALSE },		/* Envelope C3 */
+	{ "iso_c4_229x324mm", FALSE },		/* Envelope C4 */
+
+	{ "iso_c6_114x162mm", FALSE },		/* Envelope C6 */
+	{ "iso_c6c5_114x229mm", FALSE },	/* Envelope C6/C5 */
+	{ "iso_b4_250x353mm", FALSE },
+	{ "iso_b5_176x250mm", FALSE },
+	{ "iso_b6_125x176mm", FALSE },
+
+	{ "om_italian_110x230mm", FALSE },	/* Envelope Italy */
+	{ "na_monarch_3.875x7.5in", FALSE },	/* Envelope Monarch */
+	{ "na_personal_3.625x6.5in", FALSE },	/* 6 1/2 Envelope */
+	{ "na_fanfold-us_11x14.875in", TRUE },	/* US Standard Fanfold ROTATED */
+	{ "na_fanfold-eur_8.5x12in", FALSE },	/* German Std Fanfold */
+
+	{ "na_foolscap_8.5x13in", FALSE },	/* German Legal Fanfold */
+	{ "iso_b4_250x353mm", FALSE },		/* Yes, twice... */
+	{ "jpn_hagaki_100x148mm", FALSE },	/* Japanese Postcard */
+	{ "na_9x11_9x11in", FALSE },	/* 9x11 */
+	{ "na_10x11_10x11in", FALSE },	/* 10x11 */
+
+	{ "na_11x15_11x15in", FALSE },	/* 15x11 switch landscape */
+	{ "om_invite_220x220mm", FALSE },	/* Envelope Invite */
+	{ NULL, FALSE},		/* undefined */
+	{ NULL, FALSE },		/* undefined */
+	{ "na_letter-extra_9.5x12in", FALSE },	/* Letter Extra */
+
+	{ "na_legal-extra_9.5x15in", FALSE },	/* Legal Extra */
+	{ "na_arch-b_12x18in", FALSE },	/* Tabloid Extra */
+	{ "iso_a4_extra_235.5x322.3mm", FALSE },	/* A4 Extra */
+	{ "na_letter_8.5x11in", FALSE },	/* Letter Transverse */
+	{ "iso_a4_210x297mm", FALSE },		/* A4 Transverse */
+
+	{ "na_letter-extra_9.5x12in", FALSE },	/* Letter Extra Transverse */
+	{ "custom_super-aa4_227x356mm", FALSE },	/* Super A/A4 */
+	{ "custom_super-ba3_305x487mm", FALSE },	/* Super B/A3 */
+	{ "na_letter-plus_8.5x12.69in", FALSE },	/* Letter Plus */
+	{ "om_folio_210x330mm", FALSE },	/* A4 Plus */
+
+	{ "iso_a5_148x210mm", FALSE },		/* A5 Transverse */
+	{ "jis_b5_182x257mm", FALSE },		/* B5 (JIS) Transverse */
+	{ "iso_a3-extra_322x455mm", FALSE },	/* A3 Extra */
+	{ "iso_a5-extra_174x235mm", FALSE },	/* A5 Extra */
+	{ "iso_b5-extra_201x276mm", FALSE },	/* B5 (ISO) Extra */
+
+	{ "iso_a2_420x594mm", FALSE },
+	{ "iso_a3_297x420mm", FALSE },		/* A3 Transverse */
+	{ "iso_a3-extra_322x455mm", FALSE },	/* A3 Extra Transverse */
+	{ "jpn_oufuku_148x200mm", TRUE },	/* Dbl. Japanese Postcard ROTATED */
+	{ "iso_a6_105x148mm", FALSE },
+
+	{ NULL, FALSE },		/* FIXME: No documentation found */
+	{ NULL, FALSE },		/* FIXME: No documentation found */
+	{ NULL, FALSE },		/* FIXME: No documentation found */
+	{ NULL, FALSE },		/* FIXME: No documentation found */
+	{ "na_letter_8.5x11in", TRUE },	/* Letter Rotated */
+
+	{ "iso_a3_297x420mm", TRUE },	/* A3 Rotated */
+	{ "iso_a4_210x297mm", TRUE },	/* A4 Rotated */
+	{ "iso_a5_148x210mm", TRUE },	/* A5 Rotated */
+	{ "jis_b4_257x364mm", TRUE },	/* B4 (JIS) Rotated */
+	{ "jis_b5_182x257mm", TRUE },	/* B5 (JIS) Rotated */
+
+	{ "jpn_hagaki_100x148mm", TRUE },	/* Japanese Postcard Rotated */
+	{ "jpn_oufuku_148x200mm", FALSE },	/* Dbl. Jap. Postcard*/
+	{ "iso_a6_105x148mm", TRUE },	/* A6 Rotated */
+	{ NULL, FALSE },		/* FIXME: No documentation found */
+	{ NULL, FALSE },		/* FIXME: No documentation found */
+
+
+	{ NULL, FALSE },		/* FIXME: No documentation found */
+	{ NULL, FALSE },		/* FIXME: No documentation found */
+	{ "jis_b6_128x182mm", FALSE },		/* B6 (JIS) */
+	{ "jis_b6_128x182mm", TRUE },	/* B6 (JIS) Rotated */
+	{ "na_11x12_11x12in", TRUE },	/* 12x11 ROTATED */
+};
+
+
+const char *
+xls_paper_name (unsigned idx, gboolean *rotated)
+{
+	if (idx < G_N_ELEMENTS (paper_size_table)) {
+		*rotated = paper_size_table[idx].rotated;
+		return paper_size_table[idx].gp_name;
+	} else {
+		*rotated = FALSE;
+		return NULL;
+	}
+}
+
+unsigned
+xls_paper_size (GtkPaperSize *ps, gboolean rotated)
+{
+	const char *name = gtk_paper_size_get_name (ps);
+	size_t name_len = strlen (name);
+	double w = gtk_paper_size_get_width (ps, GTK_UNIT_MM);
+	double h = gtk_paper_size_get_height (ps, GTK_UNIT_MM);
+	unsigned ui;
+
+	for (ui = 0; ui < G_N_ELEMENTS (paper_size_table); ui++) {
+		const char *thisname = paper_size_table[ui].gp_name;
+		GtkPaperSize *tps;
+		double d, tw, th;
+
+		if (!thisname ||
+		    strncmp (name, thisname, name_len) != 0 ||
+		    thisname[name_len] != '_')
+			continue;
+
+		if (rotated != paper_size_table[ui].rotated)
+			continue;
+
+		tps = gtk_paper_size_new (thisname);
+		tw = gtk_paper_size_get_width (tps, GTK_UNIT_MM);
+		th = gtk_paper_size_get_height (tps, GTK_UNIT_MM);
+		gtk_paper_size_free (tps);
+		d = hypot (w - tw, h - th);
+		if (d < 2.0) {
+			return ui;
+		}
+	}
+
+	return 0;
+}
diff --git a/plugins/excel/ms-excel-util.h b/plugins/excel/ms-excel-util.h
index 7dcbcf9..534af8a 100644
--- a/plugins/excel/ms-excel-util.h
+++ b/plugins/excel/ms-excel-util.h
@@ -93,4 +93,13 @@ typedef struct {
 XL_font_width const *xl_lookup_font_specs   (char const *name);
 void		     destroy_xl_font_widths (void);
 
+
+/*****************************************************************************/
+
+const char *xls_paper_name (unsigned idx, gboolean *rotated);
+unsigned xls_paper_size (GtkPaperSize *ps, gboolean rotated);
+
+/*****************************************************************************/
+
+
 #endif /* GNM_MS_EXCEL_UTIL_H */
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index d1b43ad..c27380e 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -483,11 +483,15 @@ excel_write_SETUP (BiffPut *bp, ExcelWriteSheet *esheet)
 	guint8 *data = ms_biff_put_len_next (bp, BIFF_SETUP, 34);
 	guint16 flags = 0;
 	guint16 scale = 100;
+	guint16 papersize = 0; 	/* _invalid_ paper size */
 
 	if (NULL != esheet)
 		pi = esheet->gnum_sheet->print_info;
 	if (NULL != pi) {
 		GtkPageOrientation orient;
+		GtkPaperSize *ps;
+		gboolean rotated = FALSE; /* ??? */
+
 		if (pi->print_across_then_down)
 			flags |= 0x01;
 		orient = print_info_get_paper_orientation (pi);
@@ -517,17 +521,21 @@ excel_write_SETUP (BiffPut *bp, ExcelWriteSheet *esheet)
 			scale = pi->scaling.percentage.x + .5;
 		print_info_get_margins (pi, &header, &footer,
 					NULL, NULL, NULL, NULL);
+
+		ps = print_info_get_paper_size (pi);
+		if (ps)
+			papersize = xls_paper_size (ps, rotated);
 	} else
 		flags |= 0x44;  /* mark orientation, copies, and start page as being invalid */
 	header = points_to_inches (header);
 	footer = points_to_inches (footer);
 
-	GSF_LE_SET_GUINT16 (data +  0, 0);	/* _invalid_ paper size */
+	GSF_LE_SET_GUINT16 (data +  0, papersize);
 	GSF_LE_SET_GUINT16 (data +  2, scale);	/* scaling factor */
 	GSF_LE_SET_GUINT16 (data +  4, pi ? pi->start_page : 0);
 	GSF_LE_SET_GUINT16 (data +  6, pi ? pi->scaling.dim.cols : 1);
 	GSF_LE_SET_GUINT16 (data +  8, pi ? pi->scaling.dim.rows : 1);
-	GSF_LE_SET_GUINT32 (data + 10, (guint32)flags);
+	GSF_LE_SET_GUINT16 (data + 10, flags);
 	GSF_LE_SET_GUINT32 (data + 12, 600);	/* guess x resolution */
 	GSF_LE_SET_GUINT32 (data + 14, 600);	/* guess y resolution */
 	gsf_le_set_double  (data + 16, header);
diff --git a/src/print-info.c b/src/print-info.c
index 2a8ada1..495dd59 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -1236,6 +1236,16 @@ print_info_get_paper (PrintInformation *pi)
 	return page_setup_get_paper (pi->page_setup);
 }
 
+GtkPaperSize *
+print_info_get_paper_size (PrintInformation *pi)
+{
+	g_return_val_if_fail (pi != NULL, NULL);
+	print_info_load_defaults (pi);
+
+	return gtk_page_setup_get_paper_size (pi->page_setup);
+}
+
+
 char  const*
 print_info_get_paper_display_name (PrintInformation *pi)
 {
diff --git a/src/print-info.h b/src/print-info.h
index 05a81c1..6ecda8a 100644
--- a/src/print-info.h
+++ b/src/print-info.h
@@ -162,6 +162,7 @@ gboolean    page_setup_set_paper (GtkPageSetup *page_setup, char const *paper);
 char	   *page_setup_get_paper (GtkPageSetup *page_setup); /* caller frees result */
 gboolean    print_info_set_paper (PrintInformation *pi, char const *paper);
 char       *print_info_get_paper (PrintInformation *pi); /* caller frees result */
+GtkPaperSize *print_info_get_paper_size (PrintInformation *pi);
 
 void	    print_info_set_paper_orientation   (PrintInformation *pi,
 						GtkPageOrientation orientation);



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