1 17 18 19 20 package org.apache.fop.area; 21 22 import java.util.List ; 24 25 import org.xml.sax.SAXException ; 27 28 import org.apache.commons.logging.Log; 30 import org.apache.commons.logging.LogFactory; 31 32 40 public class AreaTreeModel { 41 private List pageSequenceList = null; 42 private int currentPageSequenceIndex = -1; 43 44 protected PageSequence currentPageSequence; 45 private List offDocumentItems = new java.util.ArrayList (); 46 47 protected static Log log = LogFactory.getLog(AreaTreeModel.class); 48 49 52 public AreaTreeModel() { 53 pageSequenceList = new java.util.ArrayList (); 54 } 55 56 60 public void startPageSequence(LineArea title) { 61 currentPageSequence = new PageSequence(title); 62 pageSequenceList.add(currentPageSequence); 63 currentPageSequenceIndex = pageSequenceList.size() - 1; 64 } 65 66 70 public void addPage(PageViewport page) { 71 currentPageSequence.addPage(page); 72 int pageIndex = 0; 73 for (int i = 0; i < currentPageSequenceIndex; i++) { 74 pageIndex += ((PageSequence)pageSequenceList.get(i)).getPageCount(); 75 } 76 pageIndex += currentPageSequence.getPageCount() - 1; 77 page.setPageIndex(pageIndex); 78 page.setPageSequence(currentPageSequence); 79 } 80 81 85 public void handleOffDocumentItem(OffDocumentItem ext) {}; 86 87 91 public void endDocument() throws SAXException {}; 92 93 97 public int getPageSequenceCount() { 98 return pageSequenceList.size(); 99 } 100 101 106 public int getPageCount(int seq) { 107 PageSequence sequence = (PageSequence)pageSequenceList.get(seq - 1); 108 return sequence.getPageCount(); 109 } 110 111 117 public PageViewport getPage(int seq, int count) { 118 PageSequence sequence = (PageSequence)pageSequenceList.get(seq - 1); 119 return sequence.getPage(count); 120 } 121 } 122 | Popular Tags |