Revision: 7653
Author: victormote
Date: 2006-06-16 15:33:49 -0700 (Fri, 16 Jun 2006)
ViewCVS: http://svn.sourceforge.net/foray/?rev=7653&view=rev
Log Message:
-----------
Only allow inline items to be laid out on lines or in other inline items.
Modified Paths:
--------------
trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java
trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/AbstractInlineArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -38,12 +38,29 @@
public abstract class AbstractInlineArea extends AreaFlexible
implements GeneralInlineArea {
- public AbstractInlineArea(FONode generatedBy, Area parentArea,
+ /**
+ * Constructor for inline content being added to a LineArea.
+ * @param generatedBy
+ * @param parentArea
+ * @param retrieveMarker
+ */
+ public AbstractInlineArea(FONode generatedBy, LineArea parentArea,
RetrieveMarker retrieveMarker) {
super(generatedBy, parentArea, retrieveMarker);
}
/**
+ * Constructor for inline content being added to another inline area.
+ * @param generatedBy
+ * @param parentArea
+ * @param retrieveMarker
+ */
+ public AbstractInlineArea(FONode generatedBy, AbstractInlineArea parentArea,
+ RetrieveMarker retrieveMarker) {
+ super(generatedBy, parentArea, retrieveMarker);
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean isBlockArea() {
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/BasicLinkArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -35,7 +35,7 @@
implements org.axsl.areaR.BasicLinkArea,
org.axsl.areaW.BasicLinkArea {
- public BasicLinkArea(BasicLink generatedBy, Area parentArea,
+ public BasicLinkArea(BasicLink generatedBy, LineArea parentArea,
RetrieveMarker retrieveMarker) {
super(generatedBy, parentArea, retrieveMarker);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ExternalGraphicArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -34,9 +34,24 @@
implements org.axsl.areaR.ExternalGraphicArea,
org.axsl.areaW.ExternalGraphicArea {
- public ExternalGraphicArea(ExternalGraphic generatedBy, Area parentArea,
+ public ExternalGraphicArea(ExternalGraphic generatedBy, LineArea parentArea,
RetrieveMarker retrieveMarker, int width) {
super(generatedBy, parentArea, retrieveMarker);
+ init(parentArea, width);
+ }
+
+ public ExternalGraphicArea(ExternalGraphic generatedBy,
+ AbstractInlineArea parentArea, RetrieveMarker retrieveMarker,
+ int width) {
+ super(generatedBy, parentArea, retrieveMarker);
+ init(parentArea, width);
+ }
+
+ /**
+ * @param parentArea
+ * @param width
+ */
+ private void init(Area parentArea, int width) {
setProgressionDimension(width);
// Adjust the bpd of the parent line-area.
parentArea.setMinimumProgressionDimension(viewportBPD());
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/ForeignObjectArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -35,8 +35,20 @@
org.axsl.areaW.ForeignObjectArea {
public ForeignObjectArea(InstreamForeignObject generatedBy,
- Area parentArea, RetrieveMarker retrieveMarker, int width) {
+ LineArea parentArea, RetrieveMarker retrieveMarker, int width) {
super(generatedBy, parentArea, retrieveMarker);
+ init(generatedBy, parentArea, retrieveMarker, width);
+ }
+
+ public ForeignObjectArea(InstreamForeignObject generatedBy,
+ AbstractInlineArea parentArea, RetrieveMarker retrieveMarker,
+ int width) {
+ super(generatedBy, parentArea, retrieveMarker);
+ init(generatedBy, parentArea, retrieveMarker, width);
+ }
+
+ private void init(InstreamForeignObject generatedBy, Area parentArea,
+ RetrieveMarker retrieveMarker, int width) {
setProgressionDimension(width);
// Adjust the bpd of the parent line-area.
parentArea.setMinimumProgressionDimension(viewportBPD());
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -41,7 +41,7 @@
implements org.axsl.areaR.InlineArea,
org.axsl.areaW.InlineArea {
- public InlineArea(Inline generatedBy, Area parentArea,
+ public InlineArea(Inline generatedBy, LineArea parentArea,
RetrieveMarker retrieveMarker) {
super(generatedBy, parentArea, retrieveMarker);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -63,9 +63,22 @@
implements org.axsl.areaR.LeaderArea,
org.axsl.areaW.LeaderArea {
- public LeaderArea(Leader generatedBy, Area parentArea,
+ public LeaderArea(Leader generatedBy, LineArea parentArea,
RetrieveMarker retrieveMarker, int initialProgressionDimension) {
super(generatedBy, parentArea, retrieveMarker);
+ init(initialProgressionDimension);
+ }
+
+ public LeaderArea(Leader generatedBy, AbstractInlineArea parentArea,
+ RetrieveMarker retrieveMarker, int initialProgressionDimension) {
+ super(generatedBy, parentArea, retrieveMarker);
+ init(initialProgressionDimension);
+ }
+
+ /**
+ * @param initialProgressionDimension
+ */
+ private void init(int initialProgressionDimension) {
setProgressionDimension(initialProgressionDimension);
}
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-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -777,46 +777,102 @@
}
public static org.axsl.areaW.ForeignObjectArea makeForeignObjectArea(
- InstreamForeignObject ifo, Area parentArea, int ipd,
+ InstreamForeignObject ifo, LineArea parentArea, int ipd,
RetrieveMarker retrieveMarker) {
return new ForeignObjectArea(ifo, parentArea, retrieveMarker, ipd);
}
+ public static org.axsl.areaW.ForeignObjectArea makeForeignObjectArea(
+ InstreamForeignObject ifo, AbstractInlineArea parentArea, int ipd,
+ RetrieveMarker retrieveMarker) {
+ return new ForeignObjectArea(ifo, parentArea, retrieveMarker, ipd);
+ }
+
public static org.axsl.areaW.ExternalGraphicArea makeExternalGraphicArea(
- ExternalGraphic ifo, Area parentArea, int ipd,
+ ExternalGraphic ifo, LineArea parentArea, int ipd,
RetrieveMarker retrieveMarker) {
return new ExternalGraphicArea(ifo, parentArea, retrieveMarker, ipd);
}
+ public static org.axsl.areaW.ExternalGraphicArea makeExternalGraphicArea(
+ ExternalGraphic ifo, AbstractInlineArea parentArea, int ipd,
+ RetrieveMarker retrieveMarker) {
+ return new ExternalGraphicArea(ifo, parentArea, retrieveMarker, ipd);
+ }
+
public static org.axsl.areaW.LeaderArea makeLeaderArea(
- Leader leader, Area parentArea, int ipd,
+ Leader leader, LineArea parentArea, int ipd,
RetrieveMarker retrieveMarker) {
return new LeaderArea(leader, parentArea, retrieveMarker, ipd);
}
+ public static org.axsl.areaW.LeaderArea makeLeaderArea(
+ Leader leader, AbstractInlineArea parentArea, int ipd,
+ RetrieveMarker retrieveMarker) {
+ return new LeaderArea(leader, parentArea, retrieveMarker, ipd);
+ }
+
public static org.axsl.areaW.PageNumberArea makePageNumberArea(
- PageNumber pageNumber, Area parentArea, int ipd,
+ PageNumber pageNumber, LineArea parentArea, int ipd,
RetrieveMarker retrieveMarker) {
return new PageNumberArea(pageNumber, parentArea, retrieveMarker, ipd);
}
+ public static org.axsl.areaW.PageNumberArea makePageNumberArea(
+ PageNumber pageNumber, AbstractInlineArea parentArea, int ipd,
+ RetrieveMarker retrieveMarker) {
+ return new PageNumberArea(pageNumber, parentArea, retrieveMarker, ipd);
+ }
+
public static org.axsl.areaW.PageNumberCitationArea
- makePageNumberCitationArea(
- PageNumberCitation citation, Area parentArea, int ipd,
+ makePageNumberCitationArea(PageNumberCitation citation, LineArea parentArea,
+ int ipd, RetrieveMarker retrieveMarker) {
+ return new PageNumberCitationArea(citation, parentArea, retrieveMarker,
+ ipd);
+ }
+
+ public static org.axsl.areaW.PageNumberCitationArea
+ makePageNumberCitationArea(PageNumberCitation citation,
+ AbstractInlineArea parentArea, int ipd,
RetrieveMarker retrieveMarker) {
return new PageNumberCitationArea(citation, parentArea, retrieveMarker,
ipd);
}
public static org.axsl.areaW.TextArea makeTextArea(FOTextContent foText,
- Area parentArea, int ipd,
+ LineArea parentArea, int ipd,
int startOffset, int sizeInChars, boolean hasDiscretionaryHyphen,
boolean hasFauxSmallCaps, boolean isLastItemOnLine,
FOContext context, RetrieveMarker retrieveMarker) {
+ if (shouldCreateTextArea(foText, parentArea, startOffset, sizeInChars,
+ isLastItemOnLine, context)) {
+ return new TextArea(foText, parentArea, retrieveMarker, startOffset,
+ sizeInChars, ipd, hasDiscretionaryHyphen, hasFauxSmallCaps);
+ }
+ return null;
+ }
+
+ public static org.axsl.areaW.TextArea makeTextArea(FOTextContent foText,
+ AbstractInlineArea parentArea, int ipd,
+ int startOffset, int sizeInChars, boolean hasDiscretionaryHyphen,
+ boolean hasFauxSmallCaps, boolean isLastItemOnLine,
+ FOContext context, RetrieveMarker retrieveMarker) {
+
+ if (shouldCreateTextArea(foText, parentArea, startOffset, sizeInChars,
+ isLastItemOnLine, context)) {
+ return new TextArea(foText, parentArea, retrieveMarker, startOffset,
+ sizeInChars, ipd, hasDiscretionaryHyphen, hasFauxSmallCaps);
+ }
+ return null;
+ }
+
+ private static boolean shouldCreateTextArea(FOTextContent foText,
+ Area parentArea, int startOffset, int sizeInChars,
+ boolean isLastItemOnLine, FOContext context) {
/* If the raw text is empty, don't create the TextArea. */
if (sizeInChars < 1) {
- return null;
+ return false;
}
/* If the final text will be empty, don't create the TextArea. */
@@ -829,12 +885,9 @@
sizeInChars, isLastItemOnLine,
parentArea.traitWhiteSpaceTreatment());
if (ignoreAtStart + ignoreAtEnd >= sizeInChars) {
- return null;
+ return false;
}
-
- /* Go ahead and create*/
- return new TextArea(foText, parentArea, retrieveMarker, startOffset,
- sizeInChars, ipd, hasDiscretionaryHyphen, hasFauxSmallCaps);
+ return true;
}
public org.axsl.areaW.ForeignObjectArea makeForeignObjectArea(
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -35,9 +35,22 @@
implements org.axsl.areaR.PageNumberArea,
org.axsl.areaW.PageNumberArea {
- public PageNumberArea(FObj generatedBy, Area parentArea,
+ public PageNumberArea(FObj generatedBy, LineArea parentArea,
RetrieveMarker retrieveMarker, int width) {
super(generatedBy, parentArea, retrieveMarker);
+ init(width);
+ }
+
+ public PageNumberArea(FObj generatedBy, AbstractInlineArea parentArea,
+ RetrieveMarker retrieveMarker, int width) {
+ super(generatedBy, parentArea, retrieveMarker);
+ init(width);
+ }
+
+ /**
+ * @param width
+ */
+ private void init(int width) {
setProgressionDimension(width);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/PageNumberCitationArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -32,9 +32,23 @@
implements org.axsl.areaR.PageNumberCitationArea,
org.axsl.areaW.PageNumberCitationArea {
- public PageNumberCitationArea(FObj generatedBy, Area parentArea,
+ public PageNumberCitationArea(FObj generatedBy, LineArea parentArea,
RetrieveMarker retrieveMarker, int width) {
super(generatedBy, parentArea, retrieveMarker);
+ init(width);
+ }
+
+ public PageNumberCitationArea(FObj generatedBy,
+ AbstractInlineArea parentArea, RetrieveMarker retrieveMarker,
+ int width) {
+ super(generatedBy, parentArea, retrieveMarker);
+ init(width);
+ }
+
+ /**
+ * @param width
+ */
+ private void init(int width) {
setProgressionDimension(width);
}
Modified: trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java
===================================================================
--- trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2006-06-16 18:59:43 UTC (rev 7652)
+++ trunk/foray/foray-areatree/src/java/org/foray/area/TextArea.java 2006-06-16 22:33:49 UTC (rev 7653)
@@ -99,11 +99,35 @@
*/
boolean hasFauxSmallCaps = false;
- public TextArea(FOTextContent generatedBy, Area parentArea,
+ public TextArea(FOTextContent generatedBy, LineArea parentArea,
RetrieveMarker retrieveMarker, int backingOffset, int backingSize,
int progressionDimensionUsed, boolean hasDiscretionaryHyphen,
boolean hasFauxSmallCaps) {
super(generatedBy, parentArea, retrieveMarker);
+ init(parentArea, backingOffset, backingSize, progressionDimensionUsed,
+ hasDiscretionaryHyphen, hasFauxSmallCaps);
+ }
+
+ public TextArea(FOTextContent generatedBy, AbstractInlineArea parentArea,
+ RetrieveMarker retrieveMarker, int backingOffset, int backingSize,
+ int progressionDimensionUsed, boolean hasDiscretionaryHyphen,
+ boolean hasFauxSmallCaps) {
+ super(generatedBy, parentArea, retrieveMarker);
+ init(parentArea, backingOffset, backingSize, progressionDimensionUsed,
+ hasDiscretionaryHyphen, hasFauxSmallCaps);
+ }
+
+ /**
+ * @param parentArea
+ * @param backingOffset
+ * @param backingSize
+ * @param progressionDimensionUsed
+ * @param hasDiscretionaryHyphen
+ * @param hasFauxSmallCaps
+ */
+ private void init(Area parentArea, int backingOffset, int backingSize,
+ int progressionDimensionUsed, boolean hasDiscretionaryHyphen,
+ boolean hasFauxSmallCaps) {
this.backingOffset = backingOffset;
this.backingSize = backingSize;
this.resolvedLetterSpacing = parentArea.traitLetterSpacingOpt();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|