1 50 51 package com.lowagie.text.pdf.events; 52 53 import java.util.ArrayList ; 54 import java.util.Iterator ; 55 56 import com.lowagie.text.Document; 57 import com.lowagie.text.Paragraph; 58 import com.lowagie.text.Rectangle; 59 import com.lowagie.text.pdf.PdfPageEvent; 60 import com.lowagie.text.pdf.PdfWriter; 61 62 68 69 public class PdfPageEventForwarder implements PdfPageEvent { 70 71 72 protected ArrayList events = new ArrayList (); 73 74 78 public void addPageEvent(PdfPageEvent event) { 79 events.add(event); 80 } 81 82 90 public void onOpenDocument(PdfWriter writer, Document document) { 91 PdfPageEvent event; 92 for (Iterator i = events.iterator(); i.hasNext(); ) { 93 event = (PdfPageEvent)i.next(); 94 event.onOpenDocument(writer, document); 95 } 96 } 97 98 109 public void onStartPage(PdfWriter writer, Document document) { 110 PdfPageEvent event; 111 for (Iterator i = events.iterator(); i.hasNext(); ) { 112 event = (PdfPageEvent)i.next(); 113 event.onStartPage(writer, document); 114 } 115 } 116 117 126 public void onEndPage(PdfWriter writer, Document document) { 127 PdfPageEvent event; 128 for (Iterator i = events.iterator(); i.hasNext(); ) { 129 event = (PdfPageEvent)i.next(); 130 event.onEndPage(writer, document); 131 } 132 } 133 134 145 public void onCloseDocument(PdfWriter writer, Document document) { 146 PdfPageEvent event; 147 for (Iterator i = events.iterator(); i.hasNext(); ) { 148 event = (PdfPageEvent)i.next(); 149 event.onCloseDocument(writer, document); 150 } 151 } 152 153 167 public void onParagraph(PdfWriter writer, Document document, 168 float paragraphPosition) { 169 PdfPageEvent event; 170 for (Iterator i = events.iterator(); i.hasNext(); ) { 171 event = (PdfPageEvent)i.next(); 172 event.onParagraph(writer, document, paragraphPosition); 173 } 174 } 175 176 189 public void onParagraphEnd(PdfWriter writer, Document document, 190 float paragraphPosition) { 191 PdfPageEvent event; 192 for (Iterator i = events.iterator(); i.hasNext(); ) { 193 event = (PdfPageEvent)i.next(); 194 event.onParagraphEnd(writer, document, paragraphPosition); 195 } 196 } 197 198 213 public void onChapter(PdfWriter writer, Document document, 214 float paragraphPosition, Paragraph title) { 215 PdfPageEvent event; 216 for (Iterator i = events.iterator(); i.hasNext(); ) { 217 event = (PdfPageEvent)i.next(); 218 event.onChapter(writer, document, paragraphPosition, title); 219 } 220 } 221 222 234 public void onChapterEnd(PdfWriter writer, Document document, float position) { 235 PdfPageEvent event; 236 for (Iterator i = events.iterator(); i.hasNext(); ) { 237 event = (PdfPageEvent)i.next(); 238 event.onChapterEnd(writer, document, position); 239 } 240 } 241 242 259 public void onSection(PdfWriter writer, Document document, 260 float paragraphPosition, int depth, Paragraph title) { 261 PdfPageEvent event; 262 for (Iterator i = events.iterator(); i.hasNext(); ) { 263 event = (PdfPageEvent)i.next(); 264 event.onSection(writer, document, paragraphPosition, depth, title); 265 } 266 } 267 268 280 public void onSectionEnd(PdfWriter writer, Document document, float position) { 281 PdfPageEvent event; 282 for (Iterator i = events.iterator(); i.hasNext(); ) { 283 event = (PdfPageEvent)i.next(); 284 event.onSectionEnd(writer, document, position); 285 } 286 } 287 288 304 public void onGenericTag(PdfWriter writer, Document document, 305 Rectangle rect, String text) { 306 PdfPageEvent event; 307 for (Iterator i = events.iterator(); i.hasNext(); ) { 308 event = (PdfPageEvent)i.next(); 309 event.onGenericTag(writer, document, rect, text); 310 } 311 } 312 } | Popular Tags |