public void exportText(RenderingContext c, Writer writer) throws IOException { int baselinePos = getAbsY() + getBaseline(); if (baselinePos >= c.getPage().getBottom() && isInDocumentFlow()) { exportPageBoxText(c, writer, baselinePos); } for (Iterator i = getNonFlowContent().iterator(); i.hasNext(); ) { Box b = (Box)i.next(); b.exportText(c, writer); } if (isContainsContent()) { StringBuffer result = new StringBuffer(); collectText(c, result); writer.write(result.toString().trim()); writer.write(LINE_SEPARATOR); } }
public void exportText(RenderingContext c, Writer writer) throws IOException { int baselinePos = getAbsY() + getBaseline(); if (baselinePos >= c.getPage().getBottom() && isInDocumentFlow()) { exportPageBoxText(c, writer, baselinePos); } for (Iterator i = getNonFlowContent().iterator(); i.hasNext(); ) { Box b = (Box)i.next(); b.exportText(c, writer); } if (isContainsContent()) { StringBuffer result = new StringBuffer(); collectText(c, result); writer.write(result.toString().trim()); writer.write(LINE_SEPARATOR); } }
public String toString() { return "LineBox: (" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + "," + getHeight() + ")"; }
public String toString() { return "LineBox: (" + getAbsX() + "," + getAbsY() + ")->(" + getWidth() + "," + getHeight() + ")"; }
private int calcDelta(CssContext cssCtx, LineBox line, BoxDistance boxDistance) { BlockBox floated = boxDistance.getBox(); Rectangle rect = floated.getBorderEdge(floated.getAbsX(), floated.getAbsY(), cssCtx); int bottom = rect.y + rect.height; return bottom - line.getAbsY(); }
public Rectangle getPaintingClipEdge(CssContext cssCtx) { Box parent = getParent(); Rectangle result = null; if (parent.getStyle().isIdent( CSSName.FS_TEXT_DECORATION_EXTENT, IdentValue.BLOCK) || getJustificationInfo() != null) { result = new Rectangle( getAbsX(), getAbsY() + _paintingTop, parent.getAbsX() + parent.getTx() + parent.getContentWidth() - getAbsX(), _paintingHeight); } else { result = new Rectangle( getAbsX(), getAbsY() + _paintingTop, getContentWidth(), _paintingHeight); } return result; }
public Rectangle getPaintingClipEdge(CssContext cssCtx) { Box parent = getParent(); Rectangle result = null; if (parent.getStyle().isIdent( CSSName.FS_TEXT_DECORATION_EXTENT, IdentValue.BLOCK) || getJustificationInfo() != null) { result = new Rectangle( getAbsX(), getAbsY() + _paintingTop, parent.getAbsX() + parent.getTx() + parent.getContentWidth() - getAbsX(), _paintingHeight); } else { result = new Rectangle( getAbsX(), getAbsY() + _paintingTop, getContentWidth(), _paintingHeight); } return result; }
public void calcCanvasLocation() { LineBox lineBox = getLineBox(); setAbsX(lineBox.getAbsX() + getX()); setAbsY(lineBox.getAbsY() + getY()); }
public void calcCanvasLocation() { LineBox lineBox = getLineBox(); setAbsX(lineBox.getAbsX() + getX()); setAbsY(lineBox.getAbsY() + getY()); }
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(); } } }
public void drawTextDecoration(RenderingContext c, LineBox lineBox) { setColor(lineBox.getStyle().getColor()); Box parent = lineBox.getParent(); List decorations = lineBox.getTextDecorations(); for (Iterator i = decorations.iterator(); i.hasNext(); ) { TextDecoration textDecoration = (TextDecoration)i.next(); if (parent.getStyle().isIdent( CSSName.FS_TEXT_DECORATION_EXTENT, IdentValue.BLOCK)) { fillRect( lineBox.getAbsX(), lineBox.getAbsY() + textDecoration.getOffset(), parent.getAbsX() + parent.getTx() + parent.getContentWidth() - lineBox.getAbsX(), textDecoration.getThickness()); } else { fillRect( lineBox.getAbsX(), lineBox.getAbsY() + textDecoration.getOffset(), lineBox.getContentWidth(), textDecoration.getThickness()); } } }
public void drawTextDecoration(RenderingContext c, LineBox lineBox) { setColor(lineBox.getStyle().getColor()); Box parent = lineBox.getParent(); List decorations = lineBox.getTextDecorations(); for (Iterator i = decorations.iterator(); i.hasNext(); ) { TextDecoration textDecoration = (TextDecoration)i.next(); if (parent.getStyle().isIdent( CSSName.FS_TEXT_DECORATION_EXTENT, IdentValue.BLOCK)) { fillRect( lineBox.getAbsX(), lineBox.getAbsY() + textDecoration.getOffset(), parent.getAbsX() + parent.getTx() + parent.getContentWidth() - lineBox.getAbsX(), textDecoration.getThickness()); } else { fillRect( lineBox.getAbsX(), lineBox.getAbsY() + textDecoration.getOffset(), lineBox.getContentWidth(), textDecoration.getThickness()); } } }
private static int getReferenceBaseline(RenderingContext c, BlockBox box) { MarkerData markerData = box.getMarkerData(); StrutMetrics strutMetrics = box.getMarkerData().getStructMetrics(); if (markerData.getReferenceLine() != null) { return markerData.getReferenceLine().getAbsY() + strutMetrics.getBaseline(); } else { return box.getAbsY() + box.getTy() + strutMetrics.getBaseline(); } }
private static int getReferenceBaseline(RenderingContext c, BlockBox box) { MarkerData markerData = box.getMarkerData(); StrutMetrics strutMetrics = box.getMarkerData().getStructMetrics(); if (markerData.getReferenceLine() != null) { return markerData.getReferenceLine().getAbsY() + strutMetrics.getBaseline(); } else { return box.getAbsY() + box.getTy() + strutMetrics.getBaseline(); } }
public int calcInlineBaseline(CssContext c) { if (isReplaced() && getReplacedElement().hasBaseline()) { Rectangle bounds = getContentAreaEdge(getAbsX(), getAbsY(), c); return bounds.y + getReplacedElement().getBaseline() - getAbsY(); } else { LineBox lastLine = findLastLineBox(); if (lastLine == null) { return getHeight(); } else { return lastLine.getAbsY() + lastLine.getBaseline() - getAbsY(); } } }
public int calcInlineBaseline(CssContext c) { if (isReplaced() && getReplacedElement().hasBaseline()) { Rectangle bounds = getContentAreaEdge(getAbsX(), getAbsY(), c); return bounds.y + getReplacedElement().getBaseline() - getAbsY(); } else { LineBox lastLine = findLastLineBox(); if (lastLine == null) { return getHeight(); } else { return lastLine.getAbsY() + lastLine.getBaseline() - getAbsY(); } } }
setAbsY(lineBox.getAbsY() + getY());