[FOray-commit] SF.net SVN: foray: [7426] trunk/foray/foray-areatree/src/java/org/foray/area
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-06-06 20:24:54
|
Revision: 7426 Author: victormote Date: 2006-06-06 11:42:43 -0700 (Tue, 06 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7426&view=rev Log Message: ----------- Implement new axsl methods. Modified Paths: -------------- 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 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-06 18:04:34 UTC (rev 7425) +++ trunk/foray/foray-areatree/src/java/org/foray/area/InlineArea.java 2006-06-06 18:42:43 UTC (rev 7426) @@ -25,7 +25,13 @@ package org.foray.area; import org.axsl.common.ConstantsAreaTree; +import org.axsl.foR.FOText; +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; +import org.axsl.foR.fo.PageNumberCitation; /** * Areas generated by the fo:inline object. @@ -49,4 +55,40 @@ return "inline"; } + public org.axsl.areaW.ForeignObjectArea makeForeignObjectArea( + InstreamForeignObject ifo, int ipd) { + return LineArea.makeForeignObjectArea(ifo, this, ipd); + } + + public org.axsl.areaW.ExternalGraphicArea makeExternalGraphicArea( + ExternalGraphic ifo, int ipd) { + return LineArea.makeExternalGraphicArea(ifo, this, ipd); + } + + public org.axsl.areaW.LeaderArea makeLeaderArea( + Leader leader, int ipd) { + return LineArea.makeLeaderArea(leader, this, ipd); + } + + public org.axsl.areaW.PageNumberArea makePageNumberArea( + PageNumber pageNumber, int ipd) { + return LineArea.makePageNumberArea(pageNumber, this, ipd); + } + + public org.axsl.areaW.PageNumberCitationArea makePageNumberCitationArea( + PageNumberCitation citation, int ipd) { + return LineArea.makePageNumberCitationArea(citation, this, ipd); + } + + /** + * {@inheritDoc} + */ + public org.axsl.areaW.TextArea makeTextArea(FOText foText, int ipd, + int startOffset, int sizeInChars, boolean hasDiscretionaryHyphen, + boolean hasFauxSmallCaps, boolean isLastItemOnLine) { + return LineArea.makeTextArea(foText, this, ipd, startOffset, + sizeInChars, hasDiscretionaryHyphen, hasFauxSmallCaps, + isLastItemOnLine); + } + } 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-06 18:04:34 UTC (rev 7425) +++ trunk/foray/foray-areatree/src/java/org/foray/area/LeaderArea.java 2006-06-06 18:42:43 UTC (rev 7426) @@ -24,8 +24,13 @@ package org.foray.area; +import org.axsl.foR.FOText; import org.axsl.foR.FObj; +import org.axsl.foR.fo.ExternalGraphic; +import org.axsl.foR.fo.InstreamForeignObject; import org.axsl.foR.fo.Leader; +import org.axsl.foR.fo.PageNumber; +import org.axsl.foR.fo.PageNumberCitation; import org.axsl.common.Constants; import org.axsl.common.ConstantsAreaTree; @@ -248,4 +253,40 @@ return "leader"; } + public org.axsl.areaW.ForeignObjectArea makeForeignObjectArea( + InstreamForeignObject ifo, int ipd) { + return LineArea.makeForeignObjectArea(ifo, this, ipd); + } + + public org.axsl.areaW.ExternalGraphicArea makeExternalGraphicArea( + ExternalGraphic ifo, int ipd) { + return LineArea.makeExternalGraphicArea(ifo, this, ipd); + } + + public org.axsl.areaW.LeaderArea makeLeaderArea( + Leader leader, int ipd) { + return LineArea.makeLeaderArea(leader, this, ipd); + } + + public org.axsl.areaW.PageNumberArea makePageNumberArea( + PageNumber pageNumber, int ipd) { + return LineArea.makePageNumberArea(pageNumber, this, ipd); + } + + public org.axsl.areaW.PageNumberCitationArea makePageNumberCitationArea( + PageNumberCitation citation, int ipd) { + return LineArea.makePageNumberCitationArea(citation, this, ipd); + } + + /** + * {@inheritDoc} + */ + public org.axsl.areaW.TextArea makeTextArea(FOText foText, int ipd, + int startOffset, int sizeInChars, boolean hasDiscretionaryHyphen, + boolean hasFauxSmallCaps, boolean isLastItemOnLine) { + return LineArea.makeTextArea(foText, this, ipd, startOffset, + sizeInChars, hasDiscretionaryHyphen, hasFauxSmallCaps, + isLastItemOnLine); + } + } 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 18:04:34 UTC (rev 7425) +++ trunk/foray/foray-areatree/src/java/org/foray/area/LineArea.java 2006-06-06 18:42:43 UTC (rev 7426) @@ -778,35 +778,34 @@ return this.children.size() > 0; } - public org.axsl.areaW.ForeignObjectArea makeForeignObjectArea( - InstreamForeignObject ifo, int ipd) { - return new ForeignObjectArea(ifo, this, ipd); + public static org.axsl.areaW.ForeignObjectArea makeForeignObjectArea( + InstreamForeignObject ifo, Area parentArea, int ipd) { + return new ForeignObjectArea(ifo, parentArea, ipd); } - public org.axsl.areaW.ExternalGraphicArea makeExternalGraphicArea( - ExternalGraphic ifo, int ipd) { - return new ExternalGraphicArea(ifo, this, ipd); + public static org.axsl.areaW.ExternalGraphicArea makeExternalGraphicArea( + ExternalGraphic ifo, Area parentArea, int ipd) { + return new ExternalGraphicArea(ifo, parentArea, ipd); } - public org.axsl.areaW.LeaderArea makeLeaderArea( - Leader leader, int ipd) { - return new LeaderArea(leader, this, ipd); + public static org.axsl.areaW.LeaderArea makeLeaderArea( + Leader leader, Area parentArea, int ipd) { + return new LeaderArea(leader, parentArea, ipd); } - public org.axsl.areaW.PageNumberArea makePageNumberArea( - PageNumber pageNumber, int ipd) { - return new PageNumberArea(pageNumber, this, ipd); + public static org.axsl.areaW.PageNumberArea makePageNumberArea( + PageNumber pageNumber, Area parentArea, int ipd) { + return new PageNumberArea(pageNumber, parentArea, ipd); } - public org.axsl.areaW.PageNumberCitationArea makePageNumberCitationArea( - PageNumberCitation citation, int ipd) { - return new PageNumberCitationArea(citation, this, ipd); + public static org.axsl.areaW.PageNumberCitationArea + makePageNumberCitationArea( + PageNumberCitation citation, Area parentArea, int ipd) { + return new PageNumberCitationArea(citation, parentArea, ipd); } - /** - * {@inheritDoc} - */ - public org.axsl.areaW.TextArea makeTextArea(FOText foText, int ipd, + public static org.axsl.areaW.TextArea makeTextArea(FOText foText, + Area parentArea, int ipd, int startOffset, int sizeInChars, boolean hasDiscretionaryHyphen, boolean hasFauxSmallCaps, boolean isLastItemOnLine) { @@ -817,11 +816,13 @@ /* If the final text will be empty, don't create the TextArea. */ char[] rawText = foText.getAreaTreeText(); - boolean isFirstItemOnline = this.children.size() == 0; + boolean isFirstItemOnline = parentArea.children.size() == 0; int ignoreAtStart = TextArea.ignoreAtStart(rawText, startOffset, - sizeInChars, isFirstItemOnline, traitWhiteSpaceTreatment()); + sizeInChars, isFirstItemOnline, + parentArea.traitWhiteSpaceTreatment()); int ignoreAtEnd = TextArea.ignoreAtEnd(rawText, startOffset, - sizeInChars, isLastItemOnLine, traitWhiteSpaceTreatment()); + sizeInChars, isLastItemOnLine, + parentArea.traitWhiteSpaceTreatment()); if (ignoreAtStart + ignoreAtEnd >= sizeInChars) { return null; } @@ -831,43 +832,56 @@ 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, this, sequence, + int initialWordSpacing = parentArea.traitWordSpacingOpt(); + int initialLetterSpacing = parentArea.traitLetterSpacingOpt(); + return new TextArea(mixed, parentArea, sequence, startOffset, sizeInChars, ipd, initialLetterSpacing, initialWordSpacing, hasDiscretionaryHyphen, hasFauxSmallCaps); } if (parent instanceof Character) { - return new TextArea((Character) parent, this, ipd, 0, 0, + return new TextArea((Character) parent, parentArea, 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; -// } + public org.axsl.areaW.ForeignObjectArea makeForeignObjectArea( + InstreamForeignObject ifo, int ipd) { + return LineArea.makeForeignObjectArea(ifo, this, ipd); + } + public org.axsl.areaW.ExternalGraphicArea makeExternalGraphicArea( + ExternalGraphic ifo, int ipd) { + return LineArea.makeExternalGraphicArea(ifo, this, ipd); + } + + public org.axsl.areaW.LeaderArea makeLeaderArea( + Leader leader, int ipd) { + return LineArea.makeLeaderArea(leader, this, ipd); + } + + public org.axsl.areaW.PageNumberArea makePageNumberArea( + PageNumber pageNumber, int ipd) { + return LineArea.makePageNumberArea(pageNumber, this, ipd); + } + + public org.axsl.areaW.PageNumberCitationArea makePageNumberCitationArea( + PageNumberCitation citation, int ipd) { + return LineArea.makePageNumberCitationArea(citation, this, ipd); + } + + /** + * {@inheritDoc} + */ + public org.axsl.areaW.TextArea makeTextArea(FOText foText, int ipd, + int startOffset, int sizeInChars, boolean hasDiscretionaryHyphen, + boolean hasFauxSmallCaps, boolean isLastItemOnLine) { + return LineArea.makeTextArea(foText, this, ipd, startOffset, + sizeInChars, hasDiscretionaryHyphen, hasFauxSmallCaps, + isLastItemOnLine); + } + public LineOutput asLineOutput() { return this; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |