diff options
Diffstat (limited to 'src/java/org/apache/fop/area')
-rw-r--r-- | src/java/org/apache/fop/area/Area.java | 16 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/Block.java | 16 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/BlockParent.java | 21 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/BlockViewport.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/LineArea.java | 14 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/SideFloat.java | 31 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/inline/InlineViewport.java | 3 | ||||
-rw-r--r-- | src/java/org/apache/fop/area/inline/TextArea.java | 3 |
8 files changed, 108 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/area/Area.java b/src/java/org/apache/fop/area/Area.java index 628e9e3ad..895367c19 100644 --- a/src/java/org/apache/fop/area/Area.java +++ b/src/java/org/apache/fop/area/Area.java @@ -111,6 +111,8 @@ public class Area extends AreaTreeObject implements Serializable { /** the area's block-progression-dimension */ protected int bpd; + protected int effectiveIPD = -1; + /** * Resolved bidirectional level for area. */ @@ -208,6 +210,10 @@ public class Area extends AreaTreeObject implements Serializable { return getBorderAndPaddingWidthStart() + getIPD() + getBorderAndPaddingWidthEnd(); } + public int getEffectiveAllocIPD() { + return getBorderAndPaddingWidthStart() + getEffectiveIPD() + getBorderAndPaddingWidthEnd(); + } + /** * Get the allocation block progression dimension of this area. * This adds the content, borders, padding and spaces to find the @@ -499,4 +505,14 @@ public class Area extends AreaTreeObject implements Serializable { sb.append("}"); return sb.toString(); } + + public int getEffectiveIPD() { + return 0; + } + + public void activateEffectiveIPD() { + if (effectiveIPD != -1) { + ipd = effectiveIPD; + } + } } diff --git a/src/java/org/apache/fop/area/Block.java b/src/java/org/apache/fop/area/Block.java index e04a5dc43..565146415 100644 --- a/src/java/org/apache/fop/area/Block.java +++ b/src/java/org/apache/fop/area/Block.java @@ -184,5 +184,21 @@ public class Block extends BlockParent { return location; } + // maybe this can be done in the parent? + public int getEffectiveIPD() { + int eIPD = super.getEffectiveIPD(); + if (eIPD != 0) { + effectiveIPD = eIPD; + } + return eIPD; + } + + // maybe this can be done in the parent? + public void activateEffectiveIPD() { + super.activateEffectiveIPD(); + if (effectiveIPD != -1) { + ipd = effectiveIPD; + } + } } diff --git a/src/java/org/apache/fop/area/BlockParent.java b/src/java/org/apache/fop/area/BlockParent.java index 72baaeccf..fa599f31a 100644 --- a/src/java/org/apache/fop/area/BlockParent.java +++ b/src/java/org/apache/fop/area/BlockParent.java @@ -123,4 +123,25 @@ public class BlockParent extends Area { public int getYOffset() { return yOffset; } + + public int getEffectiveIPD() { + int maxIPD = 0; + if (children != null) { + for (Area area : children) { + int effectiveIPD = area.getEffectiveIPD(); + if (effectiveIPD > maxIPD) { + maxIPD = effectiveIPD; + } + } + } + return maxIPD; + } + + public void activateEffectiveIPD() { + if (children != null) { + for (Area area : children) { + area.activateEffectiveIPD(); + } + } + } } diff --git a/src/java/org/apache/fop/area/BlockViewport.java b/src/java/org/apache/fop/area/BlockViewport.java index 58d8d2106..d33a060e4 100644 --- a/src/java/org/apache/fop/area/BlockViewport.java +++ b/src/java/org/apache/fop/area/BlockViewport.java @@ -93,5 +93,9 @@ public class BlockViewport extends Block implements Viewport { return null; } } + + public int getEffectiveIPD() { + return getIPD(); + } } diff --git a/src/java/org/apache/fop/area/LineArea.java b/src/java/org/apache/fop/area/LineArea.java index 3213eb588..8639b8201 100644 --- a/src/java/org/apache/fop/area/LineArea.java +++ b/src/java/org/apache/fop/area/LineArea.java @@ -283,5 +283,19 @@ public class LineArea extends Area { // been handled, modifying the line indent } } + + public int getEffectiveIPD() { + int maxIPD = 0; + if (inlineAreas != null) { + for (Area area : inlineAreas) { + int effectiveIPD = area.getEffectiveIPD(); + if (effectiveIPD > maxIPD) { + maxIPD = effectiveIPD; + } + } + } + return maxIPD; + } + } diff --git a/src/java/org/apache/fop/area/SideFloat.java b/src/java/org/apache/fop/area/SideFloat.java new file mode 100644 index 000000000..af653efbf --- /dev/null +++ b/src/java/org/apache/fop/area/SideFloat.java @@ -0,0 +1,31 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.area; + +public class SideFloat extends Block { + + private static final long serialVersionUID = 2058594336594375047L; + + public SideFloat() { + setAreaClass(Area.CLASS_SIDE_FLOAT); + addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); + setPositioning(Block.ABSOLUTE); + } +} diff --git a/src/java/org/apache/fop/area/inline/InlineViewport.java b/src/java/org/apache/fop/area/inline/InlineViewport.java index 32c4c1235..e111bdd9d 100644 --- a/src/java/org/apache/fop/area/inline/InlineViewport.java +++ b/src/java/org/apache/fop/area/inline/InlineViewport.java @@ -149,4 +149,7 @@ public class InlineViewport extends InlineArea implements Viewport { this.content = (Area) in.readObject(); } + public int getEffectiveIPD() { + return getIPD(); + } } diff --git a/src/java/org/apache/fop/area/inline/TextArea.java b/src/java/org/apache/fop/area/inline/TextArea.java index a8d07148f..91a75d558 100644 --- a/src/java/org/apache/fop/area/inline/TextArea.java +++ b/src/java/org/apache/fop/area/inline/TextArea.java @@ -209,5 +209,8 @@ public class TextArea extends AbstractTextArea { } } + public int getEffectiveIPD() { + return getIPD(); + } } |