]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Move generatesInlineAreas from LayoutManager to FObj
authorKaren Lease <klease@apache.org>
Sun, 11 Nov 2001 22:14:45 +0000 (22:14 +0000)
committerKaren Lease <klease@apache.org>
Sun, 11 Nov 2001 22:14:45 +0000 (22:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194560 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/layoutmgr/AbstractLayoutManager.java
src/org/apache/fop/layoutmgr/BlockLayoutManager.java
src/org/apache/fop/layoutmgr/LayoutManager.java
src/org/apache/fop/layoutmgr/LineLayoutManager.java
src/org/apache/fop/layoutmgr/TextLayoutManager.java

index 4c7c67f14140ff45f86148fc8bf0e3924dbf397e..56fbc72f54d190809f04e3ce03f9081f29bce341 100644 (file)
@@ -87,9 +87,9 @@ public abstract class AbstractLayoutManager implements LayoutManager {
        
 
 
-    public boolean generatesInlineAreas() {
-       return false;
-    }
+//     public boolean generatesInlineAreas() {
+//     return false;
+//     }
 
 
     /**
index 7b4bfbc80439592f3e26f4cd295f185ee0700ac7..d398fdaba44c43d4f082029bd7cf3263f86454b8 100644 (file)
@@ -44,14 +44,17 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
      */
     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();
            }
index e7a3130e4476d8d2fcb6397ed8b6f255cf6576df..7f8b4756bd9f4391438a4b0305463c232535c642 100644 (file)
@@ -15,7 +15,7 @@ import org.apache.fop.area.Area;
  */
 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);
index 38451354b89c2b3171258cab6b71633e77c6efad..0605752313383d11ae9cdc8a7327455f51712f23 100644 (file)
@@ -44,16 +44,16 @@ public class LineLayoutManager extends AbstractLayoutManager {
     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();
                }
index aa88340ab1eb9d0f82c97e9cdb7c8670a6ca03ac..570515d6095491cc6f124487e63ac2a945d013df 100644 (file)
@@ -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,52 +18,34 @@ import java.util.ListIterator;
  * 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) {
@@ -70,4 +53,5 @@ public class TextLayoutManager extends AbstractLayoutManager {
        return false;
     }
 
+
 }