Ejemplo n.º 1
0
        public override Status Layout(Area area)
        {
            int originalAbsoluteHeight = area.getAbsoluteHeight();
            if (this.marker == MarkerBreakAfter)
            {
                return new Status(Status.OK);
            }

            if (this.marker == MarkerStart)
            {

                area.getIDReferences().CreateID(id);

                this.marker = 0;
                this.bDone = false;
            }

            if (marker == 0)
            {
                area.getIDReferences().ConfigureID(id, area);
            }

            int spaceLeft = area.spaceLeft() - m_borderSeparation;
            this.cellArea =
                new AreaContainer(propMgr.GetFontState(area.getFontInfo()),
                                  startOffset + startAdjust, beforeOffset,
                                  width - widthAdjust, spaceLeft,
                                  Position.RELATIVE);

            cellArea.foCreator = this;
            cellArea.setPage(area.getPage());
            cellArea.setParent(area);
            cellArea.setBorderAndPadding(
                (BorderAndPadding)propMgr.GetBorderAndPadding().Clone());
            cellArea.setBackground(propMgr.GetBackgroundProps());
            cellArea.start();

            cellArea.setAbsoluteHeight(area.getAbsoluteHeight());
            cellArea.setIDReferences(area.getIDReferences());
            cellArea.setTableCellXOffset(startOffset + startAdjust);

            int numChildren = this.children.Count;
            for (int i = this.marker; bDone == false && i < numChildren; i++)
            {
                FObj fo = (FObj)children[i];
                fo.SetIsInTableCell();
                fo.ForceWidth(width);

                this.marker = i;

                Status status;
                if ((status = fo.Layout(cellArea)).isIncomplete())
                {
                    if ((i == 0) && (status.getCode() == Status.AREA_FULL_NONE))
                    {
                        return new Status(Status.AREA_FULL_NONE);
                    }
                    else
                    {
                        area.addChild(cellArea);
                        return new Status(Status.AREA_FULL_SOME);
                    }
                }

                area.setMaxHeight(area.getMaxHeight() - spaceLeft
                    + this.cellArea.getMaxHeight());
            }
            this.bDone = true;
            cellArea.end();
            area.addChild(cellArea);

            if (minCellHeight > cellArea.getContentHeight())
            {
                cellArea.SetHeight(minCellHeight);
            }

            height = cellArea.GetHeight();
            top = cellArea.GetCurrentYPosition();

            return new Status(Status.OK);
        }