You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ke...@apache.org on 2002/08/09 09:11:16 UTC
cvs commit: xml-fop/src/org/apache/fop/layoutmgr AbstractBPLayoutManager.java AbstractLayoutManager.java BlockLayoutManager.java BlockStackingLayoutManager.java FlowLayoutManager.java InlineStackingBPLayoutManager.java LayoutManager.java LeafNodeLayoutManager.java LineBPLayoutManager.java PageLayoutManager.java SpaceSpecifier.java TextBPLayoutManager.java LineLayoutManager.java TextLayoutManager.java
keiron 2002/08/09 00:11:16
Modified: src/org/apache/fop/layoutmgr AbstractBPLayoutManager.java
AbstractLayoutManager.java BlockLayoutManager.java
BlockStackingLayoutManager.java
FlowLayoutManager.java
InlineStackingBPLayoutManager.java
LayoutManager.java LeafNodeLayoutManager.java
LineBPLayoutManager.java PageLayoutManager.java
SpaceSpecifier.java TextBPLayoutManager.java
Removed: src/org/apache/fop/layoutmgr LineLayoutManager.java
TextLayoutManager.java
Log:
removed old code, cleaned up a bit
Revision Changes Path
1.6 +8 -8 xml-fop/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java
Index: AbstractBPLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/AbstractBPLayoutManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AbstractBPLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.5
+++ AbstractBPLayoutManager.java 9 Aug 2002 07:11:15 -0000 1.6
@@ -58,9 +58,9 @@
return m_curChildLM;
} else {
m_childLMiter.remove();
- System.err.println(
- "WARNING: child LM not a BPLayoutManager: " +
- obj.getClass().getName());
+ //log.warn(
+ // "child LM not a BPLayoutManager: " +
+ // obj.getClass().getName());
}
}
return null;
@@ -69,8 +69,8 @@
protected boolean hasMoreLM(BPLayoutManager prevLM) {
// prevLM should = m_curChildLM
if (prevLM != m_curChildLM) {
- System.err.println("AbstractBPLayoutManager.peekNextLM: " +
- "passed LM is not current child LM!");
+ //log.debug("AbstractBPLayoutManager.peekNextLM: " +
+ // "passed LM is not current child LM!");
return false;
}
return !m_childLMiter.hasNext();
@@ -92,7 +92,7 @@
// ASSERT m_curChildLM == (BPLayoutManager)m_childLMiter.previous()
if (m_curChildLM !=
(BPLayoutManager) m_childLMiter.previous()) {
- System.err.println("LMiter problem!");
+ //log.error("LMiter problem!");
}
while (m_curChildLM != lm && m_childLMiter.hasPrevious()) {
m_curChildLM.resetPosition(null);
@@ -130,7 +130,7 @@
* for the areas it will create, based on Properties set on its FO.
*/
protected void initProperties(PropertyManager pm) {
- System.err.println("AbstractBPLayoutManager.initProperties");
+ //log.debug("AbstractBPLayoutManager.initProperties");
}
1.8 +1 -29 xml-fop/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
Index: AbstractLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/AbstractLayoutManager.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AbstractLayoutManager.java 26 Apr 2002 09:40:57 -0000 1.7
+++ AbstractLayoutManager.java 9 Aug 2002 07:11:15 -0000 1.8
@@ -41,34 +41,6 @@
return 0;
}
- /**
- * Propagates to lower level layout managers. It iterates over the
- * children of its FO, asks each for its LayoutManager and calls
- * its generateAreas method.
- */
- public boolean generateAreas() {
- ArrayList lms = new ArrayList();
- if (fobj != null) {
- ListIterator children = fobj.getChildren();
- while (children.hasNext()) {
- FONode node = (FONode) children.next();
- if (node instanceof FObj) {
- ((FObj) node).addLayoutManager(lms);
- }
- }
- fobj = null;
- }
-
- for (int count = 0; count < lms.size(); count++) {
- LayoutManager lm = (LayoutManager) lms.get(count);
- lm.setParentLM(this);
- if (lm.generateAreas()) {
- break;
- }
- }
- return flush(); // Add last area to parent
- }
-
// /**
// * Ask the parent LayoutManager to add the current (full) area to the
// * appropriate parent area.
1.11 +4 -70 xml-fop/src/org/apache/fop/layoutmgr/BlockLayoutManager.java
Index: BlockLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BlockLayoutManager.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- BlockLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.10
+++ BlockLayoutManager.java 9 Aug 2002 07:11:15 -0000 1.11
@@ -94,9 +94,9 @@
return m_curChildLM;
} else {
m_childLMiter.remove();
- System.err.println(
- "WARNING: child LM not a BPLayoutManager: " +
- lm.getClass().getName());
+ //log.warn(
+ // "child LM not a BPLayoutManager: " +
+ // lm.getClass().getName());
}
}
return null;
@@ -158,72 +158,6 @@
}
flush();
}
-
-
- /**
- * Generate areas by telling all layout managers for its FO's
- * children to generate areas.
- */
- public boolean generateAreas() {
- ArrayList lms = new ArrayList();
- LayoutManager lm = null;
- FObj curFobj = fobj;
- if (fobj != null) {
- ListIterator children = fobj.getChildren();
- while (children.hasNext()) {
- Object childFO = children.next();
- if (childFO instanceof FObj) {
- ((FObj) childFO).addLayoutManager(lms);
- }
- }
- //fobj = null;
- }
-
- ArrayList vecBreakPoss = new ArrayList();
-
- BreakPoss bp;
- LayoutContext childLC = new LayoutContext(0);
- while (!isFinished()) {
- if ((bp = getNextBreakPoss(childLC, null)) != null) {
- vecBreakPoss.add(bp);
- }
- }
-
- addAreas( new BreakPossPosIter(vecBreakPoss, 0,
- vecBreakPoss.size()), null);
-
-
- /*
- for (int count = 0; count < lms.size(); count++) {
- lm = (LayoutManager) lms.get(count);
- if (lm.generatesInlineAreas()) {
- ArrayList inlines = new ArrayList();
- inlines.add(lm);
- //lms.remove(count);
- while (count + 1 < lms.size()) {
- lm = (LayoutManager) lms.get(count + 1);
- if (lm.generatesInlineAreas()) {
- inlines.add(lm);
- lms.remove(count + 1);
- } else {
- break;
- }
- }
- lm = new LineBPLayoutManager(curFobj, inlines,
- lineHeight, lead, follow);
- lms.set(count, lm);
- }
- lm.setParentLM(this);
- if (lm.generateAreas()) {
- if (flush()) {
- return true;
- }
- }
- }
- */
- return flush(); // Add last area to parent
- }
-
/**
* Return an Area which can contain the passed childArea. The childArea
1.7 +2 -2 xml-fop/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
Index: BlockStackingLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- BlockStackingLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.6
+++ BlockStackingLayoutManager.java 9 Aug 2002 07:11:15 -0000 1.7
@@ -139,7 +139,7 @@
BlockParent parentArea) {
// This should be a block-level Area (Block in the generic sense)
if (!(childArea instanceof Block)) {
- System.err.println("Child not a Block in BlockStackingLM!");
+ //log.error("Child not a Block in BlockStackingLM!");
return false;
}
1.5 +1 -24 xml-fop/src/org/apache/fop/layoutmgr/FlowLayoutManager.java
Index: FlowLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/FlowLayoutManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- FlowLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.4
+++ FlowLayoutManager.java 9 Aug 2002 07:11:15 -0000 1.5
@@ -43,25 +43,6 @@
super(fobj);
}
- public boolean generateAreas() {
-
- ArrayList vecBreakPoss = new ArrayList();
-
- BreakPoss bp;
- LayoutContext childLC = new LayoutContext(0);
- while (!isFinished()) {
- if ((bp = getNextBreakPoss(childLC, null)) != null) {
- System.out.println("Flow Break: " + bp);
- vecBreakPoss.add(bp);
- }
- }
-
- addAreas( new BreakPossPosIter(vecBreakPoss, 0,
- vecBreakPoss.size()), null);
- flush();
- return false;
- }
-
public BreakPoss getNextBreakPoss(LayoutContext context,
Position prevLineBP) {
@@ -86,8 +67,6 @@
}
}
-System.out.println("Flow BreakPoss: " + vecBreakPoss);
-
return new BreakPoss(
new BlockBreakPosition(curLM, 0, vecBreakPoss));
}
@@ -96,10 +75,8 @@
}
public void addAreas(PositionIterator parentIter, LayoutContext lc) {
-System.out.println("FL add: " + parentIter);
while (parentIter.hasNext()) {
BlockBreakPosition bbp = (BlockBreakPosition) parentIter.next();
-System.out.println("FL add: " + bbp);
bbp.getLM().addAreas( new BreakPossPosIter(bbp.blockps, 0,
bbp.blockps.size()), null);
}
1.6 +5 -5 xml-fop/src/org/apache/fop/layoutmgr/InlineStackingBPLayoutManager.java
Index: InlineStackingBPLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/InlineStackingBPLayoutManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- InlineStackingBPLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.5
+++ InlineStackingBPLayoutManager.java 9 Aug 2002 07:11:15 -0000 1.6
@@ -130,9 +130,9 @@
if (prevPos != null) {
// ASSERT (prevPos.getLM() == this)
if (prevPos.getLM() != this) {
- System.err.println(
- "InlineStackingBPLayoutManager.resetPosition: " +
- "LM mismatch!!!");
+ //log.error(
+ // "InlineStackingBPLayoutManager.resetPosition: " +
+ // "LM mismatch!!!");
}
// Back up the child LM Position
Position childPos = prevPos.getPosition();
@@ -496,7 +496,7 @@
spaceRange.min) * dSpaceAdjust);
}
if (iAdjust != 0) {
- System.err.println("Add leading space: " + iAdjust);
+ //log.error("Add leading space: " + iAdjust);
Space ls = new Space();
ls.setWidth(iAdjust);
parentArea.addChild(ls);
1.6 +1 -2 xml-fop/src/org/apache/fop/layoutmgr/LayoutManager.java
Index: LayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LayoutManager.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LayoutManager.java 26 Apr 2002 09:40:57 -0000 1.5
+++ LayoutManager.java 9 Aug 2002 07:11:15 -0000 1.6
@@ -14,7 +14,6 @@
* The interface for all LayoutManagers.
*/
public interface LayoutManager {
- public boolean generateAreas();
public boolean generatesInlineAreas();
public Area getParentArea (Area childArea);
public boolean addChild (Area childArea);
1.7 +1 -5 xml-fop/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java
Index: LeafNodeLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LeafNodeLayoutManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- LeafNodeLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.6
+++ LeafNodeLayoutManager.java 9 Aug 2002 07:11:15 -0000 1.7
@@ -48,10 +48,6 @@
curArea = ia;
}
- public boolean generateAreas() {
- return flush();
- }
-
protected boolean flush() {
return false;
}
1.9 +15 -57 xml-fop/src/org/apache/fop/layoutmgr/LineBPLayoutManager.java
Index: LineBPLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LineBPLayoutManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- LineBPLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.8
+++ LineBPLayoutManager.java 9 Aug 2002 07:11:15 -0000 1.9
@@ -29,7 +29,6 @@
import java.util.ListIterator;
import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import java.util.ArrayList;
@@ -59,7 +58,7 @@
/** Break positions returned by inline content. */
- private Vector m_vecInlineBreaks = new Vector(100);
+ private ArrayList m_vecInlineBreaks = new ArrayList();
private BreakPoss m_prevBP = null; // Last confirmed break position
private boolean m_bJustify = false; // True if fo:block text-align=JUSTIFY
@@ -113,7 +112,7 @@
BreakPoss prevBP = null;
BreakPoss bp = null; // proposed BreakPoss
- Vector vecPossEnd = new Vector();
+ ArrayList vecPossEnd = new ArrayList();
// IPD remaining in line
MinOptMax availIPD = context.getStackLimit();
@@ -130,12 +129,12 @@
// INITIALIZE LAYOUT CONTEXT FOR CALL TO CHILD LM
// First break for the child LM in each of its areas
boolean bFirstBPforLM = (m_vecInlineBreaks.isEmpty() ||
- (((BreakPoss) m_vecInlineBreaks.lastElement()).
+ (((BreakPoss) m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1)).
getLayoutManager() != curLM));
// Need previous breakpoint! ATTENTION when backing up for hyphenation!
prevBP = (m_vecInlineBreaks.isEmpty()) ? null :
- (BreakPoss) m_vecInlineBreaks.lastElement();
+ (BreakPoss) m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1);
initChildLC(inlineLC, prevBP,
(m_vecInlineBreaks.size() == iPrevLineEnd),
bFirstBPforLM, new SpaceSpecifier(true));
@@ -148,7 +147,7 @@
inlineLC.setFlags(LayoutContext.SUPPRESS_LEADING_SPACE,
(m_vecInlineBreaks.size() == iPrevLineEnd &&
!m_vecInlineBreaks.isEmpty() &&
- ((BreakPoss) m_vecInlineBreaks.lastElement()).
+ ((BreakPoss) m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1)).
isForcedBreak() == false));
// GET NEXT POSSIBLE BREAK FROM CHILD LM
@@ -280,9 +279,9 @@
// ATTENTION: make sure this hasn't gotten start space for next
// LM added onto it!
actual.add(m_prevBP.resolveTrailingSpace(true));
- System.err.println("Target opt=" + availIPD.opt + " bp.opt=" +
- actual.opt + " bp.max=" + actual.max + " bm.min=" +
- actual.min);
+ //log.error("Target opt=" + availIPD.opt + " bp.opt=" +
+ // actual.opt + " bp.max=" + actual.max + " bm.min=" +
+ // actual.min);
// Don't justify last line in the sequence or if forced line-end
boolean bJustify = (m_bJustify && !m_prevBP.isForcedBreak() &&
@@ -292,7 +291,7 @@
private void reset() {
- while (m_vecInlineBreaks.lastElement() != m_prevBP) {
+ while (m_vecInlineBreaks.get(m_vecInlineBreaks.size() - 1) != m_prevBP) {
m_vecInlineBreaks.remove(m_vecInlineBreaks.size() - 1);
}
reset(m_prevBP.getPosition());
@@ -317,9 +316,9 @@
- private BreakPoss getBestBP(Vector vecPossEnd) {
+ private BreakPoss getBestBP(ArrayList vecPossEnd) {
if (vecPossEnd.size() == 1) {
- return ((BreakCost) vecPossEnd.elementAt(0)).getBP();
+ return ((BreakCost) vecPossEnd.get(0)).getBP();
}
// Choose the best break (use a sort on cost!)
Iterator iter = vecPossEnd.iterator();
@@ -359,7 +358,7 @@
while (bpIter.hasPrevious() && bpIter.previous() != prevBP)
;
if (bpIter.next() != prevBP) {
- System.err.println("findHyphenPoss: problem!");
+ //log.error("findHyphenPoss: problem!");
return null;
}
StringBuffer sbChars = new StringBuffer(30);
@@ -375,7 +374,7 @@
prevBP = bp;
}
m_vecInlineBreaks.remove(m_vecInlineBreaks.size() - 1); // remove last
- System.err.println("Word to hyphenate: " + sbChars.toString());
+ //log.debug("Word to hyphenate: " + sbChars.toString());
// Now find all hyphenation points in this word (get in an array of offsets)
// hyphProps are from the block level?. Note that according to the spec,
@@ -422,7 +421,7 @@
(double)(actual.opt - actual.min);
}
}
- System.err.println("Adjustment factor=" + dAdjust);
+ //log.debug("Adjustment factor=" + dAdjust);
BreakPoss curLineBP = new BreakPoss( new LineBreakPosition(this,
m_vecInlineBreaks.size() - 1, dAdjust));
@@ -472,47 +471,6 @@
}
setCurrentArea(null); // ?? necessary
}
-
-
- // NOTE: PATCHED FOR NOW TO ADD BreakPoss stuff to Kerion's changes
- public boolean generateAreas() {
- // Make break positions and return lines!
- // Set up a LayoutContext
- int ipd = 0;
- BreakPoss bp;
- Vector vecBreakPoss = new Vector(20);
-
- // Force area creation on first call
- // NOTE: normally not necessary when fully integrated!
- LayoutContext childLC =
- new LayoutContext(LayoutContext.CHECK_REF_AREA);
-
- while (!isFinished()) {
- if ((bp = getNextBreakPoss(childLC, null)) != null) {
- if (bp.checkIPD()) {
- // Need IPD in order to layout lines!
- // This is supposed to bubble up to PageLM to
- // make the necessary flow reference area, depending
- // on span and break-before flags set as the BreakPoss
- // makes its way back up the call stack.
- // Fake it for now!
- parentLM.getParentArea(null);
- ipd = parentLM.getContentIPD();
- childLC.flags &= ~LayoutContext.CHECK_REF_AREA;
- childLC.setStackLimit( new MinOptMax(ipd - m_iIndents -
- m_iTextIndent));
- } else {
- vecBreakPoss.add(bp);
- // Reset stackLimit for non-first lines
- childLC.setStackLimit(new MinOptMax(ipd - m_iIndents));
- }
- }
- }
- addAreas( new BreakPossPosIter(vecBreakPoss, 0,
- vecBreakPoss.size()), 0.0);
- return false;
- }
-
}
1.9 +8 -9 xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java
Index: PageLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- PageLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.8
+++ PageLayoutManager.java 9 Aug 2002 07:11:16 -0000 1.9
@@ -76,7 +76,6 @@
* rendering process can also run in a parallel thread.
*/
public void run() {
- //generateAreas();
doLayout();
flush();
}
@@ -89,11 +88,11 @@
LayoutContext childLC = new LayoutContext(0);
while (!isFinished()) {
ArrayList vecBreakPoss = new ArrayList();
- makeNewPage(false, false);
if ((bp = getNextBreakPoss(childLC, null)) != null) {
vecBreakPoss.add(bp);
addAreas( new BreakPossPosIter(vecBreakPoss, 0,
vecBreakPoss.size()), null);
+ finishPage();
}
}
@@ -125,9 +124,10 @@
vecBreakPoss.add(bp);
}
}
-System.out.println("BREAKS: " + vecBreakPoss.size());
- return new BreakPoss(
- new BlockBreakPosition(curLM, 0, vecBreakPoss));
+ if(vecBreakPoss.size() > 0) {
+ return new BreakPoss(
+ new BlockBreakPosition(curLM, 0, vecBreakPoss));
+ }
}
setFinished(true);
return null;
@@ -137,7 +137,6 @@
while (parentIter.hasNext()) {
BlockBreakPosition bbp = (BlockBreakPosition) parentIter.next();
-System.out.println("ADD BREAKS: " + bbp.blockps.size());
bbp.getLM().addAreas( new BreakPossPosIter(bbp.blockps, 0,
bbp.blockps.size()), null);
}
@@ -178,8 +177,8 @@
// end the page.
getParentArea(area);
// Alternatively the child LM indicates to parent that it's full?
- System.out.println("size: " + area.getAllocationBPD().max +
- ":" + curSpan.getMaxBPD().min);
+ //System.out.println("size: " + area.getAllocationBPD().max +
+ // ":" + curSpan.getMaxBPD().min);
if (area.getAllocationBPD().max >= curSpan.getMaxBPD().min) {
// Consider it filled
if (curSpan.getColumnCount() == curSpanColumns) {
1.7 +6 -6 xml-fop/src/org/apache/fop/layoutmgr/SpaceSpecifier.java
Index: SpaceSpecifier.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/SpaceSpecifier.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SpaceSpecifier.java 8 Aug 2002 15:08:08 -0000 1.6
+++ SpaceSpecifier.java 9 Aug 2002 07:11:16 -0000 1.7
@@ -9,7 +9,7 @@
import org.apache.fop.area.MinOptMax;
import org.apache.fop.traits.SpaceVal;
-import java.util.Vector;
+import java.util.ArrayList;
/**
* Accumulate a sequence of space-specifiers (XSL space type) on
@@ -21,7 +21,7 @@
private boolean m_bStartsRefArea;
private boolean m_bHasForcing = false;
- private Vector m_vecSpaceVals = new Vector(3);
+ private ArrayList m_vecSpaceVals = new ArrayList();
public SpaceSpecifier(boolean bStartsRefArea) {
@@ -32,7 +32,7 @@
try {
SpaceSpecifier ss = (SpaceSpecifier) super.clone();
// Clone the vector, but share the objects in it!
- ss.m_vecSpaceVals = new Vector(this.m_vecSpaceVals.size());
+ ss.m_vecSpaceVals = new ArrayList();
ss.m_vecSpaceVals.addAll(this.m_vecSpaceVals);
return ss;
} catch (CloneNotSupportedException cnse) {
@@ -95,7 +95,7 @@
// Start from the end and count conditional specifiers
// Stop at first non-conditional
for (; lastIndex > 0; --lastIndex) {
- SpaceVal sval = (SpaceVal) m_vecSpaceVals.elementAt(
+ SpaceVal sval = (SpaceVal) m_vecSpaceVals.get(
lastIndex - 1);
if (!sval.bConditional) {
break;
@@ -105,7 +105,7 @@
MinOptMax resSpace = new MinOptMax(0);
int iMaxPrec = -1;
for (int index = 0; index < lastIndex; index++) {
- SpaceVal sval = (SpaceVal) m_vecSpaceVals.elementAt(index);
+ SpaceVal sval = (SpaceVal) m_vecSpaceVals.get(index);
if (m_bHasForcing) {
resSpace.add(sval.space);
} else if (sval.iPrecedence > iMaxPrec) {
1.9 +13 -26 xml-fop/src/org/apache/fop/layoutmgr/TextBPLayoutManager.java
Index: TextBPLayoutManager.java
===================================================================
RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/TextBPLayoutManager.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TextBPLayoutManager.java 8 Aug 2002 15:08:08 -0000 1.8
+++ TextBPLayoutManager.java 9 Aug 2002 07:11:16 -0000 1.9
@@ -22,7 +22,7 @@
//import org.apache.fop.fo.properties.*;
-import java.util.Vector; // or use ArrayList ???
+import java.util.ArrayList;
/**
* LayoutManager for text (a sequence of characters) which generates one
@@ -52,7 +52,7 @@
// Hold all possible breaks for the text in this LM's FO.
- private Vector m_vecAreaInfo;
+ private ArrayList m_vecAreaInfo;
/** Non-space characters on which we can end a line. */
static private final String s_breakChars = "-/" ;
@@ -90,7 +90,7 @@
super(fobj);
this.chars = chars;
this.textInfo = textInfo;
- this.m_vecAreaInfo = new Vector(chars.length / 5); // Guess
+ this.m_vecAreaInfo = new ArrayList();
// With CID fonts, space isn't neccesary currentFontState.width(32)
m_spaceIPD = CharUtilities.getCharWidth(' ', textInfo.fs);
@@ -118,24 +118,11 @@
return null;
}
- /**
- * Generate inline areas for words in text.
- */
- public boolean generateAreas() {
- // Handle white-space characteristics. Maybe there is no area to
- // generate....
-
- // Iterate over characters and make text areas.
- // Add each one to parent. Handle word-space.
- return false;
- }
-
-
public void getWordChars(StringBuffer sbChars, Position bp1,
Position bp2) {
LeafPosition endPos = (LeafPosition) bp2;
AreaInfo ai =
- (AreaInfo) m_vecAreaInfo.elementAt(endPos.getLeafPos());
+ (AreaInfo) m_vecAreaInfo.get(endPos.getLeafPos());
// Skip all leading spaces for hyphenation
int i;
for (i = ai.m_iStartIndex; i < ai.m_iBreakIndex &&
@@ -163,15 +150,15 @@
if (prevPos != null) {
// ASSERT (prevPos.getLM() == this)
if (prevPos.getLM() != this) {
- System.err.println(
- "TextBPLayoutManager.resetPosition: " + "LM mismatch!!!");
+ //log.error(
+ // "TextBPLayoutManager.resetPosition: " + "LM mismatch!!!");
}
LeafPosition tbp = (LeafPosition) prevPos;
AreaInfo ai =
- (AreaInfo) m_vecAreaInfo.elementAt(tbp.getLeafPos());
+ (AreaInfo) m_vecAreaInfo.get(tbp.getLeafPos());
if (ai.m_iBreakIndex != m_iNextStart) {
m_iNextStart = ai.m_iBreakIndex;
- m_vecAreaInfo.setSize(tbp.getLeafPos() + 1);
+ m_vecAreaInfo.ensureCapacity(tbp.getLeafPos() + 1);
// TODO: reset or recalculate total IPD = sum of all word IPD
// up to the break position
m_ipdTotal = ai.m_ipdArea;
@@ -179,7 +166,7 @@
}
} else {
// Reset to beginning!
- m_vecAreaInfo.setSize(0);
+ m_vecAreaInfo.clear();
m_iNextStart = 0;
setFinished(false);
}
@@ -453,7 +440,7 @@
*/
while (posIter.hasNext()) {
LeafPosition tbpNext = (LeafPosition) posIter.next();
- ai = (AreaInfo) m_vecAreaInfo.elementAt(tbpNext.getLeafPos());
+ ai = (AreaInfo) m_vecAreaInfo.get(tbpNext.getLeafPos());
if (iStart == -1) {
iStart = ai.m_iStartIndex;
}
@@ -483,8 +470,8 @@
new String(chars, iStart, ai.m_iBreakIndex - iStart),
ai.m_ipdArea.opt + iAdjust);
if (iWScount > 0) {
- System.err.println("Adjustment per word-space= " +
- iAdjust / iWScount);
+ //log.error("Adjustment per word-space= " +
+ // iAdjust / iWScount);
word.setWSadjust(iAdjust / iWScount);
}
if ((chars[iStart] == SPACE || chars[iStart] == NBSPACE) &&
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org