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 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.area;
  18. import java.util.ArrayList;
  19. import java.util.List;
  20. import org.apache.fop.fo.pagination.Region;
  21. /**
  22. * This is a region reference area for the page regions.
  23. * This area represents a region on the page. It is cloneable
  24. * so the page master can make copies from the original page and regions.
  25. */
  26. public class RegionReference extends Area implements Cloneable {
  27. private int regionClass = Region.BEFORE_CODE;
  28. private CTM ctm;
  29. // the list of block areas from the static flow
  30. private List blocks = new ArrayList();
  31. private int bpd;
  32. /**
  33. * Create a new region reference area.
  34. *
  35. * @param type the region class type
  36. */
  37. public RegionReference(int type) {
  38. regionClass = type;
  39. }
  40. /**
  41. * Set the Coordinate Transformation Matrix which transforms content
  42. * coordinates in this region reference area which are specified in
  43. * terms of "start" and "before" into coordinates in a system which
  44. * is positioned in "absolute" directions (with origin at lower left of
  45. * the region reference area.
  46. *
  47. * @param ctm the current transform to position this region
  48. */
  49. public void setCTM(CTM ctm) {
  50. this.ctm = ctm;
  51. }
  52. /**
  53. * Get the current transform of this region.
  54. *
  55. * @return ctm the current transform to position this region
  56. */
  57. public CTM getCTM() {
  58. return this.ctm;
  59. }
  60. /**
  61. * Get the block in this region.
  62. *
  63. * @return the list of blocks in this region
  64. */
  65. public List getBlocks() {
  66. return blocks;
  67. }
  68. /**
  69. * Get the region class of this region.
  70. *
  71. * @return the region class
  72. */
  73. public int getRegionClass() {
  74. return regionClass;
  75. }
  76. /**
  77. * Add a block area to this region reference area.
  78. *
  79. * @param block the block area to add
  80. */
  81. public void addBlock(Block block) {
  82. blocks.add(block);
  83. }
  84. /**
  85. * Set the block-progression-dimension.
  86. *
  87. * @return the footnote area
  88. */
  89. public void setBPD(int bpd) {
  90. this.bpd = bpd;
  91. }
  92. /**
  93. * Set the block-progression-dimension.
  94. *
  95. * @return the footnote area
  96. */
  97. public int getBPD() {
  98. return bpd;
  99. }
  100. /**
  101. * Clone this region.
  102. * This is used when cloning the page by the page master.
  103. * The blocks are not copied since the master will have no blocks.
  104. *
  105. * @return a copy of this region reference area
  106. */
  107. public Object clone() {
  108. RegionReference rr = new RegionReference(regionClass);
  109. rr.ctm = ctm;
  110. rr.setIPD(getIPD());
  111. return rr;
  112. }
  113. }