1 51 package org.apache.fop.fo.expr; 52 53 import org.apache.fop.fo.Property; 54 import org.apache.fop.fo.FObj; 55 import org.apache.fop.fo.flow.ListItem; 56 57 public class BodyStartFunction extends FunctionBase { 58 59 public int nbArgs() { 60 return 0; 61 } 62 63 public Property eval(Property[] args, 64 PropertyInfo pInfo) throws PropertyException { 65 Numeric distance = 66 pInfo.getPropertyList().get("provisional-distance-between-starts").getNumeric(); 67 68 FObj item = pInfo.getFO(); 69 while (item != null &&!(item instanceof ListItem)) { 70 item = item.getParent(); 71 } 72 if (item == null) { 73 throw new PropertyException("body-start() called from outside an fo:list-item"); 74 } 75 76 Numeric startIndent = 77 item.properties.get("start-indent").getNumeric(); 78 79 return new NumericProperty(distance.add(startIndent)); 80 } 81 82 } 83 | Popular Tags |