Return-Path: Delivered-To: apmail-xmlgraphics-fop-commits-archive@www.apache.org Received: (qmail 32980 invoked from network); 25 Jul 2008 10:59:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Jul 2008 10:59:16 -0000 Received: (qmail 45591 invoked by uid 500); 25 Jul 2008 10:59:16 -0000 Delivered-To: apmail-xmlgraphics-fop-commits-archive@xmlgraphics.apache.org Received: (qmail 45558 invoked by uid 500); 25 Jul 2008 10:59:15 -0000 Mailing-List: contact fop-commits-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: fop-dev@xmlgraphics.apache.org Delivered-To: mailing list fop-commits@xmlgraphics.apache.org Received: (qmail 45549 invoked by uid 99); 25 Jul 2008 10:59:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jul 2008 03:59:15 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jul 2008 10:58:24 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 23A5A2388A8E; Fri, 25 Jul 2008 03:57:36 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r679758 [15/34] - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./ examples/embedding/java/embedding/ examples/embedding/java/embedding/events/ examples/embedding/java/embedding/intermediate/ examples/embedding/java/embedding/model/ e... Date: Fri, 25 Jul 2008 10:56:32 -0000 To: fop-commits@xmlgraphics.apache.org From: vhennebert@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080725105736.23A5A2388A8E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Fri Jul 25 03:55:49 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); } - + /** {@inheritDoc} */ 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); } - + /** {@inheritDoc} */ public int getContentAreaBPD() { if (autoHeight) { @@ -188,26 +188,26 @@ return this.vpContentBPD; } } - + /** {@inheritDoc} */ 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 @@ /** {@inheritDoc} */ protected void observeElementList(List elementList) { - ElementListObserver.observe(elementList, "block-container", + ElementListObserver.observe(elementList, "block-container", bclm.getBlockContainerFO().getId()); } - + /** {@inheritDoc} */ 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); } - + /** {@inheritDoc} */ 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. * {@inheritDoc} */ protected void flush() { viewportBlockArea.addBlock(referenceArea, autoHeight); - TraitSetter.addBackground(viewportBlockArea, + TraitSetter.addBackground(viewportBlockArea, getBlockContainerFO().getCommonBorderPaddingBackground(), this); - + super.flush(); } @@ -1004,7 +1004,7 @@ /** {@inheritDoc} */ public void discardSpace(KnuthGlue spaceGlue) { // TODO Auto-generated method stub - + } /** {@inheritDoc} */ @@ -1032,15 +1032,15 @@ */ protected BlockContainer getBlockContainerFO() { return (BlockContainer) fobj; - } + } // --------- Property Resolution related functions --------- // - + /** {@inheritDoc} */ public boolean getGeneratesReferenceArea() { return true; } - + /** {@inheritDoc} */ 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/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockKnuthSequence.java Fri Jul 25 03:55:49 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; } - + /** {@inheritDoc} */ public boolean appendSequence(KnuthSequence sequence, boolean keepTogether, BreakElement breakElement) { Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Fri Jul 25 03:55:49 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 @@ /** {@inheritDoc} */ 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; } - + /** {@inheritDoc} */ 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; } - + /** * {@inheritDoc} */ @@ -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/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLevelEventProducer.java Fri Jul 25 03:55:49 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/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java Fri Jul 25 03:55:49 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. */ Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Fri Jul 25 03:55:49 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. @@ -91,7 +91,7 @@ private Position auxiliaryPosition; private int contentAreaIPD = 0; - + /** * @param node the fo this LM deals with */ @@ -100,7 +100,7 @@ setGeneratesBlockArea(true); } - /** + /** * @return current area being filled */ protected BlockParent getCurrentArea() { @@ -181,7 +181,7 @@ } return this.auxiliaryPosition; } - + /** * @param len length in millipoints to span with bp units * @return the minimum integer n such that n * bpUnit >= len @@ -194,7 +194,7 @@ * Determines and sets the content area IPD based on available reference area IPD, start- and * end-indent properties. * end-indent is adjusted based on overconstrained geometry rules, if necessary. - * + * * @return the resulting content area IPD */ protected int updateContentAreaIPDwithOverconstrainedAdjust() { @@ -213,9 +213,9 @@ setContentAreaIPD(ipd); return ipd; } - + /** - * Sets the content area IPD by directly supplying the value. + * Sets the content area IPD by directly supplying the value. * end-indent is adjusted based on overconstrained geometry rules, if necessary. * @param contentIPD the IPD of the content * @return the resulting content area IPD @@ -234,7 +234,7 @@ setContentAreaIPD(contentIPD); return contentIPD; } - + /** {@inheritDoc} */ public List getNextKnuthElements(LayoutContext context, int alignment) { //log.debug("BLM.getNextKnuthElements> keep-together = " @@ -247,7 +247,7 @@ BlockLevelLayoutManager prevLM = null; // previously active LM referenceIPD = context.getRefIPD(); - + updateContentAreaIPDwithOverconstrainedAdjust(); List returnedList = null; @@ -268,16 +268,16 @@ addKnuthElementsForSpaceBefore(returnList, alignment); context.updateKeepWithPreviousPending(getKeepWithPreviousStrength()); } - + addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed); firstVisibleMarkServed = true; //Spaces, border and padding to be repeated at each break addPendingMarks(context); - + //Used to indicate a special break-after case when all content has already been generated. BreakElement forcedBreakAfterLast = null; - + while ((curLM = (BlockLevelLayoutManager) getChildLM()) != null) { LayoutContext childLC = new LayoutContext(0); childLC.copyPendingMarksFrom(context); @@ -314,13 +314,13 @@ } if (contentList.isEmpty()) { - // Empty fo:block, zero-length box makes sure the IDs and/or markers + // Empty fo:block, zero-length box makes sure the IDs and/or markers // are registered and borders/padding are painted. returnList.add(new KnuthBox(0, notifyPos(new Position(this)), false)); } // a descendant of this block has break-before contentList.addAll(returnedList); - + /* extension: conversione di tutta la sequenza fin'ora ottenuta */ if (bpUnit > 0) { storedList = contentList; @@ -350,7 +350,7 @@ // a descendant of this block has break-after if (curLM.isFinished() && !hasNextChildLM()) { forcedBreakAfterLast = (BreakElement) ListUtil - .removeLast(contentList); + .removeLast(contentList); context.clearPendingMarks(); break; } @@ -385,15 +385,15 @@ if (!contentList.isEmpty()) { wrapPositionElements(contentList, returnList); } else if (forcedBreakAfterLast == null) { - // Empty fo:block, zero-length box makes sure the IDs and/or markers + // Empty fo:block, zero-length box makes sure the IDs and/or markers // are registered. returnList.add(new KnuthBox(0, notifyPos(new Position(this)), true)); } 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(); if (forcedBreakAfterLast == null) { addKnuthElementsForBreakAfter(returnList, context); @@ -403,9 +403,9 @@ forcedBreakAfterLast.clearPendingMarks(); wrapPositionElement(forcedBreakAfterLast, returnList, false); } - + context.updateKeepWithNextPending(getKeepWithNextStrength()); - + setFinished(true); return returnList; @@ -419,20 +419,20 @@ */ protected void addInBetweenBreak(List contentList, LayoutContext context, LayoutContext childLC) { - if (mustKeepTogether() + if (mustKeepTogether() || context.isKeepWithNextPending() || childLC.isKeepWithPreviousPending()) { - + int strength = getKeepTogetherStrength(); - + //Handle pending keep-with-next strength = Math.max(strength, context.getKeepWithNextPending()); context.clearKeepWithNextPending(); - + //Handle pending keep-with-previous from child LM strength = Math.max(strength, childLC.getKeepWithPreviousPending()); childLC.clearKeepWithPreviousPending(); - + int penalty = KeepUtil.getPenaltyForKeep(strength); // add a penalty to forbid or discourage a break between blocks @@ -440,7 +440,7 @@ new Position(this), penalty, context)); return; } - + ListElement last = (ListElement) ListUtil.getLast(contentList); if (last.isGlue()) { // the last element in contentList is a glue; @@ -465,7 +465,7 @@ // areas for following Positions. The above test aims at preventing // such a situation from occurring. add a null penalty to allow a break // between blocks - + // add a null penalty to allow a break between blocks contentList.add(new BreakElement( new Position(this), 0, context)); @@ -473,11 +473,11 @@ } /** - * {@inheritDoc} + * {@inheritDoc} */ public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) { /*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> " + adj); -/*LF*/ //log.debug(" lastElement e' " + (lastElement.isPenalty() +/*LF*/ //log.debug(" lastElement e' " + (lastElement.isPenalty() // ? "penalty" : (lastElement.isGlue() ? "glue" : "box" ))); /*LF*/ //log.debug(" position e' " + lastElement.getPosition().getClass().getName()); /*LF*/ //log.debug(" " + (bpUnit > 0 ? "unit" : "")); @@ -497,9 +497,9 @@ return adj; } else if (innerPosition instanceof MappingPosition) { // this block has block-progression-unit > 0: the adjustment can concern - // - the space-before or space-after of this block, + // - the space-before or space-after of this block, // - the line number of a descendant of this block - MappingPosition mappingPos = (MappingPosition)innerPosition; + MappingPosition mappingPos = (MappingPosition)innerPosition; if (lastElement.isGlue()) { // lastElement is a glue /*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> bpunit con glue"); @@ -512,7 +512,7 @@ newAdjustment += ((BlockLevelLayoutManager)storedElement .getLayoutManager()).negotiateBPDAdjustment( adj - newAdjustment, storedElement); -/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> (progressivo) righe: " +/*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> (progressivo) righe: " // + newAdjustment); } } @@ -530,7 +530,7 @@ // the original penalty has width > 0 /*LF*/ //log.debug(" BLM.negotiateBPDAdjustment> chiamata passata"); return ((BlockLevelLayoutManager)storedPenalty.getLayoutManager()) - .negotiateBPDAdjustment(storedPenalty.getW(), + .negotiateBPDAdjustment(storedPenalty.getW(), (KnuthElement)storedPenalty); } else { // the original penalty has width = 0 @@ -586,11 +586,11 @@ } /** - * {@inheritDoc} + * {@inheritDoc} */ public List getChangedKnuthElements(List oldList, int alignment) { /*LF*/ //log.debug(""); -/*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = " +/*LF*/ //log.debug(" BLM.getChangedKnuthElements> inizio: oldList.size() = " // + oldList.size()); ListIterator oldListIterator = oldList.listIterator(); KnuthElement returnedElement; @@ -605,10 +605,10 @@ while (oldListIterator.hasNext()) { oldElement = (KnuthElement)oldListIterator.next(); Position innerPosition = ((NonLeafPosition) oldElement.getPosition()).getPosition(); - //log.debug(" BLM> unwrapping: " - // + (oldElement.isBox() ? "box " : (oldElement.isGlue() ? "glue " : "penalty")) + //log.debug(" BLM> unwrapping: " + // + (oldElement.isBox() ? "box " : (oldElement.isGlue() ? "glue " : "penalty")) // + " creato da " + oldElement.getLayoutManager().getClass().getName()); - //log.debug(" BLM> unwrapping: " + //log.debug(" BLM> unwrapping: " // + oldElement.getPosition().getClass().getName()); if (innerPosition != null) { // oldElement was created by a descendant of this BlockLM @@ -645,18 +645,18 @@ } int iLast = ((MappingPosition) el.getPosition()).getLastIndex(); - //log-debug(" si usa storedList da " + iFirst + " a " + iLast + //log-debug(" si usa storedList da " + iFirst + " a " + iLast // + " compresi su " + storedList.size() + " elementi totali"); workList = storedList.subList(iFirst, iLast + 1); } ListIterator workListIterator = workList.listIterator(); - //log.debug(" BLM.getChangedKnuthElements> workList.size() = " + //log.debug(" BLM.getChangedKnuthElements> workList.size() = " // + workList.size() + " da 0 a " + (workList.size() - 1)); while (workListIterator.hasNext()) { currElement = (KnuthElement) workListIterator.next(); - //log.debug("elemento n. " + workListIterator.previousIndex() + //log.debug("elemento n. " + workListIterator.previousIndex() // + " nella workList"); if (prevElement != null && prevElement.getLayoutManager() != currElement.getLayoutManager()) { @@ -667,8 +667,8 @@ currElement.getLayoutManager(); boolean bSomethingAdded = false; if (prevLM != this) { - //log.debug(" BLM.getChangedKnuthElements> chiamata da " - // + fromIndex + " a " + workListIterator.previousIndex() + " su " + //log.debug(" BLM.getChangedKnuthElements> chiamata da " + // + fromIndex + " a " + workListIterator.previousIndex() + " su " // + prevLM.getClass().getName()); returnedList.addAll(prevLM.getChangedKnuthElements(workList.subList( fromIndex, workListIterator.previousIndex()), alignment)); @@ -677,7 +677,7 @@ // prevLM == this // do nothing //log.debug(" BLM.getChangedKnuthElements> elementi propri, " - // + "ignorati, da " + fromIndex + " a " + workListIterator.previousIndex() + // + "ignorati, da " + fromIndex + " a " + workListIterator.previousIndex() // + " su " + prevLM.getClass().getName()); } fromIndex = workListIterator.previousIndex(); @@ -692,7 +692,7 @@ || prevLM.mustKeepWithNext() || currLM.mustKeepWithPrevious())) { // add an infinite penalty to forbid a break between blocks - returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, + returnedList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, new Position(this), false)); } else if (bSomethingAdded && !((KnuthElement) ListUtil.getLast(returnedList)) @@ -707,7 +707,7 @@ BlockLevelLayoutManager currLM = (BlockLevelLayoutManager) currElement.getLayoutManager(); if (currLM != this) { - //log.debug(" BLM.getChangedKnuthElements> chiamata da " + fromIndex + //log.debug(" BLM.getChangedKnuthElements> chiamata da " + fromIndex // + " a " + oldList.size() + " su " + currLM.getClass().getName()); returnedList.addAll(currLM.getChangedKnuthElements( workList.subList(fromIndex, workList.size()), alignment)); @@ -718,7 +718,7 @@ if (!returnedList.isEmpty()) { ListUtil.removeLast(returnedList); } - //log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da " + //log.debug(" BLM.getChangedKnuthElements> elementi propri, ignorati, da " // + fromIndex + " a " + workList.size()); } } @@ -747,7 +747,7 @@ } } - //log.debug(" BLM.getChangedKnuthElements> intermedio: returnedList.size() = " + //log.debug(" BLM.getChangedKnuthElements> intermedio: returnedList.size() = " // + returnedList.size()); /* estensione: conversione complessiva */ @@ -774,18 +774,18 @@ } if (bpUnit > 0 || adjustedSpaceAfter != 0) { if (!spaceAfterIsConditional) { - returnList.add(new KnuthPenalty(0, + returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, new NonLeafPosition(this, null), false)); } if (bpUnit > 0) { returnList.add(new KnuthGlue(0, 0, 0, - SPACE_AFTER_ADJUSTMENT, + SPACE_AFTER_ADJUSTMENT, new NonLeafPosition(this, null), (!spaceAfterIsConditional) ? false : true)); } else { returnList.add(new KnuthGlue(adjustedSpaceAfter, 0, 0, - SPACE_AFTER_ADJUSTMENT, + SPACE_AFTER_ADJUSTMENT, new NonLeafPosition(this, null), (!spaceAfterIsConditional) ? false : true)); } @@ -795,7 +795,7 @@ } } - //log.debug(" BLM.getChangedKnuthElements> finished: returnList.size() = " + //log.debug(" BLM.getChangedKnuthElements> finished: returnList.size() = " // + returnList.size()); return returnList; } @@ -807,7 +807,7 @@ protected int getParentKeepTogetherStrength() { int strength = KEEP_AUTO; if (getParent() instanceof BlockLevelLayoutManager) { - strength = ((BlockLevelLayoutManager)getParent()).getKeepTogetherStrength(); + strength = ((BlockLevelLayoutManager)getParent()).getKeepTogetherStrength(); } else if (getParent() instanceof InlineLayoutManager) { if (((InlineLayoutManager) getParent()).mustKeepTogether()) { strength = KEEP_ALWAYS; @@ -817,7 +817,7 @@ } return strength; } - + /** {@inheritDoc} */ public boolean mustKeepTogether() { return getKeepTogetherStrength() > KEEP_AUTO; @@ -843,7 +843,7 @@ if (borderAndPadding != null) { if (borderAndPadding.getBorderBeforeWidth(false) > 0) { context.addPendingBeforeMark(new BorderElement( - getAuxiliaryPosition(), + getAuxiliaryPosition(), borderAndPadding.getBorderInfo( CommonBorderPaddingBackground.BEFORE).getWidth(), RelSide.BEFORE, @@ -854,15 +854,15 @@ getAuxiliaryPosition(), borderAndPadding.getPaddingLengthProperty( CommonBorderPaddingBackground.BEFORE), - RelSide.BEFORE, + RelSide.BEFORE, false, false, this)); } if (borderAndPadding.getBorderAfterWidth(false) > 0) { context.addPendingAfterMark(new BorderElement( - getAuxiliaryPosition(), + getAuxiliaryPosition(), borderAndPadding.getBorderInfo( CommonBorderPaddingBackground.AFTER).getWidth(), - RelSide.AFTER, + RelSide.AFTER, false, false, this)); } if (borderAndPadding.getPaddingAfter(false, this) > 0) { @@ -870,12 +870,12 @@ getAuxiliaryPosition(), borderAndPadding.getPaddingLengthProperty( CommonBorderPaddingBackground.AFTER), - RelSide.AFTER, + RelSide.AFTER, false, false, this)); } } } - + /** @return the border, padding and background info structure */ private CommonBorderPaddingBackground getBorderPaddingBackground() { if (fobj instanceof org.apache.fop.fo.flow.Block) { @@ -897,7 +897,7 @@ return null; } } - + /** @return the space-before property */ private SpaceProperty getSpaceBeforeProperty() { if (fobj instanceof org.apache.fop.fo.flow.Block) { @@ -919,7 +919,7 @@ return null; } } - + /** @return the space-after property */ private SpaceProperty getSpaceAfterProperty() { if (fobj instanceof org.apache.fop.fo.flow.Block) { @@ -941,11 +941,11 @@ return null; } } - + /** * Creates Knuth elements for before border padding and adds them to the return list. * @param returnList return list to add the additional elements to - * @param isFirst true if this is the first time a layout manager instance needs to generate + * @param isFirst true if this is the first time a layout manager instance needs to generate * border and padding */ protected void addKnuthElementsForBorderPaddingBefore(List returnList, boolean isFirst) { @@ -954,7 +954,7 @@ if (borderAndPadding != null) { if (borderAndPadding.getBorderBeforeWidth(false) > 0) { returnList.add(new BorderElement( - getAuxiliaryPosition(), + getAuxiliaryPosition(), borderAndPadding.getBorderInfo(CommonBorderPaddingBackground.BEFORE) .getWidth(), RelSide.BEFORE, isFirst, false, this)); @@ -963,7 +963,7 @@ returnList.add(new PaddingElement( getAuxiliaryPosition(), borderAndPadding.getPaddingLengthProperty( - CommonBorderPaddingBackground.BEFORE), + CommonBorderPaddingBackground.BEFORE), RelSide.BEFORE, isFirst, false, this)); } } @@ -972,7 +972,7 @@ /** * Creates Knuth elements for after border padding and adds them to the return list. * @param returnList return list to add the additional elements to - * @param isLast true if this is the last time a layout manager instance needs to generate + * @param isLast true if this is the last time a layout manager instance needs to generate * border and padding */ protected void addKnuthElementsForBorderPaddingAfter(List returnList, boolean isLast) { @@ -988,7 +988,7 @@ } if (borderAndPadding.getBorderAfterWidth(false) > 0) { returnList.add(new BorderElement( - getAuxiliaryPosition(), + getAuxiliaryPosition(), borderAndPadding.getBorderInfo(CommonBorderPaddingBackground.AFTER) .getWidth(), RelSide.AFTER, false, isLast, this)); @@ -1002,7 +1002,7 @@ * @param context the layout context * @return true if an element has been added due to a break-before. */ - protected boolean addKnuthElementsForBreakBefore(List returnList, + protected boolean addKnuthElementsForBreakBefore(List returnList, LayoutContext context) { int breakBefore = -1; if (fobj instanceof org.apache.fop.fo.flow.Block) { @@ -1017,11 +1017,11 @@ breakBefore = ((org.apache.fop.fo.flow.table.Table) fobj).getBreakBefore(); } if (breakBefore == EN_PAGE - || breakBefore == EN_COLUMN - || breakBefore == EN_EVEN_PAGE + || breakBefore == EN_COLUMN + || breakBefore == EN_EVEN_PAGE || breakBefore == EN_ODD_PAGE) { // return a penalty element, representing a forced page break - returnList.add(new BreakElement(getAuxiliaryPosition(), + returnList.add(new BreakElement(getAuxiliaryPosition(), 0, -KnuthElement.INFINITE, breakBefore, context)); return true; } else { @@ -1035,7 +1035,7 @@ * @param context the layout context * @return true if an element has been added due to a break-after. */ - protected boolean addKnuthElementsForBreakAfter(List returnList, + protected boolean addKnuthElementsForBreakAfter(List returnList, LayoutContext context) { int breakAfter = -1; if (fobj instanceof org.apache.fop.fo.flow.Block) { @@ -1054,7 +1054,7 @@ || breakAfter == EN_EVEN_PAGE || breakAfter == EN_ODD_PAGE) { // add a penalty element, representing a forced page break - returnList.add(new BreakElement(getAuxiliaryPosition(), + returnList.add(new BreakElement(getAuxiliaryPosition(), 0, -KnuthElement.INFINITE, breakAfter, context)); return true; } else { @@ -1067,21 +1067,21 @@ * @param returnList return list to add the additional elements to * @param alignment vertical alignment */ - protected void addKnuthElementsForSpaceBefore(List returnList/*, + protected void addKnuthElementsForSpaceBefore(List returnList/*, Position returnPosition*/, int alignment) { SpaceProperty spaceBefore = getSpaceBeforeProperty(); // append elements representing space-before if (spaceBefore != null - && !(spaceBefore.getMinimum(this).getLength().getValue(this) == 0 + && !(spaceBefore.getMinimum(this).getLength().getValue(this) == 0 && spaceBefore.getMaximum(this).getLength().getValue(this) == 0)) { returnList.add(new SpaceElement(getAuxiliaryPosition(), spaceBefore, - RelSide.BEFORE, + RelSide.BEFORE, true, false, this)); } /* if (bpUnit > 0 || spaceBefore != null - && !(spaceBefore.getMinimum(this).getLength().getValue(this) == 0 + && !(spaceBefore.getMinimum(this).getLength().getValue(this) == 0 && spaceBefore.getMaximum(this).getLength().getValue(this) == 0)) { if (spaceBefore != null && !spaceBefore.getSpace().isDiscard()) { // add elements to prevent the glue to be discarded @@ -1091,7 +1091,7 @@ } if (bpUnit > 0) { returnList.add(new KnuthGlue(0, 0, 0, - BlockLevelLayoutManager.SPACE_BEFORE_ADJUSTMENT, + BlockLevelLayoutManager.SPACE_BEFORE_ADJUSTMENT, getAuxiliaryPosition(), true)); } else { //if (alignment == EN_JUSTIFY) { returnList.add(new KnuthGlue( @@ -1100,11 +1100,11 @@ - spaceBefore.getOptimum(this).getLength().getValue(this), spaceBefore.getOptimum(this).getLength().getValue(this) - spaceBefore.getMinimum(this).getLength().getValue(this), - BlockLevelLayoutManager.SPACE_BEFORE_ADJUSTMENT, + BlockLevelLayoutManager.SPACE_BEFORE_ADJUSTMENT, getAuxiliaryPosition(), true)); // } else { // returnList.add(new KnuthGlue( -// spaceBefore.getOptimum().getLength().getValue(this), +// spaceBefore.getOptimum().getLength().getValue(this), // 0, 0, BlockLevelLayoutManager.SPACE_BEFORE_ADJUSTMENT, // returnPosition, true)); } @@ -1116,28 +1116,28 @@ * @param returnList return list to add the additional elements to * @param alignment vertical alignment */ - protected void addKnuthElementsForSpaceAfter(List returnList/*, Position returnPosition*/, + protected void addKnuthElementsForSpaceAfter(List returnList/*, Position returnPosition*/, int alignment) { SpaceProperty spaceAfter = getSpaceAfterProperty(); // append elements representing space-after if (spaceAfter != null - && !(spaceAfter.getMinimum(this).getLength().getValue(this) == 0 + && !(spaceAfter.getMinimum(this).getLength().getValue(this) == 0 && spaceAfter.getMaximum(this).getLength().getValue(this) == 0)) { returnList.add(new SpaceElement(getAuxiliaryPosition(), spaceAfter, - RelSide.AFTER, + RelSide.AFTER, false, true, this)); } /* if (bpUnit > 0 || spaceAfter != null - && !(spaceAfter.getMinimum(this).getLength().getValue(this) == 0 + && !(spaceAfter.getMinimum(this).getLength().getValue(this) == 0 && spaceAfter.getMaximum(this).getLength().getValue(this) == 0)) { if (spaceAfter != null && !spaceAfter.getSpace().isDiscard()) { returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, getAuxiliaryPosition(), false)); } if (bpUnit > 0) { - returnList.add(new KnuthGlue(0, 0, 0, + returnList.add(new KnuthGlue(0, 0, 0, BlockLevelLayoutManager.SPACE_AFTER_ADJUSTMENT, getAuxiliaryPosition(), true)); } else { //if (alignment == EN_JUSTIFY) { @@ -1162,7 +1162,7 @@ } protected List createUnitElements(List oldList) { - //log.debug("Start conversion: " + oldList.size() + //log.debug("Start conversion: " + oldList.size() // + " elements, space-before.min=" + layoutProps.spaceBefore.getSpace().min // + " space-after.min=" + layoutProps.spaceAfter.getSpace().min); // add elements at the beginning and at the end of oldList @@ -1192,15 +1192,15 @@ KnuthElement element = (KnuthElement) oldListIterator.next(); if (element.isBox()) { totalLength.add(new MinOptMax(element.getW())); - //log.debug("box " + element.getW()); + //log.debug("box " + element.getW()); } else if (element.isGlue()) { totalLength.min -= ((KnuthGlue) element).getZ(); totalLength.max += ((KnuthGlue) element).getY(); //leafValue = ((LeafPosition) element.getPosition()).getLeafPos(); - //log.debug("glue " + element.getW() + " + " + //log.debug("glue " + element.getW() + " + " // + ((KnuthGlue) element).getY() + " - " + ((KnuthGlue) element).getZ()); } else { - //log.debug((((KnuthPenalty)element).getP() == KnuthElement.INFINITE + //log.debug((((KnuthPenalty)element).getP() == KnuthElement.INFINITE // ? "PENALTY " : "penalty ") + element.getW()); } } @@ -1294,12 +1294,12 @@ int uNewShrink = (unitsBeforeBreak.opt - unitsBeforeBreak.min) - (unsuppressibleUnits.opt - unsuppressibleUnits.min); - //log.debug("(" - // + unsuppressibleUnits.min + "-" + unsuppressibleUnits.opt + "-" + //log.debug("(" + // + unsuppressibleUnits.min + "-" + unsuppressibleUnits.opt + "-" // + unsuppressibleUnits.max + ") " - // + " -> " + unitsBeforeBreak.min + "-" + unitsBeforeBreak.opt + "-" + // + " -> " + unitsBeforeBreak.min + "-" + unitsBeforeBreak.opt + "-" // + unitsBeforeBreak.max - // + " + " + unitsAfterBreak.min + "-" + unitsAfterBreak.opt + "-" + // + " + " + unitsAfterBreak.min + "-" + unitsAfterBreak.opt + "-" // + unitsAfterBreak.max // + (uLengthChange != 0 ? " [length " + uLengthChange + "] " : "") // + (uStretchChange != 0 ? " [stretch " + uStretchChange + "] " : "") @@ -1332,9 +1332,9 @@ // new infinite penalty, glue and box, if necessary if (uNewStretch - uStretchChange > 0 || uNewShrink - uShrinkChange > 0) { - int iStretchUnits = (uNewStretch - uStretchChange > 0 + int iStretchUnits = (uNewStretch - uStretchChange > 0 ? (uNewStretch - uStretchChange) : 0); - int iShrinkUnits = (uNewShrink - uShrinkChange > 0 + int iShrinkUnits = (uNewShrink - uShrinkChange > 0 ? (uNewShrink - uShrinkChange) : 0); newList.add(new KnuthPenalty(0, KnuthElement.INFINITE, false, mappingPos, @@ -1381,7 +1381,7 @@ //log.debug(" PENALTY"); //log.debug(" glue 0 " + uStretchChange + " " + uShrinkChange); //log.debug(" penalty " + uLengthChange + " * unit"); - //log.debug(" glue 0 " + (- uStretchChange) + " " + //log.debug(" glue 0 " + (- uStretchChange) + " " // + (- uShrinkChange)); } else if (oldListIterator.hasNext()) { // new penalty @@ -1483,11 +1483,11 @@ StackingIter(Iterator parentIter) { super(parentIter); } - + protected LayoutManager getLM(Object nextObj) { return ((Position) nextObj).getLM(); } - + protected Position getPos(Object nextObj) { return ((Position) nextObj); } @@ -1496,24 +1496,24 @@ protected static class MappingPosition extends Position { private int iFirstIndex; private int iLastIndex; - + public MappingPosition(LayoutManager lm, int first, int last) { super(lm); iFirstIndex = first; iLastIndex = last; } - + public int getFirstIndex() { return iFirstIndex; } - + public int getLastIndex() { return iLastIndex; } } /** - * "wrap" the Position inside each element moving the elements from + * "wrap" the Position inside each element moving the elements from * SourceList to targetList * @param sourceList source list * @param targetList target list receiving the wrapped position elements @@ -1521,16 +1521,16 @@ protected void wrapPositionElements(List sourceList, List targetList) { wrapPositionElements(sourceList, targetList, false); } - + /** - * "wrap" the Position inside each element moving the elements from + * "wrap" the Position inside each element moving the elements from * SourceList to targetList * @param sourceList source list * @param targetList target list receiving the wrapped position elements * @param force if true, every Position is wrapped regardless of its LM of origin */ protected void wrapPositionElements(List sourceList, List targetList, boolean force) { - + ListIterator listIter = sourceList.listIterator(); Object tempElement; while (listIter.hasNext()) { @@ -1542,7 +1542,7 @@ force); } else if (tempElement instanceof List) { wrapPositionElements( - (List) tempElement, + (List) tempElement, targetList, force); } @@ -1563,12 +1563,12 @@ targetList.add(el); } - + /** @return the sum of start-indent and end-indent */ protected int getIPIndents() { return startIndent + endIndent; } - + /** * Returns the IPD of the content area * @return the IPD of the content area @@ -1576,7 +1576,7 @@ public int getContentAreaIPD() { return contentAreaIPD; } - + /** * Sets the IPD of the content area * @param contentAreaIPD the IPD of the content area @@ -1584,7 +1584,7 @@ protected void setContentAreaIPD(int contentAreaIPD) { this.contentAreaIPD = contentAreaIPD; } - + /** * Returns the BPD of the content area * @return the BPD of the content area @@ -1592,6 +1592,6 @@ public int getContentAreaBPD() { return -1; } - + } Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BorderElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BorderElement.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BorderElement.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BorderElement.java Fri Jul 25 03:55:49 2008 @@ -42,7 +42,7 @@ boolean isFirst, boolean isLast, PercentBaseContext context) { super(position, condLength, side, isFirst, isLast, context); } - + /** {@inheritDoc} */ public void notifyLayoutManager(MinOptMax effectiveLength) { LayoutManager lm = getOriginatingLayoutManager(); @@ -54,7 +54,7 @@ + lm.getClass().getName()); } } - + /** {@inheritDoc} */ public String toString() { StringBuffer sb = new StringBuffer("Border["); @@ -62,5 +62,5 @@ sb.append("]"); return sb.toString(); } - + } Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BorderOrPaddingElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BorderOrPaddingElement.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BorderOrPaddingElement.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BorderOrPaddingElement.java Fri Jul 25 03:55:49 2008 @@ -41,11 +41,11 @@ RelSide side, boolean isFirst, boolean isLast, PercentBaseContext context) { super(position, - new MinOptMax(condLength.getLength().getValue(context)), side, + new MinOptMax(condLength.getLength().getValue(context)), side, condLength.isDiscard(), isFirst, isLast); } - + /** {@inheritDoc} */ public abstract void notifyLayoutManager(MinOptMax effectiveLength); - + } Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BreakElement.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BreakElement.java?rev=679758&r1=679757&r2=679758&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BreakElement.java (original) +++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/BreakElement.java Fri Jul 25 03:55:49 2008 @@ -33,7 +33,7 @@ private int breakClass = -1; private List pendingBeforeMarks; private List pendingAfterMarks; - + /** * Main constructor * @param position the Position instance needed by the addAreas stage of the LMs. @@ -43,10 +43,10 @@ public BreakElement(Position position, int penaltyValue, LayoutContext context) { this(position, 0, penaltyValue, -1, context); } - + /** * Constructor for hard breaks. - * + * * @param position the Position instance needed by the addAreas stage of the LMs. * @param penaltyWidth the penalty width * @param penaltyValue the penalty value for the penalty element to be constructed @@ -55,7 +55,7 @@ * {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE}) * @param context the layout context which contains the pending conditional elements */ - public BreakElement(Position position, int penaltyWidth, int penaltyValue, + public BreakElement(Position position, int penaltyWidth, int penaltyValue, int breakClass, LayoutContext context) { super(position); this.penaltyWidth = penaltyWidth; @@ -64,7 +64,7 @@ this.pendingBeforeMarks = context.getPendingBeforeMarks(); this.pendingAfterMarks = context.getPendingAfterMarks(); } - + /** {@inheritDoc} */ public boolean isConditional() { return false; //Does not really apply here @@ -80,12 +80,12 @@ public int getPenaltyWidth() { return this.penaltyWidth; } - + /** @return the penalty value */ public int getPenaltyValue() { return this.penaltyValue; } - + /** * Sets the penalty value. * @param p the new penalty value @@ -93,15 +93,15 @@ public void setPenaltyValue(int p) { this.penaltyValue = p; } - + /** {@inheritDoc} */ public boolean isForcedBreak() { return penaltyValue == -KnuthElement.INFINITE; } - + /** * Returns the break class of this penalty. - * + * * @return one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, * {@link Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, * {@link Constants#EN_ODD_PAGE} @@ -109,10 +109,10 @@ public int getBreakClass() { return breakClass; } - + /** * Sets the break class. - * + * * @param breakClass one of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, * {@link Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE}, * {@link Constants#EN_ODD_PAGE} @@ -120,17 +120,17 @@ public void setBreakClass(int breakClass) { this.breakClass = breakClass; } - + /** @return the pending border and padding elements at the before edge */ public List getPendingBeforeMarks() { return this.pendingBeforeMarks; } - + /** @return the pending border and padding elements at the after edge */ public List getPendingAfterMarks() { return this.pendingAfterMarks; } - + /** * Clears all pending marks associated with this break element. This is used in break * cases where we only know very late if the break is actually after all the content @@ -140,7 +140,7 @@ this.pendingBeforeMarks = null; this.pendingAfterMarks = null; } - + /** {@inheritDoc} */ public String toString() { StringBuffer sb = new StringBuffer(); --------------------------------------------------------------------- To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org