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.

UnresolvedPageNumber.java 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001-2002 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.area.inline;
  8. import org.apache.fop.area.PageViewport;
  9. import org.apache.fop.area.Resolveable;
  10. import org.apache.fop.area.Trait;
  11. import java.util.List;
  12. /**
  13. * Unresolveable page number area.
  14. * This is a word area that resolves itself to a page number
  15. * from an id reference.
  16. */
  17. public class UnresolvedPageNumber extends Word implements Resolveable {
  18. private boolean resolved = false;
  19. private String pageRefId;
  20. /**
  21. * Create a new unresolveable page number.
  22. *
  23. * @param id the id reference for resolving this
  24. */
  25. public UnresolvedPageNumber(String id) {
  26. pageRefId = id;
  27. word = "?";
  28. }
  29. /**
  30. * Get the id references for this area.
  31. *
  32. * @return the id reference for this unresolved page number
  33. */
  34. public String[] getIDs() {
  35. return new String[] {pageRefId};
  36. }
  37. /**
  38. * Resolve this page number reference.
  39. * This resolves the reference by getting the page number
  40. * string from the first page in the list of pages that apply
  41. * for the id reference. The word string is then set to the
  42. * page number string.
  43. *
  44. * @param id the id reference being resolved
  45. * @param pages the list of pages for the id reference
  46. */
  47. public void resolve(String id, List pages) {
  48. resolved = true;
  49. if (pages != null) {
  50. PageViewport page = (PageViewport)pages.get(0);
  51. String str = page.getPageNumber();
  52. word = str;
  53. // update ipd
  54. String name = (String) getTrait(Trait.FONT_NAME);
  55. int size = ((Integer) getTrait(Trait.FONT_SIZE)).intValue();
  56. //FontMetric metrics = fontInfo.getMetricsFor(name);
  57. //FontState fs = new FontState(name, metrics, size);
  58. }
  59. }
  60. /**
  61. * Check if this is resolved.
  62. *
  63. * @return true when this has been resolved
  64. */
  65. public boolean isResolved() {
  66. return resolved;
  67. }
  68. }