*/
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();
}
*/
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);
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();
}
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;
* 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) {
return false;
}
+
}