aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/fo')
-rw-r--r--src/java/org/apache/fop/fo/FOText.java39
-rw-r--r--src/java/org/apache/fop/fo/FObjMixed.java9
2 files changed, 21 insertions, 27 deletions
diff --git a/src/java/org/apache/fop/fo/FOText.java b/src/java/org/apache/fop/fo/FOText.java
index ec8fcfb7e..70f0fd5bf 100644
--- a/src/java/org/apache/fop/fo/FOText.java
+++ b/src/java/org/apache/fop/fo/FOText.java
@@ -27,7 +27,6 @@ import java.util.NoSuchElementException;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.flow.Block;
-import org.apache.fop.fo.pagination.Root;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonHyphenation;
import org.apache.fop.fo.properties.CommonTextDecoration;
@@ -44,9 +43,6 @@ import org.xml.sax.Locator;
* onto references to the character data in this object
* longer than the lifetime of the object itself, causing
* excessive memory consumption and OOM errors.
- *
- * @author unascribed
- * @author <a href="mailto:mark-fop@inomial.com">Mark Lillywhite</a>
*/
public class FOText extends FONode {
@@ -70,12 +66,17 @@ public class FOText extends FONode {
* to be processed.
*
* This value is originally equal to ca.length, but becomes
- * decremented during between-word whitespace removal by the flow.Block class,
- * via the TextCharIterator.remove() method below.
+ * decremented during between-word whitespace removal by the
+ * XMLWhiteSpaceHandler via the TextCharIterator.remove()
+ * method below.
*/
public int endIndex = 0;
- // The value of properties relevant for character.
+ /** properties relevant for PCDATA */
+ /* TODO: these are basically always the same as the parent FObj or FObjMixed
+ * so maybe those can be removed, and the accessors could
+ * dispatch the call to the parent?
+ */
private CommonFont commonFont;
private CommonHyphenation commonHyphenation;
private Color color;
@@ -87,16 +88,6 @@ public class FOText extends FONode {
private Property wordSpacing;
private int wrapOption;
private Length baselineShift;
- // End of property values
-
- /**
- * Keeps track of the last FOText object created within the current
- * block. This is used to create pointers between such objects.
- * TODO: As soon as the control hierarchy is straightened out, this static
- * variable needs to become an instance variable in some parent object,
- * probably the page-sequence.
- */
- private static FOText lastFOTextProcessed = null;
/**
* Points to the previous FOText object created within the current
@@ -227,23 +218,21 @@ public class FOText extends FONode {
}
/**
- * This method is run as part of the ancestor Block's flushText(), to create xref pointers to
- * the previous FOText objects within the same Block
+ * This method is run as part of the ancestor Block's flushText(), to
+ * create xref pointers to the previous FOText objects within the same Block
*/
protected void createBlockPointers(Block ancestorBlock) {
this.ancestorBlock = ancestorBlock;
// if the last FOText is a sibling, point to it, and have it point here
- if (lastFOTextProcessed != null) {
- if (lastFOTextProcessed.ancestorBlock == this.ancestorBlock) {
- prevFOTextThisBlock = lastFOTextProcessed;
+ if (ancestorBlock.lastFOTextProcessed != null) {
+ if (ancestorBlock.lastFOTextProcessed.ancestorBlock
+ == this.ancestorBlock) {
+ prevFOTextThisBlock = ancestorBlock.lastFOTextProcessed;
prevFOTextThisBlock.nextFOTextThisBlock = this;
} else {
prevFOTextThisBlock = null;
}
}
- // save the current node in static field so the next guy knows where
- // to look
- lastFOTextProcessed = this;
return;
}
diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/java/org/apache/fop/fo/FObjMixed.java
index 84f27fbb9..67e95c5e8 100644
--- a/src/java/org/apache/fop/fo/FObjMixed.java
+++ b/src/java/org/apache/fop/fo/FObjMixed.java
@@ -36,6 +36,10 @@ public abstract class FObjMixed extends FObj {
/** Used for white-space handling; start CharIterator at node ... */
protected FONode currentTextNode;
+ /** Used in creating pointers between subsequent FOText nodes
+ * in the same Block (for handling text-transform) */
+ protected FOText lastFOTextProcessed = null;
+
/**
* @param parent FONode that is the parent of this object
*/
@@ -91,6 +95,7 @@ public abstract class FObjMixed extends FObj {
ft = null;
if (getNameId() == FO_BLOCK) {
lft.createBlockPointers((org.apache.fop.fo.flow.Block) this);
+ this.lastFOTextProcessed = lft;
} else if (getNameId() != FO_MARKER
&& getNameId() != FO_TITLE
&& getNameId() != FO_BOOKMARK_TITLE) {
@@ -106,6 +111,7 @@ public abstract class FObjMixed extends FObj {
}
if (foNameId == FO_BLOCK) {
lft.createBlockPointers((org.apache.fop.fo.flow.Block) fo);
+ ((FObjMixed) fo).lastFOTextProcessed = lft;
} else if (foNameId == FO_PAGE_SEQUENCE) {
log.error("Could not create block pointers."
+ " FOText w/o Block ancestor.");
@@ -142,6 +148,5 @@ public abstract class FObjMixed extends FObj {
*/
public CharIterator charIterator() {
return new RecursiveCharIterator(this);
- }
-
+ }
} \ No newline at end of file