[gnumeric] store page breaks if requested



commit 08171d37f8e6c4f2cbde2ac33adb0a4af5bca5c2
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sun Jun 7 22:56:42 2009 -0600

    store page breaks if requested
    
    2009-06-07  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/print-info.h (gnm_page_breaks_clean): new
    	* src/print-info.c(gnm_page_breaks_clean): new
    	* src/print.c (paginate): store page breaks if requested
    	(compute_sheet_pages): clear page breaks if storage of new ones
    	  is requested
---
 BUGS             |   15 ++++++++-------
 ChangeLog        |    8 ++++++++
 src/print-info.c |   21 +++++++++++++++++++++
 src/print-info.h |    1 +
 src/print.c      |    7 +++++++
 5 files changed, 45 insertions(+), 7 deletions(-)

diff --git a/BUGS b/BUGS
index 539df5c..2f1d366 100644
--- a/BUGS
+++ b/BUGS
@@ -476,12 +476,13 @@ Architecture Changes
 
 17) Explicit Page Breaks
     17.1) Store them in PrintInfo				(DONE)
-    17.2) Respect them
-	17.3.3) ODF
-	    17.2.5.1) Import					(DONE)
-	    17.2.5.2) Export	{merge breaks and styles}
-	17.3.4) Lotus ?
-	17.3.5) Applix ?
+    17.2) Respect them						(DONE)
+    17.3.3) ODF
+    17.3.3.1) Import						(DONE)
+    17.3.3.2) Export	{merge breaks and styles}
+    17.3.4) Lotus ?
+    17.3.5) Applix ?
+    17.3.6) Create User Interface for them
 
 2) stf							{Andreas/Morten}
     2.1) UTF-8 cleanliness					(DONE)
@@ -814,7 +815,7 @@ Architecture Changes
 38) Printing
     38.1) cell text wraps differently when printing than
 	  displaying due to scaling differences in font size.   (DONE)
-    38.2) explicit page breaks
+    38.2) explicit page breaks	    		   		(DONE)
     38.3) PI:comment_placement
     38.4) PI:display_errors
 
diff --git a/ChangeLog b/ChangeLog
index 441980f..5ec1222 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-06-07  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/print-info.h (gnm_page_breaks_clean): new
+	* src/print-info.c(gnm_page_breaks_clean): new
+	* src/print.c (paginate): store page breaks if requested
+	(compute_sheet_pages): clear page breaks if storage of new ones 
+	  is requested
+
+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
diff --git a/src/print-info.c b/src/print-info.c
index 1ba220c..d513597 100644
--- a/src/print-info.c
+++ b/src/print-info.c
@@ -1413,3 +1413,24 @@ gnm_page_break_type_from_str (char const *str)
 		return GNM_PAGE_BREAK_DATA_SLICE;
 	return GNM_PAGE_BREAK_NONE;
 }
+
+
+/**
+ *
+ * Remove all auto page breaks
+ *
+ **/
+
+void		 
+gnm_page_breaks_clean (GnmPageBreaks *breaks)
+{
+	int i;
+	for (i = 0; i < breaks->details->len; i++) {
+		GnmPageBreak *pbreak = &g_array_index (breaks->details, 
+						       GnmPageBreak, i);
+		if (pbreak->type == GNM_PAGE_BREAK_AUTO) {
+			g_array_remove_index (breaks->details, i);
+			i--;
+		}
+	} 
+}
diff --git a/src/print-info.h b/src/print-info.h
index 936c872..19c1321 100644
--- a/src/print-info.h
+++ b/src/print-info.h
@@ -174,6 +174,7 @@ void        print_info_set_breaks (PrintInformation *pi, GnmPageBreaks *breaks);
 GnmPageBreaks	*gnm_page_breaks_new		(gboolean is_vert);
 GnmPageBreaks	*gnm_page_breaks_dup		(GnmPageBreaks const *src);
 void		 gnm_page_breaks_free		(GnmPageBreaks *breaks);
+void		 gnm_page_breaks_clean		(GnmPageBreaks *breaks);
 gboolean	 gnm_page_breaks_append_break	(GnmPageBreaks *breaks,
 						 int pos,
 						 GnmPageBreakType type);
diff --git a/src/print.c b/src/print.c
index 47b7cad..e780440 100644
--- a/src/print.c
+++ b/src/print.c
@@ -696,6 +696,8 @@ paginate (GSList **paginationInfo,
 			page_count++;
 			
 			rc += count;
+			if (store_breaks && (rc < n_end))
+				gnm_page_breaks_set_break (pb, rc, GNM_PAGE_BREAK_AUTO);
 		}
 	}
 
@@ -952,6 +954,11 @@ compute_sheet_pages (GtkPrintContext   *context,
 	repeat_left_start = repeat_left_use ? r.start.col : 0;
 	repeat_left_end = repeat_left_use ? r.end.col : 0;
 
+	if (pi->ignore_pb) {
+		gnm_page_breaks_clean (pinfo->page_breaks.h);
+		gnm_page_breaks_clean (pinfo->page_breaks.v);
+	}
+
 	if (pinfo->scaling.type == PRINT_SCALE_FIT_PAGES) {
 		/* Note that the resulting scale is independent from */
 		/* whether we print first down or across!            */



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