aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java')
-rw-r--r--src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java92
1 files changed, 67 insertions, 25 deletions
diff --git a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
index d18f58a39..0f355aadc 100644
--- a/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
+++ b/src/org/apache/fop/layoutmgr/InlineStackingLayoutManager.java
@@ -1,12 +1,59 @@
/*
* $Id$
- * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved.
- * For details on use and redistribution please refer to the
- * LICENSE file included with these sources.
- */
-
+ * ============================================================================
+ * The Apache Software License, Version 1.1
+ * ============================================================================
+ *
+ * Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modifica-
+ * tion, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if any, must
+ * include the following acknowledgment: "This product includes software
+ * developed by the Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself, if
+ * and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "FOP" and "Apache Software Foundation" must not be used to
+ * endorse or promote products derived from this software without prior
+ * written permission. For written permission, please contact
+ * apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache", nor may
+ * "Apache" appear in their name, without prior written permission of the
+ * Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
+ * DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ============================================================================
+ *
+ * This software consists of voluntary contributions made by many individuals
+ * on behalf of the Apache Software Foundation and was originally created by
+ * James Tauber <jtauber@jtauber.com>. For more information on the Apache
+ * Software Foundation, please see <http://www.apache.org/>.
+ */
package org.apache.fop.layoutmgr;
+import java.util.Iterator;
+import java.util.ListIterator;
+import java.util.HashMap;
+
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyManager;
import org.apache.fop.layout.BorderAndPadding;
@@ -17,10 +64,6 @@ import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.InlineParent;
import org.apache.fop.area.inline.Space;
-import java.util.Iterator;
-import java.util.ListIterator;
-import java.util.HashMap;
-
/**
* LayoutManager for objects which stack children in the inline direction,
* such as Inline or Line
@@ -173,8 +216,8 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
// Back up the child LM Position
Position childPos = prevPos.getPosition();
reset(childPos);
- if (prevBP != null &&
- prevBP.getLayoutManager() != childPos.getLM()) {
+ if (prevBP != null
+ && prevBP.getLayoutManager() != childPos.getLM()) {
childLC = null;
}
prevBP = new BreakPoss(childPos);
@@ -198,8 +241,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
* propagate to first child LM
*/
public boolean canBreakBefore(LayoutContext context) {
- if (inlineProps.spaceStart.space.min > 0 ||
- hasLeadingFence(false)) {
+ if (inlineProps.spaceStart.getSpace().min > 0 || hasLeadingFence(false)) {
return true;
}
LayoutProcessor lm = getChildLM();
@@ -264,8 +306,8 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
* and initialize pending space from previous LM sibling's
* trailing space specifiers.
*/
- boolean bFirstChildBP = (prevBP == null ||
- prevBP.getLayoutManager() != curLM);
+ boolean bFirstChildBP = (prevBP == null
+ || prevBP.getLayoutManager() != curLM);
initChildLC(childLC, prevBP, lc.startsNewArea(),
bFirstChildBP, leadingSpace);
@@ -273,9 +315,9 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
childLC.setHyphContext(lc.getHyphContext());
}
- if (((bp = curLM.getNextBreakPoss(childLC)) != null) ||
- (lc.tryHyphenate() &&
- !lc.getHyphContext().hasMoreHyphPoints())) {
+ if (((bp = curLM.getNextBreakPoss(childLC)) != null)
+ || (lc.tryHyphenate()
+ && !lc.getHyphContext().hasMoreHyphPoints())) {
break;
}
// If LM has no content, should it generate any area? If not,
@@ -500,7 +542,7 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
context.setTrailingSpace(getContext().getTrailingSpace());
}
// Add own trailing space to parent context (or set on area?)
- if(context.getTrailingSpace() != null) {
+ if (context.getTrailingSpace() != null) {
context.getTrailingSpace().addSpace(inlineProps.spaceEnd);
}
@@ -508,10 +550,10 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
TraitSetter.setBorderPaddingTraits(getCurrentArea(),
borderProps, bAreaCreated, !bIsLast);
- if(borderProps != null) {
+ if (borderProps != null) {
TraitSetter.addBorders(getCurrentArea(), borderProps);
}
- if(backgroundProps != null) {
+ if (backgroundProps != null) {
TraitSetter.addBackground(getCurrentArea(), backgroundProps);
}
@@ -556,12 +598,12 @@ public class InlineStackingLayoutManager extends AbstractLayoutManager {
int iAdjust = spaceRange.opt;
if (dSpaceAdjust > 0.0) {
// Stretch by factor
- iAdjust += (int)((double)(spaceRange.max -
- spaceRange.opt) * dSpaceAdjust);
+ iAdjust += (int)((double)(spaceRange.max
+ - spaceRange.opt) * dSpaceAdjust);
} else if (dSpaceAdjust < 0.0) {
// Shrink by factor
- iAdjust += (int)((double)(spaceRange.opt -
- spaceRange.min) * dSpaceAdjust);
+ iAdjust += (int)((double)(spaceRange.opt
+ - spaceRange.min) * dSpaceAdjust);
}
if (iAdjust != 0) {
//getLogger().debug("Add leading space: " + iAdjust);