spepping 2004/05/29 02:07:59 Modified: src/java/org/apache/fop/layoutmgr LineLayoutManager.java Log: Remove trailing spaces at the end of a paragraph. Modify the way to deal with BPs which have not been added to vecInlineBreaks. See bug 28706. The code was rewritten w.r.t. the submitted patch. Revision Changes Path 1.23 +18 -21 xml-fop/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java Index: LineLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- LineLayoutManager.java 29 May 2004 08:50:46 -0000 1.22 +++ LineLayoutManager.java 29 May 2004 09:07:59 -0000 1.23 @@ -244,8 +244,8 @@ /* If we are not in justified text, we can end the line at * prevBP. */ - vecInlineBreaks.add(bp); if (prevBP == null) { + vecInlineBreaks.add(bp); prevBP = bp; } break; @@ -313,9 +313,15 @@ if (!bp.isForcedBreak() && vecPossEnd.size() > 0) { prevBP = getBestBP(vecPossEnd); } - // Backup child LM if necessary - if (bp != prevBP && !prevCouldEndLine(prevBP)) { - reset(); + if (bp != prevBP) { + /** Remove BPs after prevBP + if condAllAreSuppressible returns true, + else backup child LM */ + if (condAllAreSuppressible(prevBP)) { + removeAllBP(prevBP); + } else { + reset(); + } } // Don't justify last line in the sequence or if forced line-end @@ -388,27 +394,18 @@ return true; } - /** Test whether all breakposs in vecInlineBreaks - back to and including prev could end line */ - private boolean prevCouldEndLine(BreakPoss prev) { + /** Return true if we are at the end of this LM, + and BPs after prev have been added to vecInlineBreaks + and all breakposs in vecInlineBreaks + back to and excluding prev are suppressible */ + private boolean condAllAreSuppressible(BreakPoss prev) { if (!isFinished()) { return false; } - ListIterator bpIter = - vecInlineBreaks.listIterator(vecInlineBreaks.size()); - boolean couldEndLine = true; - while (bpIter.hasPrevious()) { - BreakPoss bp = (BreakPoss) bpIter.previous(); - if (bp == prev) { - break; - } else { - couldEndLine = bp.isSuppressible(); - if (!couldEndLine) { - break; - } - } + if (vecInlineBreaks.get(vecInlineBreaks.size() - 1) == prev) { + return false; } - return couldEndLine; + return allAreSuppressible(prev); } /** Test whether all breakposs in vecInlineBreaks
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]