コード例 #1
0
ファイル: BlockContainer.cs プロジェクト: nholik/Fo.Net
        public override Status Layout(Area area)
        {
            if (this.marker == MarkerStart)
            {
                AbsolutePositionProps mAbsProps = propMgr.GetAbsolutePositionProps();
                BorderAndPadding bap = propMgr.GetBorderAndPadding();
                BackgroundProps bProps = propMgr.GetBackgroundProps();
                MarginProps mProps = propMgr.GetMarginProps();

                this.marker = 0;
                this.position = this.properties.GetProperty("position").GetEnum();
                this.top = this.properties.GetProperty("top").GetLength().MValue();
                this.bottom = this.properties.GetProperty("bottom").GetLength().MValue();
                this.left = this.properties.GetProperty("left").GetLength().MValue();
                this.right = this.properties.GetProperty("right").GetLength().MValue();
                this.width = this.properties.GetProperty("width").GetLength().MValue();
                this.height = this.properties.GetProperty("height").GetLength().MValue();
                span = this.properties.GetProperty("span").GetEnum();

                string id = this.properties.GetProperty("id").GetString();
                area.getIDReferences().InitializeID(id, area);
            }

            AreaContainer container = (AreaContainer)area;
            if ((this.width == 0) && (this.height == 0))
            {
                width = right - left;
                height = bottom - top;
            }

            this.areaContainer =
                new AreaContainer(propMgr.GetFontState(container.getFontInfo()),
                                  container.getXPosition() + left,
                                  container.GetYPosition() - top, width, height,
                                  position);

            areaContainer.setPage(area.getPage());
            areaContainer.setBackground(propMgr.GetBackgroundProps());
            areaContainer.setBorderAndPadding(propMgr.GetBorderAndPadding());
            areaContainer.start();

            areaContainer.setAbsoluteHeight(0);
            areaContainer.setIDReferences(area.getIDReferences());

            int numChildren = this.children.Count;
            for (int i = this.marker; i < numChildren; i++)
            {
                FObj fo = (FObj)children[i];
                Status status = fo.Layout(areaContainer);
            }

            areaContainer.end();
            if (position == Position.ABSOLUTE)
            {
                areaContainer.SetHeight(height);
            }
            area.addChild(areaContainer);

            return new Status(Status.OK);
        }
コード例 #2
0
ファイル: RegionArea.cs プロジェクト: nholik/Fo.Net
 public AreaContainer makeAreaContainer()
 {
     AreaContainer area = new AreaContainer(
         null, xPosition, yPosition, width, height, Position.ABSOLUTE);
     area.setBackground(getBackground());
     return area;
 }
コード例 #3
0
        public AreaContainer makeAreaContainer()
        {
            AreaContainer area = new AreaContainer(
                null, xPosition, yPosition, width, height, Position.ABSOLUTE);

            area.setBackground(getBackground());
            return(area);
        }
コード例 #4
0
ファイル: LinkSet.cs プロジェクト: nholik/Fo.Net
 public void applyAreaContainerOffsets(AreaContainer ac, Area area)
 {
     int height = area.getAbsoluteHeight();
     BlockArea ba = (BlockArea)area;
     foreach (LinkedRectangle r in rects)
     {
         r.setX(r.getX() + ac.getXPosition() + area.getTableCellXOffset());
         r.setY(ac.GetYPosition() - height + (maxY - r.getY()) - ba.getHalfLeading());
     }
 }
コード例 #5
0
        public void applyAreaContainerOffsets(AreaContainer ac, Area area)
        {
            int       height = area.getAbsoluteHeight();
            BlockArea ba     = (BlockArea)area;

            foreach (LinkedRectangle r in rects)
            {
                r.setX(r.getX() + ac.getXPosition() + area.getTableCellXOffset());
                r.setY(ac.GetYPosition() - height + (maxY - r.getY()) - ba.getHalfLeading());
            }
        }
コード例 #6
0
ファイル: Area.cs プロジェクト: lajjne/Fo.Net
        public AreaContainer getNearestAncestorAreaContainer()
        {
            // Try to locate the closest parent that can be
            // casted to AreaContainer
            Area          area   = this.getParent();
            AreaContainer output = area as AreaContainer;

            while (area != null && output == null)
            {
                area   = area.getParent();
                output = area as AreaContainer;
            }
            return(output);
        }
コード例 #7
0
        public BodyAreaContainer(FontState fontState, int xPosition,
                                 int yPosition, int allocationWidth,
                                 int maxHeight, int position, int columnCount,
                                 int columnGap)
            : base(fontState, allocationWidth, maxHeight)
        {
            this.xPosition   = xPosition;
            this.yPosition   = yPosition;
            this.position    = position;
            this.columnCount = columnCount;
            this.columnGap   = columnGap;

            beforeFloatRefAreaHeight = 0;
            footnoteRefAreaHeight    = 0;
            mainRefAreaHeight        = maxHeight - beforeFloatRefAreaHeight
                                       - footnoteRefAreaHeight;
            beforeFloatReferenceArea = new AreaContainer(fontState, xPosition,
                                                         yPosition, allocationWidth, beforeFloatRefAreaHeight,
                                                         Position.ABSOLUTE);
            beforeFloatReferenceArea.setAreaName("before-float-reference-area");
            this.addChild(beforeFloatReferenceArea);
            mainReferenceArea = new AreaContainer(fontState, xPosition,
                                                  yPosition, allocationWidth,
                                                  mainRefAreaHeight,
                                                  Position.ABSOLUTE);
            mainReferenceArea.setAreaName("main-reference-area");
            this.addChild(mainReferenceArea);
            int footnoteRefAreaYPosition = yPosition - mainRefAreaHeight;

            footnoteReferenceArea = new AreaContainer(fontState, xPosition,
                                                      footnoteRefAreaYPosition,
                                                      allocationWidth,
                                                      footnoteRefAreaHeight,
                                                      Position.ABSOLUTE);
            footnoteReferenceArea.setAreaName("footnote-reference-area");
            this.addChild(footnoteReferenceArea);
        }
コード例 #8
0
ファイル: TableRow.cs プロジェクト: nholik/Fo.Net
        public override Status Layout(Area area)
        {
            if (this.marker == MarkerBreakAfter)
            {
                return new Status(Status.OK);
            }

            if (this.marker == MarkerStart)
            {
                if (!setup)
                {
                    DoSetup(area);
                }

                if (cellArray == null)
                {
                    InitCellArray();
                    area.getIDReferences().CreateID(id);
                }

                this.marker = 0;
                int breakStatus = propMgr.CheckBreakBefore(area);
                if (breakStatus != Status.OK)
                {
                    return new Status(breakStatus);
                }
            }

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

            int spaceLeft = area.spaceLeft();

            this.areaContainer =
                new AreaContainer(propMgr.GetFontState(area.getFontInfo()), 0, 0,
                                  area.getContentWidth(), spaceLeft,
                                  Position.RELATIVE);
            areaContainer.foCreator = this;
            areaContainer.setPage(area.getPage());
            areaContainer.setParent(area);

            areaContainer.setBackground(propMgr.GetBackgroundProps());
            areaContainer.start();

            areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
            areaContainer.setIDReferences(area.getIDReferences());

            largestCellHeight = minHeight;

            bool someCellDidNotLayoutCompletely = false;

            int offset = 0;
            int iColIndex = 0;

            foreach (TableColumn tcol in columns)
            {
                TableCell cell;
                ++iColIndex;
                int colWidth = tcol.GetColumnWidth();
                if (cellArray.GetCellType(iColIndex) == CellArray.CELLSTART)
                {
                    cell = cellArray.GetCell(iColIndex);
                }
                else
                {
                    if (rowSpanMgr.IsInLastRow(iColIndex))
                    {
                        int h = rowSpanMgr.GetRemainingHeight(iColIndex);
                        if (h > largestCellHeight)
                        {
                            largestCellHeight = h;
                        }
                    }
                    offset += colWidth;
                    continue;
                }
                cell.SetStartOffset(offset);
                offset += colWidth;

                int rowSpan = cell.GetNumRowsSpanned();
                Status status;
                if ((status = cell.Layout(areaContainer)).isIncomplete())
                {
                    if ((keepTogether.GetKeepType() == KeepValue.KEEP_WITH_ALWAYS)
                        || (status.getCode() == Status.AREA_FULL_NONE)
                        || rowSpan > 1)
                    {
                        this.ResetMarker();
                        this.RemoveID(area.getIDReferences());
                        return new Status(Status.AREA_FULL_NONE);
                    }
                    else if (status.getCode() == Status.AREA_FULL_SOME)
                    {
                        someCellDidNotLayoutCompletely = true;
                    }
                }
                int hi = cell.GetHeight();
                if (rowSpan > 1)
                {
                    rowSpanMgr.AddRowSpan(cell, iColIndex,
                                          cell.GetNumColumnsSpanned(), hi,
                                          rowSpan);
                }
                else if (hi > largestCellHeight)
                {
                    largestCellHeight = hi;
                }
            }

            area.setMaxHeight(area.getMaxHeight() - spaceLeft
                + this.areaContainer.getMaxHeight());

            for (int iCol = 1; iCol <= columns.Count; iCol++)
            {
                if (cellArray.GetCellType(iCol) == CellArray.CELLSTART
                    && rowSpanMgr.IsSpanned(iCol) == false)
                {
                    cellArray.GetCell(iCol).SetRowHeight(largestCellHeight);
                }
            }

            rowSpanMgr.FinishRow(largestCellHeight);

            area.addChild(areaContainer);
            areaContainer.SetHeight(largestCellHeight);
            areaAdded = true;
            areaContainer.end();

            area.addDisplaySpace(largestCellHeight
                + areaContainer.getPaddingTop()
                + areaContainer.getBorderTopWidth()
                + areaContainer.getPaddingBottom()
                + areaContainer.getBorderBottomWidth());

            if (someCellDidNotLayoutCompletely)
            {
                return new Status(Status.AREA_FULL_SOME);
            }
            else
            {
                if (rowSpanMgr.HasUnfinishedSpans())
                {
                    return new Status(Status.KEEP_WITH_NEXT);
                }
                if (breakAfter == BreakAfter.PAGE)
                {
                    this.marker = MarkerBreakAfter;
                    return new Status(Status.FORCE_PAGE_BREAK);
                }

                if (breakAfter == BreakAfter.ODD_PAGE)
                {
                    this.marker = MarkerBreakAfter;
                    return new Status(Status.FORCE_PAGE_BREAK_ODD);
                }

                if (breakAfter == BreakAfter.EVEN_PAGE)
                {
                    this.marker = MarkerBreakAfter;
                    return new Status(Status.FORCE_PAGE_BREAK_EVEN);
                }

                if (breakAfter == BreakAfter.COLUMN)
                {
                    this.marker = MarkerBreakAfter;
                    return new Status(Status.FORCE_COLUMN_BREAK);
                }
                if (keepWithNext.GetKeepType() != KeepValue.KEEP_WITH_AUTO)
                {
                    return new Status(Status.KEEP_WITH_NEXT);
                }
                return new Status(Status.OK);
            }

        }
コード例 #9
0
ファイル: Page.cs プロジェクト: nholik/Fo.Net
 internal void addBefore(AreaContainer area)
 {
     before = area;
     area.setPage(this);
 }
コード例 #10
0
ファイル: Page.cs プロジェクト: nholik/Fo.Net
 internal void addStart(AreaContainer area)
 {
     start = area;
     area.setPage(this);
 }
コード例 #11
0
ファイル: Page.cs プロジェクト: nholik/FO.Net
 internal void addAfter(AreaContainer area)
 {
     after = area;
     area.setPage(this);
 }
コード例 #12
0
ファイル: Page.cs プロジェクト: nholik/FO.Net
 internal void addStart(AreaContainer area)
 {
     start = area;
     area.setPage(this);
 }
コード例 #13
0
ファイル: TableColumn.cs プロジェクト: nholik/Fo.Net
        public override Status Layout(Area area)
        {
            if (this.marker == MarkerBreakAfter)
            {
                return new Status(Status.OK);
            }

            if (this.marker == MarkerStart)
            {
                if (!setup)
                {
                    DoSetup(area);
                }
            }
            if (columnWidth > 0)
            {
                this.areaContainer =
                    new AreaContainer(propMgr.GetFontState(area.getFontInfo()),
                                      columnOffset, 0, columnWidth,
                                      area.getContentHeight(), Position.RELATIVE);
                areaContainer.foCreator = this;
                areaContainer.setPage(area.getPage());
                areaContainer.setBorderAndPadding(propMgr.GetBorderAndPadding());
                areaContainer.setBackground(propMgr.GetBackgroundProps());
                areaContainer.SetHeight(area.GetHeight());
                area.addChild(areaContainer);
            }
            return new Status(Status.OK);
        }
コード例 #14
0
ファイル: AbstractTableBody.cs プロジェクト: nholik/Fo.Net
        public override Status Layout(Area area)
        {
            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();
                RelativePositionProps mRelProps = propMgr.GetRelativePositionProps();

                this.spaceBefore = this.properties.GetProperty("space-before.optimum").GetLength().MValue();
                this.spaceAfter = this.properties.GetProperty("space-after.optimum").GetLength().MValue();
                this.id = this.properties.GetProperty("id").GetString();

                try
                {
                    area.getIDReferences().CreateID(id);
                }
                catch (FonetException e)
                {
                    throw e;
                }

                if (area is BlockArea)
                {
                    area.end();
                }

                if (rowSpanMgr == null)
                {
                    rowSpanMgr = new RowSpanMgr(columns.Count);
                }

                this.marker = 0;
            }

            if ((spaceBefore != 0) && (this.marker == 0))
            {
                area.increaseHeight(spaceBefore);
            }

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

            int spaceLeft = area.spaceLeft();

            this.areaContainer =
                new AreaContainer(propMgr.GetFontState(area.getFontInfo()), 0,
                                  area.getContentHeight(),
                                  area.getContentWidth(),
                                  area.spaceLeft(), Position.RELATIVE);
            areaContainer.foCreator = this;
            areaContainer.setPage(area.getPage());
            areaContainer.setParent(area);
            areaContainer.setBackground(propMgr.GetBackgroundProps());
            areaContainer.setBorderAndPadding(propMgr.GetBorderAndPadding());
            areaContainer.start();

            areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
            areaContainer.setIDReferences(area.getIDReferences());

            Hashtable keepWith = new Hashtable();
            int numChildren = this.children.Count;
            TableRow lastRow = null;
            bool endKeepGroup = true;
            for (int i = this.marker; i < numChildren; i++)
            {
                Object child = children[i];
                if (child is Marker)
                {
                    ((Marker)child).Layout(area);
                    continue;
                }
                if (!(child is TableRow))
                {
                    throw new FonetException("Currently only Table Rows are supported in table body, header and footer");
                }
                TableRow row = (TableRow)child;

                row.SetRowSpanMgr(rowSpanMgr);
                row.SetColumns(columns);
                row.DoSetup(areaContainer);
                if ((row.GetKeepWithPrevious().GetKeepType() != KeepValue.KEEP_WITH_AUTO ||
                    row.GetKeepWithNext().GetKeepType() != KeepValue.KEEP_WITH_AUTO ||
                    row.GetKeepTogether().GetKeepType() != KeepValue.KEEP_WITH_AUTO) &&
                    lastRow != null && !keepWith.Contains(lastRow))
                {
                    keepWith.Add(lastRow, null);
                }
                else
                {
                    if (endKeepGroup && keepWith.Count > 0)
                    {
                        keepWith = new Hashtable();
                    }
                    if (endKeepGroup && i > this.marker)
                    {
                        rowSpanMgr.SetIgnoreKeeps(false);
                    }
                }

                bool bRowStartsArea = (i == this.marker);
                if (bRowStartsArea == false && keepWith.Count > 0)
                {
                    if (children.IndexOf(keepWith[0]) == this.marker)
                    {
                        bRowStartsArea = true;
                    }
                }
                row.setIgnoreKeepTogether(bRowStartsArea && startsAC(area));
                Status status = row.Layout(areaContainer);
                if (status.isIncomplete())
                {
                    if (status.isPageBreak())
                    {
                        this.marker = i;
                        area.addChild(areaContainer);

                        area.increaseHeight(areaContainer.GetHeight());
                        if (i == numChildren - 1)
                        {
                            this.marker = MarkerBreakAfter;
                            if (spaceAfter != 0)
                            {
                                area.increaseHeight(spaceAfter);
                            }
                        }
                        return status;
                    }
                    if ((keepWith.Count > 0)
                        && (!rowSpanMgr.IgnoreKeeps()))
                    {
                        row.RemoveLayout(areaContainer);
                        foreach (TableRow tr in keepWith.Keys)
                        {
                            tr.RemoveLayout(areaContainer);
                            i--;
                        }
                        if (i == 0)
                        {
                            ResetMarker();

                            rowSpanMgr.SetIgnoreKeeps(true);

                            return new Status(Status.AREA_FULL_NONE);
                        }
                    }
                    this.marker = i;
                    if ((i != 0) && (status.getCode() == Status.AREA_FULL_NONE))
                    {
                        status = new Status(Status.AREA_FULL_SOME);
                    }
                    if (!((i == 0) && (areaContainer.getContentHeight() <= 0)))
                    {
                        area.addChild(areaContainer);

                        area.increaseHeight(areaContainer.GetHeight());
                    }

                    rowSpanMgr.SetIgnoreKeeps(true);

                    return status;
                }
                else if (status.getCode() == Status.KEEP_WITH_NEXT
                    || rowSpanMgr.HasUnfinishedSpans())
                {
                    keepWith.Add(row, null);
                    endKeepGroup = false;
                }
                else
                {
                    endKeepGroup = true;
                }
                lastRow = row;
                area.setMaxHeight(area.getMaxHeight() - spaceLeft
                    + this.areaContainer.getMaxHeight());
                spaceLeft = area.spaceLeft();
            }
            area.addChild(areaContainer);
            areaContainer.end();

            area.increaseHeight(areaContainer.GetHeight());

            if (spaceAfter != 0)
            {
                area.increaseHeight(spaceAfter);
                area.setMaxHeight(area.getMaxHeight() - spaceAfter);
            }

            if (area is BlockArea)
            {
                area.start();
            }

            return new Status(Status.OK);
        }
コード例 #15
0
ファイル: TableCell.cs プロジェクト: nholik/Fo.Net
        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);
        }
コード例 #16
0
ファイル: Table.cs プロジェクト: nholik/Fo.Net
        public override Status Layout(Area area)
        {
            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();
                MarginProps mProps = propMgr.GetMarginProps();
                RelativePositionProps mRelProps = propMgr.GetRelativePositionProps();

                this.breakBefore = this.properties.GetProperty("break-before").GetEnum();
                this.breakAfter = this.properties.GetProperty("break-after").GetEnum();
                this.spaceBefore =
                    this.properties.GetProperty("space-before.optimum").GetLength().MValue();
                this.spaceAfter =
                    this.properties.GetProperty("space-after.optimum").GetLength().MValue();
                this.ipd =
                    this.properties.GetProperty("inline-progression-dimension").
                        GetLengthRange();
                this.height = this.properties.GetProperty("height").GetLength().MValue();
                this.bAutoLayout = (this.properties.GetProperty("table-layout").GetEnum() ==
                    TableLayout.AUTO);

                this.id = this.properties.GetProperty("id").GetString();

                this.omitHeaderAtBreak =
                    this.properties.GetProperty("table-omit-header-at-break").GetEnum()
                        == TableOmitHeaderAtBreak.TRUE;
                this.omitFooterAtBreak =
                    this.properties.GetProperty("table-omit-footer-at-break").GetEnum()
                        == TableOmitFooterAtBreak.TRUE;

                if (area is BlockArea)
                {
                    area.end();
                }
                if (this.areaContainer
                    == null)
                {
                    area.getIDReferences().CreateID(id);
                }

                this.marker = 0;

                if (breakBefore == BreakBefore.PAGE)
                {
                    return new Status(Status.FORCE_PAGE_BREAK);
                }

                if (breakBefore == BreakBefore.ODD_PAGE)
                {
                    return new Status(Status.FORCE_PAGE_BREAK_ODD);
                }

                if (breakBefore == BreakBefore.EVEN_PAGE)
                {
                    return new Status(Status.FORCE_PAGE_BREAK_EVEN);
                }

            }

            if ((spaceBefore != 0) && (this.marker == 0))
            {
                area.addDisplaySpace(spaceBefore);
            }

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

            int spaceLeft = area.spaceLeft();
            this.areaContainer =
                new AreaContainer(propMgr.GetFontState(area.getFontInfo()), 0, 0,
                                  area.getAllocationWidth(), area.spaceLeft(),
                                  Position.STATIC);

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

            areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
            areaContainer.setIDReferences(area.getIDReferences());

            bool addedHeader = false;
            bool addedFooter = false;
            int numChildren = this.children.Count;

            if (columns.Count == 0)
            {
                FindColumns(areaContainer);
                if (this.bAutoLayout)
                {
                    FonetDriver.ActiveDriver.FireFonetWarning(
                        "table-layout=auto is not supported, using fixed!");
                }
                this.contentWidth =
                    CalcFixedColumnWidths(areaContainer.getAllocationWidth());
            }
            areaContainer.setAllocationWidth(this.contentWidth);
            layoutColumns(areaContainer);

            for (int i = this.marker; i < numChildren; i++)
            {
                FONode fo = (FONode)children[i];
                if (fo is TableHeader)
                {
                    if (columns.Count == 0)
                    {
                        FonetDriver.ActiveDriver.FireFonetWarning(
                            "Current implementation of tables requires a table-column for each column, indicating column-width");
                        return new Status(Status.OK);
                    }
                    tableHeader = (TableHeader)fo;
                    tableHeader.SetColumns(columns);
                }
                else if (fo is TableFooter)
                {
                    if (columns.Count == 0)
                    {
                        FonetDriver.ActiveDriver.FireFonetWarning(
                            "Current implementation of tables requires a table-column for each column, indicating column-width");
                        return new Status(Status.OK);
                    }
                    tableFooter = (TableFooter)fo;
                    tableFooter.SetColumns(columns);
                }
                else if (fo is TableBody)
                {
                    if (columns.Count == 0)
                    {
                        FonetDriver.ActiveDriver.FireFonetWarning(
                            "Current implementation of tables requires a table-column for each column, indicating column-width");
                        return new Status(Status.OK);
                    }
                    Status status;
                    if (tableHeader != null && !addedHeader)
                    {
                        if ((status =
                            tableHeader.Layout(areaContainer)).isIncomplete())
                        {
                            tableHeader.ResetMarker();
                            return new Status(Status.AREA_FULL_NONE);
                        }
                        addedHeader = true;
                        tableHeader.ResetMarker();
                        area.setMaxHeight(area.getMaxHeight() - spaceLeft
                            + this.areaContainer.getMaxHeight());
                    }
                    if (tableFooter != null && !this.omitFooterAtBreak
                        && !addedFooter)
                    {
                        if ((status =
                            tableFooter.Layout(areaContainer)).isIncomplete())
                        {
                            return new Status(Status.AREA_FULL_NONE);
                        }
                        addedFooter = true;
                        tableFooter.ResetMarker();
                    }
                    fo.SetWidows(widows);
                    fo.SetOrphans(orphans);
                    ((TableBody)fo).SetColumns(columns);

                    if ((status = fo.Layout(areaContainer)).isIncomplete())
                    {
                        this.marker = i;
                        if (bodyCount == 0
                            && status.getCode() == Status.AREA_FULL_NONE)
                        {
                            if (tableHeader != null)
                            {
                                tableHeader.RemoveLayout(areaContainer);
                            }
                            if (tableFooter != null)
                            {
                                tableFooter.RemoveLayout(areaContainer);
                            }
                            ResetMarker();
                        }
                        if (areaContainer.getContentHeight() > 0)
                        {
                            area.addChild(areaContainer);
                            area.increaseHeight(areaContainer.GetHeight());
                            if (this.omitHeaderAtBreak)
                            {
                                tableHeader = null;
                            }
                            if (tableFooter != null && !this.omitFooterAtBreak)
                            {
                                ((TableBody)fo).SetYPosition(tableFooter.GetYPosition());
                                tableFooter.SetYPosition(tableFooter.GetYPosition()
                                    + ((TableBody)fo).GetHeight());
                            }
                            SetupColumnHeights();
                            status = new Status(Status.AREA_FULL_SOME);
                        }
                        return status;
                    }
                    else
                    {
                        bodyCount++;
                    }
                    area.setMaxHeight(area.getMaxHeight() - spaceLeft
                        + this.areaContainer.getMaxHeight());
                    if (tableFooter != null && !this.omitFooterAtBreak)
                    {
                        ((TableBody)fo).SetYPosition(tableFooter.GetYPosition());
                        tableFooter.SetYPosition(tableFooter.GetYPosition()
                            + ((TableBody)fo).GetHeight());
                    }
                }
            }

            if (tableFooter != null && this.omitFooterAtBreak)
            {
                if (tableFooter.Layout(areaContainer).isIncomplete())
                {
                    FonetDriver.ActiveDriver.FireFonetWarning(
                        "Footer could not fit on page, moving last body row to next page");
                    area.addChild(areaContainer);
                    area.increaseHeight(areaContainer.GetHeight());
                    if (this.omitHeaderAtBreak)
                    {
                        tableHeader = null;
                    }
                    tableFooter.RemoveLayout(areaContainer);
                    tableFooter.ResetMarker();
                    return new Status(Status.AREA_FULL_SOME);
                }
            }

            if (height != 0)
            {
                areaContainer.SetHeight(height);
            }

            SetupColumnHeights();

            areaContainer.end();
            area.addChild(areaContainer);

            area.increaseHeight(areaContainer.GetHeight());

            if (spaceAfter != 0)
            {
                area.addDisplaySpace(spaceAfter);
            }

            if (area is BlockArea)
            {
                area.start();
            }

            if (breakAfter == BreakAfter.PAGE)
            {
                this.marker = MarkerBreakAfter;
                return new Status(Status.FORCE_PAGE_BREAK);
            }

            if (breakAfter == BreakAfter.ODD_PAGE)
            {
                this.marker = MarkerBreakAfter;
                return new Status(Status.FORCE_PAGE_BREAK_ODD);
            }

            if (breakAfter == BreakAfter.EVEN_PAGE)
            {
                this.marker = MarkerBreakAfter;
                return new Status(Status.FORCE_PAGE_BREAK_EVEN);
            }

            return new Status(Status.OK);
        }
コード例 #17
0
ファイル: Page.cs プロジェクト: nholik/FO.Net
 internal void addBefore(AreaContainer area)
 {
     before = area;
     area.setPage(this);
 }
コード例 #18
0
ファイル: Page.cs プロジェクト: nholik/FO.Net
 internal void addEnd(AreaContainer area)
 {
     end = area;
     area.setPage(this);
 }
コード例 #19
0
ファイル: Page.cs プロジェクト: nholik/Fo.Net
 internal void addAfter(AreaContainer area)
 {
     after = area;
     area.setPage(this);
 }
コード例 #20
0
ファイル: PdfRenderer.cs プロジェクト: nholik/Fo.Net
        public void RenderAreaContainer(AreaContainer area) {
            int saveY = this.currentYPosition;
            int saveX = this.currentAreaContainerXPosition;

            if (area.getPosition() == Position.ABSOLUTE) {
                // XPosition and YPosition give the content rectangle position
                this.currentYPosition = area.GetYPosition();
                this.currentAreaContainerXPosition = area.getXPosition();
            }
            else if (area.getPosition() == Position.RELATIVE) {
                this.currentYPosition -= area.GetYPosition();
                this.currentAreaContainerXPosition += area.getXPosition();
            }
            else if (area.getPosition() == Position.STATIC) {
                this.currentYPosition -= area.getPaddingTop()
                    + area.getBorderTopWidth();
            }

            this.currentXPosition = this.currentAreaContainerXPosition;
            DoFrame(area);

            foreach (Box b in area.getChildren()) {
                b.render(this);
            }

            // Restore previous origin
            this.currentYPosition = saveY;
            this.currentAreaContainerXPosition = saveX;
            if (area.getPosition() == Position.STATIC) {
                this.currentYPosition -= area.GetHeight();
            }
        }
コード例 #21
0
ファイル: Page.cs プロジェクト: nholik/Fo.Net
 internal void addEnd(AreaContainer area)
 {
     end = area;
     area.setPage(this);
 }
コード例 #22
0
ファイル: PageSequence.cs プロジェクト: nholik/Fo.Net
 private void LayoutStaticContent(Flow.Flow flow, Region region,
                                  AreaContainer area)
 {
     if (flow is StaticContent)
     {
         ((StaticContent)flow).Layout(area, region);
     }
     else
     {
         FonetDriver.ActiveDriver.FireFonetError(region.GetName()
             + " only supports static-content flows currently. "
             + "Cannot use flow named '"
             + flow.GetFlowName() + "'");
     }
 }