Package com.openhtmltopdf.layout
Class LayoutContext
- java.lang.Object
-
- com.openhtmltopdf.layout.LayoutContext
-
- All Implemented Interfaces:
CssContext
public class LayoutContext extends java.lang.Object implements CssContext
This class tracks state which changes over the course of a layout run. Generally speaking, if possible, state information should be stored in the box tree and not here. It also provides pass-though calls to many methods inSharedContext
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LayoutContext.BlockBoxingState
-
Field Summary
-
Constructor Summary
Constructors Constructor Description LayoutContext(SharedContext sharedContext)
-
Method Summary
-
-
-
Field Detail
-
_blockBoxingState
private LayoutContext.BlockBoxingState _blockBoxingState
-
_sharedContext
private SharedContext _sharedContext
-
_rootLayer
private Layer _rootLayer
-
_firstLines
private StyleTracker _firstLines
-
_firstLetters
private StyleTracker _firstLetters
-
_currentMarkerData
private MarkerData _currentMarkerData
-
_bfcs
private java.util.LinkedList<BlockFormattingContext> _bfcs
-
_layers
private java.util.LinkedList<Layer> _layers
-
_fontContext
private FontContext _fontContext
-
_contentFunctionFactory
private final ContentFunctionFactory _contentFunctionFactory
-
_extraSpaceTop
private int _extraSpaceTop
-
_extraSpaceBottom
private int _extraSpaceBottom
-
_counterContextMap
public final java.util.Map<CalculatedStyle,CounterContext> _counterContextMap
-
_pendingPageName
private java.lang.String _pendingPageName
-
_pageName
private java.lang.String _pageName
-
_noPageBreak
private int _noPageBreak
-
_rootDocumentLayer
private Layer _rootDocumentLayer
-
_page
private PageBox _page
-
_mayCheckKeepTogether
private boolean _mayCheckKeepTogether
-
_lineBreakedBecauseOfNoWrap
private boolean _lineBreakedBecauseOfNoWrap
-
_breakAtLineContext
private BreakAtLineContext _breakAtLineContext
-
isPrintOverride
private java.lang.Boolean isPrintOverride
-
_isInFloatBottom
private boolean _isInFloatBottom
-
_savedLayoutState
private LayoutState _savedLayoutState
-
_footnoteIndex
private int _footnoteIndex
-
_footnoteManager
private FootnoteManager _footnoteManager
-
_isFootnoteAllowed
private boolean _isFootnoteAllowed
-
_splitter
private final ParagraphSplitter _splitter
-
_bidiSplitterFactory
private BidiSplitterFactory _bidiSplitterFactory
-
_defaultTextDirection
private byte _defaultTextDirection
-
_bidiReorderer
private BidiReorderer _bidiReorderer
-
-
Constructor Detail
-
LayoutContext
LayoutContext(SharedContext sharedContext)
-
-
Method Detail
-
getTextRenderer
public TextRenderer getTextRenderer()
- Specified by:
getTextRenderer
in interfaceCssContext
-
getCss
public StyleReference getCss()
- Specified by:
getCss
in interfaceCssContext
-
getCanvas
public FSCanvas getCanvas()
-
getFixedRectangle
public java.awt.Rectangle getFixedRectangle()
-
getNamespaceHandler
public NamespaceHandler getNamespaceHandler()
-
getParagraphSplitter
public ParagraphSplitter getParagraphSplitter()
The paragraph splitter splits the document into paragraphs for the purpose of bi-directional text analysis.
-
setBidiReorderer
public void setBidiReorderer(BidiReorderer reorderer)
-
getBidiReorderer
public BidiReorderer getBidiReorderer()
-
getBidiSplitterFactory
public BidiSplitterFactory getBidiSplitterFactory()
The bidi splitter is used to split text runs into LTR and RTL visual ordering.
-
setBidiSplitterFactory
public void setBidiSplitterFactory(BidiSplitterFactory factory)
The bidi splitter is used to split text runs into LTR and RTL visual ordering.
-
getDefaultTextDirection
public byte getDefaultTextDirection()
- Returns:
- the default text direction for a document.
-
setDefaultTextDirection
public void setDefaultTextDirection(byte direction)
- Parameters:
direction
- either BidiSplitter.LTR or BidiSplitter.RTL.
-
reInit
public void reInit(boolean keepLayers)
-
captureLayoutState
public LayoutState captureLayoutState()
-
restoreLayoutState
public void restoreLayoutState(LayoutState layoutState)
-
copyStateForRelayout
public LayoutState copyStateForRelayout()
-
restoreStateForRelayout
public void restoreStateForRelayout(LayoutState layoutState)
-
getBlockFormattingContext
public BlockFormattingContext getBlockFormattingContext()
-
pushBFC
public void pushBFC(BlockFormattingContext bfc)
-
popBFC
public void popBFC()
-
pushLayerIsolated
public void pushLayerIsolated(Box master)
-
pushLayer
public void pushLayer(Box master)
-
pushLayer
public void pushLayer(Layer layer)
-
popLayer
public void popLayer()
-
getLayer
public Layer getLayer()
-
getRootLayer
public Layer getRootLayer()
-
translate
public void translate(int x, int y)
-
addBoxId
public void addBoxId(java.lang.String id, Box box)
-
removeBoxId
public void removeBoxId(java.lang.String id)
-
isInteractive
public boolean isInteractive()
-
getMmPerDot
public float getMmPerDot()
- Specified by:
getMmPerDot
in interfaceCssContext
-
getDotsPerPixel
public int getDotsPerPixel()
- Specified by:
getDotsPerPixel
in interfaceCssContext
-
getFontSize2D
public float getFontSize2D(FontSpecification font)
- Specified by:
getFontSize2D
in interfaceCssContext
-
getXHeight
public float getXHeight(FontSpecification parentFont)
- Specified by:
getXHeight
in interfaceCssContext
-
getFont
public FSFont getFont(FontSpecification font)
- Specified by:
getFont
in interfaceCssContext
-
getUac
public UserAgentCallback getUac()
-
isPrint
public boolean isPrint()
-
setIsPrintOverride
public void setIsPrintOverride(java.lang.Boolean isPrint)
- Parameters:
isPrint
- true, false or null for no override.
-
getFirstLinesTracker
public StyleTracker getFirstLinesTracker()
-
getFirstLettersTracker
public StyleTracker getFirstLettersTracker()
-
getCurrentMarkerData
public MarkerData getCurrentMarkerData()
-
setCurrentMarkerData
public void setCurrentMarkerData(MarkerData currentMarkerData)
-
getReplacedElementFactory
public ReplacedElementFactory getReplacedElementFactory()
-
getFontContext
public FontContext getFontContext()
- Specified by:
getFontContext
in interfaceCssContext
-
setFontContext
public void setFontContext(FontContext fontContext)
-
getContentFunctionFactory
public ContentFunctionFactory getContentFunctionFactory()
-
getSharedContext
public SharedContext getSharedContext()
-
getExtraSpaceBottom
public int getExtraSpaceBottom()
Returns the extra space set aside for the footers of paginated tables.
-
setExtraSpaceBottom
public void setExtraSpaceBottom(int extraSpaceBottom)
-
getExtraSpaceTop
public int getExtraSpaceTop()
Returns the extra space set aside for the head section of paginated tables.
-
setExtraSpaceTop
public void setExtraSpaceTop(int extraSpaceTop)
-
resolveCounters
public void resolveCounters(CalculatedStyle style, java.lang.Integer startIndex)
-
resolveCounters
public void resolveCounters(CalculatedStyle style)
-
getCounterContext
public AbstractCounterContext getCounterContext(CalculatedStyle style)
-
getFSFontMetrics
public FSFontMetrics getFSFontMetrics(FSFont font)
- Specified by:
getFSFontMetrics
in interfaceCssContext
-
getPageName
public java.lang.String getPageName()
-
setPageName
public void setPageName(java.lang.String currentPageName)
-
getNoPageBreak
public int getNoPageBreak()
-
setNoPageBreak
public void setNoPageBreak(int noPageBreak)
-
isPageBreaksAllowed
public boolean isPageBreaksAllowed()
-
getPendingPageName
public java.lang.String getPendingPageName()
-
setPendingPageName
public void setPendingPageName(java.lang.String pendingPageName)
-
getRootDocumentLayer
public Layer getRootDocumentLayer()
-
setRootDocumentLayer
public void setRootDocumentLayer(Layer rootDocumentLayer)
-
getPage
public PageBox getPage()
-
setPage
public void setPage(PageBox page)
-
isMayCheckKeepTogether
public boolean isMayCheckKeepTogether()
-
setMayCheckKeepTogether
public void setMayCheckKeepTogether(boolean mayKeepTogether)
-
setBlockBoxingState
public void setBlockBoxingState(LayoutContext.BlockBoxingState state)
-
getBlockBoxingState
public LayoutContext.BlockBoxingState getBlockBoxingState()
-
isLineBreakedBecauseOfNoWrap
public boolean isLineBreakedBecauseOfNoWrap()
-
setLineBreakedBecauseOfNoWrap
public void setLineBreakedBecauseOfNoWrap(boolean value)
-
getBreakAtLineContext
public BreakAtLineContext getBreakAtLineContext()
-
setBreakAtLineContext
public void setBreakAtLineContext(BreakAtLineContext breakAtLineContext)
-
isFootnoteAllowed
public boolean isFootnoteAllowed()
Whether further footnote content is allowed. Used to prohibit footnotes inside footnotes.
-
setFootnoteAllowed
public void setFootnoteAllowed(boolean allowed)
SeeisFootnoteAllowed()
.
-
setIsInFloatBottom
public void setIsInFloatBottom(boolean inFloatBottom)
-
isInFloatBottom
public boolean isInFloatBottom()
Returns true if we are laying out the footnote area rather than general content.- Specified by:
isInFloatBottom
in interfaceCssContext
-
setFootnoteIndex
public void setFootnoteIndex(int footnoteIndex)
-
getFootnoteIndex
public int getFootnoteIndex()
The zero-based footnote index, which will likely be different from any counter used with the footnote.
-
hasActiveFootnotes
public boolean hasActiveFootnotes()
-
getFootnoteManager
public FootnoteManager getFootnoteManager()
Gets the document's footnote manager, creating it if required. From the footnote manager, one can add and remove footnote bodies.
-
setFirstLettersTracker
public void setFirstLettersTracker(StyleTracker firstLetters)
-
setFirstLinesTracker
public void setFirstLinesTracker(StyleTracker firstLines)
-
-