public String toString() { StringBuffer sb = new StringBuffer(); sb.append("Box: "); sb.append(" (" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + " x " + getHeight() + ")"); return sb.toString(); }
private int getPageRefY(Box box) { if (box instanceof InlineLayoutBox) { InlineLayoutBox iB = (InlineLayoutBox)box; return iB.getAbsY() + iB.getBaseline(); } else { return box.getAbsY(); } }
private int getPageRefY(Box box) { if (box instanceof InlineLayoutBox) { InlineLayoutBox iB = (InlineLayoutBox) box; return iB.getAbsY() + iB.getBaseline(); } else { return box.getAbsY(); } }
private int getPageRefY(Box box) { if (box instanceof InlineLayoutBox) { InlineLayoutBox iB = (InlineLayoutBox)box; return iB.getAbsY() + iB.getBaseline(); } else { return box.getAbsY(); } }
private int getPageRefY(Box box) { if (box instanceof InlineLayoutBox) { InlineLayoutBox iB = (InlineLayoutBox) box; return iB.getAbsY() + iB.getBaseline(); } else { return box.getAbsY(); } }
public String calculate(RenderingContext c, FSFunction function, InlineText text) { String uri = text.getParent().getElement().getAttribute("href"); if (uri != null && uri.startsWith("#")) { String anchor = uri.substring(1); Box target = c.getBoxById(anchor); if (target != null) { PageBox targetPage = c.getRootLayer().getPage(c, target.getAbsY()); return CounterFunction.createCounterText(IdentValue.DECIMAL, targetPage.getPageNo()+1); } } return ""; }
public void drawDebugOutline(RenderingContext c, Box box, FSColor color) { setColor(color); Rectangle rect = box.getMarginEdge(box.getAbsX(), box.getAbsY(), c, 0, 0); rect.height -= 1; rect.width -= 1; drawRect(rect.x, rect.y, rect.width, rect.height); }
public void drawDebugOutline(RenderingContext c, Box box, FSColor color) { setColor(color); Rectangle rect = box.getMarginEdge(box.getAbsX(), box.getAbsY(), c, 0, 0); rect.height -= 1; rect.width -= 1; drawRect(rect.x, rect.y, rect.width, rect.height); }
private void performFloatOperation(FloatOperation op, List floats) { for (Iterator i = floats.iterator(); i.hasNext();) { BoxOffset boxOffset = (BoxOffset) i.next(); BlockBox box = boxOffset.getBox(); box.setAbsX(box.getX() + getMaster().getAbsX() - boxOffset.getX()); box.setAbsY(box.getY() + getMaster().getAbsY() - boxOffset.getY()); op.operate(box); } }
private void performFloatOperation(FloatOperation op, List floats) { for (Iterator i = floats.iterator(); i.hasNext();) { BoxOffset boxOffset = (BoxOffset) i.next(); BlockBox box = boxOffset.getBox(); box.setAbsX(box.getX() + getMaster().getAbsX() - boxOffset.getX()); box.setAbsY(box.getY() + getMaster().getAbsY() - boxOffset.getY()); op.operate(box); } }
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 void calcCanvasLocation() { Box parent = getParent(); if (parent == null) { throw new XRRuntimeException("calcCanvasLocation() called with no parent"); } setAbsX(parent.getAbsX() + parent.getTx() + getX()); setAbsY(parent.getAbsY() + parent.getTy() + getY()); }
public void calcInitialFloatedCanvasLocation(LayoutContext c) { Point offset = c.getBlockFormattingContext().getOffset(); FloatManager manager = c.getBlockFormattingContext().getFloatManager(); setAbsX(manager.getMaster().getAbsX() + getX() - offset.x); setAbsY(manager.getMaster().getAbsY() + getY() - offset.y); }
public void calcInitialFloatedCanvasLocation(LayoutContext c) { Point offset = c.getBlockFormattingContext().getOffset(); FloatManager manager = c.getBlockFormattingContext().getFloatManager(); setAbsX(manager.getMaster().getAbsX() + getX() - offset.x); setAbsY(manager.getMaster().getAbsY() + getY() - offset.y); }
private PdfDestination createDestination(RenderingContext c, Box box) { PdfDestination result = null; PageBox page = _root.getLayer().getPage(c, getPageRefY(box)); if (page != null) { int distanceFromTop = page.getMarginBorderPadding(c, CalculatedStyle.TOP); distanceFromTop += box.getAbsY() + box.getMargin(c).top() - page.getTop(); result = new PdfDestination(PdfDestination.XYZ, 0, page.getHeight(c) / _dotsPerPoint - distanceFromTop / _dotsPerPoint, 0); result.addPage(_writer.getPageReference(_startPageNo + page.getPageNo() + 1)); } return result; }