[FOray-commit] SF.net SVN: foray: [7574] trunk/foray/foray-text/src/java/org/foray/text/line
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-06-13 22:22:38
|
Revision: 7574 Author: victormote Date: 2006-06-13 15:22:31 -0700 (Tue, 13 Jun 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7574&view=rev Log Message: ----------- Conform to axsl change: Revert change that allowed an anonymous object to ride through the line-breaking system. Modified Paths: -------------- trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java Modified: trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java 2006-06-13 22:22:22 UTC (rev 7573) +++ trunk/foray/foray-text/src/java/org/foray/text/line/EagerLineBreaker.java 2006-06-13 22:22:31 UTC (rev 7574) @@ -55,8 +55,8 @@ /** * @throws TextException */ - protected int processInput(LineContent lineContent, int start, int end, - Object context) throws TextException { + protected int processInput(LineContent lineContent, int start, int end) + throws TextException { int status = 0; if (lineContent instanceof LineText) { LineText lineText = (LineText) lineContent; @@ -80,8 +80,7 @@ } if (shouldSwitch) { // Process this chunk. - status = processLineText(lineText, subsetStart, i - 1, - context); + status = processLineText(lineText, subsetStart, i - 1); // If it can't process the whole chunk, we need to exit. if (status != i) { return status; @@ -90,11 +89,11 @@ } inLowerCase = isLowerCase(c); } - return processLineText(lineText, subsetStart, end, context); + return processLineText(lineText, subsetStart, end); } - status = processLineText(lineText, start, end, context); + status = processLineText(lineText, start, end); } else if (lineContent instanceof LineNonText) { - status = processLineNonText((LineNonText) lineContent, context); + status = processLineNonText((LineNonText) lineContent); } else { throw new TextException("Invalid LineContent."); } @@ -109,7 +108,7 @@ * if there is not enough room on the line for it. * @throws TextException */ - protected int processLineNonText(LineNonText nonTextItem, Object context) + protected int processLineNonText(LineNonText nonTextItem) throws TextException { int lineLength = getCurrentLine().capacityTotal(); int itemSize = nonTextItem.inlineSizeOptimum(lineLength); @@ -119,7 +118,7 @@ // There is nothing on the line. Therefore it won't fit any // better on the next line. Put it on this one. handler.handleLineBreakNonText(getCurrentLine(), nonTextItem, - itemSize, context); + itemSize); getLogger().error("Content too large for any line."); return 1; } @@ -127,13 +126,12 @@ return 0; } // It fits on the line. Add it. - handler.handleLineBreakNonText(getCurrentLine(), nonTextItem, itemSize, - context); + handler.handleLineBreakNonText(getCurrentLine(), nonTextItem, itemSize); return 1; } protected abstract int processLineText(LineText lineText, int start, - int end, Object context) throws TextException; + int end) throws TextException; protected int currentLineWidthRemaining() throws TextException { return getCurrentLine().capacityTotal() @@ -141,9 +139,9 @@ } public int addLineContent(LineContent content, int start, int end, - LineOutput output, Object context) throws TextException { + LineOutput output) throws TextException { this.currentOutput = output; - return processInput(content, start, end, context); + return processInput(content, start, end); } protected LineOutput getCurrentLine() { Modified: trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java 2006-06-13 22:22:22 UTC (rev 7573) +++ trunk/foray/foray-text/src/java/org/foray/text/line/LineBreaker.java 2006-06-13 22:22:31 UTC (rev 7574) @@ -118,7 +118,7 @@ * send all of their input to the text-processing system before processing * actually starts. * ("Eager" clients should use {@link #processLineContent(LineContent, int, - * int, LineOutput, Object)}.) + * int, LineOutput)}.) * @param contentItem The LineContent implementation that should be laid * out. */ @@ -148,12 +148,12 @@ * successfully added to the line. */ public int processLineContent(LineContent contentItem, int start, int end, - LineOutput output, Object context) throws TextException { + LineOutput output) throws TextException { validateEagerContent(contentItem, output); content.add(contentItem); this.currentOutput = output; this.currentLineContent = contentItem; - return addLineContent(contentItem, start, end, output, context); + return addLineContent(contentItem, start, end, output); } /** @@ -177,7 +177,7 @@ } protected abstract int addLineContent(LineContent contentItem, int start, - int end, LineOutput output, Object context) throws TextException; + int end, LineOutput output) throws TextException; public int getCharWidth(LineText lineText, int codePoint) { FontUse fontUse = lineText.inlinePrimaryFont(); Modified: trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java =================================================================== --- trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-13 22:22:22 UTC (rev 7573) +++ trunk/foray/foray-text/src/java/org/foray/text/line/solitary/SolitaryLineBreaker.java 2006-06-13 22:22:31 UTC (rev 7574) @@ -103,8 +103,8 @@ super(server, control, handler, fontConsumer); } - protected int processLineText(LineText lineText, int start, int end, - Object context) throws TextException { + protected int processLineText(LineText lineText, int start, int end) + throws TextException { this.currentLineText = lineText; this.currentChars = currentLineText.inlineText(); String language = lineText.inlineLanguage(); @@ -142,7 +142,7 @@ charCount++; } if (forcesLineBreak(codePoint)) { - createLineContent(start, i, finalWidth, false, context); + createLineContent(start, i, finalWidth, false); return i + 1; } if (allowsLineBreak(codePoint)) { @@ -171,8 +171,7 @@ finalWidth += spaceWidth; finalWidth += wordWidth; finalWidth += getHyphenWidth(lineText); - createLineContent(start, ret - 1, finalWidth, true, - context); + createLineContent(start, ret - 1, finalWidth, true); return ret; } } @@ -182,28 +181,26 @@ finalWidth += spaceWidth; finalWidth += wordWidth; finalWidth -= charWidth; - createLineContent(start, i - charCount, finalWidth, false, - context); + createLineContent(start, i - charCount, finalWidth, false); /* Return the index at the start of this character*/ return i - charCount + 1; } // Break the line at the end of the previous word. - createLineContent(start, wordStart - 1, finalWidth, false, - context); + createLineContent(start, wordStart - 1, finalWidth, false); return wordStart; } /* We have now read through each character. */ /* If this ends with white space, place remaining contents on this * line. */ if (previousCharacter == CONNECTOR) { - return remainingContentOnThisLine(startIndex, endIndex, context); + return remainingContentOnThisLine(startIndex, endIndex); } /* Otherwise the word may continue into the next text. See if the * entire word fits. */ if (finalWidth + spaceWidth + wordWidth + sizeFirstWordNextText(lineText, startIndex, endIndex) <= currentLineWidthRemaining()) { - return remainingContentOnThisLine(startIndex, endIndex, context); + return remainingContentOnThisLine(startIndex, endIndex); } /* TODO: If the entire words doesn't fit, see if it can be @@ -211,7 +208,7 @@ /* If nothing else works, the content doesn't fit on this line. * Break the line at the end of the previous word. */ - createLineContent(start, wordStart - 1, finalWidth, false, context); + createLineContent(start, wordStart - 1, finalWidth, false); return wordStart; } @@ -222,11 +219,11 @@ * it is one past endIndex, indicating that all has been laid out. * @throws TextException */ - private int remainingContentOnThisLine(int startIndex, int endIndex, - Object context) throws TextException { + private int remainingContentOnThisLine(int startIndex, int endIndex) + throws TextException { finalWidth += spaceWidth; finalWidth += wordWidth; - createLineContent(startIndex, endIndex, finalWidth, false, context); + createLineContent(startIndex, endIndex, finalWidth, false); return endIndex + 1; } @@ -326,7 +323,7 @@ * @param sizeInline The size, in millipoints, of the content being created. */ private void createLineContent(int startIndex, int endIndex, int sizeInline, - boolean isHyphenated, Object context) throws TextException { + boolean isHyphenated) throws TextException { LineText lineText = (LineText) this.currentLineContent; boolean everythingWritten = endIndex >= lineText.inlineText().length; boolean isLastItemOnLine = true; @@ -339,7 +336,7 @@ } handler.handleLineBreakText(this.currentOutput, lineText, startIndex, endIndex - startIndex + 1, sizeInline, isHyphenated, - inLowerCase, isLastItemOnLine, context); + inLowerCase, isLastItemOnLine); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |