public Box getRestyleTarget() { return getParent(); }
public Box getRestyleTarget() { return getParent(); }
public boolean isFirstLine() { Box parent = getParent(); return parent != null && parent.getChildCount() > 0 && parent.getChild(0) == this; }
public boolean isFirstLine() { Box parent = getParent(); return parent != null && parent.getChildCount() > 0 && parent.getChild(0) == this; }
public List getElementWithContent() { // inefficient, but the lists in question shouldn't be very long List result = new ArrayList(); BlockBox container = (BlockBox)getLineBox().getParent(); while (true) { List elementBoxes = container.getElementBoxes(getElement()); for (int i = 0; i < elementBoxes.size(); i++) { InlineLayoutBox iB = (InlineLayoutBox)elementBoxes.get(i); iB.addToContentList(result); } if ( ! (container instanceof AnonymousBlockBox) || containsEnd(result)) { break; } container = addFollowingBlockBoxes(container, result); if (container == null) { break; } } return result; }
public List getElementWithContent() { // inefficient, but the lists in question shouldn't be very long List result = new ArrayList(); BlockBox container = (BlockBox)getLineBox().getParent(); while (true) { List elementBoxes = container.getElementBoxes(getElement()); for (int i = 0; i < elementBoxes.size(); i++) { InlineLayoutBox iB = (InlineLayoutBox)elementBoxes.get(i); iB.addToContentList(result); } if ( ! (container instanceof AnonymousBlockBox) || containsEnd(result)) { break; } container = addFollowingBlockBoxes(container, result); if (container == null) { break; } } return result; }
public void restyle(LayoutContext c) { Box parent = getParent(); Element e = parent.getElement(); if (e != null) { CalculatedStyle style = c.getSharedContext().getStyle(e, true); setStyle(style.createAnonymousStyle(IdentValue.BLOCK)); } restyleChildren(c); }
public void restyle(LayoutContext c) { Box parent = getParent(); Element e = parent.getElement(); if (e != null) { CalculatedStyle style = c.getSharedContext().getStyle(e, true); setStyle(style.createAnonymousStyle(IdentValue.BLOCK)); } restyleChildren(c); }
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() { Box parent = getParent(); if (parent == null) { XRLog.layout(Level.WARNING, "calcCanvasLocation() called with no parent"); } setAbsX(parent.getAbsX() + parent.getTx() + getX()); setAbsY(parent.getAbsY() + parent.getTy() + getY()); }
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 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 void alignLine(final LayoutContext c, final LineBox current, final int maxAvailableWidth) { if (! current.isContainsDynamicFunction() && ! current.getParent().getStyle().isTextJustify()) { current.setFloatDistances(new FloatDistances() { public int getLeftFloatDistance() { return c.getBlockFormattingContext().getLeftFloatDistance(c, current, maxAvailableWidth); } public int getRightFloatDistance() { return c.getBlockFormattingContext().getRightFloatDistance(c, current, maxAvailableWidth); } }); } else { FloatDistances distances = new FloatDistances(); distances.setLeftFloatDistance( c.getBlockFormattingContext().getLeftFloatDistance( c, current, maxAvailableWidth)); distances.setRightFloatDistance( c.getBlockFormattingContext().getRightFloatDistance( c, current, maxAvailableWidth)); current.setFloatDistances(distances); } current.align(false); if (! current.isContainsDynamicFunction() && ! current.getParent().getStyle().isTextJustify()) { current.setFloatDistances(null); } }
public BreakAtLineContext calcBreakAtLineContext(LayoutContext c) { if (! c.isPrint() || ! getStyle().isKeepWithInline()) { return null; } LineBox breakLine = findLastNthLineBox((int)getStyle().asFloat(CSSName.WIDOWS)); if (breakLine != null) { PageBox linePage = c.getRootLayer().getLastPage(c, breakLine); PageBox ourPage = c.getRootLayer().getLastPage(c, this); if (linePage != null && ourPage != null && linePage.getPageNo() + 1 == ourPage.getPageNo()) { BlockBox breakBox = (BlockBox)breakLine.getParent(); return new BreakAtLineContext(breakBox, breakBox.findOffset(breakLine)); } } return null; }
public BreakAtLineContext calcBreakAtLineContext(LayoutContext c) { if (! c.isPrint() || ! getStyle().isKeepWithInline()) { return null; } LineBox breakLine = findLastNthLineBox((int)getStyle().asFloat(CSSName.WIDOWS)); if (breakLine != null) { PageBox linePage = c.getRootLayer().getLastPage(c, breakLine); PageBox ourPage = c.getRootLayer().getLastPage(c, this); if (linePage != null && ourPage != null && linePage.getPageNo() + 1 == ourPage.getPageNo()) { BlockBox breakBox = (BlockBox)breakLine.getParent(); return new BreakAtLineContext(breakBox, breakBox.findOffset(breakLine)); } } return null; }
public void paintInline(RenderingContext c) { if (! getParent().getStyle().isVisible()) { return; } if (isContainsDynamicFunction()) { lookForDynamicFunctions(c); int totalLineWidth = InlineBoxing.positionHorizontally(c, this, 0); setContentWidth(totalLineWidth); calcChildLocations(); align(true); calcPaintingInfo(c, false); } if (_textDecorations != null) { c.getOutputDevice().drawTextDecoration(c, this); } if (c.debugDrawLineBoxes()) { c.getOutputDevice().drawDebugOutline(c, this, FSRGBColor.GREEN); } }
public void paintInline(RenderingContext c) { if (! getParent().getStyle().isVisible()) { return; } if (isContainsDynamicFunction()) { lookForDynamicFunctions(c); int totalLineWidth = InlineBoxing.positionHorizontally(c, this, 0); setContentWidth(totalLineWidth); calcChildLocations(); align(true); calcPaintingInfo(c, false); } if (_textDecorations != null) { c.getOutputDevice().drawTextDecoration(c, this); } if (c.debugDrawLineBoxes()) { c.getOutputDevice().drawDebugOutline(c, this, FSRGBColor.GREEN); } }