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.

RegionReference.java 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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;
  8. import java.io.Serializable;
  9. import java.util.ArrayList;
  10. import java.util.List;
  11. /**
  12. * This is a region reference area for the page regions.
  13. * This area represents a region on the page. It is cloneable
  14. * so the page master can make copies from the original page and regions.
  15. */
  16. public class RegionReference extends Area implements Serializable, Cloneable {
  17. /**
  18. * The before region.
  19. */
  20. public static final int BEFORE = 0;
  21. /**
  22. * The start region.
  23. */
  24. public static final int START = 1;
  25. /**
  26. * The body region.
  27. */
  28. public static final int BODY = 2;
  29. /**
  30. * The end region.
  31. */
  32. public static final int END = 3;
  33. /**
  34. * The after region.
  35. */
  36. public static final int AFTER = 4;
  37. private int regionClass = BEFORE;
  38. private CTM ctm;
  39. // the list of block areas from the static flow
  40. private ArrayList blocks = new ArrayList();
  41. /**
  42. * Create a new region reference area.
  43. *
  44. * @param type the region class type
  45. */
  46. public RegionReference(int type) {
  47. regionClass = type;
  48. }
  49. /**
  50. * Set the Coordinate Transformation Matrix which transforms content
  51. * coordinates in this region reference area which are specified in
  52. * terms of "start" and "before" into coordinates in a system which
  53. * is positioned in "absolute" directions (with origin at lower left of
  54. * the region reference area.
  55. *
  56. * @param ctm the current transform to position this region
  57. */
  58. public void setCTM(CTM ctm) {
  59. this.ctm = ctm;
  60. }
  61. /**
  62. * Get the current transform of this region.
  63. *
  64. * @return ctm the current transform to position this region
  65. */
  66. public CTM getCTM() {
  67. return this.ctm;
  68. }
  69. /**
  70. * Get the block in this region.
  71. *
  72. * @return the list of blocks in this region
  73. */
  74. public List getBlocks() {
  75. return blocks;
  76. }
  77. /**
  78. * Get the region class of this region.
  79. *
  80. * @return the region class
  81. */
  82. public int getRegionClass() {
  83. return regionClass;
  84. }
  85. /**
  86. * Add a block area to this region reference area.
  87. *
  88. * @param block the block area to add
  89. */
  90. public void addBlock(Block block) {
  91. blocks.add(block);
  92. }
  93. /**
  94. * Clone this region.
  95. * This is used when cloning the page by the page master.
  96. * The blocks are not copied since the master will have no blocks.
  97. *
  98. * @return a copy of this region reference area
  99. */
  100. public Object clone() {
  101. RegionReference rr = new RegionReference(regionClass);
  102. rr.ctm = ctm;
  103. rr.setIPD(getIPD());
  104. return rr;
  105. }
  106. }