jeremias 2005/02/01 06:18:29 Modified: src/java/org/apache/fop/layoutmgr BlockLayoutManager.java Log: Bugfix for special case when markers weren't added correctly. This happens when a block is empty except for marker elements. Revision Changes Path 1.40 +28 -27 xml-fop/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Index: BlockLayoutManager.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java,v retrieving revision 1.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- BlockLayoutManager.java 25 Jan 2005 12:45:46 -0000 1.39 +++ BlockLayoutManager.java 1 Feb 2005 14:18:28 -0000 1.40 @@ -33,6 +33,9 @@ * LayoutManager for a block FO. */ public class BlockLayoutManager extends BlockStackingLayoutManager { + + private static final int FINISHED_LEAF_POS = -2; + private org.apache.fop.fo.flow.Block fobj; private Block curBlockArea; @@ -270,7 +273,7 @@ } } setFinished(true); - BreakPoss breakPoss = new BreakPoss(new LeafPosition(this, -2)); + BreakPoss breakPoss = new BreakPoss(new LeafPosition(this, FINISHED_LEAF_POS)); breakPoss.setStackingSize(stackSize); return breakPoss; } @@ -290,34 +293,32 @@ addID(fobj.getId()); addMarkers(true, true); - LayoutManager childLM; - LayoutContext lc = new LayoutContext(0); - while (parentIter.hasNext()) { - LeafPosition lfp = (LeafPosition) parentIter.next(); - if (lfp.getLeafPos() == -2) { - curBlockArea = null; - flush(); - return; - } - // Add the block areas to Area - PositionIterator breakPosIter = - new BreakPossPosIter(childBreaks, iStartPos, - lfp.getLeafPos() + 1); - iStartPos = lfp.getLeafPos() + 1; - while ((childLM = breakPosIter.getNextChildLM()) != null) { - childLM.addAreas(breakPosIter, lc); + try { + LayoutManager childLM; + LayoutContext lc = new LayoutContext(0); + while (parentIter.hasNext()) { + LeafPosition lfp = (LeafPosition) parentIter.next(); + if (lfp.getLeafPos() == FINISHED_LEAF_POS) { + return; + } + // Add the block areas to Area + PositionIterator breakPosIter + = new BreakPossPosIter(childBreaks, iStartPos, + lfp.getLeafPos() + 1); + iStartPos = lfp.getLeafPos() + 1; + while ((childLM = breakPosIter.getNextChildLM()) != null) { + childLM.addAreas(breakPosIter, lc); + } } + } finally { + addMarkers(false, true); + flush(); + + // if adjusted space after + foBlockSpaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter).getSpace(); + addBlockSpacing(adjust, foBlockSpaceAfter); + curBlockArea = null; } - - addMarkers(false, true); - - flush(); - - // if adjusted space after - foBlockSpaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter).getSpace(); - addBlockSpacing(adjust, foBlockSpaceAfter); - - curBlockArea = null; } /**
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]