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.

BlockParent.java 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. /**
  21. * A BlockParent holds block-level areas.
  22. */
  23. public class BlockParent extends Area {
  24. // this position is used for absolute position
  25. // or as an indent
  26. // this has the size in the block progression dimension
  27. /**
  28. * The x offset position of this block parent.
  29. * Used for relative and absolute positioning.
  30. */
  31. protected int xOffset = 0;
  32. /**
  33. * The y offset position of this block parent.
  34. * Used for relative and absolute positioning.
  35. */
  36. protected int yOffset = 0;
  37. /**
  38. * The width of this block parent.
  39. */
  40. protected int width = 0;
  41. /**
  42. * The height of this block parent.
  43. */
  44. protected int height = 0;
  45. /**
  46. * The children of this block parent area.
  47. */
  48. protected List children = null;
  49. // orientation if reference area
  50. private int orientation = ORIENT_0;
  51. /**
  52. * Add the block area to this block parent.
  53. *
  54. * @param block the child block area to add
  55. */
  56. public void addBlock(Block block) {
  57. if (children == null) {
  58. children = new ArrayList();
  59. }
  60. children.add(block);
  61. }
  62. /**
  63. * Get the list of child areas for this block area.
  64. *
  65. * @return the list of child areas
  66. */
  67. public List getChildAreas() {
  68. return children;
  69. }
  70. /**
  71. * Set the X offset of this block parent area.
  72. *
  73. * @param off the x offset of the block parent area
  74. */
  75. public void setXOffset(int off) {
  76. xOffset = off;
  77. }
  78. /**
  79. * Set the Y offset of this block parent area.
  80. *
  81. * @param off the y offset of the block parent area
  82. */
  83. public void setYOffset(int off) {
  84. yOffset = off;
  85. }
  86. /**
  87. * Set the width of this block parent area.
  88. *
  89. * @param w the width of the area
  90. */
  91. public void setWidth(int w) {
  92. width = w;
  93. }
  94. /**
  95. * Set the height of this block parent area.
  96. *
  97. * @param h the height of the block parent area
  98. */
  99. public void setHeight(int h) {
  100. height = h;
  101. }
  102. /**
  103. * Get the X offset of this block parent area.
  104. *
  105. * @return the x offset of the block parent area
  106. */
  107. public int getXOffset() {
  108. return xOffset;
  109. }
  110. /**
  111. * Get the Y offset of this block parent area.
  112. *
  113. * @return the y offset of the block parent area
  114. */
  115. public int getYOffset() {
  116. return yOffset;
  117. }
  118. /**
  119. * Get the width of this block parent area.
  120. *
  121. * @return the width of the area
  122. */
  123. public int getWidth() {
  124. return width;
  125. }
  126. /**
  127. * Get the height of this block parent area.
  128. *
  129. * @return the height of the block parent area
  130. */
  131. public int getHeight() {
  132. return height;
  133. }
  134. }