keiron      2002/06/18 04:27:36

  Modified:    src/org/apache/fop/layoutmgr BlockLayoutManager.java
                        LeafNodeLayoutManager.java LineBPLayoutManager.java
                        TextBPLayoutManager.java
  Log:
  ttempt to fix add inline objects and fix some probs
  
  Revision  Changes    Path
  1.9       +5 -3      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- BlockLayoutManager.java   10 May 2002 12:38:15 -0000      1.8
  +++ BlockLayoutManager.java   18 Jun 2002 11:27:36 -0000      1.9
  @@ -62,8 +62,10 @@
           if (fobj != null) {
               ListIterator children = fobj.getChildren();
               while (children.hasNext()) {
  -                FObj childFO = (FObj) children.next();
  -                childFO.addLayoutManager(lms);
  +                Object childFO = children.next();
  +                if(childFO instanceof FObj) {
  +                    ((FObj)childFO).addLayoutManager(lms);
  +                }
               }
               fobj = null;
           }
  
  
  
  1.5       +26 -2     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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- LeafNodeLayoutManager.java        26 Apr 2002 09:40:57 -0000      1.4
  +++ LeafNodeLayoutManager.java        18 Jun 2002 11:27:36 -0000      1.5
  @@ -9,6 +9,7 @@
   
   import org.apache.fop.fo.FObj;
   import org.apache.fop.area.Area;
  +import org.apache.fop.area.MinOptMax;
   import org.apache.fop.area.inline.InlineArea;
   
   
  @@ -17,7 +18,7 @@
    * These are all inline objects. Most of them cannot be split (Text is
    * an exception to this rule.)
    */
  -public class LeafNodeLayoutManager extends AbstractLayoutManager {
  +public class LeafNodeLayoutManager extends AbstractBPLayoutManager {
   
       private InlineArea curArea = null;
   
  @@ -68,5 +69,28 @@
           return null;
       }
   
  +    public BreakPoss getNextBreakPoss(LayoutContext context,
  +              Position prevBreakPoss) {
  +        curArea = get(0);
  +        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 | BreakPoss.REST_ARE_SUPPRESS_AT_LB);
  +        bp.setStackingSize(curArea.getAllocationIPD());
  +        setFinished(true);
  +        return bp;
  +    }
  +
  +    public void addAreas(PositionIterator posIter, LayoutContext context) {
  +        parentLM.addChild(curArea);
  +        while(posIter.hasNext()) {
  +            posIter.next();
  +        }
  +    }
   
  +    public boolean canBreakBefore(LayoutContext context) {
  +        return true;
  +    }
   }
  +
  
  
  
  1.7       +14 -4     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.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- LineBPLayoutManager.java  26 May 2002 15:02:43 -0000      1.6
  +++ LineBPLayoutManager.java  18 Jun 2002 11:27:36 -0000      1.7
  @@ -254,18 +254,28 @@
        }
   
        if(bp == null) return null;
  +        if(m_prevBP == null) m_prevBP = bp;
   
        // Choose the best break
        if (!bp.isForcedBreak() && vecPossEnd.size()>0) {
            m_prevBP = getBestBP(vecPossEnd);
        }
        // Backup child LM if necessary
  -     if (bp != m_prevBP) {
  +     if (bp != m_prevBP && !bp.couldEndLine()) {
            reset();
        }
        // Distribute space in the line
  -     MinOptMax actual = MinOptMax.add(m_prevBP.getStackingSize(),
  -                                      getPrevIPD(m_prevBP.getLayoutManager()));
  +     MinOptMax actual;
  +        if(bp != m_prevBP) {
  +        MinOptMax mom = getPrevIPD(m_prevBP.getLayoutManager());
  +        if(mom != null) {
  +        actual = MinOptMax.add(m_prevBP.getStackingSize(), mom);
  +        } else {
  +            actual = m_prevBP.getStackingSize();
  +        }
  +        } else {
  +            actual = m_prevBP.getStackingSize();
  +        }
        // ATTENTION: make sure this hasn't gotten start space for next
        // LM added onto it!
        actual.add(m_prevBP.resolveTrailingSpace(true));
  
  
  
  1.6       +3 -1      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.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TextBPLayoutManager.java  26 May 2002 15:02:43 -0000      1.5
  +++ TextBPLayoutManager.java  18 Jun 2002 11:27:36 -0000      1.6
  @@ -390,7 +390,9 @@
       {
        MinOptMax ipd = new MinOptMax(wordDim);
        ipd.add(spaceIPD);
  +        if(m_ipdTotal != null) {
        ipd.add(m_ipdTotal); // sum of all words so far in line
  +        }
        // Note: break position now stores total size to here
   
        // Position is the index of the info for this word in the vector
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to