Revision: 7425
Author: victormote
Date: 2006-06-06 11:04:34 -0700 (Tue, 06 Jun 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7425&view=rev
Log Message:
-----------
If the factory method in this class is creating it, then this LineArea is the parent. Other Area classes that create inlines need their own factory methods.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-06-06 00:53:11 UTC (rev 7424)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-06-06 18:04:34 UTC (rev 7425)
@@ -27,15 +27,11 @@
import org.axsl.areaW.AreaWException;
import org.axsl.common.Constants;
import org.axsl.common.ConstantsAreaTree;
-import org.axsl.foR.FONode;
import org.axsl.foR.FOText;
import org.axsl.foR.FObj;
import org.axsl.foR.FObjMixed;
-import org.axsl.foR.fo.BasicLink;
-import org.axsl.foR.fo.Block;
import org.axsl.foR.fo.Character;
import org.axsl.foR.fo.ExternalGraphic;
-import org.axsl.foR.fo.Inline;
import org.axsl.foR.fo.InstreamForeignObject;
import org.axsl.foR.fo.Leader;
import org.axsl.foR.fo.PageNumber;
@@ -784,32 +780,27 @@
public org.axsl.areaW.ForeignObjectArea makeForeignObjectArea(
InstreamForeignObject ifo, int ipd) {
- Area parentArea = findParentArea(ifo);
- return new ForeignObjectArea(ifo, parentArea, ipd);
+ return new ForeignObjectArea(ifo, this, ipd);
}
public org.axsl.areaW.ExternalGraphicArea makeExternalGraphicArea(
ExternalGraphic ifo, int ipd) {
- Area parentArea = findParentArea(ifo);
- return new ExternalGraphicArea(ifo, parentArea, ipd);
+ return new ExternalGraphicArea(ifo, this, ipd);
}
public org.axsl.areaW.LeaderArea makeLeaderArea(
Leader leader, int ipd) {
- Area parentArea = findParentArea(leader);
- return new LeaderArea(leader, parentArea, ipd);
+ return new LeaderArea(leader, this, ipd);
}
public org.axsl.areaW.PageNumberArea makePageNumberArea(
PageNumber pageNumber, int ipd) {
- Area parentArea = findParentArea(pageNumber);
- return new PageNumberArea(pageNumber, parentArea, ipd);
+ return new PageNumberArea(pageNumber, this, ipd);
}
public org.axsl.areaW.PageNumberCitationArea makePageNumberCitationArea(
PageNumberCitation citation, int ipd) {
- Area parentArea = findParentArea(citation);
- return new PageNumberCitationArea(citation, parentArea, ipd);
+ return new PageNumberCitationArea(citation, this, ipd);
}
/**
@@ -837,46 +828,45 @@
/* Go ahead and create*/
FObj parent = foText.parentFO();
- Area parentArea = findParentArea(foText);
if (parent instanceof FObjMixed) {
FObjMixed mixed = (FObjMixed) foText.parentFO();
int sequence = mixed.getChildren().indexOf(foText);
int initialWordSpacing = this.traitWordSpacingOpt();
int initialLetterSpacing = this.traitLetterSpacingOpt();
- return new TextArea(mixed, parentArea, sequence,
+ return new TextArea(mixed, this, sequence,
startOffset, sizeInChars, ipd, initialLetterSpacing,
initialWordSpacing, hasDiscretionaryHyphen,
hasFauxSmallCaps);
}
if (parent instanceof Character) {
- return new TextArea((Character) parent, parentArea, ipd, 0, 0,
+ return new TextArea((Character) parent, this, ipd, 0, 0,
hasDiscretionaryHyphen, hasFauxSmallCaps);
}
return null;
}
- private AreaFlexible findParentArea(FONode node) {
- // This is the easy and probably most frequent case
- if (node.parentFO() instanceof Block) {
- return this;
- }
- /*
- * TODO: A test needs to be
- * added to see whether the last child of LineArea should be a parent
- * or other ancestor of node. If so, as much of that hierarchy as is
- * common to node should be preserved.
- */
- if (node.parentFO() instanceof BasicLink) {
- BasicLink bl = (BasicLink) node.parentFO();
- return new BasicLinkArea(bl, findParentArea(bl));
- }
- if (node.parentFO() instanceof Inline) {
- Inline inline = (Inline) node.parentFO();
- return new InlineArea(inline, findParentArea(inline));
- }
- // Default if nothing else works.
- return this;
- }
+// private AreaFlexible findParentArea(FONode node) {
+// // This is the easy and probably most frequent case
+// if (node.parentFO() instanceof Block) {
+// return this;
+// }
+// /*
+// * TODO: A test needs to be
+// * added to see whether the last child of LineArea should be a parent
+// * or other ancestor of node. If so, as much of that hierarchy as is
+// * common to node should be preserved.
+// */
+// if (node.parentFO() instanceof BasicLink) {
+// BasicLink bl = (BasicLink) node.parentFO();
+// return new BasicLinkArea(bl, findParentArea(bl));
+// }
+// if (node.parentFO() instanceof Inline) {
+// Inline inline = (Inline) node.parentFO();
+// return new InlineArea(inline, findParentArea(inline));
+// }
+// // Default if nothing else works.
+// return this;
+// }
public LineOutput asLineOutput() {
return this;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|