/** * Adds an <CODE>Object</CODE> to the <CODE>List</CODE>. * * @param o the object to add. * @return true if adding the object succeeded */ public override bool Add(Object o) { if (o is ListItem) { ListItem item = (ListItem)o; Chunk chunk; if (greeklower) { chunk = SpecialSymbol.Get((char)(first + list.Count + 944), symbol.Font); } else { chunk = SpecialSymbol.Get((char)(first + list.Count + 912), symbol.Font); } chunk.Append("."); item.ListSymbol = chunk; item.IndentationLeft = symbolIndent; item.IndentationRight = 0; list.Add(item); return(true); } else if (o is List) { List nested = (List)o; nested.IndentationLeft = nested.IndentationLeft + symbolIndent; first--; list.Add(nested); return(true); } else if (o is string) { return(this.Add(new ListItem((string)o))); } return(false); }
/** * Gets a special kind of Phrase that changes some characters into corresponding symbols. * @param leading * @param string * @param font * @return a newly constructed Phrase */ public static Phrase GetInstance(int leading, String str, Font font) { Phrase p = new Phrase(true); p.Leading = leading; p.font = font; if (font.Family != Font.FontFamily.SYMBOL && font.Family != Font.FontFamily.ZAPFDINGBATS && font.BaseFont == null) { int index; while ((index = SpecialSymbol.Index(str)) > -1) { if (index > 0) { String firstPart = str.Substring(0, index); p.Add(new Chunk(firstPart, font)); str = str.Substring(index); } Font symbol = new Font(Font.FontFamily.SYMBOL, font.Size, font.Style, font.Color); StringBuilder buf = new StringBuilder(); buf.Append(SpecialSymbol.GetCorrespondingSymbol(str[0])); str = str.Substring(1); while (SpecialSymbol.Index(str) == 0) { buf.Append(SpecialSymbol.GetCorrespondingSymbol(str[0])); str = str.Substring(1); } p.Add(new Chunk(buf.ToString(), symbol)); } } if (!string.IsNullOrEmpty(str)) { p.Add(new Chunk(str, font)); } return(p); }
/** * Gets a chunk with a symbol character. * @param c a character that has to be changed into a symbol * @param font Font if there is no SYMBOL character corresponding with c * @return a SYMBOL version of a character */ public static Chunk Get(char c, Font font) { char greek = SpecialSymbol.GetCorrespondingSymbol(c); if (greek == ' ') { return(new Chunk(c.ToString(), font)); } Font symbol = new Font(Font.FontFamily.SYMBOL, font.Size, font.Style, font.Color); return(new Chunk(greek.ToString(), symbol)); }
/** * Gets a special kind of Phrase that changes some characters into corresponding symbols. * @param leading * @param string * @param font * @return a newly constructed Phrase */ public static Phrase GetInstance(int leading, String str, Font font) { Phrase p = new Phrase(true); p.Leading = leading; p.font = font; if (font.Family != Font.SYMBOL && font.Family != Font.ZAPFDINGBATS && font.BaseFont == null) { int index; while ((index = SpecialSymbol.Index(str)) > -1) { if (index > 0) { string firstPart = str.Substring(0, index); /* bugfix [ #461272 ] CODE CHANGE REQUIRED IN Phrase.java * by Arekh Nambiar */ ((ArrayList)p).Add(new Chunk(firstPart, font)); str = str.Substring(index); } Font symbol = new Font(Font.SYMBOL, font.Size, font.Style, font.Color); StringBuilder buf = new StringBuilder(); buf.Append(SpecialSymbol.GetCorrespondingSymbol(str[0])); str = str.Substring(1); while (SpecialSymbol.Index(str) == 0) { buf.Append(SpecialSymbol.GetCorrespondingSymbol(str[0])); str = str.Substring(1); } ((ArrayList)p).Add(new Chunk(buf.ToString(), symbol)); } } /* bugfix by August Detlefsen */ if (str != null && str.Length != 0) { ((ArrayList)p).Add(new Chunk(str, font)); } return(p); }