Browse Source

PR:

Obtained from:
Submitted by:
Reviewed by:
1.) Continued conversion/deprecation of AddLMVisitor. About 16 FO's remaining.
2.) Created a *temporary* LMVisited interface to mark those FO's still
needing conversion.  This will be dropped once the process is complete.


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197857 13f79535-47bb-0310-9956-ffa450edef68
tags/Root_Temp_KnuthStylePageBreaking
Glen Mazza 20 years ago
parent
commit
55a4dc03ee
34 changed files with 209 additions and 280 deletions
  1. 0
    12
      src/java/org/apache/fop/fo/FONode.java
  2. 7
    6
      src/java/org/apache/fop/fo/FOText.java
  3. 0
    9
      src/java/org/apache/fop/fo/FObj.java
  4. 12
    6
      src/java/org/apache/fop/fo/FObjMixed.java
  5. 26
    0
      src/java/org/apache/fop/fo/LMVisited.java
  6. 2
    1
      src/java/org/apache/fop/fo/flow/BasicLink.java
  7. 27
    3
      src/java/org/apache/fop/fo/flow/BidiOverride.java
  8. 10
    8
      src/java/org/apache/fop/fo/flow/Block.java
  9. 9
    6
      src/java/org/apache/fop/fo/flow/BlockContainer.java
  10. 2
    1
      src/java/org/apache/fop/fo/flow/Character.java
  11. 2
    1
      src/java/org/apache/fop/fo/flow/ExternalGraphic.java
  12. 14
    5
      src/java/org/apache/fop/fo/flow/Footnote.java
  13. 0
    4
      src/java/org/apache/fop/fo/flow/Inline.java
  14. 12
    6
      src/java/org/apache/fop/fo/flow/InlineContainer.java
  15. 2
    1
      src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
  16. 2
    1
      src/java/org/apache/fop/fo/flow/Leader.java
  17. 9
    7
      src/java/org/apache/fop/fo/flow/ListBlock.java
  18. 2
    1
      src/java/org/apache/fop/fo/flow/ListItem.java
  19. 3
    1
      src/java/org/apache/fop/fo/flow/PageNumber.java
  20. 2
    1
      src/java/org/apache/fop/fo/flow/PageNumberCitation.java
  21. 3
    1
      src/java/org/apache/fop/fo/flow/RetrieveMarker.java
  22. 2
    1
      src/java/org/apache/fop/fo/flow/Table.java
  23. 3
    1
      src/java/org/apache/fop/fo/flow/TableBody.java
  24. 10
    8
      src/java/org/apache/fop/fo/flow/TableCell.java
  25. 2
    1
      src/java/org/apache/fop/fo/flow/TableFooter.java
  26. 2
    1
      src/java/org/apache/fop/fo/flow/TableHeader.java
  27. 9
    7
      src/java/org/apache/fop/fo/flow/TableRow.java
  28. 2
    1
      src/java/org/apache/fop/fo/flow/Wrapper.java
  29. 7
    7
      src/java/org/apache/fop/fo/pagination/Flow.java
  30. 0
    10
      src/java/org/apache/fop/fo/pagination/StaticContent.java
  31. 0
    10
      src/java/org/apache/fop/fo/pagination/Title.java
  32. 23
    149
      src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
  33. 2
    2
      src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java
  34. 1
    1
      src/java/org/apache/fop/layoutmgr/ICLayoutManager.java

+ 0
- 12
src/java/org/apache/fop/fo/FONode.java View File

@@ -33,9 +33,6 @@ import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.util.CharUtilities;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.fo.extensions.svg.SVGElementMapping;
import org.apache.fop.layoutmgr.AddLMVisitor;



/**
* base class for nodes in the XML tree
@@ -197,15 +194,6 @@ public abstract class FONode {
return new OneCharIterator(CharUtilities.CODE_EOT);
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveFONode(this);
}

/**
* Helper function to standardize the names of all namespace URI - local
* name pairs in text messages.

+ 7
- 6
src/java/org/apache/fop/fo/FOText.java View File

@@ -19,12 +19,13 @@
package org.apache.fop.fo;

// Java
import java.util.List;
import java.util.NoSuchElementException;

// FOP
import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.pagination.Root;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.layoutmgr.TextLayoutManager;

/**
* A text node in the formatting object tree.
@@ -492,11 +493,11 @@ public class FOText extends FObj {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveFOText(this);
public void addLayoutManager(List list) {
if (endIndex - startIndex > 0) {
list.add(new TextLayoutManager(this));
}
}
}

+ 0
- 9
src/java/org/apache/fop/fo/FObj.java View File

@@ -442,15 +442,6 @@ public class FObj extends FONode implements Constants {
public void addLayoutManager(List list) {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveFObj(this);
}
/*
* Return a string representation of the fo element.
* Deactivated in order to see precise ID of each fo element created

+ 12
- 6
src/java/org/apache/fop/fo/FObjMixed.java View File

@@ -18,8 +18,10 @@

package org.apache.fop.fo;

import java.util.List;
import org.xml.sax.Locator;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.layoutmgr.LMiter;
import org.apache.fop.layoutmgr.InlineStackingLayoutManager;

/**
* Base class for representation of mixed content formatting objects
@@ -74,12 +76,16 @@ public class FObjMixed extends FObj {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveFObjMixed(this);
public void addLayoutManager(List list) {
if (getChildNodes() != null) {
InlineStackingLayoutManager lm;
lm = new InlineStackingLayoutManager(this);
lm.setLMiter(new LMiter(lm, getChildNodes()));
list.add(lm);
}
}
}


+ 26
- 0
src/java/org/apache/fop/fo/LMVisited.java View File

@@ -0,0 +1,26 @@
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/* $Id$ */

package org.apache.fop.fo;

import org.apache.fop.layoutmgr.AddLMVisitor;

public interface LMVisited {
public void acceptVisitor(AddLMVisitor aLMV);
}


+ 2
- 1
src/java/org/apache/fop/fo/flow/BasicLink.java View File

@@ -33,13 +33,14 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.LMVisited;

/**
* The basic link.
* This sets the basic link trait on the inline parent areas
* that are created by the fo element.
*/
public class BasicLink extends Inline {
public class BasicLink extends Inline implements LMVisited {
private String link = null;
private boolean external = false;


+ 27
- 3
src/java/org/apache/fop/fo/flow/BidiOverride.java View File

@@ -18,6 +18,10 @@

package org.apache.fop.fo.flow;

// Java
import java.util.ArrayList;
import java.util.List;

// XML
import org.xml.sax.Attributes;
import org.xml.sax.Locator;
@@ -27,10 +31,13 @@ import org.xml.sax.SAXParseException;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.layoutmgr.BidiLayoutManager;
import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonRelativePosition;


/**
* fo:bidi-override element.
*/
@@ -116,7 +123,24 @@ public class BidiOverride extends FObjMixed {
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveBidiOverride(this);
public void addLayoutManager(List list) {
if (false) {
super.addLayoutManager(list);
} else {
ArrayList childList = new ArrayList();
super.addLayoutManager(list);
for (int count = childList.size() - 1; count >= 0; count--) {
LayoutManager lm = (LayoutManager) childList.get(count);
if (lm.generatesInlineAreas()) {
LayoutManager blm = new BidiLayoutManager((InlineStackingLayoutManager) lm);
blm.setFObj(this);
list.add(blm);
} else {
list.add(lm);
}
}
}
}

}

+ 10
- 8
src/java/org/apache/fop/fo/flow/Block.java View File

@@ -18,6 +18,9 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;

// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -30,7 +33,7 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.RecursiveCharIterator;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.layoutmgr.BlockLayoutManager;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
@@ -337,15 +340,14 @@ public class Block extends FObjMixed {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveBlock(this);
public void addLayoutManager(List list) {
BlockLayoutManager blm = new BlockLayoutManager(this);
list.add(blm);
}
public String getName() {
public String getName() {
return "fo:block";
}


+ 9
- 6
src/java/org/apache/fop/fo/flow/BlockContainer.java View File

@@ -18,15 +18,18 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;

// FOP
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.properties.CommonAbsolutePosition;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.layoutmgr.BlockContainerLayoutManager;

import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
@@ -131,12 +134,12 @@ public class BlockContainer extends FObj {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveBlockContainer(this);
public void addLayoutManager(List list) {
BlockContainerLayoutManager blm = new BlockContainerLayoutManager(this);
blm.setOverflow(getProperty(PR_OVERFLOW).getEnum());
list.add(blm);
}

public String getName() {

+ 2
- 1
src/java/org/apache/fop/fo/flow/Character.java View File

@@ -36,6 +36,7 @@ import org.apache.fop.fo.properties.CommonHyphenation;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.LMVisited;

/**
* This class represents the flow object 'fo:character'. Its use is defined by
@@ -50,7 +51,7 @@ import org.apache.fop.apps.FOPException;
* Overrides may be specified in an implementation-specific manner." (6.6.3)
*
*/
public class Character extends FObj {
public class Character extends FObj implements LMVisited {

/** constant indicating that the character is OK */
public static final int OK = 0;

+ 2
- 1
src/java/org/apache/fop/fo/flow/ExternalGraphic.java View File

@@ -33,13 +33,14 @@ import org.apache.fop.fo.FObj;
import org.apache.fop.image.FopImage;
import org.apache.fop.image.ImageFactory;
import org.xml.sax.Attributes;
import org.apache.fop.fo.LMVisited;

/**
* External graphic formatting object.
* This FO node handles the external graphic. It creates an image
* inline area that can be added to the area tree.
*/
public class ExternalGraphic extends FObj {
public class ExternalGraphic extends FObj implements LMVisited {
private String url;
private int breakAfter;
private int breakBefore;

+ 14
- 5
src/java/org/apache/fop/fo/flow/Footnote.java View File

@@ -18,6 +18,9 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;

// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -25,7 +28,6 @@ import org.xml.sax.SAXParseException;

// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.FObj;

/**
@@ -74,15 +76,22 @@ public class Footnote extends FObj {
return inlineFO;
}

public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveFootnote(this);
}
protected void endOfNode() throws SAXParseException {
super.endOfNode();
getFOInputHandler().endFootnote(this);
}
/**
* @param list the list to which the layout manager(s) should be added
*/
public void addLayoutManager(List list) {
if (getInlineFO() == null) {
getLogger().error("inline required in footnote");
return;
}
getInlineFO().addLayoutManager(list);
}

public String getName() {
return "fo:footnote";
}

+ 0
- 4
src/java/org/apache/fop/fo/flow/Inline.java View File

@@ -107,10 +107,6 @@ public class Inline extends FObjMixed {
return new InlineCharIterator(this, propMgr.getBorderAndPadding());
}

public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveInline(this);
}

public String getName() {
return "fo:inline";
}

+ 12
- 6
src/java/org/apache/fop/fo/flow/InlineContainer.java View File

@@ -18,14 +18,19 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;
import java.util.ArrayList;

// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;

// FOP
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.ICLayoutManager;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginInline;
@@ -89,12 +94,13 @@ public class InlineContainer extends FObj {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveInlineContainer(this);
public void addLayoutManager(List list) {
ArrayList childList = new ArrayList();
super.addLayoutManager(childList);
LayoutManager lm = new ICLayoutManager(this, childList);
list.add(lm);
}

public String getName() {

+ 2
- 1
src/java/org/apache/fop/fo/flow/InstreamForeignObject.java View File

@@ -25,6 +25,7 @@ import org.xml.sax.SAXParseException;

// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.LMVisited;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.FObj;
@@ -34,7 +35,7 @@ import org.apache.fop.fo.FObj;
* This is an atomic inline object that contains
* xml data.
*/
public class InstreamForeignObject extends FObj {
public class InstreamForeignObject extends FObj implements LMVisited {

boolean hasNonXSLNamespaceElement = false;


+ 2
- 1
src/java/org/apache/fop/fo/flow/Leader.java View File

@@ -31,13 +31,14 @@ import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.PercentLength;
import org.apache.fop.fonts.Font;
import org.apache.fop.fo.LMVisited;

/**
* Class modelling fo:leader object. See Sec. 6.6.9 of the XSL-FO Standard.
* The main property of fo:leader is leader-pattern.
* The following patterns are treated: rule, space, dots and use-content.
*/
public class Leader extends FObjMixed {
public class Leader extends FObjMixed implements LMVisited {

private int ruleStyle;
private int ruleThickness;

+ 9
- 7
src/java/org/apache/fop/fo/flow/ListBlock.java View File

@@ -18,6 +18,9 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;

// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
@@ -26,7 +29,7 @@ import org.xml.sax.SAXParseException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.layoutmgr.list.ListBlockLayoutManager;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBackground;
@@ -99,19 +102,18 @@ public class ListBlock extends FObj {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveListBlock(this);
public void addLayoutManager(List list) {
ListBlockLayoutManager lm = new ListBlockLayoutManager(this);
list.add(lm);
}

protected void endOfNode() throws SAXParseException {
super.endOfNode();
getFOInputHandler().endList(this);
}
public String getName() {
return "fo:list-block";
}

+ 2
- 1
src/java/org/apache/fop/fo/flow/ListItem.java View File

@@ -33,12 +33,13 @@ import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.LMVisited;

/**
* Class modelling the fo:list-item object. See Sec. 6.8.3 of the XSL-FO
* Standard.
*/
public class ListItem extends FObj {
public class ListItem extends FObj implements LMVisited {

private ListItemLabel label = null;
private ListItemBody body = null;

+ 3
- 1
src/java/org/apache/fop/fo/flow/PageNumber.java View File

@@ -35,12 +35,14 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fonts.Font;
import org.apache.fop.fo.LMVisited;


/**
* Class modelling the fo:page-number object. See Sec. 6.6.10 of the XSL-FO
* Standard.
*/
public class PageNumber extends FObj {
public class PageNumber extends FObj implements LMVisited {
/** FontState for this object */
protected Font fontState;


+ 2
- 1
src/java/org/apache/fop/fo/flow/PageNumberCitation.java View File

@@ -34,6 +34,7 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginInline;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fonts.Font;
import org.apache.fop.fo.LMVisited;


/**
@@ -43,7 +44,7 @@ import org.apache.fop.fonts.Font;
* The page number used is the page that contains the start of the
* block referenced with the ref-id attribute.
*/
public class PageNumberCitation extends FObj {
public class PageNumberCitation extends FObj implements LMVisited {
/** Fontstate for this object **/
protected Font fontState;


+ 3
- 1
src/java/org/apache/fop/fo/flow/RetrieveMarker.java View File

@@ -27,13 +27,15 @@ import org.xml.sax.SAXParseException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.LMVisited;


/**
* The retrieve-marker formatting object.
* This will create a layout manager that will retrieve
* a marker based on the information.
*/
public class RetrieveMarker extends FObjMixed {
public class RetrieveMarker extends FObjMixed implements LMVisited {

private String retrieveClassName;
private int retrievePosition;

+ 2
- 1
src/java/org/apache/fop/fo/flow/Table.java View File

@@ -37,11 +37,12 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.fo.LMVisited;

/**
* Class modelling the fo:table object. See Sec. 6.7.3 of the XSL-FO Standard.
*/
public class Table extends FObj {
public class Table extends FObj implements LMVisited {
private static final int MINCOLWIDTH = 10000; // 10pt

/** collection of columns in this table */

+ 3
- 1
src/java/org/apache/fop/fo/flow/TableBody.java View File

@@ -34,12 +34,14 @@ import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonRelativePosition;
import org.apache.fop.fo.LMVisited;


/**
* Class modelling the fo:table-body object. See Sec. 6.7.8 of the XSL-FO
* Standard.
*/
public class TableBody extends FObj {
public class TableBody extends FObj implements LMVisited {

private int spaceBefore;
private int spaceAfter;

+ 10
- 8
src/java/org/apache/fop/fo/flow/TableCell.java View File

@@ -18,6 +18,9 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;

// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -27,7 +30,7 @@ import org.xml.sax.SAXParseException;
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.layoutmgr.table.Cell;

import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
@@ -339,15 +342,14 @@ public class TableCell extends FObj {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveTableCell(this);
public void addLayoutManager(List list) {
Cell clm = new Cell(this);
list.add(clm);
}
protected void endOfNode() throws SAXParseException {
protected void endOfNode() throws SAXParseException {
getFOInputHandler().endCell(this);
}

+ 2
- 1
src/java/org/apache/fop/fo/flow/TableFooter.java View File

@@ -21,12 +21,13 @@ package org.apache.fop.fo.flow;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.LMVisited;

/**
* Class modelling the fo:table-footer object. See Sec. 6.7.7 of the XSL-FO
* Standard.
*/
public class TableFooter extends TableBody {
public class TableFooter extends TableBody implements LMVisited {

/**
* @param parent FONode that is the parent of this object

+ 2
- 1
src/java/org/apache/fop/fo/flow/TableHeader.java View File

@@ -21,12 +21,13 @@ package org.apache.fop.fo.flow;
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.LMVisited;

/**
* Class modelling the fo:table-header object. See Sec. 6.7.6 of the XSL-FO
* Standard.
*/
public class TableHeader extends TableBody {
public class TableHeader extends TableBody implements LMVisited {

/**
* @param parent FONode that is the parent of this object

+ 9
- 7
src/java/org/apache/fop/fo/flow/TableRow.java View File

@@ -18,6 +18,9 @@

package org.apache.fop.fo.flow;

// Java
import java.util.List;

// XML
import org.xml.sax.Attributes;
import org.xml.sax.SAXParseException;
@@ -27,7 +30,7 @@ import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.KeepValue;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.layoutmgr.table.Row;
import org.apache.fop.fo.Constants;

import org.apache.fop.fo.properties.CommonAccessibility;
@@ -135,15 +138,14 @@ public class TableRow extends FObj {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveTableRow(this);
public void addLayoutManager(List list) {
Row rlm = new Row(this);
list.add(rlm);
}

protected void endOfNode() throws SAXParseException {
protected void endOfNode() throws SAXParseException {
getFOInputHandler().endRow(this);
}

+ 2
- 1
src/java/org/apache/fop/fo/flow/Wrapper.java View File

@@ -22,6 +22,7 @@ package org.apache.fop.fo.flow;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.LMVisited;

/**
* Implementation for fo:wrapper formatting object.
@@ -31,7 +32,7 @@ import org.apache.fop.layoutmgr.AddLMVisitor;
* Content: (#PCDATA|%inline;|%block;)*
* Properties: id
*/
public class Wrapper extends FObjMixed {
public class Wrapper extends FObjMixed implements LMVisited {

/**
* @param parent FONode that is the parent of this object

+ 7
- 7
src/java/org/apache/fop/fo/pagination/Flow.java View File

@@ -20,6 +20,7 @@ package org.apache.fop.fo.pagination;

// Java
import java.util.ArrayList;
import java.util.List;

// XML
import org.xml.sax.Attributes;
@@ -30,7 +31,7 @@ import org.xml.sax.SAXParseException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.layoutmgr.FlowLayoutManager;

/**
* Class modelling the fo:flow object. See Sec. 6.4.18 in the XSL-FO Standard.
@@ -171,14 +172,13 @@ public class Flow extends FObj {
}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
* @param list the list to which the layout manager(s) should be added
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveFlow(this);
public void addLayoutManager(List list) {
FlowLayoutManager lm = new FlowLayoutManager(this);
list.add(lm);
}
public String getName() {
return "fo:flow";
}

+ 0
- 10
src/java/org/apache/fop/fo/pagination/StaticContent.java View File

@@ -26,7 +26,6 @@ import org.xml.sax.SAXParseException;
// FOP
import org.apache.fop.fo.FOElementMapping;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;

/**
* Class modelling the fo:static-content object. See Sec. 6.4.19 of the XSL-FO
@@ -82,15 +81,6 @@ public class StaticContent extends Flow {

}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveStaticContent(this);
}

public String getName() {
return "fo:static-content";
}

+ 0
- 10
src/java/org/apache/fop/fo/pagination/Title.java View File

@@ -28,7 +28,6 @@ import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.FONode;
import org.apache.fop.layoutmgr.AddLMVisitor;
import org.apache.fop.fo.properties.CommonAccessibility;
import org.apache.fop.fo.properties.CommonAural;
import org.apache.fop.fo.properties.CommonBackground;
@@ -96,15 +95,6 @@ public class Title extends FObjMixed {

}

/**
* This is a hook for the AddLMVisitor class to be able to access
* this object.
* @param aLMV the AddLMVisitor object that can access this object.
*/
public void acceptVisitor(AddLMVisitor aLMV) {
aLMV.serveTitle(this);
}

public String getName() {
return "fo:title";
}

+ 23
- 149
src/java/org/apache/fop/layoutmgr/AddLMVisitor.java View File

@@ -41,24 +41,15 @@ import org.apache.fop.area.inline.TextArea;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.TextInfo;
import org.apache.fop.fo.ToBeImplementedElement;
import org.apache.fop.fo.XMLObj;
import org.apache.fop.fo.flow.BasicLink;
import org.apache.fop.fo.flow.BidiOverride;
import org.apache.fop.fo.flow.Block;
import org.apache.fop.fo.flow.BlockContainer;
import org.apache.fop.fo.flow.Character;
import org.apache.fop.fo.flow.ExternalGraphic;
import org.apache.fop.fo.flow.Footnote;
import org.apache.fop.fo.flow.Inline;
import org.apache.fop.fo.flow.InlineContainer;
import org.apache.fop.fo.flow.InstreamForeignObject;
import org.apache.fop.fo.flow.Leader;
import org.apache.fop.fo.flow.ListBlock;
import org.apache.fop.fo.flow.ListItem;
import org.apache.fop.fo.flow.ListItemBody;
import org.apache.fop.fo.flow.ListItemLabel;
@@ -74,20 +65,16 @@ import org.apache.fop.fo.flow.TableFooter;
import org.apache.fop.fo.flow.TableHeader;
import org.apache.fop.fo.flow.TableRow;
import org.apache.fop.fo.flow.Wrapper;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.pagination.Title;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.layoutmgr.list.Item;
import org.apache.fop.layoutmgr.list.ListBlockLayoutManager;
import org.apache.fop.layoutmgr.list.ListItemLayoutManager;
import org.apache.fop.layoutmgr.table.Body;
import org.apache.fop.layoutmgr.table.Cell;
import org.apache.fop.layoutmgr.table.Column;
import org.apache.fop.layoutmgr.table.Row;
import org.apache.fop.layoutmgr.table.TableLayoutManager;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.fo.LMVisited;

/**
* Visitor pattern for the purpose of adding
@@ -115,7 +102,11 @@ public class AddLMVisitor {
/* Store the List in a global variable so that it can be accessed by the
Visitor methods */
currentLMList = lmList;
fobj.acceptVisitor(this);
if (fobj instanceof LMVisited) {
((LMVisited) fobj).acceptVisitor(this);
} else {
fobj.addLayoutManager(currentLMList);
}
}

/**
@@ -134,81 +125,6 @@ public class AddLMVisitor {
return saveLMList;
}

/**
* @param node FONode object to process
*/
public void serveFONode(FONode node) {
}

/**
* @param node FObj object to process
*/
public void serveFObj(FObj node) {
serveFONode((FONode)node);
}

public void serveFOText(FOText foText) {
if (foText.endIndex - foText.startIndex > 0) {
currentLMList.add(new TextLayoutManager(foText));
}
}

public void serveFObjMixed(FObjMixed node) {
if (node.getChildNodes() != null) {
InlineStackingLayoutManager lm;
lm = new InlineStackingLayoutManager(node);
lm.setLMiter(new LMiter(lm, node.getChildNodes()));
currentLMList.add(lm);
}
}

public void serveBidiOverride(BidiOverride node) {
if (false) {
serveFObjMixed((FObjMixed)node);
} else {
ArrayList childList = new ArrayList();
saveLMList = currentLMList;
currentLMList = childList;
serveFObjMixed((FObjMixed)node);
currentLMList = saveLMList;
for (int count = childList.size() - 1; count >= 0; count--) {
LayoutManager lm = (LayoutManager) childList.get(count);
if (lm.generatesInlineAreas()) {
LayoutManager blm = new BidiLayoutManager((InlineStackingLayoutManager) lm);
blm.setFObj(node);
currentLMList.add(blm);
} else {
currentLMList.add(lm);
}
}
}
}

/**
* @param node Inline object to process
*/
public void serveInline(Inline node) {
serveFObjMixed((FObjMixed)node);
}

public void serveFootnote(Footnote node) {
if (node.getInlineFO() == null) {
node.getLogger().error("inline required in footnote");
return;
}
serveInline(node.getInlineFO());
}

public void serveInlineContainer(InlineContainer node) {
ArrayList childList = new ArrayList();
saveLMList = currentLMList;
currentLMList = childList;
serveFObj((FObj)node);
currentLMList = saveLMList;
LayoutManager lm = new ICLayoutManager(node, childList);
currentLMList.add(lm);
}

/**
* Add start and end properties for the link
*/
@@ -243,11 +159,6 @@ public class AddLMVisitor {
}
}

public void serveBlock(Block node) {
BlockLayoutManager blm = new BlockLayoutManager(node);
currentLMList.add(blm);
}

public void serveLeader(final Leader node) {
LeafNodeLayoutManager lm = new LeafNodeLayoutManager(node) {
public InlineArea get(LayoutContext context) {
@@ -417,17 +328,6 @@ public class AddLMVisitor {
return vp;
}

public void serveBlockContainer(BlockContainer node) {
BlockContainerLayoutManager blm = new BlockContainerLayoutManager(node);
blm.setOverflow(node.getProperty(Constants.PR_OVERFLOW).getEnum());
currentLMList.add(blm);
}

public void serveListBlock(ListBlock node) {
ListBlockLayoutManager blm = new ListBlockLayoutManager(node);
currentLMList.add(blm);
}

public void serveInstreamForeignObject(InstreamForeignObject node) {
Viewport areaCurrent = getInstreamForeignObjectInlineArea(node);
if (areaCurrent != null) {
@@ -438,7 +338,6 @@ public class AddLMVisitor {
currentLMList.add(lm);
}
}

/**
* Get the inline area created by this element.
*
@@ -755,48 +654,6 @@ public class AddLMVisitor {
return blm;
}

public void serveTableCell(TableCell node) {
Cell clm = new Cell(node);
currentLMList.add(clm);
}

public void serveTableRow(TableRow node) {
Row rlm = new Row(node);
currentLMList.add(rlm);
}

public void serveFlow(Flow node) {
FlowLayoutManager lm = new FlowLayoutManager(node);
currentLMList.add(lm);
}

/**
* @param node Wrapper object to process
*/
public void serveWrapper(Wrapper node) {
ListIterator baseIter;
baseIter = node.getChildNodes();
if (baseIter == null) return;
while (baseIter.hasNext()) {
FObj child = (FObj) baseIter.next();
child.acceptVisitor(this);
}
}
/**
* @param node StaticContent object to process
*/
public void serveStaticContent(StaticContent node) {
serveFlow((Flow)node);
}

/**
* @param node Title object to process
*/
public void serveTitle(Title node) {
serveFObjMixed((FObjMixed)node);
}

/**
* @param node TableFooter object to process
*/
@@ -810,4 +667,21 @@ public class AddLMVisitor {
public void serveTableHeader(TableHeader node) {
serveTableBody((TableBody)node);
}

/**
* @param node Wrapper object to process
*/
public void serveWrapper(Wrapper node) {
ListIterator baseIter;
baseIter = node.getChildNodes();
if (baseIter == null) return;
while (baseIter.hasNext()) {
FObj child = (FObj) baseIter.next();
if (child instanceof LMVisited) {
((LMVisited) child).acceptVisitor(this);
} else {
child.addLayoutManager(currentLMList);
}
}
}
}

+ 2
- 2
src/java/org/apache/fop/layoutmgr/BidiLayoutManager.java View File

@@ -29,11 +29,11 @@ import org.apache.fop.area.inline.InlineArea;
* ltr or rtl than its parent writing mode then this
* reverses the inline areas (at the character level).
*/
class BidiLayoutManager extends LeafNodeLayoutManager {
public class BidiLayoutManager extends LeafNodeLayoutManager {

private List children;

BidiLayoutManager(InlineStackingLayoutManager cLM) {
public BidiLayoutManager(InlineStackingLayoutManager cLM) {
children = new ArrayList();
/*
for (int count = cLM.size() - 1; count >= 0; count--) {

+ 1
- 1
src/java/org/apache/fop/layoutmgr/ICLayoutManager.java View File

@@ -34,7 +34,7 @@ public class ICLayoutManager extends LeafNodeLayoutManager {

private List childrenLM;

ICLayoutManager(FObj node, List childLM) {
public ICLayoutManager(FObj node, List childLM) {
super(node);
childrenLM = childLM;
}

Loading…
Cancel
Save