From: Jeremias Maerki Date: Thu, 22 Dec 2005 07:58:31 +0000 (+0000) Subject: Introduced a flag to tell the page breaking to operate in auto-height mode, i.e.... X-Git-Tag: fop-0_92-beta~277 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=45fee7442a433c41bd6017d60f9e0324f1fadbec;p=xmlgraphics-fop.git Introduced a flag to tell the page breaking to operate in auto-height mode, i.e. no overflows can happen. This disables the overflow warnings when footnote-separators are defined. They don't have an explicit height. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@358522 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java index 729f153f1..2258441f1 100644 --- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java +++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java @@ -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; diff --git a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java index 944ba9da4..56a8465b7 100644 --- a/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java @@ -41,7 +41,7 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { boolean partOverflowRecovery, int columnCount) { super(topLevelLM, pageProvider, alignment, alignmentLast, - footnoteSeparatorLength, partOverflowRecovery); + footnoteSeparatorLength, partOverflowRecovery, false); this.columnCount = columnCount; this.considerTooShort = true; //This is important! } diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java index ec456c030..5608b1720 100644 --- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java +++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java @@ -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.", diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java index 9028f17cf..cce2d671c 100644 --- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java @@ -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."); } }