1 17 18 19 20 package org.apache.fop.render.rtf.rtflib.rtfdoc; 21 22 28 29 import java.io.IOException ; 30 import java.io.Writer ; 31 32 36 37 public class RtfPage 38 extends RtfContainer { 39 private final RtfAttributes attrib; 40 41 42 43 public static final String PAGE_WIDTH = "paperw"; 44 45 public static final String PAGE_HEIGHT = "paperh"; 46 47 48 public static final String LANDSCAPE = "landscape"; 49 50 51 public static final String MARGIN_TOP = "margt"; 52 53 public static final String MARGIN_BOTTOM = "margb"; 54 55 public static final String MARGIN_LEFT = "margl"; 56 57 public static final String MARGIN_RIGHT = "margr"; 58 59 60 public static final String HEADERY = "headery"; 61 62 public static final String FOOTERY = "footery"; 63 64 65 public static final String [] PAGE_ATTR = new String []{ 66 PAGE_WIDTH, PAGE_HEIGHT, LANDSCAPE, MARGIN_TOP, MARGIN_BOTTOM, 67 MARGIN_LEFT, MARGIN_RIGHT, HEADERY, FOOTERY 68 }; 69 70 72 RtfPage(RtfPageArea parent, Writer w, RtfAttributes attrs) throws IOException { 73 super((RtfContainer)parent, w); 74 attrib = attrs; 75 } 76 77 82 protected void writeRtfContent() throws IOException { 83 writeAttributes(attrib, PAGE_ATTR); 84 85 if (attrib != null) { 86 Object widthRaw = attrib.getValue(PAGE_WIDTH); 87 Object heightRaw = attrib.getValue(PAGE_HEIGHT); 88 89 if ((widthRaw instanceof Integer ) && (heightRaw instanceof Integer ) 90 && ((Integer ) widthRaw).intValue() > ((Integer ) heightRaw).intValue()) { 91 writeControlWord(LANDSCAPE); 92 } 93 } 94 } 95 96 100 public RtfAttributes getAttributes() { 101 return attrib; 102 } 103 104 110 protected boolean okToWriteRtf() { 111 return true; 112 } 113 114 } 115 | Popular Tags |