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.

RegionAfter.java 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 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.fo.pagination;
  8. // FOP
  9. import org.apache.fop.fo.*;
  10. import org.apache.fop.fo.properties.*;
  11. import org.apache.fop.apps.FOPException;
  12. import org.apache.fop.layout.RegionArea;
  13. import org.apache.fop.layout.BorderAndPadding;
  14. import org.apache.fop.layout.BackgroundProps;
  15. /**
  16. * Class modeling the fo:region-after object.
  17. *
  18. * @see <a href="@XSLFO-STD@#fo_region-after"
  19. target="_xslfostd">@XSLFO-STDID@
  20. * &para;6.4.15</a>
  21. */
  22. public class RegionAfter extends Region {
  23. public static class Maker extends FObj.Maker {
  24. public FObj make(FObj parent,
  25. PropertyList propertyList) throws FOPException {
  26. return new RegionAfter(parent, propertyList);
  27. }
  28. }
  29. public static FObj.Maker maker() {
  30. return new RegionAfter.Maker();
  31. }
  32. public static final String REGION_CLASS = "after";
  33. private int precedence;
  34. protected RegionAfter(FObj parent,
  35. PropertyList propertyList) throws FOPException {
  36. super(parent, propertyList);
  37. precedence = this.properties.get("precedence").getEnum();
  38. }
  39. public String getName() {
  40. return "fo:region-after";
  41. }
  42. RegionArea makeRegionArea(int allocationRectangleXPosition,
  43. int allocationRectangleYPosition,
  44. int allocationRectangleWidth,
  45. int allocationRectangleHeight) {
  46. // Common Border, Padding, and Background Properties
  47. BorderAndPadding bap = propMgr.getBorderAndPadding();
  48. BackgroundProps bProps = propMgr.getBackgroundProps();
  49. // this.properties.get("clip");
  50. // this.properties.get("display-align");
  51. int extent = this.properties.get("extent").getLength().mvalue();
  52. // this.properties.get("overflow");
  53. // this.properties.get("precedence");
  54. // this.properties.get("region-name");
  55. // this.properties.get("reference-orientation");
  56. // this.properties.get("writing-mode");
  57. RegionArea area = new RegionArea(allocationRectangleXPosition,
  58. allocationRectangleYPosition
  59. - allocationRectangleHeight + extent,
  60. allocationRectangleWidth, extent);
  61. area.setBackground(bProps);
  62. return area;
  63. }
  64. RegionArea makeRegionArea(int allocationRectangleXPosition,
  65. int allocationRectangleYPosition,
  66. int allocationRectangleWidth,
  67. int allocationRectangleHeight,
  68. int startExtent, int endExtent) {
  69. if (getPrecedence() == false) {
  70. allocationRectangleXPosition += startExtent;
  71. allocationRectangleWidth -= startExtent + endExtent;
  72. }
  73. return makeRegionArea(allocationRectangleXPosition,
  74. allocationRectangleYPosition,
  75. allocationRectangleWidth,
  76. allocationRectangleHeight);
  77. }
  78. protected String getDefaultRegionName() {
  79. return "xsl-region-after";
  80. }
  81. public String getRegionClass() {
  82. return REGION_CLASS;
  83. }
  84. public boolean getPrecedence() {
  85. return (precedence == Precedence.TRUE ? true : false);
  86. }
  87. public int getExtent() {
  88. return properties.get("extent").getLength().mvalue();
  89. }
  90. }