1 17 18 19 20 package org.apache.fop.render.rtf.rtflib.rtfdoc; 21 22 28 29 import java.util.Map ; 30 import java.util.HashMap ; 31 import java.util.Iterator ; 32 import java.io.Writer ; 33 import java.io.IOException ; 34 36 41 42 class RtfHeader extends RtfContainer { 43 private final String charset = "ansi"; 44 private final Map userProperties = new HashMap (); 45 46 47 RtfHeader(RtfFile f, Writer w) throws IOException { 48 super(f, w); 49 new RtfFontTable(this, w); 50 new RtfGenerator(this, w); 51 } 53 54 55 protected void writeRtfContent() throws IOException { 56 writeControlWord(charset); 57 writeUserProperties(); 58 RtfColorTable.getInstance().writeColors(this); 59 super.writeRtfContent(); 60 RtfTemplate.getInstance().writeTemplate(this); 61 RtfStyleSheetTable.getInstance().writeStyleSheet(this); 62 writeFootnoteProperties(); 63 64 } 65 66 67 private void writeUserProperties() throws IOException { 68 if (userProperties.size() > 0) { 69 writeGroupMark(true); 70 writeStarControlWord("userprops"); 71 for (Iterator it = userProperties.entrySet().iterator(); it.hasNext();) { 72 final Map.Entry entry = (Map.Entry )it.next(); 73 writeGroupMark(true); 74 writeControlWord("propname"); 75 RtfStringConverter.getInstance().writeRtfString(writer, 76 entry.getKey().toString()); 77 writeGroupMark(false); 78 writeControlWord("proptype30"); 79 writeGroupMark(true); 80 writeControlWord("staticval"); 81 RtfStringConverter.getInstance().writeRtfString(writer, 82 entry.getValue().toString()); 83 writeGroupMark(false); 84 } 85 writeGroupMark(false); 86 } 87 } 88 89 93 void write(String toWrite) throws IOException { 94 writer.write(toWrite); 95 } 96 97 98 void writeRtfString(String toWrite) throws IOException { 99 RtfStringConverter.getInstance().writeRtfString(writer, toWrite); 100 } 101 102 105 private void writeFootnoteProperties() throws IOException { 106 newLine(); 107 writeControlWord("fet0"); writeControlWord("ftnbj"); } 112 } 113 | Popular Tags |