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 kl...@apache.org on 2001/11/11 23:14:45 UTC

cvs commit: xml-fop/src/org/apache/fop/layoutmgr AbstractLayoutManager.java BlockLayoutManager.java LayoutManager.java LineLayoutManager.java TextLayoutManager.java

klease      01/11/11 14:14:45

  Modified:    src/org/apache/fop/layoutmgr AbstractLayoutManager.java
                        BlockLayoutManager.java LayoutManager.java
                        LineLayoutManager.java TextLayoutManager.java
  Log:
  Move generatesInlineAreas from LayoutManager to FObj
  
  Revision  Changes    Path
  1.4       +4 -4      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractLayoutManager.java	2001/11/11 14:11:46	1.3
  +++ AbstractLayoutManager.java	2001/11/11 22:14:45	1.4
  @@ -1,5 +1,5 @@
   /*
  - * $Id: AbstractLayoutManager.java,v 1.3 2001/11/11 14:11:46 klease Exp $
  + * $Id: AbstractLayoutManager.java,v 1.4 2001/11/11 22:14:45 klease Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -87,9 +87,9 @@
   	
   
   
  -    public boolean generatesInlineAreas() {
  -	return false;
  -    }
  +//     public boolean generatesInlineAreas() {
  +// 	return false;
  +//     }
   
   
       /**
  
  
  
  1.2       +11 -8     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BlockLayoutManager.java	2001/11/11 14:13:51	1.1
  +++ BlockLayoutManager.java	2001/11/11 22:14:45	1.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: BlockLayoutManager.java,v 1.1 2001/11/11 14:13:51 klease Exp $
  + * $Id: BlockLayoutManager.java,v 1.2 2001/11/11 22:14:45 klease Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -44,14 +44,17 @@
        */
       public void generateAreas() {
   	ListIterator children = fobj.getChildren();
  +	LayoutManager lm=null;
   	while (children.hasNext()) {
  -	    LayoutManager lm = ((FObj)children.next()).getLayoutManager();
  - 	    if (lm != null) {
  -		if (lm.generatesInlineAreas()) {
  -		    // Back up one
  -		    children.previous();
  -		    lm = new LineLayoutManager(children);
  -		}
  +	    FObj childFO = (FObj)children.next();
  +	    if (childFO.generatesInlineAreas()) {
  +		children.previous();
  +		lm = new LineLayoutManager(children);
  +	    }
  +	    else {
  +		lm = childFO.getLayoutManager();
  +	    }
  +	    if (lm != null) {
   		lm.setParentLM(this);
   		lm.generateAreas();
   	    }
  
  
  
  1.3       +2 -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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LayoutManager.java	2001/11/11 14:11:46	1.2
  +++ LayoutManager.java	2001/11/11 22:14:45	1.3
  @@ -1,5 +1,5 @@
   /*
  - * $Id: LayoutManager.java,v 1.2 2001/11/11 14:11:46 klease Exp $
  + * $Id: LayoutManager.java,v 1.3 2001/11/11 22:14:45 klease Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -15,7 +15,7 @@
    */
   public interface LayoutManager {
       public void generateAreas();
  -    public boolean generatesInlineAreas();
  +    //public boolean generatesInlineAreas();
       public Area getParentArea (Area childArea);
       public void addChild (Area childArea);
       public boolean splitArea(Area areaToSplit, SplitContext context);
  
  
  
  1.2       +11 -11    xml-fop/src/org/apache/fop/layoutmgr/LineLayoutManager.java
  
  Index: LineLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/LineLayoutManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LineLayoutManager.java	2001/11/11 14:13:51	1.1
  +++ LineLayoutManager.java	2001/11/11 22:14:45	1.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: LineLayoutManager.java,v 1.1 2001/11/11 14:13:51 klease Exp $
  + * $Id: LineLayoutManager.java,v 1.2 2001/11/11 22:14:45 klease Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -44,16 +44,16 @@
       public void generateAreas() {
   	this.bFirstLine = true;
   	while (fobjIter.hasNext()) {
  -	    FObj fobj = (FObj)fobjIter.next();
  -	    curLM = fobj.getLayoutManager();
  - 	    if (curLM != null) {
  -		if (curLM.generatesInlineAreas()==false) {
  -		    // It generates blocks, pass back to parent
  -		    // Back up one
  -		    fobjIter.previous();
  -		    break;
  -		}
  -		else { // generates inline area
  +	    FObj childFO = (FObj)fobjIter.next();
  +	    if (childFO.generatesInlineAreas()==false) {
  +		// It generates blocks, pass back to parent
  +		// Back up one
  +		fobjIter.previous();
  +		break;
  +	    }
  +	    else { // generates inline area
  +		curLM = childFO.getLayoutManager();
  +		if (curLM != null) {
   		    curLM.setParentLM(this);
   		    curLM.generateAreas();
   		}
  
  
  
  1.2       +13 -29    xml-fop/src/org/apache/fop/layoutmgr/TextLayoutManager.java
  
  Index: TextLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/TextLayoutManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TextLayoutManager.java	2001/11/11 14:13:51	1.1
  +++ TextLayoutManager.java	2001/11/11 22:14:45	1.2
  @@ -1,5 +1,5 @@
   /*
  - * $Id: TextLayoutManager.java,v 1.1 2001/11/11 14:13:51 klease Exp $
  + * $Id: TextLayoutManager.java,v 1.2 2001/11/11 22:14:45 klease Exp $
    * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
    * For details on use and redistribution please refer to the
    * LICENSE file included with these sources.
  @@ -8,6 +8,7 @@
   package org.apache.fop.layoutmgr;
   
   import org.apache.fop.fo.FObj;
  +import org.apache.fop.fo.FOText; // For TextInfo: TODO: make independent!
   import org.apache.fop.area.Area;
   import org.apache.fop.area.inline.Word;
   
  @@ -17,57 +18,40 @@
    * LayoutManager for text (a sequence of characters) which generates one
    * more inline areas.
    */
  -public class TextLayoutManager extends AbstractLayoutManager {
  +public class TextLayoutManager extends LeafNodeLayoutManager {
   
       private char[] chars;
  -    private Word curWordArea;
  +    private FOText.TextInfo textInfo;
   
  -    public TextLayoutManager(FObj fobj, char[] chars) {
  +    public TextLayoutManager(FObj fobj, char[] chars, 
  +			     FOText.TextInfo textInfo) {
   	super(fobj);
   	this.chars = chars;
  +	this.textInfo = textInfo;
       }
   
  -
       /**
        * Generate inline areas for words in text.
        */
       public void 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.
  -	curWordArea = new Word();
  +	Word curWordArea = new Word();
   	curWordArea.setWord(new String(chars));
  +	setCurrentArea(curWordArea);
   	flush();
       }
   
   
  -    protected void flush() {
  -	parentLM.addChild(curWordArea);
  -    }
  -
  -
  -    public boolean generatesInlineAreas() {
  -	return true;
  -    }
  -
  -    /**
  -     * This is a leaf-node, so this method is never called.
  -     */
  -    public void addChild(Area childArea) {}
  -
  -
  -    /**
  -     * This is a leaf-node, so this method is never called.
  -     */
  -    public Area getParentArea(Area childArea) {
  -	return null;
  -    }
  -	
  -
   
       /** Try to split the word area by hyphenating the word. */
       public boolean splitArea(Area areaToSplit, SplitContext context) {
   	context.nextArea = areaToSplit;
   	return false;
       }
  +
   
   }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org