+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-import org.apache.fop.fo.Property;
-
-public interface CompoundDatatype {
- public void setComponent(String sCmpnName, Property cmpnValue,
- boolean bIsDefault);
-
- public Property getComponent(String sCmpnName);
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.fo.Property;
-import org.apache.fop.fo.properties.Constants;
-
-/**
- * a space quantity in XSL (space-before, space-after)
- */
-public class CondLength implements CompoundDatatype {
-
- private Property length;
- private Property conditionality;
-
- // From CompoundDatatype
- public void setComponent(String sCmpnName, Property cmpnValue,
- boolean bIsDefault) {
- if (sCmpnName.equals("length"))
- length = cmpnValue;
- else if (sCmpnName.equals("conditionality"))
- conditionality = cmpnValue;
- }
-
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("length"))
- return length;
- else if (sCmpnName.equals("conditionality"))
- return conditionality;
- else
- return null;
- }
-
- public Property getConditionality() {
- return this.conditionality;
- }
-
- public Property getLength() {
- return this.length;
- }
-
- public boolean isDiscard() {
- return this.conditionality.getEnum() == Constants.DISCARD;
- }
-
- public int mvalue() {
- return this.length.getLength().mvalue();
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.pdf.PDFGoTo;
-
-
-public class IDNode {
- private String idValue, internalLinkGoToPageReference;
-
- private PDFGoTo internalLinkGoTo;
-
- private int pageNumber = -1, xPosition = 0, // x position on page
- yPosition = 0; // y position on page
-
-
- /**
- * Constructor for IDNode
- *
- * @param idValue The value of the id for this node
- */
- protected IDNode(String idValue) {
- this.idValue = idValue;
- }
-
-
- /**
- * Sets the page number for this node
- *
- * @param number page number of node
- */
- protected void setPageNumber(int number) {
- pageNumber = number;
- }
-
-
- /**
- * Returns the page number of this node
- *
- * @return page number of this node
- */
- public String getPageNumber() {
- return (pageNumber != -1) ? new Integer(pageNumber).toString() : null;
- }
-
-
- /**
- * creates a new GoTo object for an internal link
- *
- * @param objectNumber
- * the number to be assigned to the new object
- */
- protected void createInternalLinkGoTo(int objectNumber) {
- if (internalLinkGoToPageReference == null) {
- internalLinkGoTo = new PDFGoTo(objectNumber, null);
- } else {
- internalLinkGoTo = new PDFGoTo(objectNumber,
- internalLinkGoToPageReference);
- }
-
- if (xPosition
- != 0) // if the position is known (if x is known, then y is known)
- {
- internalLinkGoTo.setXPosition(xPosition);
- internalLinkGoTo.setYPosition(yPosition);
- }
-
- }
-
-
-
- /**
- * sets the page reference for the internal link's GoTo. The GoTo will jump to this page reference.
- *
- * @param pageReference
- * the page reference to which the internal link GoTo should jump
- * ex. 23 0 R
- */
- protected void setInternalLinkGoToPageReference(String pageReference) {
- if (internalLinkGoTo != null) {
- internalLinkGoTo.setPageReference(pageReference);
- } else {
- internalLinkGoToPageReference = pageReference;
- }
-
- }
-
-
-
- /**
- * Returns the reference to the Internal Link's GoTo object
- *
- * @return GoTo object reference
- */
- protected String getInternalLinkGoToReference() {
- return internalLinkGoTo.referencePDF();
- }
-
-
-
- /**
- * Returns the id value of this node
- *
- * @return this node's id value
- */
- protected String getIDValue() {
- return idValue;
- }
-
-
-
- /**
- * Returns the PDFGoTo object associated with the internal link
- *
- * @return PDFGoTo object
- */
- protected PDFGoTo getInternalLinkGoTo() {
- return internalLinkGoTo;
- }
-
-
- /**
- * Determines whether there is an internal link GoTo for this node
- *
- * @return true if internal link GoTo for this node is set, false otherwise
- */
- protected boolean isThereInternalLinkGoTo() {
- return internalLinkGoTo != null;
- }
-
-
- /**
- * Sets the position of this node
- *
- * @param x the x position
- * @param y the y position
- */
- protected void setPosition(int x, int y) {
- if (internalLinkGoTo != null) {
- internalLinkGoTo.setXPosition(x);
- internalLinkGoTo.setYPosition(y);
- } else {
- xPosition = x;
- yPosition = y;
- }
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.pdf.PDFGoTo;
-import org.apache.fop.layout.AreaContainer;
-
-
-// Java
-import java.util.Hashtable;
-import java.util.Vector;
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-import org.apache.fop.layout.Area;
-import org.apache.fop.apps.FOPException;
-
-/**
- IDReferences contains a map of IDs and the objects to which
- they refer. It also contains a list of references to IDs which
- have yet to be encountered.
-
- Modified by Mark Lillywhite mark-fop@inomial.com. Added
- getInvalidElements() so that StreamRenderer cna tell what
- hasn't been determined yet.
- */
-public class IDReferences {
- private Hashtable idReferences, idValidation;
-
- final static int ID_PADDING = 5000; // space to add before id y position
-
- /**
- * Constructor for IDReferences
- */
- public IDReferences() {
- idReferences = new Hashtable();
- idValidation = new Hashtable();
- }
-
-
- /**
- * Creates and configures the specified id.
- *
- * @param id The id to initialize
- * @param area The area where this id was encountered
- * @exception FOPException
- */
- public void initializeID(String id, Area area) throws FOPException {
- createID(id);
- configureID(id, area);
- }
-
-
- /**
- * Creates id entry
- *
- * @param id The id to create
- * @param area The area where this id was encountered
- * @exception FOPException
- */
- public void createID(String id) throws FOPException {
- if (id != null &&!id.equals("")) {
- if (doesIDExist(id)) {
- throw new FOPException("The id \"" + id
- + "\" already exists in this document");
- } else {
- createNewId(id);
- removeFromIdValidationList(id);
- }
-
- }
- }
-
-
- /**
- * Configures this id
- *
- * @param id The id to configure
- * @param area The area where the id was encountered
- */
- public void configureID(String id, Area area) {
- if (id != null &&!id.equals("")) {
- setPosition(id,
- area.getPage().getBody().getXPosition()
- + area.getTableCellXOffset() - ID_PADDING,
- area.getPage().getBody().getYPosition()
- - area.getAbsoluteHeight() + ID_PADDING);
- setPageNumber(id, area.getPage().getNumber());
- area.getPage().addToIDList(id);
- }
- }
-
- /**
- * Adds id to validation list to be validated . This should be used if it is unsure whether the id is valid
- *
- * @param id id to be added
- */
- public void addToIdValidationList(String id) {
- idValidation.put(id, "");
- }
-
-
-
- /**
- * Removes id from validation list. This should be used if the id has been determined to be valid
- *
- * @param id the id to remove
- */
- public void removeFromIdValidationList(String id) {
- idValidation.remove(id);
- }
-
-
- /**
- * Removes id from IDReferences
- *
- * @param id The id to remove
- * @exception FOPException
- */
- public void removeID(String id) {
- idReferences.remove(id);
- }
-
-
- /**
- * Determines whether all id's are valid
- *
- * @return true if all id's are valid, false otherwise
- */
- public boolean isEveryIdValid() {
- return (idValidation.size() == 0);
- }
-
-
-
- /**
- * Returns all invalid id's still remaining in the validation list
- *
- * @return invalid ids from validation list
- */
- public String getInvalidIds() {
- StringBuffer list = new StringBuffer();
- Enumeration enum = idValidation.keys();
- while (enum.hasMoreElements()) {
- list.append("\n\"").append(enum.nextElement().toString()).append("\" ");
- }
- return list.toString();
- }
-
-
- /**
- * Determines whether specified id already exists in IDReferences
- *
- * @param id the id to search for
- * @return true if ID was found, false otherwise
- */
- public boolean doesIDExist(String id) {
- return idReferences.containsKey(id);
- }
-
-
- /**
- * Determines whether the GoTo reference for the specified id is defined
- *
- * @param id the id to search for
- * @return true if GoTo reference is defined, false otherwise
- */
- public boolean doesGoToReferenceExist(String id) {
- IDNode node = (IDNode)idReferences.get(id);
- return node.isThereInternalLinkGoTo();
- }
-
-
-
-
- /**
- * Returns the reference to the GoTo object used for the internal link
- *
- * @param id the id whose reference to use
- * @return reference to GoTo object
- */
- public String getInternalLinkGoToReference(String id) {
- IDNode node = (IDNode)idReferences.get(id);
- return node.getInternalLinkGoToReference();
- }
-
-
-
- /**
- * creates an Internal Link GoTo object for this id
- *
- * @param id The id for which to set the Internal Link Go To
- * @param objectNumber
- * The object number to use for the GoTo object
- * @return the object reference of the new GoTo object
- */
- public String createInternalLinkGoTo(String id, int objectNumber) {
- IDNode node = (IDNode)idReferences.get(id); // retrieve id node
- node.createInternalLinkGoTo(objectNumber); // create Internal Link GoTo object
- return node.getInternalLinkGoToReference(); // return Internal Link Go To object reference
- }
-
-
-
- /**
- * Adds an id to IDReferences
- *
- * @param id the id to add
- */
- public void createNewId(String id) {
- IDNode node = new IDNode(id);
- idReferences.put(id, node);
- }
-
-
- /**
- * Returns the PDFGoTo object for the specified id
- *
- * @param id the id for which the PDFGoTo to be retrieved is associated
- * @return the PDFGoTo object associated with the specified id
- */
- public PDFGoTo getPDFGoTo(String id) {
- IDNode node = (IDNode)idReferences.get(id);
- return node.getInternalLinkGoTo();
- }
-
-
- /**
- * sets the page reference for the internal link's GoTo. The GoTo will jump to this page reference.
- *
- * @param pageReference
- * the page reference to which the internal link GoTo should jump
- * ex. 23 0 R
- */
- public void setInternalGoToPageReference(String id,
- String pageReference) {
- IDNode node = (IDNode)idReferences.get(id);
- if (node != null) {
- node.setInternalLinkGoToPageReference(pageReference);
- }
- }
-
-
- /**
- * Sets the page number for the specified id
- *
- * @param id The id whose page number is being set
- * @param pageNumber The page number of the specified id
- */
- public void setPageNumber(String id, int pageNumber) {
- IDNode node = (IDNode)idReferences.get(id);
- node.setPageNumber(pageNumber);
- }
-
-
- /**
- * Returns the page number where the specified id is found
- *
- * @param id The id whose page number to return
- * @return the page number of the id, or null if the id does not exist
- */
- public String getPageNumber(String id) {
- if (doesIDExist(id)) {
- IDNode node = (IDNode)idReferences.get(id);
- return node.getPageNumber();
- } else {
- addToIdValidationList(id);
- return null;
- }
- }
-
-
- /**
- * Sets the x and y position of specified id
- *
- * @param id the id whose position is to be set
- * @param x x position of id
- * @param y y position of id
- */
- public void setPosition(String id, int x, int y) {
- IDNode node = (IDNode)idReferences.get(id);
- node.setPosition(x, y);
- }
-
- public Enumeration getInvalidElements() {
- return idValidation.keys();
- }
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-/**
- * Keep Value
- * Stores the different types of keeps in a single convenient format.
- */
-public class KeepValue {
- public static final String KEEP_WITH_ALWAYS = "KEEP_WITH_ALWAYS";
- public static final String KEEP_WITH_AUTO = "KEEP_WITH_AUTO";
- public static final String KEEP_WITH_VALUE = "KEEP_WITH_VALUE";
- private String type = KEEP_WITH_AUTO;
- private int value = 0;
-
- public KeepValue(String type, int val) {
- this.type = type;
- this.value = val;
- }
-
- public int getValue() {
- return value;
- }
-
- public String getType() {
- return type;
- }
-
- public String toString() {
- return type;
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyList;
-import org.apache.fop.messaging.MessageHandler;
-
-public class LengthBase implements PercentBase {
- // Standard kinds of percent-based length
- public static final int CUSTOM_BASE = 0;
- public static final int FONTSIZE = 1;
- public static final int INH_FONTSIZE = 2;
- public static final int CONTAINING_BOX = 3;
- public static final int CONTAINING_REFAREA = 4;
-
- /**
- * FO parent of the FO for which this property is to be calculated.
- */
- protected /* final */ FObj parentFO;
-
- /**
- * PropertyList for the FO where this property is calculated.
- */
- private /* final */ PropertyList propertyList;
-
- /**
- * One of the defined types of LengthBase
- */
- private /* final */ int iBaseType;
-
- public LengthBase(FObj parentFO, PropertyList plist, int iBaseType) {
- this.parentFO = parentFO;
- this.propertyList = plist;
- this.iBaseType = iBaseType;
- }
-
- /**
- * Accessor for parentFO object from subclasses which define
- * custom kinds of LengthBase calculations.
- */
- protected FObj getParentFO() {
- return parentFO;
- }
-
- /**
- * Accessor for propertyList object from subclasses which define
- * custom kinds of LengthBase calculations.
- */
- protected PropertyList getPropertyList() {
- return propertyList;
- }
-
- public int getDimension() {
- return 1;
- }
-
- public double getBaseValue() {
- return 1.0;
- }
-
- public int getBaseLength() {
- switch (iBaseType) {
- case FONTSIZE:
- return propertyList.get("font-size").getLength().mvalue();
- case INH_FONTSIZE:
- return propertyList.getInherited("font-size").getLength().mvalue();
- case CONTAINING_BOX:
- // depends on property?? inline-progression vs block-progression
- return parentFO.getContentWidth();
- case CONTAINING_REFAREA: // example: start-indent, end-indent
- {
- FObj fo;
- for (fo = parentFO; fo != null &&!fo.generatesReferenceAreas();
- fo = fo.getParent());
- return (fo != null ? fo.getContentWidth() : 0);
- }
- case CUSTOM_BASE:
- MessageHandler.errorln("!!! LengthBase.getBaseLength() called on CUSTOM_BASE type !!!");
- return 0;
- default:
- MessageHandler.errorln("Unknown base type for LengthBase.");
- return 0;
- }
- }
-
-}
-
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.messaging.MessageHandler;
-import org.apache.fop.fo.Property;
-
-/**
- * This datatype hold a pair of lengths, specifiying the dimensions in
- * both inline and block-progression-directions.
- * It is currently only used to specify border-separation in tables.
- */
-public class LengthPair implements CompoundDatatype {
-
- private Property ipd;
- private Property bpd;
-
- // From CompoundDatatype
- public void setComponent(String sCmpnName, Property cmpnValue,
- boolean bIsDefault) {
- if (sCmpnName.equals("block-progression-direction"))
- bpd = cmpnValue;
- else if (sCmpnName.equals("inline-progression-direction"))
- ipd = cmpnValue;
- }
-
- // From CompoundDatatype
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("block-progression-direction"))
- return getBPD();
- else if (sCmpnName.equals("inline-progression-direction"))
- return getIPD();
- else
- return null; // SHOULDN'T HAPPEN
- }
-
- public Property getIPD() {
- return this.ipd;
- }
-
- public Property getBPD() {
- return this.bpd;
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.messaging.MessageHandler;
-import org.apache.fop.fo.Property;
-
-/**
- * a "progression-dimension" quantity
- * ex. block-progression-dimension, inline-progression-dimension
- * corresponds to the triplet min-height, height, max-height (or width)
- */
-public class LengthRange implements CompoundDatatype {
-
- private Property minimum;
- private Property optimum;
- private Property maximum;
- private static final int MINSET = 1;
- private static final int OPTSET = 2;
- private static final int MAXSET = 4;
- private int bfSet = 0; // bit field
- private boolean bChecked = false;
-
- // From CompoundDatatype
- public void setComponent(String sCmpnName, Property cmpnValue,
- boolean bIsDefault) {
- if (sCmpnName.equals("minimum"))
- setMinimum(cmpnValue, bIsDefault);
- else if (sCmpnName.equals("optimum"))
- setOptimum(cmpnValue, bIsDefault);
- else if (sCmpnName.equals("maximum"))
- setMaximum(cmpnValue, bIsDefault);
- }
-
- // From CompoundDatatype
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("minimum"))
- return getMinimum();
- else if (sCmpnName.equals("optimum"))
- return getOptimum();
- else if (sCmpnName.equals("maximum"))
- return getMaximum();
- else
- return null; // SHOULDN'T HAPPEN
- }
-
- /**
- * Set minimum value to min.
- * @param min A Length value specifying the minimum value for this
- * LengthRange.
- * @param bIsDefault If true, this is set as a "default" value
- * and not a user-specified explicit value.
- */
- protected void setMinimum(Property minimum, boolean bIsDefault) {
- this.minimum = minimum;
- if (!bIsDefault)
- bfSet |= MINSET;
- }
-
-
- /**
- * Set maximum value to max if it is >= optimum or optimum isn't set.
- * @param max A Length value specifying the maximum value for this
- * @param bIsDefault If true, this is set as a "default" value
- * and not a user-specified explicit value.
- */
- protected void setMaximum(Property max, boolean bIsDefault) {
- maximum = max;
- if (!bIsDefault)
- bfSet |= MAXSET;
- }
-
-
- /**
- * Set the optimum value.
- * @param opt A Length value specifying the optimum value for this
- * @param bIsDefault If true, this is set as a "default" value
- * and not a user-specified explicit value.
- */
- protected void setOptimum(Property opt, boolean bIsDefault) {
- optimum = opt;
- if (!bIsDefault)
- bfSet |= OPTSET;
- }
-
- // Minimum is prioritaire, if explicit
- private void checkConsistency() {
- if (bChecked)
- return;
- // Make sure max >= min
- // Must also control if have any allowed enum values!
-
- /**
- * *******************
- * if (minimum.mvalue() > maximum.mvalue()) {
- * if ((bfSet&MINSET)!=0) {
- * // if minimum is explicit, force max to min
- * if ((bfSet&MAXSET)!=0) {
- * // Warning: min>max, resetting max to min
- * MessageHandler.errorln("WARNING: forcing max to min in LengthRange");
- * }
- * maximum = minimum ;
- * }
- * else {
- * minimum = maximum; // minimum was default value
- * }
- * }
- * // Now make sure opt <= max and opt >= min
- * if (optimum.mvalue() > maximum.mvalue()) {
- * if ((bfSet&OPTSET)!=0) {
- * if ((bfSet&MAXSET)!=0) {
- * // Warning: opt > max, resetting opt to max
- * MessageHandler.errorln("WARNING: forcing opt to max in LengthRange");
- * optimum = maximum ;
- * }
- * else {
- * maximum = optimum; // maximum was default value
- * }
- * }
- * else {
- * // opt is default and max is explicit or default
- * optimum = maximum ;
- * }
- * }
- * else if (optimum.mvalue() < minimum.mvalue()) {
- * if ((bfSet&MINSET)!=0) {
- * // if minimum is explicit, force opt to min
- * if ((bfSet&OPTSET)!=0) {
- * MessageHandler.errorln("WARNING: forcing opt to min in LengthRange");
- * }
- * optimum = minimum ;
- * }
- * else {
- * minimum = optimum; // minimum was default value
- * }
- * }
- * *******$*******
- */
- bChecked = true;
- }
-
- public Property getMinimum() {
- checkConsistency();
- return this.minimum;
- }
-
- public Property getMaximum() {
- checkConsistency();
- return this.maximum;
- }
-
- public Property getOptimum() {
- checkConsistency();
- return this.optimum;
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import java.util.Vector;
-
-public class LinearCombinationLength extends Length {
-
- protected Vector factors;
- protected Vector lengths;
-
- public LinearCombinationLength() {
- super(0);
- factors = new Vector();
- lengths = new Vector();
- super.setIsComputed(false);
- }
-
- public void addTerm(double factor, Length length) {
- factors.addElement(new Double(factor));
- lengths.addElement(length);
- }
-
- /**
- * Return the computed value in millipoints.
- */
- protected int computeValue() {
- int result = 0;
- int numFactors = factors.size();
- for (int i = 0; i < numFactors; ++i) {
- result +=
- (int)(((Double)factors.elementAt(i)).doubleValue()
- * (double)((Length)lengths.elementAt(i)).mvalue());
- }
- return result;
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.messaging.MessageHandler;
-
-/**
- * A length quantity in XSL which is specified with a mixture
- * of absolute and relative and/or percent components.
- * The actual value may not be computable before layout is done.
- */
-public class MixedLength extends Length {
-
- private PercentLength pcPart;
-
- /**
- * construct an object based on a factor (the percent, as a
- * a factor) and an object which has a method to return the
- * Length which provides the "base" for this calculation.
- */
- public MixedLength(int absPart, PercentLength pcPart) {
- super(absPart);
- this.pcPart = pcPart;
- super.setIsComputed(false);
- }
-
- protected int computeValue() {
- int rslt = super.computeValue(); // absolute part
- if (pcPart != null) {
- rslt += pcPart.computeValue();
- }
- return rslt;
- }
-
- public String toString() {
- // return the factor as a percent
- // What about the base value?
- StringBuffer rslt = new StringBuffer(super.toString());
-
- if (pcPart != null) {
- rslt.append("+" + pcPart.toString());
- }
- return rslt.toString();
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-public interface PercentBase {
- public int getDimension();
- public double getBaseValue();
- public int getBaseLength();
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.messaging.MessageHandler;
-
-/**
- * a percent specified length quantity in XSL
- */
-public class PercentLength extends Length {
-
- private double factor;
- private PercentBase lbase = null;
-
- /**
- * construct an object based on a factor (the percent, as a
- * a factor) and an object which has a method to return the
- * Length which provides the "base" for this calculation.
- */
- public PercentLength(double factor) {
- this(factor, null);
- }
-
- public PercentLength(double factor, PercentBase lbase) {
- super(0);
- this.factor = factor;
- this.lbase = lbase;
- super.setIsComputed(false);
- }
-
- public void setBaseLength(PercentBase lbase) {
- this.lbase = lbase;
- }
-
- public PercentBase getBaseLength() {
- return this.lbase;
- }
-
- /**
- * Return the computed value in millipoints. This assumes that the
- * base length has been resolved to an absolute length value.
- */
- protected int computeValue() {
- return (int)(factor * (double)lbase.getBaseLength());
- }
-
- public double value() {
- return factor;
- }
-
- public String toString() {
- // return the factor as a percent
- // What about the base value?
- return (new Double(factor * 100.0).toString()) + "%";
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.fo.Property;
-
-/**
- * a space quantity in XSL (space-before, space-after)
- */
-public class Space extends LengthRange {
-
- private Property precedence;
- private Property conditionality;
-
- // From CompoundDatatype
- public void setComponent(String sCmpnName, Property cmpnValue,
- boolean bIsDefault) {
- if (sCmpnName.equals("precedence"))
- setPrecedence(cmpnValue, bIsDefault);
- else if (sCmpnName.equals("conditionality"))
- setConditionality(cmpnValue, bIsDefault);
- else
- super.setComponent(sCmpnName, cmpnValue, bIsDefault);
- }
-
- // From CompoundDatatype
- public Property getComponent(String sCmpnName) {
- if (sCmpnName.equals("precedence"))
- return getPrecedence();
- else if (sCmpnName.equals("conditionality"))
- return getConditionality();
- else
- return super.getComponent(sCmpnName);
- }
-
- protected void setPrecedence(Property precedence, boolean bIsDefault) {
- this.precedence = precedence;
- }
-
- protected void setConditionality(Property conditionality,
- boolean bIsDefault) {
- this.conditionality = conditionality;
- }
-
- public Property getPrecedence() {
- return this.precedence;
- }
-
- /*
- * public boolean isDiscard() {
- * return (this.conditionality == DISCARD);
- * }
- */
-
- public Property getConditionality() {
- return this.conditionality;
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.messaging.MessageHandler;
-
-/**
- * A table-column width specification, possibly including some
- * number of proportional "column-units". The absolute size of a
- * column-unit depends on the fixed and proportional sizes of all
- * columns in the table, and on the overall size of the table.
- * It can't be calculated until all columns have been specified and until
- * the actual width of the table is known. Since this can be specified
- * as a percent of its parent containing width, the calculation is done
- * during layout.
- * NOTE: this is only supposed to be allowed if table-layout=fixed.
- */
-public class TableColLength extends MixedLength {
-
- /**
- * Number of table-column proportional units
- */
- double tcolUnits;
-
- /**
- * Construct an object with tcolUnits of proportional measure.
- */
- public TableColLength(double tcolUnits) {
- super(0, null);
- this.tcolUnits = tcolUnits;
- }
-
- public TableColLength(int absUnits, PercentLength pcUnits,
- double tcolUnits) {
- super(absUnits, pcUnits);
- this.tcolUnits = tcolUnits;
- }
-
-
- /**
- * Override the method in Length to return the number of specified
- * proportional table-column units.
- */
- public double getTableUnits() {
- return tcolUnits;
- }
-
- // Set tcolUnits too when resolved?
-
- public String toString() {
- return (super.toString() + "+" + (new Double(tcolUnits).toString())
- + "table-column-units");
- }
-
-}
+++ /dev/null
-/*
- * $Id$
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-/**
- * a not as yet implemented value
- */
-public class ToBeImplemented {
-
- public ToBeImplemented(String value) {}
-
-}
-
+++ /dev/null
-/*
- * $Id$ --
- * 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.
- */
-
-package org.apache.fop.datatypes;
-
-import org.apache.fop.fo.*;
-import org.apache.fop.messaging.MessageHandler;
-
-public class ToBeImplementedProperty extends Property {
-
- public static class Maker extends Property.Maker {
-
- public Maker(String propName) {
- super(propName);
- }
-
- public Property convertProperty(Property p,
- PropertyList propertyList, FObj fo) {
- if (p instanceof ToBeImplementedProperty)
- return p;
- ToBeImplementedProperty val =
- new ToBeImplementedProperty(getPropName());
- return val;
- }
-
- }
-
- public ToBeImplementedProperty(String propName) {
- MessageHandler.errorln("Warning: property - \"" + propName
- + "\" is not implemented yet.");
- }
-
-}