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.

InlineArea.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * $Id$
  3. * Copyright (C) 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.Area;
  9. import org.apache.fop.area.Trait;
  10. import org.apache.fop.render.Renderer;
  11. import org.apache.fop.traits.BorderProps;
  12. import java.util.ArrayList;
  13. /**
  14. * Inline Area
  15. * This area is for all inline areas that can be placed
  16. * in a line area.
  17. * Extensions of this class should render themselves with the
  18. * requested renderer.
  19. */
  20. public class InlineArea extends Area {
  21. // int width;
  22. private int height;
  23. protected int contentIPD = 0;
  24. // offset position from top of parent area
  25. int verticalPosition = 0;
  26. // store properties in array list, need better solution
  27. private ArrayList props = null;
  28. /**
  29. * Render this inline area.
  30. * Inline areas that extend this class are expected
  31. * to implement this method to render themselves in
  32. * the renderer.
  33. *
  34. * @param renderer the renderer to render this inline area
  35. */
  36. public void render(Renderer renderer) {
  37. }
  38. public void setWidth(int w) {
  39. contentIPD = w;
  40. }
  41. public int getWidth() {
  42. return contentIPD;
  43. }
  44. public void setIPD(int ipd) {
  45. this.contentIPD = ipd;
  46. }
  47. public int getIPD() {
  48. return this.contentIPD;
  49. }
  50. public void increaseIPD(int ipd) {
  51. this.contentIPD += ipd;
  52. }
  53. public void setHeight(int h) {
  54. height = h;
  55. }
  56. public int getHeight() {
  57. return height;
  58. }
  59. public int getAllocIPD() {
  60. // If start or end border or padding is non-zero, add to content IPD
  61. int iBP = contentIPD;
  62. Object t;
  63. if ((t = getTrait(Trait.PADDING_START)) != null) {
  64. iBP += ((Integer) t).intValue();
  65. }
  66. if ((t = getTrait(Trait.PADDING_END)) != null) {
  67. iBP += ((Integer) t).intValue();
  68. }
  69. if ((t = getTrait(Trait.BORDER_START)) != null) {
  70. iBP += ((BorderProps) t).width;
  71. }
  72. if ((t = getTrait(Trait.BORDER_END)) != null) {
  73. iBP += ((BorderProps) t).width;
  74. }
  75. return iBP;
  76. }
  77. public void setOffset(int v) {
  78. verticalPosition = v;
  79. }
  80. public int getOffset() {
  81. return verticalPosition;
  82. }
  83. }