
package org.apache.fop.fo.properties;

import org.apache.fop.datatypes.*;
import org.apache.fop.fo.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.messaging.MessageHandler;

public class LineHeightMaker extends  LengthProperty.Maker {




    static public Property.Maker maker(String propName) {
	return new LineHeightMaker(propName);
    }

    protected LineHeightMaker(String name) {
	super(name);

    }


   public boolean isInherited() { return true; }

   public boolean inheritsSpecified() {
	 return true;
   }

    public Property make(PropertyList propertyList) throws FOPException {
      
        return make(propertyList, "normal", propertyList.getParentFObj());
	
    }

    protected String checkValueKeywords(String value) {
  
      if (value.equals("normal")) {
	return new String("1.2em");
      }
  
      return super.checkValueKeywords(value);
    }

    // See if other value types are acceptable
    protected Property convertPropertyDatatype(Property p,
	PropertyList propertyList, FObj fo) {
      
      {
        Number numval = 
		p.getNumber();
	if (numval != null) {
	    return new LengthProperty(
		    
		new PercentLength(numval.doubleValue(),
				 getPercentBase(fo,propertyList)));
        }
      }
      
      return super.convertPropertyDatatype(p, propertyList, fo);
    }

    /** Return object used to calculate base Length
     * for percent specifications.
     */
    public PercentBase getPercentBase(final FObj fo, final PropertyList propertyList) {
     
	return new LengthBase(fo, propertyList, LengthBase.FONTSIZE);
       
    }

}
