1 17 18 19 20 package org.apache.fop.render.rtf.rtflib.rtfdoc; 21 22 28 29 import java.io.IOException ; 31 32 import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfElement; 34 35 38 public class RtfListStyleText extends RtfListStyle { 39 private String text; 40 41 45 public RtfListStyleText(String s) { 46 text = s; 47 } 48 49 55 public void writeListPrefix(RtfListItem item) 56 throws IOException { 57 item.writeControlWord("pnlvlblt"); 59 item.writeControlWord("ilvl0"); 60 item.writeOneAttribute(RtfListTable.LIST_NUMBER, new Integer (item.getNumber())); 61 item.writeOneAttribute("pnindent", 62 item.getParentList().attrib.getValue(RtfListTable.LIST_INDENT)); 63 item.writeControlWord("pnf1"); 64 item.writeGroupMark(true); 65 item.writeOneAttribute(RtfListTable.LIST_FONT_TYPE, "2"); 67 item.writeControlWord("pntxtb"); 68 RtfStringConverter.getInstance().writeRtfString(item.writer, text); 69 item.writeGroupMark(false); 70 } 71 72 79 public void writeParagraphPrefix(RtfElement element) 80 throws IOException { 81 element.writeGroupMark(true); 82 element.writeControlWord("pntext"); 83 element.writeGroupMark(false); 84 } 85 86 93 public void writeLevelGroup(RtfElement element) 94 throws IOException { 95 element.attrib.set(RtfListTable.LIST_NUMBER_TYPE, 23); 96 element.writeGroupMark(true); 97 98 String sCount; 99 if (text.length() < 10) { 100 sCount = "0" + String.valueOf(text.length()); 101 } else { 102 sCount = String.valueOf(Integer.toHexString(text.length())); 103 if (sCount.length() == 1) { 104 sCount = "0" + sCount; 105 } 106 } 107 element.writeOneAttributeNS( 108 RtfListTable.LIST_TEXT_FORM, "\\'" + sCount 109 + RtfStringConverter.getInstance().escape(text)); 110 element.writeGroupMark(false); 111 112 element.writeGroupMark(true); 113 element.writeOneAttributeNS(RtfListTable.LIST_NUM_POSITION, null); 114 element.writeGroupMark(false); 115 116 element.attrib.set(RtfListTable.LIST_FONT_TYPE, 2); 117 } 118 } 119 | Popular Tags |