Class FilteringPageBreakPositions

    • Constructor Detail

      • FilteringPageBreakPositions

        public FilteringPageBreakPositions​(PageBreakPositions backend,
                                           long pageStart)
    • Method Detail

      • findNextBreakPosition

        public long findNextBreakPosition​(long position)
        Finds the closest break-position that is larger or equal to the given position. This returns the next pagebreak in the flow after the given position. If the position given is larger than the largest posible page-break, then this returns the last pagebreak instead.
        Specified by:
        findNextBreakPosition in interface PageBreakPositions
        Parameters:
        position - the position from where to search the next pagebreak.
        Returns:
        the position.
      • findNextMajorBreakPosition

        public long findNextMajorBreakPosition​(long position)
        Finds the closest master break-position that is larger or equal to the given position. A master pagebreak is the boundary of a logical page, which in itself can consist of several physical pages.

        This returns the next master pagebreak in the flow after the given position. If the position given is larger than the largest posible page-break, then this returns the last pagebreak instead.

        Specified by:
        findNextMajorBreakPosition in interface PageBreakPositions
        Parameters:
        position - the position from where to search the next pagebreak.
        Returns:
        the position.
      • findPageStartPositionForPageEndPosition

        public long findPageStartPositionForPageEndPosition​(long pageOffset)
        Description copied from interface: PageBreakPositions
        Locates the page-start for a given page-end position.
        Specified by:
        findPageStartPositionForPageEndPosition in interface PageBreakPositions
        Parameters:
        pageOffset - the current page-end for which to find the page-start.
        Returns:
        the start position for the page ending on pageEndPosition.
      • findPageEndForPageStartPosition

        public long findPageEndForPageStartPosition​(long pageOffset)
        Description copied from interface: PageBreakPositions
        Locates the page-end for a given page-start position.
        Specified by:
        findPageEndForPageStartPosition in interface PageBreakPositions
        Parameters:
        pageOffset - the current page-start for which to find the page-end.
        Returns:
        the end position for the page starting on pageStartPosition.
      • isCrossingPagebreak

        public boolean isCrossingPagebreak​(long boxY,
                                           long boxHeight,
                                           long pagebreakShift)
        Description copied from interface: PageBreakPositions
        Checks, whether the given box will cross a pagebreak. The box's y-position is shifted by the given amount before testing the result. A box will cross a pagebreak if its shifted y position and its shifted y2 position (y + height) are located on different pages. A box with a height of zero cannot cross a pagebreak by definition.
        Specified by:
        isCrossingPagebreak in interface PageBreakPositions
        Parameters:
        boxY - the box Y, unshifted.
        boxHeight - the box height.
        pagebreakShift - the current shift that should be applied for the test
        Returns:
        true, if the box crosses a pagebreak, false otherwise.