diff options
author | Keiron Liddle <keiron@apache.org> | 2001-01-30 00:03:06 +0000 |
---|---|---|
committer | Keiron Liddle <keiron@apache.org> | 2001-01-30 00:03:06 +0000 |
commit | 19b89b86937f321cf4e0eabdfc97fe9ec4b4ce5d (patch) | |
tree | e7e9473383348c485dd3170986fab328f577e7ca /src | |
parent | b163e2b08b1aba4ec19249a489eb7b2659d3a84a (diff) | |
download | xmlgraphics-fop-19b89b86937f321cf4e0eabdfc97fe9ec4b4ce5d.tar.gz xmlgraphics-fop-19b89b86937f321cf4e0eabdfc97fe9ec4b4ce5d.zip |
moved code out of block area -> char and pag num
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193990 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/org/apache/fop/fo/flow/Character.java | 25 | ||||
-rw-r--r-- | src/org/apache/fop/fo/flow/PageNumberCitation.java | 16 | ||||
-rw-r--r-- | src/org/apache/fop/layout/BlockArea.java | 82 |
3 files changed, 63 insertions, 60 deletions
diff --git a/src/org/apache/fop/fo/flow/Character.java b/src/org/apache/fop/fo/flow/Character.java index cefc59626..c7168cbc8 100644 --- a/src/org/apache/fop/fo/flow/Character.java +++ b/src/org/apache/fop/fo/flow/Character.java @@ -60,6 +60,7 @@ import org.apache.fop.layout.Area; import org.apache.fop.layout.inline.InlineArea; import org.apache.fop.fo.FObj; import org.apache.fop.layout.FontState; +import org.apache.fop.layout.LineArea; import org.apache.fop.apps.FOPException; import org.apache.fop.messaging.MessageHandler; @@ -81,7 +82,6 @@ public class Character extends FObj { public final static int OK = 0; public final static int DOESNOT_FIT = 1; - public Character(FObj parent, PropertyList propertyList) { super(parent, propertyList); this.name = "fo:character"; @@ -143,10 +143,27 @@ public class Character extends FObj { // initialize id String id = this.properties.get("id").getString(); blockArea.getIDReferences().initializeID(id, blockArea); - blockArea.addCharacter(fontstate,red,green,blue,wrapOption,this.getLinkSet(), - whiteSpaceCollapse,characterValue,textDecoration); - return new Status(Status.OK); + LineArea la = blockArea.getCurrentLineArea(); + la.changeFont(fontstate); + la.changeColor(red, green, blue); + la.changeWrapOption(wrapOption); + la.changeWhiteSpaceCollapse(whiteSpaceCollapse); + blockArea.setupLinkSet(this.getLinkSet()); + int result = la.addCharacter(characterValue, this.getLinkSet(), textDecoration); + if (result == Character.DOESNOT_FIT) { + la = blockArea.createNextLineArea(); + if(la == null) { + return new Status(Status.AREA_FULL_NONE); + } + la.changeFont(fontstate); + la.changeColor(red, green, blue); + la.changeWrapOption(wrapOption); + la.changeWhiteSpaceCollapse(whiteSpaceCollapse); + blockArea.setupLinkSet(this.getLinkSet()); + la.addCharacter(characterValue, this.getLinkSet(), textDecoration); + } + return new Status(Status.OK); } diff --git a/src/org/apache/fop/fo/flow/PageNumberCitation.java b/src/org/apache/fop/fo/flow/PageNumberCitation.java index ce339c675..16e979526 100644 --- a/src/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/org/apache/fop/fo/flow/PageNumberCitation.java @@ -206,9 +206,19 @@ public class PageNumberCitation extends FObj { pageNumber.toCharArray(), 0, pageNumber.length(), false); } else { // add pageNumberCitation to area to be resolved during rendering - this.marker = ((BlockArea) area).addPageNumberCitation(fs, red, - green, blue, wrapOption, null, whiteSpaceCollapse, - refId); + BlockArea blockArea = (BlockArea)area; + LineArea la = blockArea.getCurrentLineArea(); + la.changeFont(fs); + la.changeColor(red, green, blue); + la.changeWrapOption(wrapOption); + la.changeWhiteSpaceCollapse(whiteSpaceCollapse); +/* la.changeHyphenation(language, country, hyphenate, + hyphenationChar, hyphenationPushCharacterCount, + hyphenationRemainCharacterCount);*/ + +// blockArea.setupLinkSet(null); + la.addPageNumberCitation(refId, null); + this.marker = -1; } diff --git a/src/org/apache/fop/layout/BlockArea.java b/src/org/apache/fop/layout/BlockArea.java index e114cee52..e36dbc4c2 100644 --- a/src/org/apache/fop/layout/BlockArea.java +++ b/src/org/apache/fop/layout/BlockArea.java @@ -62,6 +62,16 @@ import java.util.Vector; import java.util.Enumeration; import org.apache.fop.messaging.MessageHandler; +/** + * This class represents a Block Area. + * A block area is made up of a sequence of Line Areas. + * + * This class is used to organise the sequence of line areas as + * inline areas are added to this block it creates and ands line areas + * to hold the inline areas. + * This uses the line-height and line-stacking-strategy to work + * out how to stack the lines. + */ public class BlockArea extends Area { /* relative to area container */ @@ -141,31 +151,6 @@ public class BlockArea extends Area { } } - public int addPageNumberCitation(FontState fontState, float red, - float green, float blue, int wrapOption, LinkSet ls, - int whiteSpaceCollapse, String refid) { - - this.currentLineArea.changeFont(fontState); - this.currentLineArea.changeColor(red, green, blue); - this.currentLineArea.changeWrapOption(wrapOption); - this.currentLineArea.changeWhiteSpaceCollapse(whiteSpaceCollapse); - this.currentLineArea.changeHyphenation(language, country, hyphenate, - hyphenationChar, hyphenationPushCharacterCount, - hyphenationRemainCharacterCount); - - - if (ls != null) { - this.currentLinkSet = ls; - ls.setYOffset(currentHeight); - } - - this.currentLineArea.addPageNumberCitation(refid, ls); - this.hasLines = true; - - return -1; - - } - // font-variant support : addText is a wrapper for addRealText // added by Eric SCHAEFFER public int addText(FontState fontState, float red, float green, @@ -359,45 +344,36 @@ public class BlockArea extends Area { return 1; } - public void addCharacter(FontState fontState, float red, float green, - float blue, int wrapOption, LinkSet ls, - int whiteSpaceCollapse, char data, boolean ul) { + public LineArea getCurrentLineArea() + { + return this.currentLineArea; + } - this.currentLineArea.changeFont(fontState); - this.currentLineArea.changeColor(red, green, blue); - this.currentLineArea.changeWrapOption(wrapOption); - this.currentLineArea.changeWhiteSpaceCollapse(whiteSpaceCollapse); - - if (ls != null) { - this.currentLinkSet = ls; - ls.setYOffset(currentHeight); - } - - int marker = this.currentLineArea.addCharacter(data, ls, ul); - //if character didn't fit into line, open a new one - if (marker == org.apache.fop.fo.flow.Character.DOESNOT_FIT) { + public LineArea createNextLineArea() + { + if (this.hasLines) { + this.currentLineArea.addPending(); this.currentLineArea.align(this.align); +// this.currentLineArea.verticalAlign(); this.addLineArea(this.currentLineArea); - + } this.currentLineArea = new LineArea(fontState, lineHeight, halfLeading, allocationWidth, startIndent, endIndent, currentLineArea); - this.currentLineArea.changeFont(fontState); - this.currentLineArea.changeColor(red, green, blue); - this.currentLineArea.changeWrapOption(wrapOption); - this.currentLineArea.changeWhiteSpaceCollapse( - whiteSpaceCollapse); + if (currentHeight + lineHeight > maxHeight) { + return null; + } + return this.currentLineArea; + } + + public void setupLinkSet(LinkSet ls) + { if (ls != null) { this.currentLinkSet = ls; ls.setYOffset(currentHeight); } - - this.currentLineArea.addCharacter(data, ls, ul); - } - this.hasLines = true; - } - + } public void end() { if (this.hasLines) { |