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.

LayoutProps.java 1.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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.traits;
  8. import org.apache.fop.datatypes.Length;
  9. import org.apache.fop.fo.properties.Constants;
  10. /**
  11. * Store properties affecting layout: break-before, break-after, keeps, span.
  12. * for a block level FO.
  13. * Public "structure" allows direct member access.
  14. */
  15. public class LayoutProps {
  16. public int breakBefore; // enum constant BreakBefore.xxx
  17. public int breakAfter; // enum constant BreakAfter.xxx
  18. public boolean bIsSpan;
  19. public SpaceVal spaceBefore;
  20. public SpaceVal spaceAfter;
  21. private static final int[] s_breakPriorities = new int[] {
  22. Constants.AUTO, Constants.COLUMN, Constants.PAGE };
  23. public LayoutProps() {
  24. breakBefore = breakAfter = Constants.AUTO;
  25. bIsSpan = false;
  26. }
  27. // public static int higherBreak(int brkParent, int brkChild) {
  28. // if (brkParent == brkChild) return brkChild;
  29. // for (int i=0; i < s_breakPriorities.length; i++) {
  30. // int bp = s_breakPriorities[i];
  31. // if (bp == brkParent) return brkChild;
  32. // else if (bp == brkChild) return brkParent;
  33. // }
  34. // return brkChild;
  35. // }
  36. public void combineWithParent(LayoutProps parentLP) {
  37. if (parentLP.breakBefore != breakBefore) {
  38. for (int i=0; i < s_breakPriorities.length; i++) {
  39. int bp = s_breakPriorities[i];
  40. if (bp == breakBefore) {
  41. breakBefore = parentLP.breakBefore;
  42. break;
  43. }
  44. else if (bp == parentLP.breakBefore) break;
  45. }
  46. }
  47. // Parent span always overrides child span
  48. bIsSpan = parentLP.bIsSpan;
  49. }
  50. }