1 58 package org.apache.ecs.rtf; 59 60 import org.apache.ecs.ConcreteElement; 61 62 public class RTFDocument 63 { 64 66 67 public static String ANSI = "\\ansi"; 68 69 public static String MAC = "\\mac"; 70 71 public static String PC = "\\pc"; 72 73 public static String PCA = "\\pca"; 74 75 private Info info = new Info(); 76 private Title title = new Title(); 77 private Subject subject = new Subject(); 78 private Comment comment = new Comment(); 79 private Version version = new Version(); 80 81 RTF rtf = new RTF(); 82 83 { 84 rtf.addElement("charSet",ANSI); 85 info.addElement(title); 86 info.addElement(subject); 87 info.addElement(version); 88 info.addElement(comment); 89 rtf.addElement(info); 90 } 91 92 public RTFDocument() 93 { 94 } 95 96 public Info getInfo() 97 { 98 return info; 99 } 100 101 public RTFDocument setTitle(String title) 102 { 103 this.title.addElement(title); 104 return this; 105 } 106 107 public RTFDocument setVersion(int version) 108 { 109 this.version.setVersion(version); 110 return this; 111 } 112 113 public RTFDocument setComment(String comment) 114 { 115 this.comment.addElement("comment",comment); 116 return this; 117 } 118 119 public RTFDocument setSubject(String subject) 120 { 121 this.subject.addElement(subject); 122 return this; 123 } 124 125 public RTFDocument setColorTable(ColorTbl tbl) 126 { 127 rtf.addElement(tbl); 128 return this; 129 } 130 131 public RTFDocument setCharacterSet(String charSet) 132 { 133 rtf.addElement("charSet",charSet); 134 return this; 135 } 136 137 public RTFDocument setCodeSet(String codePage) 138 { 139 rtf.addElement("\\ansicpg"+codePage); 140 return this; 141 } 142 143 public org.apache.ecs.ConcreteElement getElement(String element) 144 { 145 return rtf.getElement(element); 146 } 147 148 public RTFDocument addElement(String element) 149 { 150 rtf.addElement(element); 151 return this; 152 } 153 154 public RTFDocument addElement(String key,String element) 155 { 156 rtf.addElement(key,element); 157 return this; 158 } 159 160 public RTFDocument addElement(RTFElement element) 161 { 162 rtf.addElement(element); 163 return this; 164 } 165 166 public RTFDocument addElement(String key, RTFElement element) 167 { 168 rtf.addElement(key,element); 169 return this; 170 } 171 172 public void output(java.io.OutputStream out) 173 { 174 rtf.output(out); 175 } 176 177 public void output(java.io.PrintWriter out) 178 { 179 rtf.output(out); 180 } 181 } 182 | Popular Tags |