]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Introduced a flag to tell the page breaking to operate in auto-height mode, i.e....
authorJeremias Maerki <jeremias@apache.org>
Thu, 22 Dec 2005 07:58:31 +0000 (07:58 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 22 Dec 2005 07:58:31 +0000 (07:58 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@358522 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java

index 729f153f11fe9b8b3be02076f276597c36b697c8..2258441f12b45d788c2a98f73448228c70100a85 100644 (file)
@@ -179,6 +179,16 @@ public abstract class AbstractBreaker {
      * @param flowBPD the constant available block-progression-dimension (used for every part)
      */
     public void doLayout(int flowBPD) {
+        doLayout(flowBPD, false);
+    }
+    
+    /**
+     * Starts the page breaking process.
+     * @param flowBPD the constant available block-progression-dimension (used for every part)
+     * @param autoHeight true if warnings about overflows should be disabled because the
+     *                   the BPD is really undefined (for footnote-separators, for example)
+     */
+    public void doLayout(int flowBPD, boolean autoHeight) {
         LayoutContext childLC = createLayoutContext();
         childLC.setStackLimit(new MinOptMax(flowBPD));
 
@@ -224,7 +234,7 @@ public abstract class AbstractBreaker {
                 PageBreakingAlgorithm alg = new PageBreakingAlgorithm(getTopLevelLM(),
                         getPageProvider(),
                         alignment, alignmentLast, footnoteSeparatorLength,
-                        isPartOverflowRecoveryActivated());
+                        isPartOverflowRecoveryActivated(), autoHeight);
                 int iOptPageCount;
 
                 BlockSequence effectiveList;
index 944ba9da4ebdf6f4a2daf8fefa3592d0979164e6..56a8465b76e639b42542c6cf5cc4bd770a40fba4 100644 (file)
@@ -41,7 +41,7 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm {
             boolean partOverflowRecovery,\r
             int columnCount) {\r
         super(topLevelLM, pageProvider, alignment, alignmentLast, \r
-                footnoteSeparatorLength, partOverflowRecovery);\r
+                footnoteSeparatorLength, partOverflowRecovery, false);\r
         this.columnCount = columnCount;\r
         this.considerTooShort = true; //This is important!\r
     }\r
index ec456c0302eadeda7870c3352b1b169e0f79db36..5608b17206310395f40199a539e2a4d033ff38df 100644 (file)
@@ -65,11 +65,14 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
     private int storedBreakIndex = -1;
     private boolean storedValue = false;
 
+    //Controls whether overflows should be warned about or not
+    private boolean autoHeight = false;
+    
     public PageBreakingAlgorithm(LayoutManager topLevelLM,
                                  PageSequenceLayoutManager.PageProvider pageProvider,
                                  int alignment, int alignmentLast,
                                  MinOptMax footnoteSeparatorLength,
-                                 boolean partOverflowRecovery) {
+                                 boolean partOverflowRecovery, boolean autoHeight) {
         super(alignment, alignmentLast, true, partOverflowRecovery, 0);
         this.topLevelLM = topLevelLM;
         this.pageProvider = pageProvider;
@@ -79,6 +82,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
         if (footnoteSeparatorLength.min == footnoteSeparatorLength.max) {
             footnoteSeparatorLength.max += 10000;
         }
+        this.autoHeight = autoHeight;
     }
 
     /**
@@ -717,7 +721,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
         //      ? bestActiveNode.difference : bestActiveNode.difference + fillerMinWidth;
         int difference = bestActiveNode.difference;
         if (difference + bestActiveNode.availableShrink < 0) {
-            if (log.isWarnEnabled()) {
+            if (!autoHeight && log.isWarnEnabled()) {
                 log.warn(FONode.decorateWithContextInfo(
                         "Part/page " + (getPartCount() + 1) 
                         + " overflows the available area in block-progression dimension.", 
index 9028f17cf8aa8cd903ad4b196e915a2e901dc590..cce2d671c0834596381e516b7ececcf4a71d88ec 100644 (file)
@@ -208,11 +208,15 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
         int targetIPD = 0;
         int targetBPD = 0;
         int targetAlign = EN_AUTO;
+        boolean autoHeight = false;
         StaticContentBreaker breaker;
 
         if (getStaticContentFO().getFlowName().equals("xsl-footnote-separator")) {
             targetIPD = targetBlock.getIPD();
             targetBPD = targetBlock.getBPD();
+            if (targetBPD == 0) {
+                autoHeight = true;
+            }
             targetAlign = EN_BEFORE;
         } else {
             targetIPD = targetRegion.getIPD();
@@ -222,13 +226,15 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
         setContentAreaIPD(targetIPD);
         setContentAreaBPD(targetBPD);
         breaker = new StaticContentBreaker(this, targetIPD, targetAlign);
-        breaker.doLayout(targetBPD);
+        breaker.doLayout(targetBPD, autoHeight);
         if (breaker.isOverflow()) {
-            if (!getStaticContentFO().getFlowName().equals("xsl-footnote-separator")
-                && regionFO.getOverflow() == EN_ERROR_IF_OVERFLOW) {
-                //TODO throw layout exception
+            if (!autoHeight) {
+                //Overflow handling
+                if (regionFO.getOverflow() == EN_ERROR_IF_OVERFLOW) {
+                    //TODO throw layout exception
+                }
+                log.warn("static-content overflows the available area.");
             }
-            log.warn("static-content overflows the available area.");
         }
     }