Class PageBreakPositionList

    • Constructor Detail

      • PageBreakPositionList

        public PageBreakPositionList()
    • Method Detail

      • addMinorBreak

        public void addMinorBreak​(long position)
      • addMajorBreak

        public void addMajorBreak​(long position,
                                  long pageHeaderSize)
      • 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.
      • isCrossingPagebreak

        public boolean isCrossingPagebreak​(long boxY,
                                           long boxHeight,
                                           long pagebreakShift)
        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.
      • computeFixedPositionInFlow

        public long computeFixedPositionInFlow​(long shiftedBoxPosition,
                                               long fixedPositionResolved)
        Computes the box's position in the normal-flow that will fullfill the 'fixed-position' constraint. The result will be the position on the current page. This position might sit on already processed content, so the caller has to check whether the return value of this function is less than the shifted box position. In that case, the band must cause a pagebreak before it can be positioned.
        Specified by:
        computeFixedPositionInFlow in interface PageBreakPositions
        Parameters:
        shiftedBoxPosition -
        fixedPositionResolved -
        Returns:
        the computed fixed position, which may be invalid.
      • getPageHeaderHeight

        protected long getPageHeaderHeight​(long 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.
      • getLastMasterBreak

        public long getLastMasterBreak()
      • getMasterBreakSize

        public int getMasterBreakSize()
      • getMasterBreak

        public long getMasterBreak​(int index)
      • 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.
      • 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.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object