aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/PageProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/PageProvider.java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageProvider.java51
1 files changed, 22 insertions, 29 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/PageProvider.java b/src/java/org/apache/fop/layoutmgr/PageProvider.java
index 037f02094..a7918db6e 100644
--- a/src/java/org/apache/fop/layoutmgr/PageProvider.java
+++ b/src/java/org/apache/fop/layoutmgr/PageProvider.java
@@ -24,7 +24,6 @@ import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.fop.apps.FOPException;
import org.apache.fop.area.AreaTreeHandler;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.PageSequence;
@@ -196,10 +195,10 @@ public class PageProvider implements Constants {
}
/**
- *
- * @param isBlank true if the Page should be a blank one
+ * Returns a Page.
+ * @param isBlank true if the Page should be a blank one
* @param index the Page's index
- * @return a Page instance
+ * @return a Page instance
*/
protected Page getPage(boolean isBlank, int index) {
boolean isLastPage = (lastPageIndex >= 0) && (index == lastPageIndex);
@@ -251,31 +250,25 @@ public class PageProvider implements Constants {
}
private Page cacheNextPage(int index, boolean isBlank, boolean isLastPage) {
- try {
- String pageNumberString = pageSeq.makeFormattedPageNumber(index);
- SimplePageMaster spm = pageSeq.getNextSimplePageMaster(
- index, (startPageOfPageSequence == index), isLastPage, false, isBlank);
-
- Region body = spm.getRegion(FO_REGION_BODY);
- if (!pageSeq.getMainFlow().getFlowName().equals(body.getRegionName())) {
- // this is fine by the XSL Rec (fo:flow's flow-name can be mapped to
- // any region), but we don't support it yet.
- BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
- pageSeq.getUserAgent().getEventBroadcaster());
- eventProducer.flowNotMappingToRegionBody(this,
- pageSeq.getMainFlow().getFlowName(), spm.getMasterName(), spm.getLocator());
- }
- Page page = new Page(spm, index, pageNumberString, isBlank);
- //Set unique key obtained from the AreaTreeHandler
- page.getPageViewport().setKey(areaTreeHandler.generatePageViewportKey());
- page.getPageViewport().setForeignAttributes(spm.getForeignAttributes());
- cachedPages.add(page);
- return page;
- } catch (FOPException e) {
- //TODO Maybe improve. It'll mean to propagate this exception up several
- //methods calls.
- throw new IllegalStateException(e.getMessage());
+ String pageNumberString = pageSeq.makeFormattedPageNumber(index);
+ SimplePageMaster spm = pageSeq.getNextSimplePageMaster(
+ index, (startPageOfPageSequence == index), isLastPage, false, isBlank);
+
+ Region body = spm.getRegion(FO_REGION_BODY);
+ if (!pageSeq.getMainFlow().getFlowName().equals(body.getRegionName())) {
+ // this is fine by the XSL Rec (fo:flow's flow-name can be mapped to
+ // any region), but we don't support it yet.
+ BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
+ pageSeq.getUserAgent().getEventBroadcaster());
+ eventProducer.flowNotMappingToRegionBody(this,
+ pageSeq.getMainFlow().getFlowName(), spm.getMasterName(), spm.getLocator());
}
+ Page page = new Page(spm, index, pageNumberString, isBlank);
+ //Set unique key obtained from the AreaTreeHandler
+ page.getPageViewport().setKey(areaTreeHandler.generatePageViewportKey());
+ page.getPageViewport().setForeignAttributes(spm.getForeignAttributes());
+ cachedPages.add(page);
+ return page;
}
-
+
} \ No newline at end of file