You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Length.java 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.datatypes;
  8. import org.apache.fop.fo.expr.Numeric;
  9. import org.apache.fop.fo.Property;
  10. /**
  11. * a length quantity in XSL
  12. */
  13. public class Length {
  14. protected int millipoints = 0;
  15. protected boolean bIsComputed = false;
  16. /**
  17. * return the length in 1/1000ths of a point
  18. */
  19. public int mvalue() {
  20. if (!bIsComputed) {
  21. computeValue();
  22. }
  23. return millipoints;
  24. }
  25. protected void computeValue() {
  26. }
  27. protected void setComputedValue(int millipoints) {
  28. setComputedValue(millipoints, true);
  29. }
  30. protected void setComputedValue(int millipoints, boolean bSetComputed) {
  31. this.millipoints = millipoints;
  32. this.bIsComputed = bSetComputed;
  33. }
  34. public boolean isAuto() {
  35. return false;
  36. }
  37. public boolean isComputed() {
  38. return this.bIsComputed;
  39. }
  40. /**
  41. * Return the number of table units which are included in this
  42. * length specification.
  43. * This will always be 0 unless the property specification used
  44. * the proportional-column-width() function (only only table
  45. * column FOs).
  46. * <p>If this value is not 0, the actual value of the Length cannot
  47. * be known without looking at all of the columns in the table to
  48. * determine the value of a "table-unit".
  49. * @return The number of table units which are included in this
  50. * length specification.
  51. */
  52. public double getTableUnits() {
  53. return 0.0;
  54. }
  55. public void resolveTableUnit(double dTableUnit) {
  56. }
  57. public Numeric asNumeric() {
  58. return null;
  59. }
  60. public String toString() {
  61. String s = millipoints + "mpt";
  62. return s;
  63. }
  64. }