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.

RegionBA.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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.apps.FOPException;
  11. import org.apache.fop.fo.properties.Precedence;
  12. import java.awt.Rectangle;
  13. public abstract class RegionBA extends RegionBASE {
  14. private boolean bPrecedence;
  15. protected RegionBA(FONode parent) {
  16. super(parent);
  17. }
  18. boolean getPrecedence() {
  19. return bPrecedence;
  20. }
  21. public void end() {
  22. super.end();
  23. bPrecedence =
  24. (this.properties.get("precedence").getEnum()==Precedence.TRUE);
  25. }
  26. /**
  27. * Adjust the viewport reference rectangle for a region as a function
  28. * of precedence.
  29. * If precedence is false on a before or after region, its
  30. * inline-progression-dimension is limited by the extent of the start
  31. * and end regions if they are present.
  32. */
  33. protected void adjustIPD(Rectangle vpRect) {
  34. int xoff = 0;
  35. Region start = getSiblingRegion(Region.START);
  36. if (start != null) {
  37. xoff = start.getExtent();
  38. vpRect.translate(xoff, 0);
  39. }
  40. Region end =getSiblingRegion(Region.END);
  41. if (end != null) {
  42. xoff += end.getExtent();
  43. }
  44. if (xoff > 0) {
  45. vpRect.grow(-xoff,0);
  46. }
  47. }
  48. }