public override Status Layout(Area area) { BlockArea blockArea; if (this.marker == MarkerBreakAfter) { return(new Status(Status.OK)); } if (this.marker == MarkerStart) { AccessibilityProps mAccProps = propMgr.GetAccessibilityProps(); AuralProps mAurProps = propMgr.GetAuralProps(); BorderAndPadding bap = propMgr.GetBorderAndPadding(); BackgroundProps bProps = propMgr.GetBackgroundProps(); HyphenationProps mHyphProps = propMgr.GetHyphenationProps(); MarginProps mProps = propMgr.GetMarginProps(); RelativePositionProps mRelProps = propMgr.GetRelativePositionProps(); this.align = this.properties.GetProperty("text-align").GetEnum(); this.alignLast = this.properties.GetProperty("text-align-last").GetEnum(); this.breakAfter = this.properties.GetProperty("break-after").GetEnum(); this.lineHeight = this.properties.GetProperty("line-height").GetLength().MValue(); this.startIndent = this.properties.GetProperty("start-indent").GetLength().MValue(); this.endIndent = this.properties.GetProperty("end-indent").GetLength().MValue(); this.spaceBefore = this.properties.GetProperty("space-before.optimum").GetLength().MValue(); this.spaceAfter = this.properties.GetProperty("space-after.optimum").GetLength().MValue(); this.textIndent = this.properties.GetProperty("text-indent").GetLength().MValue(); this.keepWithNext = this.properties.GetProperty("keep-with-next").GetEnum(); this.blockWidows = this.properties.GetProperty("widows").GetNumber().IntValue(); this.blockOrphans = (int) this.properties.GetProperty("orphans").GetNumber().IntValue(); this.id = this.properties.GetProperty("id").GetString(); if (area is BlockArea) { area.end(); } if (area.getIDReferences() != null) { area.getIDReferences().CreateID(id); } this.marker = 0; int breakBeforeStatus = propMgr.CheckBreakBefore(area); if (breakBeforeStatus != Status.OK) { return(new Status(breakBeforeStatus)); } int numChildren = this.children.Count; for (int i = 0; i < numChildren; i++) { FONode fo = (FONode)children[i]; if (fo is FOText) { if (((FOText)fo).willCreateArea()) { fo.SetWidows(blockWidows); break; } else { children.RemoveAt(i); numChildren = this.children.Count; i--; } } else { fo.SetWidows(blockWidows); break; } } for (int i = numChildren - 1; i >= 0; i--) { FONode fo = (FONode)children[i]; if (fo is FOText) { if (((FOText)fo).willCreateArea()) { fo.SetOrphans(blockOrphans); break; } } else { fo.SetOrphans(blockOrphans); break; } } } if ((spaceBefore != 0) && (this.marker == 0)) { area.addDisplaySpace(spaceBefore); } if (anythingLaidOut) { this.textIndent = 0; } if (marker == 0 && area.getIDReferences() != null) { area.getIDReferences().ConfigureID(id, area); } int spaceLeft = area.spaceLeft(); blockArea = new BlockArea(propMgr.GetFontState(area.getFontInfo()), area.getAllocationWidth(), area.spaceLeft(), startIndent, endIndent, textIndent, align, alignLast, lineHeight); blockArea.setGeneratedBy(this); this.areasGenerated++; if (this.areasGenerated == 1) { blockArea.isFirst(true); } blockArea.addLineagePair(this, this.areasGenerated); blockArea.setParent(area); blockArea.setPage(area.getPage()); blockArea.setBackground(propMgr.GetBackgroundProps()); blockArea.setBorderAndPadding(propMgr.GetBorderAndPadding()); blockArea.setHyphenation(propMgr.GetHyphenationProps()); blockArea.start(); blockArea.setAbsoluteHeight(area.getAbsoluteHeight()); blockArea.setIDReferences(area.getIDReferences()); blockArea.setTableCellXOffset(area.getTableCellXOffset()); for (int i = this.marker; i < children.Count; i++) { FONode fo = (FONode)children[i]; Status status; if ((status = fo.Layout(blockArea)).isIncomplete()) { this.marker = i; if (status.getCode() == Status.AREA_FULL_NONE) { if ((i != 0)) { status = new Status(Status.AREA_FULL_SOME); area.addChild(blockArea); area.setMaxHeight(area.getMaxHeight() - spaceLeft + blockArea.getMaxHeight()); area.increaseHeight(blockArea.GetHeight()); anythingLaidOut = true; return(status); } else { anythingLaidOut = false; return(status); } } area.addChild(blockArea); area.setMaxHeight(area.getMaxHeight() - spaceLeft + blockArea.getMaxHeight()); area.increaseHeight(blockArea.GetHeight()); anythingLaidOut = true; return(status); } anythingLaidOut = true; } blockArea.end(); area.setMaxHeight(area.getMaxHeight() - spaceLeft + blockArea.getMaxHeight()); area.addChild(blockArea); area.increaseHeight(blockArea.GetHeight()); if (spaceAfter != 0) { area.addDisplaySpace(spaceAfter); } if (area is BlockArea) { area.start(); } areaHeight = blockArea.GetHeight(); contentWidth = blockArea.getContentWidth(); int breakAfterStatus = propMgr.CheckBreakAfter(area); if (breakAfterStatus != Status.OK) { this.marker = MarkerBreakAfter; blockArea = null; return(new Status(breakAfterStatus)); } if (keepWithNext != 0) { blockArea = null; return(new Status(Status.KEEP_WITH_NEXT)); } blockArea.isLast(true); blockArea = null; return(new Status(Status.OK)); }
public override Status Layout(Area area) { BlockArea blockArea; if (!(area is BlockArea)) { FonetDriver.ActiveDriver.FireFonetWarning( "Currently Character can only be in a BlockArea"); return(new Status(Status.OK)); } blockArea = (BlockArea)area; bool textDecoration; AuralProps mAurProps = propMgr.GetAuralProps(); BorderAndPadding bap = propMgr.GetBorderAndPadding(); BackgroundProps bProps = propMgr.GetBackgroundProps(); HyphenationProps mHyphProps = propMgr.GetHyphenationProps(); MarginInlineProps mProps = propMgr.GetMarginInlineProps(); RelativePositionProps mRelProps = propMgr.GetRelativePositionProps(); ColorType c = this.properties.GetProperty("color").GetColorType(); float red = c.Red; float green = c.Green; float blue = c.Blue; int whiteSpaceCollapse = this.properties.GetProperty("white-space-collapse").GetEnum(); int wrapOption = this.parent.properties.GetProperty("wrap-option").GetEnum(); int tmp = this.properties.GetProperty("text-decoration").GetEnum(); if (tmp == TextDecoration.UNDERLINE) { textDecoration = true; } else { textDecoration = false; } char characterValue = this.properties.GetProperty("character").GetCharacter(); string id = this.properties.GetProperty("id").GetString(); blockArea.getIDReferences().InitializeID(id, blockArea); LineArea la = blockArea.getCurrentLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } la.changeFont(propMgr.GetFontState(area.getFontInfo())); la.changeColor(red, green, blue); la.changeWrapOption(wrapOption); la.changeWhiteSpaceCollapse(whiteSpaceCollapse); blockArea.setupLinkSet(this.GetLinkSet()); int result = la.addCharacter(characterValue, this.GetLinkSet(), textDecoration); if (result == Character.DOESNOT_FIT) { la = blockArea.createNextLineArea(); if (la == null) { return(new Status(Status.AREA_FULL_NONE)); } la.changeFont(propMgr.GetFontState(area.getFontInfo())); la.changeColor(red, green, blue); la.changeWrapOption(wrapOption); la.changeWhiteSpaceCollapse(whiteSpaceCollapse); blockArea.setupLinkSet(this.GetLinkSet()); la.addCharacter(characterValue, this.GetLinkSet(), textDecoration); } return(new Status(Status.OK)); }