Code Search for Developers
 
 
  

FormatGraphicCallout.java from Amavisd-new Maintenance at Krugle


Show FormatGraphicCallout.java syntax highlighted

package com.nwalsh.xalan;

import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.SAXException;
import org.w3c.dom.*;
import org.apache.xml.utils.DOMBuilder;
import com.nwalsh.xalan.Callout;
import org.apache.xml.utils.AttList;

/**
 * <p>Utility class for the Verbatim extension (ignore this).</p>
 *
 * <p>$Id: FormatGraphicCallout.java 69 2001-04-02 13:03:45Z nwalsh $</p>
 *
 * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
 *
 * <p><b>Change Log:</b></p>
 * <dl>
 * <dt>1.0</dt>
 * <dd><p>Initial release.</p></dd>
 * </dl>
 *
 * @author Norman Walsh
 * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
 *
 * @see Verbatim
 *
 * @version $Id: FormatGraphicCallout.java 69 2001-04-02 13:03:45Z nwalsh $
 **/

public class FormatGraphicCallout extends FormatCallout {
  String graphicsPath = "";
  String graphicsExt = "";
  int graphicsMax = 0;

  public FormatGraphicCallout(String path, String ext, int max, boolean fo) {
    graphicsPath = path;
    graphicsExt = ext;
    graphicsMax = max;
    stylesheetFO = fo;
  }

  public void formatCallout(DOMBuilder rtf,
			    Callout callout) {
    Element area = callout.getArea();
    int num = callout.getCallout();
    String label = areaLabel(area);

    try {
      if (label == null && num <= graphicsMax) {
	AttributesImpl imgAttr = new AttributesImpl();
	String ns = "";
	String prefix = "";
	String imgName = "";

	if (stylesheetFO) {
	  ns = foURI;
	  prefix = "fo:"; // FIXME: this could be a problem...
	  imgName = "external-graphic";
	  imgAttr.addAttribute("", "src", "src", "CDATA",
			       graphicsPath + num + graphicsExt);
	  imgAttr.addAttribute("", "alt", "alt", "CDATA", label);
	} else {
	  ns = "";
	  prefix = "";
	  imgName = "img";
	  imgAttr.addAttribute("", "src", "src", "CDATA",
			       graphicsPath + num + graphicsExt);
	  imgAttr.addAttribute("", "alt", "alt", "CDATA", label);
	}

	startSpan(rtf);
	rtf.startElement(ns, imgName, prefix+imgName, imgAttr);
	rtf.endElement(ns, imgName, prefix+imgName);
	endSpan(rtf);
      } else {
	formatTextCallout(rtf, callout);
      }
    } catch (SAXException e) {
      System.out.println("SAX Exception in graphics formatCallout");
    }
  }
}




See more files for this project here

Amavisd-new Maintenance

AmavisAdmin is a tool to maintain SPAMs, Viruses and blocked mails written to an SQL database by Amavisd-new. Mails can be removed automatically or manually, or they can be released to be send to the recipients.

Project homepage: http://sourceforge.net/projects/amavisadmin
Programming language(s): Java,XML
License: other

  CVS.java
  Callout.java
  FormatCallout.java
  FormatDingbatCallout.java
  FormatGraphicCallout.java
  FormatTextCallout.java
  FormatUnicodeCallout.java
  Func.java
  ImageIntrinsics.java
  Params.java
  Table.java
  Text.java
  Verbatim.java
  package.html