public boolean isNeedsKeepWithInline(LayoutContext c) { if (c.isPrint() && getStyle().isKeepWithInline()) { LineBox line = findFirstLineBox(); if (line != null) { PageBox linePage = c.getRootLayer().getFirstPage(c, line); PageBox ourPage = c.getRootLayer().getFirstPage(c, this); return linePage != null && ourPage != null && linePage.getPageNo() == ourPage.getPageNo()+1; } } return false; }
public boolean isNeedsKeepWithInline(LayoutContext c) { if (c.isPrint() && getStyle().isKeepWithInline()) { LineBox line = findFirstLineBox(); if (line != null) { PageBox linePage = c.getRootLayer().getFirstPage(c, line); PageBox ourPage = c.getRootLayer().getFirstPage(c, this); return linePage != null && ourPage != null && linePage.getPageNo() == ourPage.getPageNo()+1; } } return false; }
private boolean isShouldMoveToNextPage(LayoutContext c) { PageBox page = c.getRootLayer().getFirstPage(c, this); if (getAbsY() + getHeight() < page.getBottom()) { return false; } for (Iterator i = getChildIterator(); i.hasNext(); ) { TableCellBox cell = (TableCellBox)i.next(); int baseline = cell.calcBlockBaseline(c); if (baseline != BlockBox.NO_BASELINE && baseline < page.getBottom()) { return false; } } return true; }
private boolean isShouldMoveToNextPage(LayoutContext c) { PageBox page = c.getRootLayer().getFirstPage(c, this); if (getAbsY() + getHeight() < page.getBottom()) { return false; } for (Iterator i = getChildIterator(); i.hasNext(); ) { TableCellBox cell = (TableCellBox)i.next(); int baseline = cell.calcBlockBaseline(c); if (baseline != BlockBox.NO_BASELINE && baseline < page.getBottom()) { return false; } } return true; }
} else { BlockBox block = (BlockBox)sequences.get(sequenceStartIndex); firstPage = getFirstPage(c, block).getPageNo(); lastPage = getFirstPage(c, block).getPageNo(); } else { lastPage = c.getPageCount();
public boolean crossesPageBreak(LayoutContext c) { if (! c.isPageBreaksAllowed()) { return false; } PageBox pageBox = c.getRootLayer().getFirstPage(c, this); if (pageBox == null) { return false; } else { return getAbsY() + getHeight() >= pageBox.getBottom() - c.getExtraSpaceBottom(); } }
public boolean crossesPageBreak(LayoutContext c) { if (! c.isPageBreaksAllowed()) { return false; } PageBox pageBox = c.getRootLayer().getFirstPage(c, this); if (pageBox == null) { return false; } else { return getAbsY() + getHeight() >= pageBox.getBottom() - c.getExtraSpaceBottom(); } }
public boolean isPageBreaksChange(LayoutContext c, int posDeltaY) { if (! c.isPageBreaksAllowed()) { return false; } PageBox page = c.getRootLayer().getFirstPage(c, this); int bottomEdge = getAbsY() + getChildrenHeight(); return bottomEdge >= page.getBottom() - c.getExtraSpaceBottom() || bottomEdge + posDeltaY >= page.getBottom() - c.getExtraSpaceBottom(); }
List sequences = getSortedPageSequences(); int initial = 0; if (c.getInitialPageNo() > 0) { initial = c.getInitialPageNo() - 1; } if (sequences == null) { return initial + c.getPageNo(); } else { int sequenceStartIndex = getPageSequenceStart(c, sequences, c.getPage()); if (sequenceStartIndex == -1) { return initial + c.getPageNo(); } else { BlockBox block = (BlockBox)sequences.get(sequenceStartIndex); return c.getPageNo() - getFirstPage(c, block).getPageNo(); } } } public int getRelativePageCount(RenderingContext c) {
public int getRelativePageNo(RenderingContext c) { List sequences = getSortedPageSequences(); int initial = 0; if (c.getInitialPageNo() > 0) { initial = c.getInitialPageNo() - 1; } if (sequences == null) { return initial + c.getPageNo(); } else { int sequenceStartIndex = getPageSequenceStart(c, sequences, c.getPage()); if (sequenceStartIndex == -1) { return initial + c.getPageNo(); } else { BlockBox block = (BlockBox)sequences.get(sequenceStartIndex); return c.getPageNo() - getFirstPage(c, block).getPageNo(); } } }
public boolean isPageBreaksChange(LayoutContext c, int posDeltaY) { if (! c.isPageBreaksAllowed()) { return false; } PageBox page = c.getRootLayer().getFirstPage(c, this); int bottomEdge = getAbsY() + getChildrenHeight(); return bottomEdge >= page.getBottom() - c.getExtraSpaceBottom() || bottomEdge + posDeltaY >= page.getBottom() - c.getExtraSpaceBottom(); }
private void calcPageClearance(LayoutContext c) { if (c.isPrint() && getStyle().isCollapseBorders()) { PageBox page = c.getRootLayer().getFirstPage(c, this); TableRowBox row = getFirstRow(); if (row != null) { int spill = 0; for (Iterator i = row.getChildIterator(); i.hasNext(); ) { TableCellBox cell = (TableCellBox)i.next(); BorderPropertySet collapsed = cell.getCollapsedPaintingBorder(); int tmp = (int)collapsed.top() / 2; if (tmp > spill) { spill = tmp; } } int borderTop = getAbsY() + (int)getMargin(c).top() - spill; int delta = page.getTop() - borderTop; if (delta > 0) { setY(getY() + delta); setPageClearance(delta); calcCanvasLocation(); c.translate(0, delta); } } } }
private void calcPageClearance(LayoutContext c) { if (c.isPrint() && getStyle().isCollapseBorders()) { PageBox page = c.getRootLayer().getFirstPage(c, this); if (page != null) { TableRowBox row = getFirstRow(); if (row != null) { int spill = 0; for (Iterator i = row.getChildIterator(); i.hasNext(); ) { TableCellBox cell = (TableCellBox)i.next(); BorderPropertySet collapsed = cell.getCollapsedPaintingBorder(); int tmp = (int)collapsed.top() / 2; if (tmp > spill) { spill = tmp; } } int borderTop = getAbsY() + (int)getMargin(c).top() - spill; int delta = page.getTop() - borderTop; if (delta > 0) { setY(getY() + delta); setPageClearance(delta); calcCanvasLocation(); c.translate(0, delta); } } } } }
protected void layoutChildren(LayoutContext c, int contentStart) { ensureChildren(c); // If we have a running footer, we need its dimensions right away boolean running = c.isPrint() && getStyle().isPaginateTable(); if (running) { int headerHeight = layoutRunningHeader(c); int footerHeight = layoutRunningFooter(c); int spacingHeight = footerHeight == 0 ? 0 : getStyle().getBorderVSpacing(c); PageBox first = c.getRootLayer().getFirstPage(c, this); if (getAbsY() + getTy() + headerHeight + footerHeight + spacingHeight > first.getBottom()) { // XXX Performance problem here. This forces the table // to move to the next page (which we want), but the initial // table layout run still completes (which we don't) setNeedPageClear(true); } } super.layoutChildren(c, contentStart); }
private void calcExtraPageClearance(LayoutContext c) { if (c.isPageBreaksAllowed() && c.getExtraSpaceTop() > 0 && (getStyle().isSpecifiedAsBlock() || getStyle().isListItem())) { PageBox first = c.getRootLayer().getFirstPage(c, this); if (first != null && first.getTop() + c.getExtraSpaceTop() > getAbsY()) { int diff = first.getTop() + c.getExtraSpaceTop() - getAbsY(); setY(getY() + diff); c.translate(0, diff); calcCanvasLocation(); } } }
protected void layoutChildren(LayoutContext c, int contentStart) { ensureChildren(c); // If we have a running footer, we need its dimensions right away boolean running = c.isPrint() && getStyle().isPaginateTable(); if (running) { int headerHeight = layoutRunningHeader(c); int footerHeight = layoutRunningFooter(c); int spacingHeight = footerHeight == 0 ? 0 : getStyle().getBorderVSpacing(c); PageBox first = c.getRootLayer().getFirstPage(c, this); if (getAbsY() + getTy() + headerHeight + footerHeight + spacingHeight > first.getBottom()) { // XXX Performance problem here. This forces the table // to move to the next page (which we want), but the initial // table layout run still completes (which we don't) setNeedPageClear(true); } } super.layoutChildren(c, contentStart); }
private void calcExtraPageClearance(LayoutContext c) { if (c.isPageBreaksAllowed() && c.getExtraSpaceTop() > 0 && (getStyle().isSpecifiedAsBlock() || getStyle().isListItem())) { PageBox first = c.getRootLayer().getFirstPage(c, this); if (first != null && first.getTop() + c.getExtraSpaceTop() > getAbsY()) { int diff = first.getTop() + c.getExtraSpaceTop() - getAbsY(); setY(getY() + diff); c.translate(0, diff); calcCanvasLocation(); } } }
public void checkPagePosition(LayoutContext c, boolean alwaysBreak) { if (! c.isPageBreaksAllowed()) { return; } PageBox pageBox = c.getRootLayer().getFirstPage(c, this); if (pageBox != null) { boolean needsPageBreak = alwaysBreak || getAbsY() + getHeight() >= pageBox.getBottom() - c.getExtraSpaceBottom(); if (needsPageBreak) { forcePageBreakBefore(c, IdentValue.ALWAYS, false); calcCanvasLocation(); } else if (pageBox.getTop() + c.getExtraSpaceTop() > getAbsY()) { int diff = pageBox.getTop() + c.getExtraSpaceTop() - getAbsY(); setY(getY() + diff); calcCanvasLocation(); } } }
public void checkPagePosition(LayoutContext c, boolean alwaysBreak) { if (! c.isPageBreaksAllowed()) { return; } PageBox pageBox = c.getRootLayer().getFirstPage(c, this); if (pageBox != null) { boolean needsPageBreak = alwaysBreak || getAbsY() + getHeight() >= pageBox.getBottom() - c.getExtraSpaceBottom(); if (needsPageBreak) { forcePageBreakBefore(c, IdentValue.ALWAYS, false); calcCanvasLocation(); } else if (pageBox.getTop() + c.getExtraSpaceTop() > getAbsY()) { int diff = pageBox.getTop() + c.getExtraSpaceTop() - getAbsY(); setY(getY() + diff); calcCanvasLocation(); } } }