diff options
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/StaticContent.java | 1 | ||||
-rw-r--r-- | src/java/org/apache/fop/layoutmgr/PageLayoutManager.java | 98 |
2 files changed, 49 insertions, 50 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/StaticContent.java b/src/java/org/apache/fop/fo/pagination/StaticContent.java index b3abbda4b..39c5d3117 100644 --- a/src/java/org/apache/fop/fo/pagination/StaticContent.java +++ b/src/java/org/apache/fop/fo/pagination/StaticContent.java @@ -55,7 +55,6 @@ import org.apache.fop.fo.FONode; import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.apps.FOPException; import org.apache.fop.layoutmgr.StaticContentLayoutManager; -import org.apache.fop.apps.*; /** * Class modelling the fo:static-content object. See Sec. 6.4.19 of the XSL-FO diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java index 4c9514116..b9b4ae602 100644 --- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -467,61 +467,61 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable } private void layoutStaticContent(Region region, int regionClass) { - if (region != null) { - StaticContent flow = pageSequence - .getStaticContent(region.getRegionName()); - if (flow != null) { - RegionViewport reg = curPage.getPage() - .getRegion(regionClass); - reg.getRegion().setIPD((int)reg.getViewArea().getWidth()); - if (reg == null) { - getLogger().error("no region viewport: shouldn't happen"); - } - StaticContentLayoutManager lm = flow.getLayoutManager(); - lm.setUserAgent(getUserAgent()); - lm.init(); - lm.setRegionReference(reg.getRegion()); - lm.setParent(this); - LayoutContext childLC = new LayoutContext(0); - childLC.setStackLimit(new MinOptMax((int)curPage.getViewArea().getHeight())); - childLC.setRefIPD((int)reg.getViewArea().getWidth()); - - while (!lm.isFinished()) { - BreakPoss bp = lm.getNextBreakPoss(childLC); - if (bp != null) { - List vecBreakPoss = new ArrayList(); - vecBreakPoss.add(bp); - lm.addAreas(new BreakPossPosIter(vecBreakPoss, 0, - vecBreakPoss.size()), null); - } else { - getLogger().error("bp==null cls=" + regionClass); - } - } - //lm.flush(); - lm.reset(null); + if (region == null) { + return; + } + StaticContent flow = pageSequence.getStaticContent(region.getRegionName()); + if (flow == null) { + return; + } + RegionViewport reg = curPage.getPage().getRegion(regionClass); + reg.getRegion().setIPD((int)reg.getViewArea().getWidth()); + if (reg == null) { + getLogger().error("no region viewport: shouldn't happen"); + } + StaticContentLayoutManager lm = flow.getLayoutManager(); + lm.setUserAgent(getUserAgent()); + lm.init(); + lm.setRegionReference(reg.getRegion()); + lm.setParent(this); + LayoutContext childLC = new LayoutContext(0); + childLC.setStackLimit(new MinOptMax((int)curPage.getViewArea().getHeight())); + childLC.setRefIPD((int)reg.getViewArea().getWidth()); + while (!lm.isFinished()) { + BreakPoss bp = lm.getNextBreakPoss(childLC); + if (bp != null) { + List vecBreakPoss = new ArrayList(); + vecBreakPoss.add(bp); + lm.addAreas(new BreakPossPosIter(vecBreakPoss, 0, + vecBreakPoss.size()), null); + } else { + getLogger().error("bp==null cls=" + regionClass); } } + //lm.flush(); + lm.reset(null); } private void finishPage() { - if (curPage != null) { - // Layout static content into the regions - // Need help from pageseq for this - layoutStaticContent(currentSimplePageMaster.getRegion(Region.BEFORE), - Region.BEFORE_CODE); - layoutStaticContent(currentSimplePageMaster.getRegion(Region.AFTER), - Region.AFTER_CODE); - layoutStaticContent(currentSimplePageMaster.getRegion(Region.START), - Region.START_CODE); - layoutStaticContent(currentSimplePageMaster.getRegion(Region.END), - Region.END_CODE); - // Queue for ID resolution and rendering - areaTree.addPage(curPage); - curPage = null; - curBody = null; - curSpan = null; - curFlow = null; + if (curPage == null) { + return; } + // Layout static content into the regions + // Need help from pageseq for this + layoutStaticContent(currentSimplePageMaster.getRegion(Region.BEFORE), + Region.BEFORE_CODE); + layoutStaticContent(currentSimplePageMaster.getRegion(Region.AFTER), + Region.AFTER_CODE); + layoutStaticContent(currentSimplePageMaster.getRegion(Region.START), + Region.START_CODE); + layoutStaticContent(currentSimplePageMaster.getRegion(Region.END), + Region.END_CODE); + // Queue for ID resolution and rendering + areaTree.addPage(curPage); + curPage = null; + curBody = null; + curSpan = null; + curFlow = null; } /** |