1 45 46 package com.lowagie.text.rtf; 47 48 import java.util.Properties ; 49 50 import com.lowagie.text.BadElementException; 51 import com.lowagie.text.Cell; 52 import com.lowagie.text.Element; 53 54 60 public class RtfTableCell extends Cell 61 { 62 63 64 65 public static final int BORDER_UNDEFINED = 0; 66 67 68 public static final int BORDER_SINGLE = 1; 69 70 71 public static final int BORDER_DOUBLE_THICK = 2; 72 73 74 public static final int BORDER_SHADOWED = 3; 75 76 77 public static final int BORDER_DOTTED = 4; 78 79 80 public static final int BORDER_DASHED = 5; 81 82 83 public static final int BORDER_HAIRLINE = 6; 84 85 86 public static final int BORDER_DOUBLE = 7; 87 88 89 public static final int BORDER_DOT_DASH = 8; 90 91 92 public static final int BORDER_DOT_DOT_DASH = 9; 93 94 95 public static final int BORDER_TRIPLE = 10; 96 97 98 public static final int BORDER_THICK_THIN = 11; 99 100 101 public static final int BORDER_THIN_THICK = 12; 102 103 104 public static final int BORDER_THIN_THICK_THIN = 13; 105 106 107 public static final int BORDER_THICK_THIN_MED = 14; 108 109 110 public static final int BORDER_THIN_THICK_MED = 15; 111 112 113 public static final int BORDER_THIN_THICK_THIN_MED = 16; 114 115 116 public static final int BORDER_THICK_THIN_LARGE = 17; 117 118 119 public static final int BORDER_THIN_THICK_LARGE = 18; 120 121 122 public static final int BORDER_THIN_THICK_THIN_LARGE = 19; 123 124 125 public static final int BORDER_WAVY = 20; 126 127 128 public static final int BORDER_DOUBLE_WAVY = 21; 129 130 131 public static final int BORDER_STRIPED = 22; 132 133 134 public static final int BORDER_EMBOSS = 23; 135 136 137 public static final int BORDER_ENGRAVE = 24; 138 139 140 private float topBorderWidth; 141 private float leftBorderWidth; 142 private float rightBorderWidth; 143 private float bottomBorderWidth; 144 private int topBorderStyle = 1; 145 private int leftBorderStyle = 1; 146 private int rightBorderStyle = 1; 147 private int bottomBorderStyle = 1; 148 149 154 155 public RtfTableCell(boolean dummy) { 156 super(dummy); 157 } 158 159 168 public RtfTableCell(Element element) throws BadElementException { 169 super(element); 170 } 171 172 179 public RtfTableCell(String content) { 180 super(content); 181 } 182 183 189 190 public RtfTableCell(Properties attributes) { 191 super(attributes); 192 } 193 194 199 public void setBorderWidth(float f) { 200 super.setBorderWidth(f); 201 topBorderWidth = f; 202 leftBorderWidth = f; 203 rightBorderWidth = f; 204 bottomBorderWidth = f; 205 } 206 207 212 public void setTopBorderWidth(float f) { 213 topBorderWidth = f; 214 } 215 216 220 public float topBorderWidth() { 221 return topBorderWidth; 222 } 223 224 229 public void setLeftBorderWidth(float f) { 230 leftBorderWidth = f; 231 } 232 233 237 public float leftBorderWidth() { 238 return leftBorderWidth; 239 } 240 241 246 public void setRightBorderWidth(float f) { 247 rightBorderWidth = f; 248 } 249 250 254 public float rightBorderWidth() { 255 return rightBorderWidth; 256 } 257 258 263 public void setBottomBorderWidth(float f) { 264 bottomBorderWidth = f; 265 } 266 267 271 public float bottomBorderWidth() { 272 return bottomBorderWidth; 273 } 274 275 280 public void setBorderStyle(int style) { 281 topBorderStyle = style; 282 leftBorderStyle = style; 283 rightBorderStyle = style; 284 bottomBorderStyle = style; 285 } 286 287 292 public void setTopBorderStyle(int style) { 293 topBorderStyle = style; 294 } 295 296 300 public int topBorderStyle() { 301 return topBorderStyle; 302 } 303 304 309 public void setLeftBorderStyle(int style) { 310 leftBorderStyle = style; 311 } 312 313 317 public int leftBorderStyle() { 318 return leftBorderStyle; 319 } 320 321 326 public void setRightBorderStyle(int style) { 327 rightBorderStyle = style; 328 } 329 330 334 public int rightBorderStyle() { 335 return rightBorderStyle; 336 } 337 338 343 public void setBottomBorderStyle(int style) { 344 bottomBorderStyle = style; 345 } 346 347 351 public int bottomBorderStyle() { 352 return bottomBorderStyle; 353 } 354 355 360 protected static byte[] getStyleControlWord(int style) { 361 switch(style) 362 { 363 case BORDER_UNDEFINED : return "brdrs".getBytes(); 364 case BORDER_SINGLE : return "brdrs".getBytes(); 365 case BORDER_DOUBLE_THICK : return "brdrth".getBytes(); 366 case BORDER_SHADOWED : return "brdrsh".getBytes(); 367 case BORDER_DOTTED : return "brdrdot".getBytes(); 368 case BORDER_DASHED : return "brdrdash".getBytes(); 369 case BORDER_HAIRLINE : return "brdrhair".getBytes(); 370 case BORDER_DOUBLE : return "brdrdb".getBytes(); 371 case BORDER_DOT_DASH : return "brdrdashd".getBytes(); 372 case BORDER_DOT_DOT_DASH : return "brdrdashdd".getBytes(); 373 case BORDER_TRIPLE : return "brdrtriple".getBytes(); 374 case BORDER_THICK_THIN : return "brdrtnthsg".getBytes(); 375 case BORDER_THIN_THICK : return "brdrthtnsg".getBytes(); 376 case BORDER_THIN_THICK_THIN : return "brdrtnthtnsg".getBytes(); 377 case BORDER_THICK_THIN_MED : return "brdrtnthmg".getBytes(); 378 case BORDER_THIN_THICK_MED : return "brdrthtnmg".getBytes(); 379 case BORDER_THIN_THICK_THIN_MED : return "brdrtnthtnmg".getBytes(); 380 case BORDER_THICK_THIN_LARGE : return "brdrtnthlg".getBytes(); 381 case BORDER_THIN_THICK_LARGE : return "brdrthtnlg".getBytes(); 382 case BORDER_THIN_THICK_THIN_LARGE : return "brdrtnthtnlg".getBytes(); 383 case BORDER_WAVY : return "brdrwavy".getBytes(); 384 case BORDER_DOUBLE_WAVY : return "brdrwavydb".getBytes(); 385 case BORDER_STRIPED : return "brdrdashdotstr".getBytes(); 386 case BORDER_EMBOSS : return "brdremboss".getBytes(); 387 case BORDER_ENGRAVE : return "brdrengrave".getBytes(); 388 } 389 390 return "brdrs".getBytes(); 391 } 392 } 393 | Popular Tags |