Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Thu Jul 24 02:35:34 2008 @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -294,7 +294,7 @@ if (pos.getIndex() >= 0) { throw new IllegalStateException("Position already got its index"); } - + lastGeneratedPosition++; pos.setIndex(lastGeneratedPosition); return pos; @@ -383,27 +383,27 @@ * Checks to see if the incoming [EMAIL PROTECTED] Position} * is the last one for this LM, and if so, calls * [EMAIL PROTECTED] #notifyEndOfLayout()} and cleans up. - * + * * @param pos the [EMAIL PROTECTED] Position} to check */ protected void checkEndOfLayout(Position pos) { if (pos != null && pos.getLM() == this && this.isLast(pos)) { - + notifyEndOfLayout(); - + /* References to the child LMs are no longer needed */ childLMs = null; curChildLM = null; childLMiter = null; - + /* markers that qualify have been transferred to the page */ markers = null; - - /* References to the FO's children can be released if the + + /* References to the FO's children can be released if the * LM is a descendant of the FlowLM. For static-content * the FO may still be needed on following pages. */ @@ -418,7 +418,7 @@ } } } - + /** [EMAIL PROTECTED] */ public String toString() { return (super.toString() + (fobj != null ? "[fobj=" + fobj.toString() + "]" : ""));
Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractPageSequenceLayoutManager.java Thu Jul 24 02:35:34 2008 @@ -43,15 +43,15 @@ private static Log log = LogFactory.getLog(AbstractPageSequenceLayoutManager.class); - /** + /** * AreaTreeHandler which activates the PSLM and controls * the rendering of its pages. */ protected AreaTreeHandler areaTreeHandler; - + /** ID tracker supplied by the AreaTreeHandler */ protected IDTracker idTracker; - + /** page sequence formatting object being processed by this class */ protected AbstractPageSequence pageSeq; @@ -62,7 +62,7 @@ protected int currentPageNum = 0; /** The stating page number */ protected int startPageNum = 0; - + /** * Constructor * @@ -112,12 +112,12 @@ startPageNum = pageSeq.getStartingPageNumber(); currentPageNum = startPageNum - 1; } - + /** * This returns the first PageViewport that contains an id trait * matching the idref argument, or null if no such PV exists. * - * @param idref the idref trait needing to be resolved + * @param idref the idref trait needing to be resolved * @return the first PageViewport that contains the ID trait */ public PageViewport getFirstPVWithID(String idref) { @@ -132,7 +132,7 @@ * This returns the last PageViewport that contains an id trait * matching the idref argument, or null if no such PV exists. * - * @param idref the idref trait needing to be resolved + * @param idref the idref trait needing to be resolved * @return the last PageViewport that contains the ID trait */ public PageViewport getLastPVWithID(String idref) { @@ -142,7 +142,7 @@ } return null; } - + /** * Add an ID reference to the current page. * When adding areas the area adds its ID reference. @@ -156,7 +156,7 @@ idTracker.associateIDWithPageViewport(id, curPage.getPageViewport()); } } - + /** * Add an id reference of the layout manager in the AreaTreeHandler, * if the id hasn't been resolved yet @@ -175,7 +175,7 @@ return true; } } - + /** * Notify the areaTreeHandler that the LayoutManagers containing * idrefs have finished creating areas @@ -184,16 +184,16 @@ public void notifyEndOfLayout(String id) { idTracker.signalIDProcessed(id); } - + /** - * Identify an unresolved area (one needing an idref to be + * Identify an unresolved area (one needing an idref to be * resolved, e.g. the internal-destination of an fo:basic-link) * for both the AreaTreeHandler and PageViewport object. - * + * * The IDTracker keeps a document-wide list of idref's - * and the PV's needing them to be resolved. It uses this to + * and the PV's needing them to be resolved. It uses this to * send notifications to the PV's when an id has been resolved. - * + * * The PageViewport keeps lists of id's needing resolving, along * with the child areas (page-number-citation, basic-link, etc.) * of the PV needing their resolution. @@ -216,7 +216,7 @@ * then the containing page does not have a qualifying area, * and all qualifying areas have ended. * Therefore we use last-ending-within-page (Constants.EN_LEWP) - * as the position. + * as the position. * * @param rm the RetrieveMarker instance whose properties are to * used to find the matching Marker. @@ -227,8 +227,8 @@ AreaTreeModel areaTreeModel = areaTreeHandler.getAreaTreeModel(); String name = rm.getRetrieveClassName(); int pos = rm.getRetrievePosition(); - int boundary = rm.getRetrieveBoundary(); - + int boundary = rm.getRetrieveBoundary(); + // get marker from the current markers on area tree Marker mark = (Marker)getCurrentPV().getMarker(name, pos); if (mark == null && boundary != EN_PAGE) { @@ -271,10 +271,10 @@ * @return the newly created page */ protected abstract Page createPage(int pageNumber, boolean isBlank); - + /** * Makes a new page - * + * * @param bIsBlank whether this page is blank or not * @param bIsLast whether this page is the last page or not * @return a new page @@ -289,14 +289,14 @@ curPage = createPage(currentPageNum, isBlank); if (log.isDebugEnabled()) { - log.debug("[" + curPage.getPageViewport().getPageNumberString() + log.debug("[" + curPage.getPageViewport().getPageNumberString() + (isBlank ? "*" : "") + "]"); } - + addIDToPage(pageSeq.getId()); return curPage; } - + /** * Finishes a page in preparation for a new page. */ @@ -304,19 +304,19 @@ if (log.isTraceEnabled()) { curPage.getPageViewport().dumpMarkers(); } - + // Try to resolve any unresolved IDs for the current page. - // + // idTracker.tryIDResolution(curPage.getPageViewport()); // Queue for ID resolution and rendering areaTreeHandler.getAreaTreeModel().addPage(curPage.getPageViewport()); if (log.isDebugEnabled()) { - log.debug("page finished: " + curPage.getPageViewport().getPageNumberString() + log.debug("page finished: " + curPage.getPageViewport().getPageNumberString() + ", current num: " + currentPageNum); } curPage = null; } - + /** [EMAIL PROTECTED] */ public void doForcePageCount(Numeric nextPageSeqInitialPageNumber) { @@ -325,14 +325,14 @@ // xsl-spec version 1.0 (15.oct 2001) // auto | even | odd | end-on-even | end-on-odd | no-force | inherit // auto: - // Force the last page in this page-sequence to be an odd-page - // if the initial-page-number of the next page-sequence is even. - // Force it to be an even-page - // if the initial-page-number of the next page-sequence is odd. - // If there is no next page-sequence + // Force the last page in this page-sequence to be an odd-page + // if the initial-page-number of the next page-sequence is even. + // Force it to be an even-page + // if the initial-page-number of the next page-sequence is odd. + // If there is no next page-sequence // or if the value of its initial-page-number is "auto" do not force any page. - - // if force-page-count is auto then set the value of forcePageCount + + // if force-page-count is auto then set the value of forcePageCount // depending on the initial-page-number of the next page-sequence if (nextPageSeqInitialPageNumber != null && forcePageCount == Constants.EN_AUTO) { if (nextPageSeqInitialPageNumber.getEnum() != 0) { @@ -381,5 +381,5 @@ finishPage(); } } - + } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Thu Jul 24 02:35:34 2008 @@ -49,7 +49,7 @@ * @param parentIter the position iterator * @param layoutContext the layout context */ - public static void addAreas(BlockStackingLayoutManager bslm, + public static void addAreas(BlockStackingLayoutManager bslm, PositionIterator parentIter, LayoutContext layoutContext) { LayoutManager childLM = null; LayoutContext lc = new LayoutContext(0); @@ -57,9 +57,9 @@ LayoutManager lastLM = null; Position firstPos = null; Position lastPos = null; - + // "unwrap" the NonLeafPositions stored in parentIter - // and put them in a new list; + // and put them in a new list; LinkedList positionList = new LinkedList(); Position pos; while (parentIter.hasNext()) { @@ -93,11 +93,11 @@ //correctly determine first and last conditions. The Iterator //doesn't give us that info. } - + if (bslm != null) { bslm.addMarkersToPage( - true, - bslm.isFirst(firstPos), + true, + bslm.isFirst(firstPos), bslm.isLast(lastPos)); } @@ -120,15 +120,15 @@ lc.setStackLimitsFrom(layoutContext); childLM.addAreas(childPosIter, lc); } - + if (bslm != null) { bslm.addMarkersToPage( - false, - bslm.isFirst(firstPos), + false, + bslm.isFirst(firstPos), bslm.isLast(lastPos)); } - + } - + } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java Thu Jul 24 02:35:34 2008 @@ -30,11 +30,11 @@ public class BalancingColumnBreakingAlgorithm extends PageBreakingAlgorithm { private Log log = LogFactory.getLog(BalancingColumnBreakingAlgorithm.class); - + private int columnCount; private int fullLen; private int idealPartLen; - + public BalancingColumnBreakingAlgorithm(LayoutManager topLevelLM, PageProvider pageProvider, PageBreakingLayoutListener layoutListener, @@ -43,18 +43,18 @@ boolean partOverflowRecovery, int columnCount) { super(topLevelLM, pageProvider, layoutListener, - alignment, alignmentLast, + alignment, alignmentLast, footnoteSeparatorLength, partOverflowRecovery, false, false); this.columnCount = columnCount; this.considerTooShort = true; //This is important! } - + /** [EMAIL PROTECTED] */ protected double computeDemerits(KnuthNode activeNode, KnuthElement element, int fitnessClass, double r) { double dem = super.computeDemerits(activeNode, element, fitnessClass, r); if (log.isTraceEnabled()) { - log.trace("original demerit=" + dem + " " + totalWidth + log.trace("original demerit=" + dem + " " + totalWidth + " line=" + activeNode.line + "/" + columnCount + " pos=" + activeNode.position + "/" + (par.size() - 1)); } @@ -71,7 +71,7 @@ avgRestLen = restLen / remParts; } if (log.isTraceEnabled()) { - log.trace("remaining parts: " + remParts + " rest len: " + restLen + log.trace("remaining parts: " + remParts + " rest len: " + restLen + " avg=" + avgRestLen); } double balance = (idealPartLen - partLen) / 1000f; @@ -92,9 +92,9 @@ dem = dem * 1.2f; } } - //Step 2: This helps keep the trailing parts shorter than the previous ones + //Step 2: This helps keep the trailing parts shorter than the previous ones dem += (avgRestLen) / 1000f; - + if (activeNode.line >= columnCount) { //We don't want more columns than available dem = Double.MAX_VALUE; Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Thu Jul 24 02:35:34 2008 @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -44,14 +44,14 @@ /** * LayoutManager for a block-container FO. */ -public class BlockContainerLayoutManager extends BlockStackingLayoutManager +public class BlockContainerLayoutManager extends BlockStackingLayoutManager implements ConditionalElementListener { /** * logging instance */ private static Log log = LogFactory.getLog(BlockContainerLayoutManager.class); - + private BlockViewport viewportBlockArea; private Block referenceArea; @@ -62,11 +62,11 @@ private Length height; //private int vpContentIPD; private int vpContentBPD; - + // When viewport should grow with the content. private boolean autoHeight = true; private boolean inlineElementList = false; - + /* holds the (one-time use) fo:block space-before and -after properties. Large fo:blocks are split into multiple Area.Blocks to accomodate the subsequent @@ -78,7 +78,7 @@ //TODO space-before|after: handle space-resolution rules private MinOptMax foBlockSpaceBefore; private MinOptMax foBlockSpaceAfter; - + private boolean discardBorderBefore; private boolean discardBorderAfter; private boolean discardPaddingBefore; @@ -86,7 +86,7 @@ private MinOptMax effSpaceBefore; private MinOptMax effSpaceAfter; - + /** * Create a new block container layout manager. * @param node block-container node to create the layout manager for. @@ -94,7 +94,7 @@ public BlockContainerLayoutManager(BlockContainer node) { super(node); } - + /** [EMAIL PROTECTED] */ public void initialize() { abProps = getBlockContainerFO().getCommonAbsolutePosition(); @@ -103,7 +103,7 @@ foBlockSpaceAfter = new SpaceVal(getBlockContainerFO().getCommonMarginBlock() .spaceAfter, this).getSpace(); startIndent = getBlockContainerFO().getCommonMarginBlock().startIndent.getValue(this); - endIndent = getBlockContainerFO().getCommonMarginBlock().endIndent.getValue(this); + endIndent = getBlockContainerFO().getCommonMarginBlock().endIndent.getValue(this); boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0); if (rotated) { @@ -117,7 +117,7 @@ width = getBlockContainerFO().getInlineProgressionDimension() .getOptimum(this).getLength(); } - + bpUnit = 0; //layoutProps.blockProgressionUnit; if (bpUnit == 0) { // use optimum space values @@ -133,11 +133,11 @@ .spaceAfter.getSpace().getMinimum(this).getLength().getValue(this); } } - + private void resetSpaces() { - this.discardBorderBefore = false; - this.discardBorderAfter = false; - this.discardPaddingBefore = false; + this.discardBorderBefore = false; + this.discardBorderAfter = false; + this.discardPaddingBefore = false; this.discardPaddingAfter = false; this.effSpaceBefore = null; this.effSpaceAfter = null; @@ -153,11 +153,11 @@ int overflow = getBlockContainerFO().getOverflow(); return (overflow == EN_HIDDEN || overflow == EN_ERROR_IF_OVERFLOW); } - + private int getSpaceBefore() { return foBlockSpaceBefore.opt; } - + private int getBPIndents() { int indents = 0; /* TODO This is wrong isn't it? @@ -170,16 +170,16 @@ .getBPPaddingAndBorder(false, this); return indents; } - + private boolean isAbsoluteOrFixed() { - return (abProps.absolutePosition == EN_ABSOLUTE) + return (abProps.absolutePosition == EN_ABSOLUTE) || (abProps.absolutePosition == EN_FIXED); } private boolean isFixed() { return (abProps.absolutePosition == EN_FIXED); } - + /** [EMAIL PROTECTED] */ public int getContentAreaBPD() { if (autoHeight) { @@ -188,26 +188,26 @@ return this.vpContentBPD; } } - + /** [EMAIL PROTECTED] */ public List getNextKnuthElements(LayoutContext context, int alignment) { resetSpaces(); if (isAbsoluteOrFixed()) { return getNextKnuthElementsAbsolute(context, alignment); } - + autoHeight = false; //boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0); int maxbpd = context.getStackLimitBP().opt; int allocBPD; - if (height.getEnum() == EN_AUTO + if (height.getEnum() == EN_AUTO || (!height.isAbsolute() && getAncestorBlockAreaBPD() <= 0)) { - //auto height when height="auto" or "if that dimension is not specified explicitly + //auto height when height="auto" or "if that dimension is not specified explicitly //(i.e., it depends on content's block-progression-dimension)" (XSL 1.0, 7.14.1) allocBPD = maxbpd; autoHeight = true; if (getBlockContainerFO().getReferenceOrientation() == 0) { - //Cannot easily inline element list when ref-or="180" + //Cannot easily inline element list when ref-or="180" inlineElementList = true; } } else { @@ -223,7 +223,7 @@ int contentWidth = width.getValue(this); updateContentAreaIPDwithOverconstrainedAdjust(contentWidth); } - + double contentRectOffsetX = 0; contentRectOffsetX += getBlockContainerFO() .getCommonMarginBlock().startIndent.getValue(this); @@ -232,7 +232,7 @@ .getCommonBorderPaddingBackground().getBorderBeforeWidth(false); contentRectOffsetY += getBlockContainerFO() .getCommonBorderPaddingBackground().getPaddingBefore(false, this); - + updateRelDims(contentRectOffsetX, contentRectOffsetY, autoHeight); int availableIPD = referenceIPD - getIPIndents(); @@ -243,13 +243,13 @@ getContentAreaIPD(), context.getRefIPD(), getBlockContainerFO().getLocator()); } - + MinOptMax stackLimit = new MinOptMax(relDims.bpd); List returnedList; List contentList = new LinkedList(); List returnList = new LinkedList(); - + if (!breakBeforeServed) { try { if (addKnuthElementsForBreakBefore(returnList, context)) { @@ -264,7 +264,7 @@ addKnuthElementsForSpaceBefore(returnList, alignment); context.updateKeepWithPreviousPending(getKeepWithPreviousStrength()); } - + addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed); firstVisibleMarkServed = true; @@ -366,7 +366,7 @@ returnList.add(new KnuthBox(vpContentBPD, notifyPos(bcPosition), false)); //TODO Handle min/opt/max for block-progression-dimension /* These two elements will be used to add stretchability to the above box - returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE, + returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, returnPosition, false)); returnList.add(new KnuthGlue(0, 1 * constantLineHeight, 0, LINE_NUMBER_ADJUSTMENT, returnPosition, false)); @@ -375,7 +375,7 @@ if (contentOverflows) { BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get( getBlockContainerFO().getUserAgent().getEventBroadcaster()); - boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW); + boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW); eventProducer.viewportOverflow(this, getBlockContainerFO().getName(), breaker.getOverflowAmount(), needClip(), canRecover, getBlockContainerFO().getLocator()); @@ -384,7 +384,7 @@ addKnuthElementsForBorderPaddingAfter(returnList, true); addKnuthElementsForSpaceAfter(returnList, alignment); - //All child content is processed. Only break-after can occur now, so... + //All child content is processed. Only break-after can occur now, so... context.clearPendingMarks(); addKnuthElementsForBreakAfter(returnList, context); @@ -393,7 +393,7 @@ setFinished(true); return returnList; } - + private List getNextKnuthElementsAbsolute(LayoutContext context, int alignment) { autoHeight = false; @@ -403,7 +403,7 @@ int allocBPD, allocIPD; if (height.getEnum() == EN_AUTO || (!height.isAbsolute() && getAncestorBlockAreaBPD() <= 0)) { - //auto height when height="auto" or "if that dimension is not specified explicitly + //auto height when height="auto" or "if that dimension is not specified explicitly //(i.e., it depends on content's blockprogression-dimension)" (XSL 1.0, 7.14.1) allocBPD = 0; if (abProps.bottom.getEnum() != EN_AUTO) { @@ -411,7 +411,7 @@ if (isFixed()) { availHeight = (int)getCurrentPV().getViewArea().getHeight(); } else { - availHeight = context.getStackLimitBP().opt; + availHeight = context.getStackLimitBP().opt; } allocBPD = availHeight; allocBPD -= offset.y; @@ -456,7 +456,7 @@ if (width.getEnum() == EN_AUTO) { int availWidth; if (isFixed()) { - availWidth = (int)getCurrentPV().getViewArea().getWidth(); + availWidth = (int)getCurrentPV().getViewArea().getWidth(); } else { availWidth = context.getRefIPD(); } @@ -500,7 +500,7 @@ vpContentBPD = allocBPD - getBPIndents(); setContentAreaIPD(allocIPD - getIPIndents()); - + updateRelDims(0, 0, autoHeight); MinOptMax range = new MinOptMax(relDims.ipd); @@ -521,12 +521,12 @@ if (!breaker.isEmpty()) { Position bcPosition = new BlockContainerPosition(this, breaker); returnList.add(new KnuthBox(0, notifyPos(bcPosition), false)); - + //TODO Maybe check for page overflow when autoHeight=true if (!autoHeight & (contentOverflows)) { BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get( getBlockContainerFO().getUserAgent().getEventBroadcaster()); - boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW); + boolean canRecover = (getBlockContainerFO().getOverflow() != EN_ERROR_IF_OVERFLOW); eventProducer.viewportOverflow(this, getBlockContainerFO().getName(), breaker.getOverflowAmount(), needClip(), canRecover, getBlockContainerFO().getLocator()); @@ -539,16 +539,16 @@ private void updateRelDims(double xOffset, double yOffset, boolean skipAutoHeight) { Rectangle2D rect = new Rectangle2D.Double( - xOffset, yOffset, + xOffset, yOffset, getContentAreaIPD(), this.vpContentBPD); relDims = new FODimension(0, 0); absoluteCTM = CTM.getCTMandRelDims( getBlockContainerFO().getReferenceOrientation(), - getBlockContainerFO().getWritingMode(), + getBlockContainerFO().getWritingMode(), rect, relDims); } - + private class BlockContainerPosition extends NonLeafPosition { private BlockContainerBreaker breaker; @@ -557,23 +557,23 @@ super(lm, null); this.breaker = breaker; } - + public BlockContainerBreaker getBreaker() { return this.breaker; } - + } - + private class BlockContainerBreaker extends AbstractBreaker { - + private BlockContainerLayoutManager bclm; private MinOptMax ipd; - + //Info for deferred adding of areas private PageBreakingAlgorithm deferredAlg; private BlockSequence deferredOriginalList; private BlockSequence deferredEffectiveList; - + public BlockContainerBreaker(BlockContainerLayoutManager bclm, MinOptMax ipd) { this.bclm = bclm; this.ipd = ipd; @@ -581,10 +581,10 @@ /** [EMAIL PROTECTED] */ protected void observeElementList(List elementList) { - ElementListObserver.observe(elementList, "block-container", + ElementListObserver.observe(elementList, "block-container", bclm.getBlockContainerFO().getId()); } - + /** [EMAIL PROTECTED] */ protected boolean isPartOverflowRecoveryActivated() { //For block-containers, this must be disabled because of wanted overflow. @@ -600,19 +600,19 @@ PageBreakPosition pbp = (PageBreakPosition)this.deferredAlg.getPageBreaks().getFirst(); return pbp.difference; } - + public boolean isOverflow() { return !isEmpty() && ((deferredAlg.getPageBreaks().size() > 1) || (deferredAlg.totalWidth - deferredAlg.totalShrink) > deferredAlg.getLineWidth()); } - + public int getOverflowAmount() { - return (deferredAlg.totalWidth - deferredAlg.totalShrink) + return (deferredAlg.totalWidth - deferredAlg.totalShrink) - deferredAlg.getLineWidth(); } - + protected LayoutManager getTopLevelLM() { return bclm; } @@ -623,7 +623,7 @@ lc.setWritingMode(getBlockContainerFO().getWritingMode()); return lc; } - + protected List getNextKnuthElements(LayoutContext context, int alignment) { LayoutManager curLM; // currently active LM List returnList = new LinkedList(); @@ -633,7 +633,7 @@ childLC.setStackLimitBP(context.getStackLimitBP()); childLC.setRefIPD(context.getRefIPD()); childLC.setWritingMode(getBlockContainerFO().getWritingMode()); - + List returnedList = null; if (!curLM.isFinished()) { returnedList = curLM.getNextKnuthElements(childLC, alignment); @@ -650,45 +650,45 @@ protected int getCurrentDisplayAlign() { return getBlockContainerFO().getDisplayAlign(); } - + protected boolean hasMoreContent() { return !isFinished(); } - + protected void addAreas(PositionIterator posIter, LayoutContext context) { - AreaAdditionUtil.addAreas(bclm, posIter, context); + AreaAdditionUtil.addAreas(bclm, posIter, context); } - - protected void doPhase3(PageBreakingAlgorithm alg, int partCount, + + protected void doPhase3(PageBreakingAlgorithm alg, int partCount, BlockSequence originalList, BlockSequence effectiveList) { //Defer adding of areas until addAreas is called by the parent LM this.deferredAlg = alg; this.deferredOriginalList = originalList; this.deferredEffectiveList = effectiveList; } - + protected void finishPart(PageBreakingAlgorithm alg, PageBreakPosition pbp) { //nop for bclm } - + protected LayoutManager getCurrentChildLM() { return curChildLM; } - + public void addContainedAreas() { if (isEmpty()) { return; } - //Rendering all parts (not just the first) at once for the case where the parts that + //Rendering all parts (not just the first) at once for the case where the parts that //overflow should be visible. this.deferredAlg.removeAllPageBreaks(); - this.addAreas(this.deferredAlg, - this.deferredAlg.getPageBreaks().size(), + this.addAreas(this.deferredAlg, + this.deferredAlg.getPageBreaks().size(), this.deferredOriginalList, this.deferredEffectiveList); } - + } - + private Point getAbsOffset() { int x = 0; int y = 0; @@ -696,7 +696,7 @@ x = abProps.left.getValue(this); } else if (abProps.right.getEnum() != EN_AUTO && width.getEnum() != EN_AUTO) { - x = getReferenceAreaIPD() + x = getReferenceAreaIPD() - abProps.right.getValue(this) - width.getValue(this); } if (abProps.top.getEnum() != EN_AUTO) { @@ -708,7 +708,7 @@ } return new Point(x, y); } - + /** [EMAIL PROTECTED] */ public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) { @@ -755,7 +755,7 @@ if (bcpos != null) { throw new IllegalStateException("Only one BlockContainerPosition allowed"); } - bcpos = (BlockContainerPosition)pos; + bcpos = (BlockContainerPosition)pos; //Add child areas inside the reference area //bcpos.getBreaker().addContainedAreas(); } else if (innerPosition == null) { @@ -786,9 +786,9 @@ } addId(); - + addMarkersToPage(true, isFirst(firstPos), isLast(lastPos)); - + if (bcpos == null) { if (bpUnit == 0) { // the Positions in positionList were inside the elements @@ -831,7 +831,7 @@ //log.debug("Adding areas from " + iFirst + " to " + iLast); //log.debug("splitLength= " + splitLength // + " (" + neededUnits(splitLength) + " units') " - // + (neededUnits(splitLength) * bpUnit - splitLength) + // + (neededUnits(splitLength) * bpUnit - splitLength) // + " spacing"); // add space before and / or after the paragraph // to reach a multiple of bpUnit @@ -864,7 +864,7 @@ .size()); //} } - + while ((childLM = childPosIter.getNextChildLM()) != null) { // set last area flag lc.setFlags(LayoutContext.LAST_AREA, @@ -880,7 +880,7 @@ addMarkersToPage(false, isFirst(firstPos), isLast(lastPos)); - TraitSetter.addSpaceBeforeAfter(viewportBlockArea, layoutContext.getSpaceAdjust(), + TraitSetter.addSpaceBeforeAfter(viewportBlockArea, layoutContext.getSpaceAdjust(), effSpaceBefore, effSpaceAfter); flush(); @@ -890,7 +890,7 @@ notifyEndOfLayout(); } - + /** * Get the parent area for children of this block container. * This returns the current block container area @@ -906,7 +906,7 @@ viewportBlockArea = new BlockViewport(allowBPDUpdate); viewportBlockArea.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE); - + viewportBlockArea.setIPD(getContentAreaIPD()); if (allowBPDUpdate) { viewportBlockArea.setBPD(0); @@ -914,22 +914,22 @@ viewportBlockArea.setBPD(this.vpContentBPD); } transferForeignAttributes(viewportBlockArea); - + TraitSetter.setProducerID(viewportBlockArea, getBlockContainerFO().getId()); - TraitSetter.addBorders(viewportBlockArea, - getBlockContainerFO().getCommonBorderPaddingBackground(), + TraitSetter.addBorders(viewportBlockArea, + getBlockContainerFO().getCommonBorderPaddingBackground(), discardBorderBefore, discardBorderAfter, false, false, this); - TraitSetter.addPadding(viewportBlockArea, - getBlockContainerFO().getCommonBorderPaddingBackground(), + TraitSetter.addPadding(viewportBlockArea, + getBlockContainerFO().getCommonBorderPaddingBackground(), discardPaddingBefore, discardPaddingAfter, false, false, this); - // TraitSetter.addBackground(viewportBlockArea, + // TraitSetter.addBackground(viewportBlockArea, // getBlockContainerFO().getCommonBorderPaddingBackground(), // this); - TraitSetter.addMargins(viewportBlockArea, + TraitSetter.addMargins(viewportBlockArea, getBlockContainerFO().getCommonBorderPaddingBackground(), startIndent, endIndent, this); - + viewportBlockArea.setCTM(absoluteCTM); viewportBlockArea.setClip(needClip()); /* @@ -940,7 +940,7 @@ viewportBlockArea.addTrait(Trait.SPACE_AFTER, new Integer(foBlockSpaceAfter.opt)); }*/ - if (abProps.absolutePosition == EN_ABSOLUTE + if (abProps.absolutePosition == EN_ABSOLUTE || abProps.absolutePosition == EN_FIXED) { Point offset = getAbsOffset(); viewportBlockArea.setXOffset(offset.x); @@ -981,17 +981,17 @@ } } - /** + /** * Force current area to be added to parent area. * [EMAIL PROTECTED] */ protected void flush() { viewportBlockArea.addBlock(referenceArea, autoHeight); - TraitSetter.addBackground(viewportBlockArea, + TraitSetter.addBackground(viewportBlockArea, getBlockContainerFO().getCommonBorderPaddingBackground(), this); - + super.flush(); } @@ -1004,7 +1004,7 @@ /** [EMAIL PROTECTED] */ public void discardSpace(KnuthGlue spaceGlue) { // TODO Auto-generated method stub - + } /** [EMAIL PROTECTED] */ @@ -1032,15 +1032,15 @@ */ protected BlockContainer getBlockContainerFO() { return (BlockContainer) fobj; - } + } // --------- Property Resolution related functions --------- // - + /** [EMAIL PROTECTED] */ public boolean getGeneratesReferenceArea() { return true; } - + /** [EMAIL PROTECTED] */ public boolean getGeneratesBlockArea() { return true; @@ -1050,13 +1050,13 @@ public void notifySpace(RelSide side, MinOptMax effectiveLength) { if (RelSide.BEFORE == side) { if (log.isDebugEnabled()) { - log.debug(this + ": Space " + side + ", " + log.debug(this + ": Space " + side + ", " + this.effSpaceBefore + "-> " + effectiveLength); } this.effSpaceBefore = effectiveLength; } else { if (log.isDebugEnabled()) { - log.debug(this + ": Space " + side + ", " + log.debug(this + ": Space " + side + ", " + this.effSpaceAfter + "-> " + effectiveLength); } this.effSpaceAfter = effectiveLength; Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java Thu Jul 24 02:35:34 2008 @@ -26,16 +26,16 @@ * Represents a list of block level Knuth elements. */ public class BlockKnuthSequence extends KnuthSequence { - + private boolean isClosed = false; - + /** * Creates a new and empty list. */ public BlockKnuthSequence() { super(); } - + /** * Creates a new list from an existing list. * @param list The list from which to create the new list. @@ -59,7 +59,7 @@ // log.debug("Cannot append a sequence without a BreakElement"); return false; } - + /** [EMAIL PROTECTED] */ public boolean appendSequence(KnuthSequence sequence, boolean keepTogether, BreakElement breakElement) { Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Thu Jul 24 02:35:34 2008 @@ -42,14 +42,14 @@ /** * LayoutManager for a block FO. */ -public class BlockLayoutManager extends BlockStackingLayoutManager +public class BlockLayoutManager extends BlockStackingLayoutManager implements ConditionalElementListener { /** * logging instance */ private static Log log = LogFactory.getLog(BlockLayoutManager.class); - + private Block curBlockArea; /** Iterator over the child layout managers. */ @@ -59,7 +59,7 @@ private Length lineHeight; private int follow = 2000; //private int middleShift = 0; - + private boolean discardBorderBefore; private boolean discardBorderAfter; private boolean discardPaddingBefore; @@ -91,7 +91,7 @@ //middleShift = -fs.getXHeight() / 2; lineHeight = getBlockFO().getLineHeight().getOptimum(this).getLength(); startIndent = getBlockFO().getCommonMarginBlock().startIndent.getValue(this); - endIndent = getBlockFO().getCommonMarginBlock().endIndent.getValue(this); + endIndent = getBlockFO().getCommonMarginBlock().endIndent.getValue(this); foSpaceBefore = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceBefore, this) .getSpace(); foSpaceAfter = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceAfter, this) @@ -114,19 +114,19 @@ /** [EMAIL PROTECTED] */ public List getNextKnuthElements(LayoutContext context, int alignment) { - resetSpaces(); + resetSpaces(); return super.getNextKnuthElements(context, alignment); } - + private void resetSpaces() { - this.discardBorderBefore = false; - this.discardBorderAfter = false; - this.discardPaddingBefore = false; + this.discardBorderBefore = false; + this.discardBorderAfter = false; + this.discardPaddingBefore = false; this.discardPaddingAfter = false; this.effSpaceBefore = null; this.effSpaceAfter = null; } - + /** * Proxy iterator for Block LM. * This iterator creates and holds the complete list @@ -216,7 +216,7 @@ strength = Math.max(strength, getParentKeepTogetherStrength()); return strength; } - + /** [EMAIL PROTECTED] */ public int getKeepWithNextStrength() { return KeepUtil.getCombinedBlockLevelKeepStrength(getBlockFO().getKeepWithNext()); @@ -298,7 +298,7 @@ } addId(); - + addMarkersToPage(true, isFirst(firstPos), isLast(lastPos)); if (bpUnit == 0) { @@ -340,7 +340,7 @@ //log.debug("Adding areas from " + iFirst + " to " + iLast); //log.debug("splitLength= " + splitLength // + " (" + neededUnits(splitLength) + " units') " - // + (neededUnits(splitLength) * bpUnit - splitLength) + // + (neededUnits(splitLength) * bpUnit - splitLength) // + " spacing"); // add space before and / or after the paragraph // to reach a multiple of bpUnit @@ -385,13 +385,13 @@ addMarkersToPage(false, isFirst(firstPos), isLast(lastPos)); - TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(), + TraitSetter.addSpaceBeforeAfter(curBlockArea, layoutContext.getSpaceAdjust(), effSpaceBefore, effSpaceAfter); flush(); curBlockArea = null; resetSpaces(); - + //Notify end of block layout manager to the PSLM checkEndOfLayout(lastPos); } @@ -414,7 +414,7 @@ curBlockArea.setIPD(super.getContentAreaIPD()); - TraitSetter.addBreaks(curBlockArea, + TraitSetter.addBreaks(curBlockArea, getBlockFO().getBreakBefore(), getBlockFO().getBreakAfter()); // Must get dimensions from parent area @@ -423,14 +423,14 @@ // set traits TraitSetter.setProducerID(curBlockArea, getBlockFO().getId()); - TraitSetter.addBorders(curBlockArea, - getBlockFO().getCommonBorderPaddingBackground(), + TraitSetter.addBorders(curBlockArea, + getBlockFO().getCommonBorderPaddingBackground(), discardBorderBefore, discardBorderAfter, false, false, this); - TraitSetter.addPadding(curBlockArea, - getBlockFO().getCommonBorderPaddingBackground(), + TraitSetter.addPadding(curBlockArea, + getBlockFO().getCommonBorderPaddingBackground(), discardPaddingBefore, discardPaddingAfter, false, false, this); TraitSetter.addMargins(curBlockArea, - getBlockFO().getCommonBorderPaddingBackground(), + getBlockFO().getCommonBorderPaddingBackground(), startIndent, endIndent, this); @@ -458,7 +458,7 @@ */ protected void flush() { if (curBlockArea != null) { - TraitSetter.addBackground(curBlockArea, + TraitSetter.addBackground(curBlockArea, getBlockFO().getCommonBorderPaddingBackground(), this); super.flush(); @@ -472,9 +472,9 @@ protected org.apache.fop.fo.flow.Block getBlockFO() { return (org.apache.fop.fo.flow.Block) fobj; } - + // --------- Property Resolution related functions --------- // - + /** * Returns the IPD of the content area * @return the IPD of the content area @@ -485,7 +485,7 @@ } return super.getContentAreaIPD(); } - + /** * Returns the BPD of the content area @@ -497,7 +497,7 @@ } return -1; } - + /** * [EMAIL PROTECTED] */ @@ -509,13 +509,13 @@ public void notifySpace(RelSide side, MinOptMax effectiveLength) { if (RelSide.BEFORE == side) { if (log.isDebugEnabled()) { - log.debug(this + ": Space " + side + ", " + log.debug(this + ": Space " + side + ", " + this.effSpaceBefore + "-> " + effectiveLength); } this.effSpaceBefore = effectiveLength; } else { if (log.isDebugEnabled()) { - log.debug(this + ": Space " + side + ", " + log.debug(this + ": Space " + side + ", " + this.effSpaceAfter + "-> " + effectiveLength); } this.effSpaceAfter = effectiveLength; Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java Thu Jul 24 02:35:34 2008 @@ -34,7 +34,7 @@ * Provider class for the event producer. */ class Provider { - + /** * Returns an event producer. * @param broadcaster the event broadcaster to use @@ -56,7 +56,7 @@ * @event.severity WARN */ void rowTooTall(Object source, int row, int effCellBPD, int maxCellBPD, Locator loc); - + /** * Auto-table layout is not supported, yet. * @param source the event source @@ -64,28 +64,28 @@ * @event.severity INFO */ void tableFixedAutoWidthNotSupported(Object source, Locator loc); - + /** * An formatting object is too wide. * @param source the event source - * @param elementName the formatting object + * @param elementName the formatting object * @param effIPD the effective extent in inline-progression direction of the table contents * @param maxIPD the maximum extent in inline-progression direction available * @param loc the location of the error or null * @event.severity WARN */ void objectTooWide(Object source, String elementName, int effIPD, int maxIPD, Locator loc); - + /** * An overconstrained geometry adjustment rule was triggered (5.3.4, XSL 1.0). * @param source the event source - * @param elementName the formatting object + * @param elementName the formatting object * @param amount the amount of the adjustment (in mpt) * @param loc the location of the error or null * @event.severity INFO */ void overconstrainedAdjustEndIndent(Object source, String elementName, int amount, Locator loc); - + /** * Contents overflow a viewport. * @param source the event source @@ -97,10 +97,10 @@ * @throws LayoutException the layout error provoked by the method call * @event.severity FATAL */ - void viewportOverflow(Object source, String elementName, + void viewportOverflow(Object source, String elementName, int amount, boolean clip, boolean canRecover, Locator loc) throws LayoutException; - + /** * Contents overflow a region viewport. * @param source the event source @@ -117,7 +117,7 @@ String page, int amount, boolean clip, boolean canRecover, Locator loc) throws LayoutException; - + /** * Indicates that FOP doesn't support flows that are not mapped to region-body, yet. * @param source the event source @@ -129,7 +129,7 @@ */ void flowNotMappingToRegionBody(Object source, String flowName, String masterName, Locator loc) throws UnsupportedOperationException; - + /** * A page sequence master is exhausted. * @param source the event source @@ -152,7 +152,7 @@ */ void missingSubsequencesInPageSequenceMaster(Object source, String pageSequenceMasterName, Locator loc) throws PageProductionException; - + /** * No single-page-master matching in page sequence master. * @param source the event source @@ -164,5 +164,5 @@ */ void noMatchingPageMaster(Object source, String pageSequenceMasterName, String pageMasterName, Locator loc) throws PageProductionException; - + } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java?rev=679326&r1=679325&r2=679326&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java Thu Jul 24 02:35:34 2008 @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,7 +16,7 @@ */ /* $Id$ */ - + package org.apache.fop.layoutmgr; /** @@ -39,7 +39,7 @@ int KEEP_AUTO = Integer.MIN_VALUE; /** The integer value for "always" keep strength */ int KEEP_ALWAYS = Integer.MAX_VALUE; - + int negotiateBPDAdjustment(int adj, KnuthElement lastElement); void discardSpace(KnuthGlue spaceGlue); @@ -60,7 +60,7 @@ * @return the keep-with-previous strength */ int getKeepWithPreviousStrength(); - + /** * @return true if this element must be kept with the previous element. */ @@ -71,7 +71,7 @@ * @return the keep-with-next strength */ int getKeepWithNextStrength(); - + /** * @return true if this element must be kept with the next element. */ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
