
package org.apache.fop.fo.properties;

import java.util.Hashtable;
import java.util.Enumeration;
import org.apache.fop.svg.*;

public class SVGPropertyMapping {

  private static Hashtable s_htGeneric = new Hashtable(200);
  private static Hashtable s_htElementLists = new Hashtable(10);
  
  private static Hashtable s_httref;
  private static Hashtable s_httext;
  static {
    // Generate the generic mapping
    s_htGeneric.put("width", SVGLengthProperty.maker("width"));
    s_htGeneric.put("height", SVGLengthProperty.maker("height"));
    s_htGeneric.put("x", SVGLengthProperty.maker("x"));
    s_htGeneric.put("y", SVGLengthProperty.maker("y"));
    s_htGeneric.put("x1", SVGLengthProperty.maker("x1"));
    s_htGeneric.put("y1", SVGLengthProperty.maker("y1"));
    s_htGeneric.put("x2", SVGLengthProperty.maker("x2"));
    s_htGeneric.put("y2", SVGLengthProperty.maker("y2"));
    s_htGeneric.put("rx", SVGLengthProperty.maker("rx"));
    s_htGeneric.put("ry", SVGLengthProperty.maker("ry"));
    s_htGeneric.put("dx", SVGLengthProperty.maker("dx"));
    s_htGeneric.put("dy", SVGLengthProperty.maker("dy"));
    s_htGeneric.put("cx", SVGLengthProperty.maker("cx"));
    s_htGeneric.put("cy", SVGLengthProperty.maker("cy"));
    s_htGeneric.put("r", SVGLengthProperty.maker("r"));
    s_htGeneric.put("fx", SVGLengthProperty.maker("fx"));
    s_htGeneric.put("fy", SVGLengthProperty.maker("fy"));
    s_htGeneric.put("refX", SVGLengthProperty.maker("refX"));
    s_htGeneric.put("refY", SVGLengthProperty.maker("refY"));
    s_htGeneric.put("markerWidth", SVGLengthProperty.maker("markerWidth"));
    s_htGeneric.put("markerHeight", SVGLengthProperty.maker("markerHeight"));
    s_htGeneric.put("offset", SVGLengthProperty.maker("offset"));
    s_htGeneric.put("style", SVGStyle.maker("style"));
    s_htGeneric.put("transform", SVGTransform.maker("transform"));
    s_htGeneric.put("gradientTransform", SVGTransform.maker("gradientTransform"));
    s_htGeneric.put("d", SVGD.maker("d"));
    s_htGeneric.put("points", SVGPoints.maker("points"));
    s_htGeneric.put("font-family", FontFamilyMaker.maker("font-family"));
    s_htGeneric.put("font-style", FontStyleMaker.maker("font-style"));
    s_htGeneric.put("font-weight", FontWeightMaker.maker("font-weight"));
    s_htGeneric.put("font-size", FontSizeMaker.maker("font-size"));
    s_htGeneric.put("id", IdMaker.maker("id"));
    s_htGeneric.put("xlink:href", HRefMaker.maker("xlink:href"));
    s_htGeneric.put("requiredFeatures", RequiredFeaturesMaker.maker("requiredFeatures"));
    s_htGeneric.put("requiredExtensions", RequiredExtensionsMaker.maker("requiredExtensions"));
    s_htGeneric.put("systemLanguage", SystemLanguageMaker.maker("systemLanguage"));
    s_htGeneric.put("class", ElementClassMaker.maker("class"));
    s_htGeneric.put("xml:space", XMLSpaceMaker.maker("xml:space"));
    s_htGeneric.put("spreadMethod", SpreadMethodMaker.maker("spreadMethod"));
    s_htGeneric.put("gradientUnits", GenericUnits.maker("gradientUnits"));
    s_htGeneric.put("patternUnits", GenericUnits.maker("patternUnits"));
    s_htGeneric.put("patternContentUnits", GenericUnits.maker("patternContentUnits"));
    s_htGeneric.put("clipPathUnits", GenericUnits.maker("clipPathUnits"));

  /* PROPCLASS = EnumProperty */
    s_htGeneric.put("viewBox", ViewBoxMaker.maker("viewBox"));

  }

  static {
    s_httref = new Hashtable();
   
    s_htElementLists.put("tref", s_httref);
   
    s_htElementLists.put("tspan", s_httref);
       s_httref.put("x", SVGLengthListProperty.maker("x"));
    s_httref.put("y", SVGLengthListProperty.maker("y"));
    s_httref.put("dx", SVGLengthListProperty.maker("dx"));
    s_httref.put("dy", SVGLengthListProperty.maker("dy"));

  }

  static {
    s_httext = new Hashtable();
   
    s_htElementLists.put("text", s_httext);
       s_httext.put("x", SVGLengthProperty.maker("x"));
    s_httext.put("y", SVGLengthProperty.maker("y"));
    s_httext.put("style", SVGStyle.maker("style"));
    s_httext.put("transform", SVGTransform.maker("transform"));
    s_httext.put("text-anchor", TextAnchorMaker.maker("text-anchor"));
    s_httext.put("xml:space", XMLSpaceMaker.maker("xml:space"));

  }


  public static Hashtable getGenericMappings() {
    return s_htGeneric;
  }

  public static Enumeration getElementMappings() {
    return s_htElementLists.keys();
  }

  public static Hashtable getElementMapping(String elemName) {
    return (Hashtable)s_htElementLists.get(elemName);
  }
}
