aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
diff options
context:
space:
mode:
authorSimon Pepping <spepping@apache.org>2004-11-13 20:37:17 +0000
committerSimon Pepping <spepping@apache.org>2004-11-13 20:37:17 +0000
commit29fbb7396529145c4bab73f3f441c34a1d276f7c (patch)
treee1af3996e99da9577de866b6e941e198bd4452e8 /src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
parent8576c6b0c72dd6dc53e44028eb4eb7b5b69c14bd (diff)
downloadxmlgraphics-fop-29fbb7396529145c4bab73f3f441c34a1d276f7c.tar.gz
xmlgraphics-fop-29fbb7396529145c4bab73f3f441c34a1d276f7c.zip
Patch 31206 by Luca Furini:
- A new interface InlineLevelLayoutManager, implemented by LeafNodeLM, InlineLM, TextLM, BasicLinkLM and ContentLM - Leaders with pattern "use-content" and "dots" now works - Better handling of preserved linefeeds - Correct calculation of the lineheight, according to the value of the property vertical-align For a few points which may need further work, see the bugzilla page. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198142 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java74
1 files changed, 10 insertions, 64 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
index 42da5776f..ce1a19aaf 100644
--- a/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
@@ -33,12 +33,13 @@ import java.util.LinkedList;
* This class can be extended to handle the creation and adding of the
* inline area.
*/
-public class LeafNodeLayoutManager extends AbstractLayoutManager {
+public class LeafNodeLayoutManager extends AbstractLayoutManager
+ implements InlineLevelLayoutManager {
/**
* The inline area that this leafnode will add.
*/
protected InlineArea curArea = null;
- protected int alignment;
+ protected int verticalAlignment;
private int lead;
private MinOptMax ipd;
@@ -116,7 +117,7 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager {
* @param al the vertical alignment positioning
*/
public void setAlignment(int al) {
- alignment = al;
+ verticalAlignment = al;
}
/**
@@ -147,49 +148,6 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager {
}
/**
- * Get the next break position.
- * Since this holds an inline area it will return a single
- * break position.
- * @param context the layout context for this inline area
- * @return the break poisition for adding this inline area
- */
- public BreakPoss getNextBreakPoss(LayoutContext context) {
- curArea = get(context);
- if (curArea == null) {
- setFinished(true);
- return null;
- }
- BreakPoss bp = new BreakPoss(new LeafPosition(this, 0),
- BreakPoss.CAN_BREAK_AFTER
- | BreakPoss.CAN_BREAK_BEFORE | BreakPoss.ISFIRST
- | BreakPoss.ISLAST);
- ipd = getAllocationIPD(context.getRefIPD());
- bp.setStackingSize(ipd);
- bp.setNonStackingSize(new MinOptMax(curArea.getBPD()));
- bp.setTrailingSpace(new SpaceSpecifier(false));
-
- int bpd = curArea.getBPD();
- switch (alignment) {
- case VerticalAlign.MIDDLE:
- bp.setMiddle(bpd / 2 /* - fontLead/2 */);
- bp.setLead(bpd / 2 /* + fontLead/2 */);
- break;
- case VerticalAlign.TOP:
- bp.setTotal(bpd);
- break;
- case VerticalAlign.BOTTOM:
- bp.setTotal(bpd);
- break;
- case VerticalAlign.BASELINE:
- default:
- bp.setLead(bpd);
- break;
- }
- setFinished(true);
- return bp;
- }
-
- /**
* Get the allocation ipd of the inline area.
* This method may be overridden to handle percentage values.
* @param refIPD the ipd of the parent reference area
@@ -200,19 +158,6 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager {
}
/**
- * Reset the position.
- * If the reset position is null then this inline area should be
- * restarted.
- * @param resetPos the position to reset.
- */
- public void resetPosition(Position resetPos) {
- // only reset if setting null, start again
- if (resetPos == null) {
- setFinished(false);
- }
- }
-
- /**
* Add the area for this layout manager.
* This adds the single inline area to the parent.
* @param posIter the position iterator
@@ -244,9 +189,9 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager {
*/
protected void offsetArea(LayoutContext context) {
int bpd = curArea.getBPD();
- switch (alignment) {
+ switch (verticalAlignment) {
case VerticalAlign.MIDDLE:
- curArea.setOffset(context.getBaseline() - bpd / 2 /* - fontLead/2 */);
+ curArea.setOffset(context.getMiddleBaseline() - bpd / 2);
break;
case VerticalAlign.TOP:
//curArea.setOffset(0);
@@ -305,7 +250,7 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager {
int lead = 0;
int total = 0;
int middle = 0;
- switch (alignment) {
+ switch (verticalAlignment) {
case VerticalAlign.MIDDLE : middle = bpd / 2 ;
lead = bpd / 2 ;
break;
@@ -331,6 +276,9 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager {
return returnList;
}
+ public void getWordChars(StringBuffer sbChars, Position bp) {
+ }
+
public KnuthElement addALetterSpaceTo(KnuthElement element) {
// return the unchanged box object
return new KnuthBox(areaInfo.ipdArea.opt, areaInfo.lead,
@@ -339,8 +287,6 @@ public class LeafNodeLayoutManager extends AbstractLayoutManager {
}
public void hyphenate(Position pos, HyphContext hc) {
- // use the AbstractLayoutManager.hyphenate() null implementation
- super.hyphenate(pos, hc);
}
public boolean applyChanges(List oldList) {