1 package com.nwalsh.xalan; 2 3 import org.xml.sax.helpers.AttributesImpl ; 4 import org.xml.sax.SAXException ; 5 import org.w3c.dom.*; 6 import org.apache.xml.utils.DOMBuilder; 7 import com.nwalsh.xalan.Callout; 8 import org.apache.xml.utils.AttList; 9 10 30 31 public class FormatDingbatCallout extends FormatCallout { 32 int graphicsMax = 0; 33 34 public FormatDingbatCallout(int max, boolean fo) { 35 graphicsMax = max; 36 stylesheetFO = fo; 37 } 38 39 public void formatCallout(DOMBuilder rtf, 40 Callout callout) { 41 Element area = callout.getArea(); 42 int num = callout.getCallout(); 43 String label = areaLabel(area); 44 45 try { 46 if (label == null && num <= graphicsMax) { 47 AttributesImpl imgAttr = new AttributesImpl (); 48 String ns = ""; 49 String prefix = ""; 50 String imgName = ""; 51 52 if (stylesheetFO) { 53 ns = foURI; 54 prefix = "fo:"; imgName = "inline"; 56 imgAttr.addAttribute("", "font-family", "font-family", "CDATA", 57 "ZapfDingbats"); 58 } else { 59 ns = ""; 60 prefix = ""; 61 imgName = "font"; 62 imgAttr.addAttribute("", "face", "face", "CDATA", 63 "ZapfDingbats"); 64 } 65 66 startSpan(rtf); 67 rtf.startElement(ns, imgName, prefix+imgName, imgAttr); 68 69 char chars[] = new char[1]; 70 chars[0] = (char) (0x2775 + num); 71 rtf.characters(chars, 0, 1); 72 73 rtf.endElement(ns, imgName, prefix+imgName); 74 endSpan(rtf); 75 } else { 76 formatTextCallout(rtf, callout); 77 } 78 } catch (SAXException e) { 79 System.out.println("SAX Exception in graphics formatCallout"); 80 } 81 } 82 } 83 | Popular Tags |