|
|
@@ -81,6 +81,14 @@ import org.apache.fop.traits.MinOptMax; |
|
|
|
public class LineLayoutManager extends InlineStackingLayoutManager |
|
|
|
implements BlockLevelLayoutManager { |
|
|
|
|
|
|
|
/** |
|
|
|
* this constant is used to create elements when text-align is center: |
|
|
|
* every TextLM descendant of LineLM must use the same value, |
|
|
|
* otherwise the line breaking algorithm does not find the right |
|
|
|
* break point |
|
|
|
*/ |
|
|
|
public static final int DEFAULT_SPACE_WIDTH = 3336; |
|
|
|
|
|
|
|
/** |
|
|
|
* logging instance |
|
|
|
*/ |
|
|
@@ -89,29 +97,6 @@ public class LineLayoutManager extends InlineStackingLayoutManager |
|
|
|
private Block fobj; |
|
|
|
private boolean isFirstInBlock; |
|
|
|
|
|
|
|
/** {@inheritDoc} */ |
|
|
|
public void initialize() { |
|
|
|
textAlignment = fobj.getTextAlign(); |
|
|
|
textAlignmentLast = fobj.getTextAlignLast(); |
|
|
|
textIndent = fobj.getTextIndent(); |
|
|
|
lastLineEndIndent = fobj.getLastLineEndIndent(); |
|
|
|
hyphenationProperties = fobj.getCommonHyphenation(); |
|
|
|
hyphenationLadderCount = fobj.getHyphenationLadderCount(); |
|
|
|
wrapOption = fobj.getWrapOption(); |
|
|
|
whiteSpaceTreament = fobj.getWhitespaceTreatment(); |
|
|
|
// |
|
|
|
effectiveAlignment = getEffectiveAlignment(textAlignment, textAlignmentLast); |
|
|
|
isFirstInBlock = (this == getParent().getChildLMs().get(0)); |
|
|
|
} |
|
|
|
|
|
|
|
private int getEffectiveAlignment(int alignment, int alignmentLast) { |
|
|
|
if (textAlignment != EN_JUSTIFY && textAlignmentLast == EN_JUSTIFY) { |
|
|
|
return 0; |
|
|
|
} else { |
|
|
|
return textAlignment; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Private class to store information about inline breaks. |
|
|
|
* Each value holds the start and end indexes into a List of |
|
|
@@ -182,15 +167,6 @@ public class LineLayoutManager extends InlineStackingLayoutManager |
|
|
|
*/ |
|
|
|
private boolean hyphenationPerformed; |
|
|
|
|
|
|
|
/** |
|
|
|
* this constant is used to create elements when text-align is center: |
|
|
|
* every TextLM descendant of LineLM must use the same value, |
|
|
|
* otherwise the line breaking algorithm does not find the right |
|
|
|
* break point |
|
|
|
*/ |
|
|
|
public static final int DEFAULT_SPACE_WIDTH = 3336; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* This class is used to remember |
|
|
|
* which was the first element in the paragraph |
|
|
@@ -557,6 +533,29 @@ public class LineLayoutManager extends InlineStackingLayoutManager |
|
|
|
follow = f; |
|
|
|
} |
|
|
|
|
|
|
|
/** {@inheritDoc} */ |
|
|
|
public void initialize() { |
|
|
|
textAlignment = fobj.getTextAlign(); |
|
|
|
textAlignmentLast = fobj.getTextAlignLast(); |
|
|
|
textIndent = fobj.getTextIndent(); |
|
|
|
lastLineEndIndent = fobj.getLastLineEndIndent(); |
|
|
|
hyphenationProperties = fobj.getCommonHyphenation(); |
|
|
|
hyphenationLadderCount = fobj.getHyphenationLadderCount(); |
|
|
|
wrapOption = fobj.getWrapOption(); |
|
|
|
whiteSpaceTreament = fobj.getWhitespaceTreatment(); |
|
|
|
// |
|
|
|
effectiveAlignment = getEffectiveAlignment(textAlignment, textAlignmentLast); |
|
|
|
isFirstInBlock = (this == getParent().getChildLMs().get(0)); |
|
|
|
} |
|
|
|
|
|
|
|
private int getEffectiveAlignment(int alignment, int alignmentLast) { |
|
|
|
if (textAlignment != EN_JUSTIFY && textAlignmentLast == EN_JUSTIFY) { |
|
|
|
return 0; |
|
|
|
} else { |
|
|
|
return textAlignment; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** {@inheritDoc} */ |
|
|
|
public List getNextKnuthElements(LayoutContext context, int alignment) { |
|
|
|
if (alignmentContext == null) { |