klease 01/10/14 13:38:25 Modified: src/org/apache/fop/fo/expr Numeric.java PropertyParser.java Log: Modify Length property parsing Revision Changes Path 1.4 +15 -10 xml-fop/src/org/apache/fop/fo/expr/Numeric.java Index: Numeric.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/expr/Numeric.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Numeric.java 2001/07/30 20:29:21 1.3 +++ Numeric.java 2001/10/14 20:38:25 1.4 @@ -1,5 +1,5 @@ /* - * $Id: Numeric.java,v 1.3 2001/07/30 20:29:21 tore Exp $ + * $Id: Numeric.java,v 1.4 2001/10/14 20:38:25 klease Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -7,9 +7,11 @@ package org.apache.fop.fo.expr; +import java.util.Vector; import org.apache.fop.fo.Property; import org.apache.fop.datatypes.Length; +import org.apache.fop.datatypes.FixedLength; import org.apache.fop.datatypes.PercentLength; import org.apache.fop.datatypes.LinearCombinationLength; import org.apache.fop.datatypes.MixedLength; @@ -91,7 +93,7 @@ * Construct a Numeric object from a Length. * @param l The Length. */ - public Numeric(Length l) { + public Numeric(FixedLength l) { this(ABS_LENGTH, (double)l.mvalue(), 0.0, 0.0, 1, null); } @@ -121,19 +123,22 @@ */ public Length asLength() { if (dim == 1) { - if (valType == ABS_LENGTH) { - return new Length((int)absValue); + Vector len = new Vector(3); + if ((valType & ABS_LENGTH) != 0) { + len.add(new FixedLength((int)absValue)); } - PercentLength pclen = null; if ((valType & PC_LENGTH) != 0) { - pclen = new PercentLength(pcValue, pcBase); - if (valType == PC_LENGTH) - return pclen; + len.add(new PercentLength(pcValue, pcBase)); } if ((valType & TCOL_LENGTH) != 0) { - return new TableColLength((int)absValue, pclen, tcolValue); + len.add(new TableColLength(tcolValue)); } - return new MixedLength((int)absValue, pclen); + if (len.size() == 1) { + return (Length)len.elementAt(0); + } + else { + return new MixedLength(len); + } } else { // or throw exception??? // can't make Length if dimension != 1 1.6 +3 -3 xml-fop/src/org/apache/fop/fo/expr/PropertyParser.java Index: PropertyParser.java =================================================================== RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/expr/PropertyParser.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- PropertyParser.java 2001/07/30 20:29:21 1.5 +++ PropertyParser.java 2001/10/14 20:38:25 1.6 @@ -1,5 +1,5 @@ /* - * $Id: PropertyParser.java,v 1.5 2001/07/30 20:29:21 tore Exp $ + * $Id: PropertyParser.java,v 1.6 2001/10/14 20:38:25 klease Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -270,10 +270,10 @@ numLen)); Length length = null; if (unitPart.equals(RELUNIT)) { - length = new Length(numPart.doubleValue(), + length = new FixedLength(numPart.doubleValue(), propInfo.currentFontSize()); } else - length = new Length(numPart.doubleValue(), unitPart); + length = new FixedLength(numPart.doubleValue(), unitPart); if (length == null) { throw new PropertyException("unrecognized unit name: " + currentTokenValue);
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]