01: package com.nwalsh.xalan;
02:
03: import org.xml.sax.SAXException;
04: import org.w3c.dom.*;
05: import org.apache.xml.utils.DOMBuilder;
06: import com.nwalsh.xalan.Callout;
07: import org.apache.xml.utils.AttList;
08:
09: /**
10: * <p>Utility class for the Verbatim extension (ignore this).</p>
11: *
12: * <p>$Id: FormatUnicodeCallout.java,v 1.1 2001/04/02 13:03:45 nwalsh Exp $</p>
13: *
14: * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
15: *
16: * <p><b>Change Log:</b></p>
17: * <dl>
18: * <dt>1.0</dt>
19: * <dd><p>Initial release.</p></dd>
20: * </dl>
21: *
22: * @author Norman Walsh
23: * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
24: *
25: * @see Verbatim
26: *
27: * @version $Id: FormatUnicodeCallout.java,v 1.1 2001/04/02 13:03:45 nwalsh Exp $
28: **/
29:
30: public class FormatUnicodeCallout extends FormatCallout {
31: int unicodeMax = 0;
32: int unicodeStart = 0;
33:
34: public FormatUnicodeCallout(int start, int max, boolean fo) {
35: unicodeMax = max;
36: unicodeStart = start;
37: stylesheetFO = fo;
38: }
39:
40: public void formatCallout(DOMBuilder rtf, 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 <= unicodeMax) {
47: char chars[] = new char[1];
48: chars[0] = (char) (unicodeStart + num - 1);
49:
50: startSpan(rtf);
51: rtf.characters(chars, 0, 1);
52: endSpan(rtf);
53: } else {
54: formatTextCallout(rtf, callout);
55: }
56: } catch (SAXException e) {
57: System.out
58: .println("SAX Exception in unicode formatCallout");
59: }
60: }
61: }
|