From: Glen Mazza Date: Thu, 10 Feb 2005 17:08:24 +0000 (+0000) Subject: PR: X-Git-Tag: Root_Temp_KnuthStylePageBreaking~92 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=586fbcfa7eb1b846cc12d1218b61e2d9300dd54b;p=xmlgraphics-fop.git PR: Obtained from: Submitted by: Reviewed by: Some simplification to StorePagesModel, removal of not very informative comment in PSLM. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198415 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/area/RenderPagesModel.java b/src/java/org/apache/fop/area/RenderPagesModel.java index b16a1c71a..f32364bd2 100644 --- a/src/java/org/apache/fop/area/RenderPagesModel.java +++ b/src/java/org/apache/fop/area/RenderPagesModel.java @@ -67,6 +67,7 @@ public class RenderPagesModel extends StorePagesModel { public RenderPagesModel (FOUserAgent userAgent, int renderType, FontInfo fontInfo, OutputStream stream) throws FOPException { + super(); renderer = RendererFactory.createRenderer(userAgent, renderType); try { @@ -220,12 +221,12 @@ public class RenderPagesModel extends StorePagesModel { processOffDocumentItems(pendingODI); pendingODI.clear(); processOffDocumentItems(endDocODI); - + try { renderer.stopRenderer(); } catch (IOException ex) { throw new SAXException(ex); - } + } } } diff --git a/src/java/org/apache/fop/area/StorePagesModel.java b/src/java/org/apache/fop/area/StorePagesModel.java index 922e29441..90491b77e 100644 --- a/src/java/org/apache/fop/area/StorePagesModel.java +++ b/src/java/org/apache/fop/area/StorePagesModel.java @@ -34,8 +34,8 @@ import org.apache.commons.logging.LogFactory; * The pages are stored and can be retrieved in any order. */ public class StorePagesModel extends AreaTreeModel { - private List pageSequence = null; - private List currSequence; + private List pageSequenceList = null; + private List currentPageSequencePageList; private List offDocumentItems = new java.util.ArrayList(); protected static Log log = LogFactory.getLog(StorePagesModel.class); @@ -44,6 +44,7 @@ public class StorePagesModel extends AreaTreeModel { * Create a new store pages model */ public StorePagesModel() { + pageSequenceList = new java.util.ArrayList(); } /** @@ -52,11 +53,8 @@ public class StorePagesModel extends AreaTreeModel { * @param title the title of the page sequence. */ public void startPageSequence(LineArea title) { - if (pageSequence == null) { - pageSequence = new java.util.ArrayList(); - } - currSequence = new java.util.ArrayList(); - pageSequence.add(currSequence); + currentPageSequencePageList = new java.util.ArrayList(); + pageSequenceList.add(currentPageSequencePageList); } /** @@ -64,7 +62,7 @@ public class StorePagesModel extends AreaTreeModel { * @param page the page to add to the current page sequence */ public void addPage(PageViewport page) { - currSequence.add(page); + currentPageSequencePageList.add(page); } /** @@ -72,7 +70,7 @@ public class StorePagesModel extends AreaTreeModel { * @return the number of page sequences in the document. */ public int getPageSequenceCount() { - return pageSequence.size(); + return pageSequenceList.size(); } /** @@ -81,7 +79,7 @@ public class StorePagesModel extends AreaTreeModel { * @return returns the number of pages in a page sequence */ public int getPageCount(int seq) { - List sequence = (List) pageSequence.get(seq - 1); + List sequence = (List) pageSequenceList.get(seq - 1); return sequence.size(); } @@ -92,7 +90,7 @@ public class StorePagesModel extends AreaTreeModel { * @return the PageViewport for the particular page */ public PageViewport getPage(int seq, int count) { - List sequence = (List) pageSequence.get(seq - 1); + List sequence = (List) pageSequenceList.get(seq - 1); return (PageViewport) sequence.get(count); } @@ -100,36 +98,14 @@ public class StorePagesModel extends AreaTreeModel { * @see org.apache.fop.area.AreaTreeModel#handleOffDocumentItem(OffDocumentItem) */ public void handleOffDocumentItem(OffDocumentItem ext) { - int seq, page; - switch(ext.getWhenToProcess()) { - case OffDocumentItem.IMMEDIATELY: - seq = pageSequence == null ? 0 : pageSequence.size(); - page = currSequence == null ? 0 : currSequence.size(); - break; - case OffDocumentItem.AFTER_PAGE: - break; - case OffDocumentItem.END_OF_DOC: - break; - } offDocumentItems.add(ext); } /** - * Get the list of OffDocumentItems that apply at a particular - * position in the document. - * @param seq the page sequence number - * @param count the page count in the sequence + * Get the list of OffDocumentItems for this StorePagesModel. * @return the list of OffDocumentItems */ - public List getOffDocumentItems(int seq, int count) { - return null; - } - - /** - * Get the end of document OffDocumentItems for this store pages model. - * @return the list of end OffDocumentItems - */ - public List getEndOffDocumentItems() { + public List getOffDocumentItems() { return offDocumentItems; } diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java index 3e99fe44e..7e5026901 100644 --- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java @@ -202,7 +202,6 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager { areaTreeModel.startPageSequence(title); log.debug("Starting layout"); - // this should be done another way makeNewPage(false, false); createBodyMainReferenceArea(); createSpan(1);