1 17 18 19 20 package org.apache.fop.fo.properties; 21 22 import org.apache.fop.datatypes.Numeric; 23 import org.apache.fop.fo.Constants; 24 import org.apache.fop.fo.FObj; 25 import org.apache.fop.fo.PropertyList; 26 import org.apache.fop.fo.expr.PropertyException; 27 28 36 37 public class LineHeightPropertyMaker extends SpaceProperty.Maker { 38 42 public LineHeightPropertyMaker(int propId) { 43 super(propId); 44 } 45 46 50 public Property make(PropertyList propertyList, String value, FObj fo) 51 throws PropertyException { 52 55 Property p = super.make(propertyList, value, fo); 56 p.getSpace().setConditionality( 57 EnumProperty.getInstance(Constants.EN_RETAIN, "RETAIN"), true); 58 p.getSpace().setPrecedence( 59 EnumProperty.getInstance(Constants.EN_FORCE, "FORCE"), true); 60 return p; 61 } 62 63 68 protected Property compute(PropertyList propertyList) throws PropertyException { 69 Property specProp = propertyList.getNearestSpecified(propId); 72 if (specProp != null) { 73 String specVal = specProp.getSpecifiedValue(); 74 if (specVal != null) { 75 return make(propertyList, specVal, 76 propertyList.getParentFObj()); 77 } 78 } 79 return null; 80 } 81 82 85 public Property convertProperty(Property p, 86 PropertyList propertyList, 87 FObj fo) throws PropertyException { 88 Numeric numval = p.getNumeric(); 89 if (numval != null && numval.getDimension() == 0) { 90 p = new PercentLength(numval.getNumericValue(), getPercentBase(fo, propertyList)); 91 Property spaceProp = super.convertProperty(p, propertyList, fo); 92 spaceProp.setSpecifiedValue(String.valueOf(numval.getNumericValue())); 93 return spaceProp; 94 } 95 return super.convertProperty(p, propertyList, fo); 96 } 97 } 98 | Popular Tags |