Browse Source

Modify Length to Numeric conversion code


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194505 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-0_20_3
Karen Lease 22 years ago
parent
commit
1739edf236
1 changed files with 3 additions and 12 deletions
  1. 3
    12
      src/org/apache/fop/fo/LengthProperty.java

+ 3
- 12
src/org/apache/fop/fo/LengthProperty.java View File

@@ -8,8 +8,7 @@
package org.apache.fop.fo;

import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.PercentLength;
import org.apache.fop.datatypes.TableColLength;
import org.apache.fop.datatypes.AutoLength;
import org.apache.fop.fo.expr.Numeric;
import org.apache.fop.apps.FOPException;

@@ -40,7 +39,7 @@ public class LengthProperty extends Property {
if (isAutoLengthAllowed()) {
String pval = p.getString();
if (pval != null && pval.equals("auto"))
return new LengthProperty(Length.AUTO);
return new LengthProperty(new AutoLength());
}
if (p instanceof LengthProperty)
return p;
@@ -70,15 +69,7 @@ public class LengthProperty extends Property {
}

public Numeric getNumeric() {
// Can't just do new Numeric(length) because it always uses
// the constructor for Length!
// Otherwise, must make each class know about Numeric...
// ie, return length.asNumeric(): cleaner
if (length instanceof PercentLength)
return new Numeric((PercentLength)length);
if (length instanceof TableColLength)
return new Numeric((TableColLength)length);
return new Numeric(length);
return length.asNumeric() ;
}

public Length getLength() {

Loading…
Cancel
Save