Class PagedBoxCollector
java.lang.Object
com.openhtmltopdf.render.displaylist.PagedBoxCollector
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static classprivate static interfaceThe joys of lambda style programming in Java 6! Provides a method to add a box to a shadow page if it is determined to sit on a particular shadow page.private static classstatic classstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final PagedBoxCollector.PageFinderstatic final intAdd collected boxes to all pages, including inserted shadow pages.static final intAdd collected items to base page only, ignoring inserted shadow pages.private final List<PagedBoxCollector.PageResult> private final int -
Constructor Summary
ConstructorsConstructorDescriptionPagedBoxCollector(List<PageBox> pages, int minPage, int maxPage) A more efficient paged box collector that can only find boxes on pages minPage to maxPage inclusive. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddBlock(Box container, PagedBoxCollector.PageResult pageResult) Adds block box to appropriate flat box lists.private voidaddBlockToAll(CssContext c, Layer layer, Box container, int pgStart, int pgEnd, Shape ourClip, List<PagedBoxCollector.PageResult> clipPages, boolean includeShadowPages) private voidaddBlockToShadowPage(CssContext c, Layer layer, Box container, int pgStart, int pgEnd, Shape ourClip, List<PagedBoxCollector.PageResult> clipPages, int shadowPageNumber) private voidaddBoxToShadowPages(CssContext c, Box container, int pageNumber, PagedBoxCollector.PageResult pageResult, Shape ourClip, List<PagedBoxCollector.PageResult> clipPages, Layer layer, PagedBoxCollector.AddToShadowPage addToMethod) Adds box to inserted shadow pages as needed.private voidaddLineBoxToAll(CssContext c, Layer layer, LineBox container, int basePageNumber, boolean includeShadowPages) Adds a line box to the base page if needed and any shadow pages as needed.private voidaddLineBoxToShadowPage(CssContext c, Layer layer, LineBox container, int basePageNumber, int shadowPageNumber) private voidaddTableHeaderFooter(CssContext c, Layer layer, Box container, int shadowPageNumber) private static RectangleapplyOverflowClip(Rectangle bounds, Area overflowClip) private booleanboxIntersects(CssContext c, Shape clip, Box box, Rectangle boxBounds) voidcollect(CssContext c, Layer layer) voidcollect(CssContext c, Layer layer, Box container, int shadowPageNumber) The main box collection method.voidcollect(CssContext c, Layer layer, Box container, int pgStart, int pgEnd, int shadowPageNumber) voidcollectFloats(CssContext c, Layer layer) private voidcollectInline(CssContext c, Layer layer) static RectanglefindAdjustedBoundsForBorderBox(CssContext c, Box container, List<PageBox> pages) Finds the document coordinates border box bounds of a box adjusted for transform and clipped according to overflow hidden.static RectanglefindAdjustedBoundsForContentBox(CssContext c, Box container) Finds the document coordinates content box bounds of a box adjusted for transform and clipped according to overflow hidden.protected intfindEndPage(CssContext c, Box container, AffineTransform transform) static intfindEndPage(CssContext c, Box container, List<PageBox> pages) protected intfindEndPage(CssContext c, Rectangle bounds, AffineTransform transform) static List<PagedBoxCollector.PageInfo> findLayerPages(CssContext c, Layer layer, List<PageBox> pages) Returns the pages a layer appears on including inserted overflow pages.static RectanglefindLayerRect(CssContext c, Layer layer) static intfindPageForY(CssContext c, double y, List<PageBox> pages) protected intfindStartPage(CssContext c, Box container, AffineTransform transform) static intfindStartPage(CssContext c, Box container, List<PageBox> pages) protected intfindStartPage(CssContext c, Rectangle bounds, AffineTransform transform) private static RectanglegetBoxRect(CssContext c, Box container) private static PagedBoxCollector.FourPointgetCornersFromTransformedBounds(Rectangle bounds, AffineTransform transform) protected intprivate static doublegetMaxX(PagedBoxCollector.FourPoint corners) private static doublegetMaxXFromTransformedBox(Rectangle bounds, AffineTransform transform) There is a matrix in effect.private static doublegetMaxY(PagedBoxCollector.FourPoint corners) private static doublegetMaxYFromTransformedBox(Rectangle bounds, AffineTransform transform) There is a matrix in effect, we have to apply it to the box bounds before checking what page(s) it sits on.protected intprivate static doublegetMinX(PagedBoxCollector.FourPoint corners) private static doublegetMinY(PagedBoxCollector.FourPoint corners) private static doublegetMinYFromTransformedBox(Rectangle bounds, AffineTransform transform) There is a matrix in effect, we have to apply it to the box bounds before checking what page(s) it sits on.private PagedBoxCollector.PageResultgetOrCreateShadowPage(PagedBoxCollector.PageResult basePage, int shadowPageNumber) Inserts shadow pages as needed.protected PageBoxgetPageBox(int pageNo) protected PagedBoxCollector.PageResultgetPageResult(int pageNo) static intgetShadowPageForBounds(CssContext c, Rectangle bounds, PageBox page) protected intgetValidMaxPageNumber(int pageNo) protected intgetValidMinPageNumber(int pageNo) private booleanintersectsAggregateBounds(CssContext c, Shape clip, Box box) private booleanintersectsAny(CssContext c, Shape clip, Box master, Box container) private booleanintersectsBorderBoxBounds(CssContext c, Shape clip, Box box) Returns whether a box (out to the outside edge of border) is partially or fully in a clip shape.private static voidtransformBounds(Rectangle bounds, AffineTransform transform)
-
Field Details
-
result
-
pages
-
finder
-
startPage
private final int startPage -
PAGE_BASE_ONLY
public static final int PAGE_BASE_ONLYAdd collected items to base page only, ignoring inserted shadow pages.- See Also:
-
PAGE_ALL
public static final int PAGE_ALLAdd collected boxes to all pages, including inserted shadow pages.- See Also:
-
-
Constructor Details
-
PagedBoxCollector
A more efficient paged box collector that can only find boxes on pages minPage to maxPage inclusive.
-
-
Method Details
-
collect
-
collectInline
-
collectFloats
-
collect
The main box collection method. This method works recursively to add all the boxes (inlines and blocks separately) owned by this layer to their respective flat page display lists. It also adds clip and setClip operations where needed to clip content inoverflow:hiddenblocks.- Parameters:
c-layer-container-
-
collect
public void collect(CssContext c, Layer layer, Box container, int pgStart, int pgEnd, int shadowPageNumber) -
addBlockToAll
private void addBlockToAll(CssContext c, Layer layer, Box container, int pgStart, int pgEnd, Shape ourClip, List<PagedBoxCollector.PageResult> clipPages, boolean includeShadowPages) -
addBlockToShadowPage
private void addBlockToShadowPage(CssContext c, Layer layer, Box container, int pgStart, int pgEnd, Shape ourClip, List<PagedBoxCollector.PageResult> clipPages, int shadowPageNumber) -
addLineBoxToShadowPage
private void addLineBoxToShadowPage(CssContext c, Layer layer, LineBox container, int basePageNumber, int shadowPageNumber) -
addLineBoxToAll
private void addLineBoxToAll(CssContext c, Layer layer, LineBox container, int basePageNumber, boolean includeShadowPages) Adds a line box to the base page if needed and any shadow pages as needed. -
getOrCreateShadowPage
private PagedBoxCollector.PageResult getOrCreateShadowPage(PagedBoxCollector.PageResult basePage, int shadowPageNumber) Inserts shadow pages as needed. -
addBoxToShadowPages
private void addBoxToShadowPages(CssContext c, Box container, int pageNumber, PagedBoxCollector.PageResult pageResult, Shape ourClip, List<PagedBoxCollector.PageResult> clipPages, Layer layer, PagedBoxCollector.AddToShadowPage addToMethod) Adds box to inserted shadow pages as needed. -
addBlock
Adds block box to appropriate flat box lists. -
intersectsAggregateBounds
-
intersectsBorderBoxBounds
Returns whether a box (out to the outside edge of border) is partially or fully in a clip shape. This should give us the painting bounds of the box itself, although child boxes can overflow. -
boxIntersects
-
intersectsAny
-
getCornersFromTransformedBounds
private static PagedBoxCollector.FourPoint getCornersFromTransformedBounds(Rectangle bounds, AffineTransform transform) -
getMinYFromTransformedBox
There is a matrix in effect, we have to apply it to the box bounds before checking what page(s) it sits on. To do this we transform the four corners of the box. -
getMaxYFromTransformedBox
There is a matrix in effect, we have to apply it to the box bounds before checking what page(s) it sits on. To do this we transform the four corners of the box. -
getMaxXFromTransformedBox
There is a matrix in effect. We need the max x to see how many shadow pages need creating. -
findPageForY
-
getShadowPageForBounds
-
findAdjustedBoundsForBorderBox
public static Rectangle findAdjustedBoundsForBorderBox(CssContext c, Box container, List<PageBox> pages) Finds the document coordinates border box bounds of a box adjusted for transform and clipped according to overflow hidden. -
findAdjustedBoundsForContentBox
Finds the document coordinates content box bounds of a box adjusted for transform and clipped according to overflow hidden. -
findStartPage
-
findEndPage
-
findStartPage
-
findEndPage
-
getPageResult
-
getMaxPageNumber
protected int getMaxPageNumber() -
getMinPageNumber
protected int getMinPageNumber() -
getValidMinPageNumber
protected int getValidMinPageNumber(int pageNo) -
getValidMaxPageNumber
protected int getValidMaxPageNumber(int pageNo) -
getPageBox
-
getBoxRect
-
findLayerRect
-
getMinY
-
getMinX
-
getMaxY
-
getMaxX
-
transformBounds
-
applyOverflowClip
-
findLayerPages
public static List<PagedBoxCollector.PageInfo> findLayerPages(CssContext c, Layer layer, List<PageBox> pages) Returns the pages a layer appears on including inserted overflow pages. Takes into account any transform and overflow hidden clipping. -
findStartPage
- Returns:
- 0 based page number of start of container paint area (including overflow)
-
findEndPage
- Returns:
- 0 based page number of end of container paint area (including overflow)
-