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.

RegionEnd.java 3.5KB

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