public override RegionArea MakeRegionArea(int allocationRectangleXPosition, int allocationRectangleYPosition, int allocationRectangleWidth, int allocationRectangleHeight) { BorderAndPadding bap = propMgr.GetBorderAndPadding(); BackgroundProps bProps = propMgr.GetBackgroundProps(); MarginProps mProps = propMgr.GetMarginProps(); BodyRegionArea body = new BodyRegionArea(allocationRectangleXPosition + mProps.marginLeft, allocationRectangleYPosition - mProps.marginTop, allocationRectangleWidth - mProps.marginLeft - mProps.marginRight, allocationRectangleHeight - mProps.marginTop - mProps.marginBottom); body.setBackground(propMgr.GetBackgroundProps()); int overflow = this.properties.GetProperty("overflow").GetEnum(); string columnCountAsString = this.properties.GetProperty("column-count").GetString(); int columnCount = 1; try { columnCount = Int32.Parse(columnCountAsString); } catch (FormatException) { FonetDriver.ActiveDriver.FireFonetError( "Bad value on region body 'column-count'"); columnCount = 1; } if ((columnCount > 1) && (overflow == Overflow.SCROLL)) { FonetDriver.ActiveDriver.FireFonetError( "Setting 'column-count' to 1 because 'overflow' is set to 'scroll'"); columnCount = 1; } body.setColumnCount(columnCount); int columnGap = this.properties.GetProperty("column-gap").GetLength().MValue(); body.setColumnGap(columnGap); return(body); }
public void addBody(BodyRegionArea region) { this.body = region; }
protected internal override void End() { int pageWidth = this.properties.GetProperty("page-width").GetLength().MValue(); int pageHeight = this.properties.GetProperty("page-height").GetLength().MValue(); MarginProps mProps = propMgr.GetMarginProps(); int contentRectangleXPosition = mProps.marginLeft; int contentRectangleYPosition = pageHeight - mProps.marginTop; int contentRectangleWidth = pageWidth - mProps.marginLeft - mProps.marginRight; int contentRectangleHeight = pageHeight - mProps.marginTop - mProps.marginBottom; this.pageMaster = new PageMaster(pageWidth, pageHeight); if (getRegion(RegionBody.REGION_CLASS) != null) { BodyRegionArea body = (BodyRegionArea)getRegion(RegionBody.REGION_CLASS).MakeRegionArea(contentRectangleXPosition, contentRectangleYPosition, contentRectangleWidth, contentRectangleHeight); this.pageMaster.addBody(body); } else { FonetDriver.ActiveDriver.FireFonetError( "simple-page-master must have a region of class " + RegionBody.REGION_CLASS); } if (getRegion(RegionBefore.REGION_CLASS) != null) { RegionArea before = getRegion(RegionBefore.REGION_CLASS).MakeRegionArea(contentRectangleXPosition, contentRectangleYPosition, contentRectangleWidth, contentRectangleHeight); this.pageMaster.addBefore(before); beforePrecedence = ((RegionBefore)getRegion(RegionBefore.REGION_CLASS)).getPrecedence(); beforeHeight = before.GetHeight(); } else { beforePrecedence = false; } if (getRegion(RegionAfter.REGION_CLASS) != null) { RegionArea after = getRegion(RegionAfter.REGION_CLASS).MakeRegionArea(contentRectangleXPosition, contentRectangleYPosition, contentRectangleWidth, contentRectangleHeight); this.pageMaster.addAfter(after); afterPrecedence = ((RegionAfter)getRegion(RegionAfter.REGION_CLASS)).getPrecedence(); afterHeight = after.GetHeight(); } else { afterPrecedence = false; } if (getRegion(RegionStart.REGION_CLASS) != null) { RegionArea start = ((RegionStart)getRegion(RegionStart.REGION_CLASS)).MakeRegionArea(contentRectangleXPosition, contentRectangleYPosition, contentRectangleWidth, contentRectangleHeight, beforePrecedence, afterPrecedence, beforeHeight, afterHeight); this.pageMaster.addStart(start); } if (getRegion(RegionEnd.REGION_CLASS) != null) { RegionArea end = ((RegionEnd)getRegion(RegionEnd.REGION_CLASS)).MakeRegionArea(contentRectangleXPosition, contentRectangleYPosition, contentRectangleWidth, contentRectangleHeight, beforePrecedence, afterPrecedence, beforeHeight, afterHeight); this.pageMaster.addEnd(end); } }