public BodyAreaContainer makeBodyAreaContainer() { BodyAreaContainer area = new BodyAreaContainer( null, xPosition, yPosition, width, height, Position.ABSOLUTE, columnCount, columnGap); area.setBackground(getBackground()); return area; }
public void addBody(BodyAreaContainer area) { body = area; area.setPage(this); ((BodyAreaContainer)area).getMainReferenceArea().setPage(this); ((BodyAreaContainer)area).getBeforeFloatReferenceArea().setPage(this); ((BodyAreaContainer)area).getFootnoteReferenceArea().setPage(this); }
public void Format(AreaTree areaTree, Func <string, byte[]> imagehandler = null) { Status status = new Status(Status.OK); this.layoutMasterSet.resetPageMasters(); int firstAvailPageNumber = 0; do { firstAvailPageNumber = this.root.getRunningPageNumberCounter(); bool tempIsFirstPage = false; if (thisIsFirstPage) { tempIsFirstPage = thisIsFirstPage; if (pageNumberType == AUTO) { this.currentPageNumber = this.root.getRunningPageNumberCounter(); } else if (pageNumberType == AUTO_ODD) { this.currentPageNumber = this.root.getRunningPageNumberCounter(); if (this.currentPageNumber % 2 == 1) { this.currentPageNumber++; } } else if (pageNumberType == AUTO_EVEN) { this.currentPageNumber = this.root.getRunningPageNumberCounter(); if (this.currentPageNumber % 2 == 0) { this.currentPageNumber++; } } thisIsFirstPage = false; } this.currentPageNumber++; bool isEmptyPage = false; if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN) && ((currentPageNumber % 2) == 1)) { isEmptyPage = true; } else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD) && ((currentPageNumber % 2) == 0)) { isEmptyPage = true; } else { isEmptyPage = false; } currentPage = MakePage(areaTree, firstAvailPageNumber, tempIsFirstPage, isEmptyPage); currentPage.setNumber(this.currentPageNumber); string formattedPageNumber = pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber); currentPage.setFormattedNumber(formattedPageNumber); this.root.setRunningPageNumberCounter(this.currentPageNumber); FonetDriver.ActiveDriver.FireFonetInfo( "[" + currentPageNumber + "]"); if ((status.getCode() == Status.FORCE_PAGE_BREAK_EVEN) && ((currentPageNumber % 2) == 1)) { } else if ((status.getCode() == Status.FORCE_PAGE_BREAK_ODD) && ((currentPageNumber % 2) == 0)) { } else { BodyAreaContainer bodyArea = currentPage.getBody(); bodyArea.setIDReferences(areaTree.getIDReferences()); Flow.Flow flow = GetCurrentFlow(RegionBody.REGION_CLASS); if (flow == null) { FonetDriver.ActiveDriver.FireFonetError( "No flow found for region-body in page-master '" + currentPageMasterName + "'"); break; } else { flow.ImageHandler = imagehandler; status = flow.Layout(bodyArea); } } currentPage.setPageSequence(this); FormatStaticContent(areaTree); areaTree.addPage(currentPage); this.pageCount++; } while (FlowsAreIncomplete()); ForcePage(areaTree, firstAvailPageNumber); currentPage = null; }
public void RenderBodyAreaContainer(BodyAreaContainer area) { int saveY = this.currentYPosition; int saveX = this.currentAreaContainerXPosition; if (area.getPosition() == Position.ABSOLUTE) { // Y position is computed assuming positive Y axis, adjust for negative postscript one this.currentYPosition = area.GetYPosition(); this.currentAreaContainerXPosition = area.getXPosition(); } else if (area.getPosition() == Position.RELATIVE) { this.currentYPosition -= area.GetYPosition(); this.currentAreaContainerXPosition += area.getXPosition(); } this.currentXPosition = this.currentAreaContainerXPosition; int rx = this.currentAreaContainerXPosition; int ry = this.currentYPosition; int w = area.getAllocationWidth(); int h = area.getMaxHeight(); DoBackground(area, rx, ry, w, h); // floats & footnotes stuff RenderAreaContainer(area.getBeforeFloatReferenceArea()); RenderAreaContainer(area.getFootnoteReferenceArea()); // main reference area foreach (Box b in area.getMainReferenceArea().getChildren()) { b.render(this); // span areas } if (area.getPosition() != Position.STATIC) { this.currentYPosition = saveY; this.currentAreaContainerXPosition = saveX; } else { this.currentYPosition -= area.GetHeight(); } }
public virtual Status Layout(Area area, Region region) { if (this.marker == MarkerStart) { this.marker = 0; } BodyAreaContainer bac = (BodyAreaContainer)area; bool prevChildMustKeepWithNext = false; ArrayList pageMarker = this.getMarkerSnapshot(new ArrayList()); int numChildren = this.children.Count; if (numChildren == 0) { throw new FonetException("fo:flow must contain block-level children"); } for (int i = this.marker; i < numChildren; i++) { FObj fo = (FObj)children[i]; if (bac.isBalancingRequired(fo)) { bac.resetSpanArea(); this.Rollback(markerSnapshot); i = this.marker - 1; continue; } Area currentArea = bac.getNextArea(fo); currentArea.setIDReferences(bac.getIDReferences()); if (bac.isNewSpanArea()) { this.marker = i; markerSnapshot = this.getMarkerSnapshot(new ArrayList()); } SetContentWidth(currentArea.getContentWidth()); _status = fo.Layout(currentArea); if (_status.isIncomplete()) { if ((prevChildMustKeepWithNext) && (_status.laidOutNone())) { this.marker = i - 1; FObj prevChild = (FObj)children[this.marker]; prevChild.RemoveAreas(); prevChild.ResetMarker(); prevChild.RemoveID(area.getIDReferences()); _status = new Status(Status.AREA_FULL_SOME); return(_status); } if (bac.isLastColumn()) { if (_status.getCode() == Status.FORCE_COLUMN_BREAK) { this.marker = i; _status = new Status(Status.FORCE_PAGE_BREAK); return(_status); } else { this.marker = i; return(_status); } } else { if (_status.isPageBreak()) { this.marker = i; return(_status); } ((ColumnArea)currentArea).incrementSpanIndex(); i--; } } if (_status.getCode() == Status.KEEP_WITH_NEXT) { prevChildMustKeepWithNext = true; } else { prevChildMustKeepWithNext = false; } } return(_status); }