import org.apache.commons.logging.LogFactory;
import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.pagination.SimplePageMaster;
/**
* Page viewport that specifies the viewport area and holds the page contents.
private Rectangle2D viewArea;
private boolean clip = false;
private String pageNumberString = null;
+ private SimplePageMaster spm = null;
// list of id references and the rectangle on the page
private Map idReferences = null;
* @param p the page reference area that holds the contents
* @param bounds the bounds of this viewport
*/
- public PageViewport(Page p, Rectangle2D bounds) {
+ public PageViewport(SimplePageMaster spm, Page p, Rectangle2D bounds) {
page = p;
+ this.spm = spm;
viewArea = bounds;
}
*/
public Object clone() {
Page p = (Page)page.clone();
- PageViewport ret = new PageViewport(p, (Rectangle2D)viewArea.clone());
+ PageViewport ret = new PageViewport(spm, p, (Rectangle2D)viewArea.clone());
return ret;
}
sb.append(getPageNumberString());
return sb.toString();
}
+ /**
+ * @return Returns the spm.
+ */
+ public SimplePageMaster getSPM() {
+ return spm;
+ }
}
\ No newline at end of file
}
}*/
-
private int startPageNum = 0;
private int currentPageNum = 0;
private String pageNumberString;
*/
private AreaTreeModel areaTreeModel;
- /**
- * This is the SimplePageMaster that should be used to create the page. It
- * will be equal to the PageSequence's simplePageMaster, if it exists, or
- * to the correct member of the PageSequence's pageSequenceMaster, if that
- * is in effect instead.
- */
- private SimplePageMaster currentSimplePageMaster;
-
/**
* The collection of StaticContentLayoutManager objects that are associated
* with this Page Sequence, keyed by flow-name.
}
protected int getCurrentDisplayAlign() {
- return currentSimplePageMaster.getRegion(Constants.FO_REGION_BODY).getDisplayAlign();
+ return curPage.getSPM().getRegion(Constants.FO_REGION_BODY).getDisplayAlign();
}
protected boolean hasMoreContent() {
try {
// create a new page
- currentSimplePageMaster = pageSeq.getSimplePageMasterToUse(
+ SimplePageMaster spm = pageSeq.getSimplePageMasterToUse(
currentPageNum, isFirstPage, bIsBlank);
- Region body = currentSimplePageMaster.getRegion(FO_REGION_BODY);
+ 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.
throw new FOPException("Flow '" + pageSeq.getMainFlow().getFlowName()
+ "' does not map to the region-body in page-master '"
- + currentSimplePageMaster.getMasterName() + "'. FOP presently "
+ + spm.getMasterName() + "'. FOP presently "
+ "does not support this.");
}
- curPage = createPageAreas(currentSimplePageMaster);
+ curPage = createPageAreas(spm);
isFirstPage = false;
} catch (FOPException fopex) {
throw new IllegalArgumentException("Cannot create page: " + fopex.getMessage());
}
private void layoutSideRegion(int regionID) {
- SideRegion reg = (SideRegion)currentSimplePageMaster.getRegion(regionID);
+ SideRegion reg = (SideRegion)curPage.getSPM().getRegion(regionID);
if (reg == null) {
return;
}
page.setRegionViewport(r.getNameId(), rvp);
}
- return new PageViewport(page, new Rectangle(0, 0, pageWidth, pageHeight));
+ return new PageViewport(spm, page, new Rectangle(0, 0, pageWidth, pageHeight));
}
/**