Package com.openhtmltopdf.layout
Class LayoutContext
java.lang.Object
com.openhtmltopdf.layout.LayoutContext
- All Implemented Interfaces:
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 in
SharedContext.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LinkedList<BlockFormattingContext> private BidiReordererprivate BidiSplitterFactoryprivate LayoutContext.BlockBoxingStateprivate BreakAtLineContextprivate final ContentFunctionFactoryfinal Map<CalculatedStyle, CounterContext> private MarkerDataprivate byteprivate intprivate intprivate StyleTrackerprivate StyleTrackerprivate FontContextprivate intprivate FootnoteManagerprivate booleanprivate booleanprivate LinkedList<Layer> private booleanprivate booleanprivate intprivate PageBoxprivate Stringprivate Stringprivate Layerprivate Layerprivate LayoutStateprivate SharedContextprivate final ParagraphSplitterprivate Boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThe bidi splitter is used to split text runs into LTR and RTL visual ordering.getCounterContext(CalculatedStyle style) getCss()byteintintReturns the extra space set aside for the footers of paginated tables.intReturns the extra space set aside for the head section of paginated tables.getFont(FontSpecification font) floatintThe zero-based footnote index, which will likely be different from any counter used with the footnote.Gets the document's footnote manager, creating it if required.getFSFontMetrics(FSFont font) getLayer()floatintgetPage()The paragraph splitter splits the document into paragraphs for the purpose of bi-directional text analysis.getUac()floatgetXHeight(FontSpecification parentFont) booleanbooleanWhether further footnote content is allowed.booleanReturns true if we are laying out the footnote area rather than general content.booleanbooleanbooleanbooleanbooleanisPrint()voidpopBFC()voidpopLayer()voidvoidvoidvoidpushLayerIsolated(Box master) voidreInit(boolean keepLayers) voidremoveBoxId(String id) voidresolveCounters(CalculatedStyle style) voidresolveCounters(CalculatedStyle style, Integer startIndex) voidrestoreLayoutState(LayoutState layoutState) voidrestoreStateForRelayout(LayoutState layoutState) voidsetBidiReorderer(BidiReorderer reorderer) voidThe bidi splitter is used to split text runs into LTR and RTL visual ordering.voidvoidsetBreakAtLineContext(BreakAtLineContext breakAtLineContext) voidsetCurrentMarkerData(MarkerData currentMarkerData) voidsetDefaultTextDirection(byte direction) voidsetExtraSpaceBottom(int extraSpaceBottom) voidsetExtraSpaceTop(int extraSpaceTop) voidsetFirstLettersTracker(StyleTracker firstLetters) voidsetFirstLinesTracker(StyleTracker firstLines) voidsetFontContext(FontContext fontContext) voidsetFootnoteAllowed(boolean allowed) SeeisFootnoteAllowed().voidsetFootnoteIndex(int footnoteIndex) voidsetIsInFloatBottom(boolean inFloatBottom) voidsetIsPrintOverride(Boolean isPrint) voidsetLineBreakedBecauseOfNoWrap(boolean value) voidsetMayCheckKeepTogether(boolean mayKeepTogether) voidsetNoPageBreak(int noPageBreak) voidvoidsetPageName(String currentPageName) voidsetPendingPageName(String pendingPageName) voidsetRootDocumentLayer(Layer rootDocumentLayer) voidtranslate(int x, int y)
-
Field Details
-
_blockBoxingState
-
_rootLayer
-
_firstLines
-
_firstLetters
-
_currentMarkerData
-
_bfcs
-
_layers
-
_fontContext
-
_contentFunctionFactory
-
_extraSpaceTop
private int _extraSpaceTop -
_extraSpaceBottom
private int _extraSpaceBottom -
_counterContextMap
-
_pendingPageName
-
_pageName
-
_noPageBreak
private int _noPageBreak -
_rootDocumentLayer
-
_page
-
_mayCheckKeepTogether
private boolean _mayCheckKeepTogether -
_lineBreakedBecauseOfNoWrap
private boolean _lineBreakedBecauseOfNoWrap -
_breakAtLineContext
-
isPrintOverride
-
_isInFloatBottom
private boolean _isInFloatBottom -
_savedLayoutState
-
_footnoteIndex
private int _footnoteIndex -
_footnoteManager
-
_isFootnoteAllowed
private boolean _isFootnoteAllowed -
_splitter
-
_bidiSplitterFactory
-
_defaultTextDirection
private byte _defaultTextDirection -
_bidiReorderer
-
-
Constructor Details
-
Method Details
-
getTextRenderer
- Specified by:
getTextRendererin interfaceCssContext
-
getCss
- Specified by:
getCssin interfaceCssContext
-
getCanvas
-
getFixedRectangle
-
getNamespaceHandler
-
getParagraphSplitter
The paragraph splitter splits the document into paragraphs for the purpose of bi-directional text analysis. -
setBidiReorderer
-
getBidiReorderer
-
getBidiSplitterFactory
The bidi splitter is used to split text runs into LTR and RTL visual ordering. -
setBidiSplitterFactory
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
-
restoreLayoutState
-
copyStateForRelayout
-
restoreStateForRelayout
-
getBlockFormattingContext
-
pushBFC
-
popBFC
public void popBFC() -
pushLayerIsolated
-
pushLayer
-
pushLayer
-
popLayer
public void popLayer() -
getLayer
-
getRootLayer
-
translate
public void translate(int x, int y) -
addBoxId
-
removeBoxId
-
isInteractive
public boolean isInteractive() -
getMmPerDot
public float getMmPerDot()- Specified by:
getMmPerDotin interfaceCssContext
-
getDotsPerPixel
public int getDotsPerPixel()- Specified by:
getDotsPerPixelin interfaceCssContext
-
getFontSize2D
- Specified by:
getFontSize2Din interfaceCssContext
-
getXHeight
- Specified by:
getXHeightin interfaceCssContext
-
getFont
- Specified by:
getFontin interfaceCssContext
-
getUac
-
isPrint
public boolean isPrint() -
setIsPrintOverride
- Parameters:
isPrint- true, false or null for no override.
-
getFirstLinesTracker
-
getFirstLettersTracker
-
getCurrentMarkerData
-
setCurrentMarkerData
-
getReplacedElementFactory
-
getFontContext
- Specified by:
getFontContextin interfaceCssContext
-
setFontContext
-
getContentFunctionFactory
-
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
-
resolveCounters
-
getCounterContext
-
getFSFontMetrics
- Specified by:
getFSFontMetricsin interfaceCssContext
-
getPageName
-
setPageName
-
getNoPageBreak
public int getNoPageBreak() -
setNoPageBreak
public void setNoPageBreak(int noPageBreak) -
isPageBreaksAllowed
public boolean isPageBreaksAllowed() -
getPendingPageName
-
setPendingPageName
-
getRootDocumentLayer
-
setRootDocumentLayer
-
getPage
-
setPage
-
isMayCheckKeepTogether
public boolean isMayCheckKeepTogether() -
setMayCheckKeepTogether
public void setMayCheckKeepTogether(boolean mayKeepTogether) -
setBlockBoxingState
-
getBlockBoxingState
-
isLineBreakedBecauseOfNoWrap
public boolean isLineBreakedBecauseOfNoWrap() -
setLineBreakedBecauseOfNoWrap
public void setLineBreakedBecauseOfNoWrap(boolean value) -
getBreakAtLineContext
-
setBreakAtLineContext
-
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:
isInFloatBottomin 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
Gets the document's footnote manager, creating it if required. From the footnote manager, one can add and remove footnote bodies. -
setFirstLettersTracker
-
setFirstLinesTracker
-