private Rectangular getMinimalVisualBounds()
    {
        final Box box = getBox();
        if (box instanceof TextBox)
            return new RectangularZ(box.getAbsoluteBounds().intersection(box.getClipBlock().getClippedContentBounds()), zoom);
        else if (box != null && box.isReplaced())
            return new RectangularZ(box.getMinimalAbsoluteBounds().intersection(box.getClipBlock().getClippedContentBounds()), zoom);
        else
        {
        	Rectangular ret = null;
            for (int i = 0; i < getChildCount(); i++)
            {
                BoxNode subnode = (BoxNode) getChildAt(i); 
                Box sub = subnode.getBox();
                Rectangular sb = subnode.getVisualBounds();
                if (sub.isDisplayed() && subnode.isVisible() && sb.getWidth() > 0 && sb.getHeight() > 0)
                {
	                if (ret == null)
	                	ret = new Rectangular(sb);
	                else
	                	ret.expandToEnclose(sb);
                }
            }
            //if nothing has been found return an empty rectangle at the top left corner
            if (ret == null)
            {
                Rectangle b = box.getAbsoluteBounds().intersection(box.getClipBlock().getClippedContentBounds());
            	return new RectangularZ(b.x, b.y, zoom);
            }
            else
            	return ret;
        }
    }
private Rectangular getMinimalVisualBounds()
    {
        final Box box = getBox();
        if (box instanceof TextBox)
            return new RectangularZ(box.getAbsoluteBounds().intersection(box.getClipBlock().getClippedContentBounds()), zoom);
        else if (box != null && box.isReplaced())
            return new RectangularZ(box.getMinimalAbsoluteBounds().intersection(box.getClipBlock().getClippedContentBounds()), zoom);
        else
        {
        	Rectangular ret = null;
            for (int i = 0; i < getChildCount(); i++)
            {
                BoxNode subnode = (BoxNode) getChildAt(i); 
                Box sub = subnode.getBox();
                Rectangular sb = subnode.getVisualBounds();
                if (sub.isDisplayed() && subnode.isVisible() && sb.getWidth() > 0 && sb.getHeight() > 0)
                {
	                if (ret == null)
	                	ret = new Rectangular(sb);
	                else
	                	ret.expandToEnclose(sb);
                }
            }
            
            if (ret == null)
            {
                Rectangle b = box.getAbsoluteBounds().intersection(box.getClipBlock().getClippedContentBounds());
            	return new RectangularZ(b.x, b.y, zoom);
            }
            else
            	return ret;
        }
    }
private Rectangular getMinimalVisualBounds ( ) { final Box box = getBox ( ) ; if ( box instanceof TextBox ) return new RectangularZ ( box . getAbsoluteBounds ( ) . intersection ( box . getClipBlock ( ) . getClippedContentBounds ( ) ) , zoom ) ; else if ( box != null && box . isReplaced ( ) ) return new RectangularZ ( box . getMinimalAbsoluteBounds ( ) . intersection ( box . getClipBlock ( ) . getClippedContentBounds ( ) ) , zoom ) ; else { Rectangular ret = null ; for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { BoxNode subnode = ( BoxNode ) getChildAt ( i ) ; Box sub = subnode . getBox ( ) ; Rectangular sb = subnode . getVisualBounds ( ) ; if ( sub . isDisplayed ( ) && subnode . isVisible ( ) && sb . getWidth ( ) > 0 && sb . getHeight ( ) > 0 ) { if ( ret == null ) ret = new Rectangular ( sb ) ; else ret . expandToEnclose ( sb ) ; } } //if nothing has been found return an empty rectangle at the top left corner if ( ret == null ) { Rectangle b = box . getAbsoluteBounds ( ) . intersection ( box . getClipBlock ( ) . getClippedContentBounds ( ) ) ; return new RectangularZ ( b . x , b . y , zoom ) ; } else return ret ; } }
Returns the minimal bounds of the box for enclosing all the contained boxes.
@return the minimal visual bounds
Returns the minimal bounds of the box for enclosing all the contained boxes .