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.

LineArea.java 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 org.apache.fop.area.inline.InlineArea;
  19. import java.util.ArrayList;
  20. import java.util.List;
  21. /**
  22. * The line area.
  23. * This is a line area that contains inline areas.
  24. */
  25. public class LineArea extends Area {
  26. private int stacking = LR;
  27. // contains inline areas
  28. // has start indent and length, dominant baseline, height
  29. private int startIndent;
  30. private int length;
  31. private int lineHeight;
  32. // this is the offset for the dominant baseline
  33. private int baseLine;
  34. // this class can contain the dominant char styling info
  35. // this means that many renderers can optimise a bit
  36. private List inlineAreas = new ArrayList();
  37. /**
  38. * Set the height of this line area.
  39. *
  40. * @param height the height of the line area
  41. */
  42. public void setHeight(int height) {
  43. lineHeight = height;
  44. }
  45. /**
  46. * Get the height of this line area.
  47. *
  48. * @return the height of the line area
  49. */
  50. public int getHeight() {
  51. return lineHeight;
  52. }
  53. /**
  54. * Add a child area to this line area.
  55. *
  56. * @param childArea the inline child area to add
  57. */
  58. public void addChild(Area childArea) {
  59. if (childArea instanceof InlineArea) {
  60. addInlineArea((InlineArea)childArea);
  61. }
  62. }
  63. /**
  64. * Add an inline child area to this line area.
  65. *
  66. * @param area the inline child area to add
  67. */
  68. public void addInlineArea(InlineArea area) {
  69. inlineAreas.add(area);
  70. }
  71. /**
  72. * Get the inline child areas of this line area.
  73. *
  74. * @return the list of inline areas
  75. */
  76. public List getInlineAreas() {
  77. return inlineAreas;
  78. }
  79. /**
  80. * Set the start indent of this line area.
  81. * The start indent is used for offsetting the start of
  82. * the inline areas for alignment or other indents.
  83. *
  84. * @param si the start indent value
  85. */
  86. public void setStartIndent(int si) {
  87. startIndent = si;
  88. }
  89. /**
  90. * Get the start indent of this line area.
  91. * The start indent is used for offsetting the start of
  92. * the inline areas for alignment or other indents.
  93. *
  94. * @return the start indent value
  95. */
  96. public int getStartIndent() {
  97. return startIndent;
  98. }
  99. }