aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaren Lease <klease@apache.org>2002-05-10 12:24:19 +0000
committerKaren Lease <klease@apache.org>2002-05-10 12:24:19 +0000
commitdb755bf42556bc19d396ae22cb919fdb995fe4cf (patch)
treea43f47d55c69c1c1c17e9158a2e15140ff1daaf6 /src
parent37dffb850401e486fc48240e6f6bd82db4fa7546 (diff)
downloadxmlgraphics-fop-db755bf42556bc19d396ae22cb919fdb995fe4cf.tar.gz
xmlgraphics-fop-db755bf42556bc19d396ae22cb919fdb995fe4cf.zip
Add support for nested inlines using the BreakPoss logic.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194817 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/area/inline/InlineParent.java41
-rw-r--r--src/org/apache/fop/fo/FOText.java4
-rw-r--r--src/org/apache/fop/fo/FObjMixed.java22
-rw-r--r--src/org/apache/fop/fo/PropertyManager.java27
-rw-r--r--src/org/apache/fop/layout/BorderAndPadding.java17
5 files changed, 75 insertions, 36 deletions
diff --git a/src/org/apache/fop/area/inline/InlineParent.java b/src/org/apache/fop/area/inline/InlineParent.java
new file mode 100644
index 000000000..4ec3d0447
--- /dev/null
+++ b/src/org/apache/fop/area/inline/InlineParent.java
@@ -0,0 +1,41 @@
+/*
+ * $Id$
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources.
+ */
+
+package org.apache.fop.area.inline;
+
+import org.apache.fop.area.Area;
+import org.apache.fop.area.Block;
+import org.apache.fop.render.Renderer;
+
+import java.util.List;
+import java.util.ArrayList;
+
+// this is an inline area that can have other inlines as children
+public class InlineParent extends InlineArea {
+ ArrayList inlines = new ArrayList();
+ int width;
+
+ public InlineParent() {
+ }
+
+ public void render(Renderer renderer) {
+ renderer.renderInlineParent(this);
+ }
+
+ public void addChild(InlineArea child) {
+ inlines.add(child);
+ }
+
+ public List getChildAreas() {
+ return inlines;
+ }
+
+ public int getWidth() {
+ return width;
+ }
+
+}
diff --git a/src/org/apache/fop/fo/FOText.java b/src/org/apache/fop/fo/FOText.java
index 589bf4a11..3cf9db50d 100644
--- a/src/org/apache/fop/fo/FOText.java
+++ b/src/org/apache/fop/fo/FOText.java
@@ -81,9 +81,9 @@ public class FOText extends FObj {
ca = new char[length];
System.arraycopy(tmp, 0, ca, 0, length);
}
- list.add(new TextLayoutManager(this, ca, textInfo));
+ // list.add(new TextLayoutManager(this, ca, textInfo));
// TEST VARIANT USING Karen's BreakPoss scheme
- // list.add(new TextBPLayoutManager(this, ca, textInfo));
+ list.add(new TextBPLayoutManager(this, ca, textInfo));
}
public CharIterator charIterator() {
diff --git a/src/org/apache/fop/fo/FObjMixed.java b/src/org/apache/fop/fo/FObjMixed.java
index 45e77dfe5..34899ff63 100644
--- a/src/org/apache/fop/fo/FObjMixed.java
+++ b/src/org/apache/fop/fo/FObjMixed.java
@@ -13,6 +13,8 @@ import org.apache.fop.layout.FontInfo;
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.StreamRenderer;
import org.apache.fop.datatypes.ColorType;
+import org.apache.fop.layoutmgr.InlineStackingBPLayoutManager;
+import org.apache.fop.layoutmgr.LMiter;
import java.util.List;
@@ -33,15 +35,17 @@ public class FObjMixed extends FObj {
}
public void addLayoutManager(List lms) {
- // set start and end properties for this element, id, etc.
- int numChildren = this.children.size();
- for (int i = 0; i < numChildren; i++) {
- Object o = children.get(i);
- if (o instanceof FObj) {
- FObj fo = (FObj) o;
- fo.addLayoutManager(lms);
- }
- }
+ lms.add(new InlineStackingBPLayoutManager(this,
+ new LMiter(children.listIterator())));
+ // set start and end properties for this element, id, etc.
+// int numChildren = this.children.size();
+// for (int i = 0; i < numChildren; i++) {
+// Object o = children.get(i);
+// if (o instanceof FObj) {
+// FObj fo = (FObj) o;
+// fo.addLayoutManager(lms);
+// }
+// }
}
protected void addCharacters(char data[], int start, int length) {
diff --git a/src/org/apache/fop/fo/PropertyManager.java b/src/org/apache/fop/fo/PropertyManager.java
index b72a19584..7a720ff35 100644
--- a/src/org/apache/fop/fo/PropertyManager.java
+++ b/src/org/apache/fop/fo/PropertyManager.java
@@ -47,10 +47,10 @@ public class PropertyManager {
private HyphenationProps hyphProps = null;
private TextInfo textInfo = null;
- private String[] saLeft;
- private String[] saRight;
- private String[] saTop;
- private String[] saBottom;
+ private static String[] saBefore = new String[] {"before"};
+ private static String[] saAfter = new String[] {"after"};
+ private static String[] saStart = new String[] {"start"};
+ private static String[] saEnd = new String[] {"end"};
private static MessageFormat msgColorFmt =
new MessageFormat("border-{0}-color");
@@ -69,16 +69,6 @@ public class PropertyManager {
m_fontInfo = fontInfo;
}
- private void initDirections() {
- saLeft = new String[1];
- saRight = new String[1];
- saTop = new String[1];
- saBottom = new String[1];
- saTop[0] = properties.wmAbsToRel(PropertyList.TOP);
- saBottom[0] = properties.wmAbsToRel(PropertyList.BOTTOM);
- saLeft[0] = properties.wmAbsToRel(PropertyList.LEFT);
- saRight[0] = properties.wmAbsToRel(PropertyList.RIGHT);
- }
public FontState getFontState(FontInfo fontInfo) throws FOPException {
if (fontState == null) {
@@ -106,12 +96,11 @@ public class PropertyManager {
public BorderAndPadding getBorderAndPadding() {
if (borderAndPadding == null) {
this.borderAndPadding = new BorderAndPadding();
- initDirections();
- initBorderInfo(BorderAndPadding.TOP, saTop);
- initBorderInfo(BorderAndPadding.BOTTOM, saBottom);
- initBorderInfo(BorderAndPadding.LEFT, saLeft);
- initBorderInfo(BorderAndPadding.RIGHT, saRight);
+ initBorderInfo(BorderAndPadding.BEFORE, saBefore);
+ initBorderInfo(BorderAndPadding.AFTER, saAfter);
+ initBorderInfo(BorderAndPadding.START, saStart);
+ initBorderInfo(BorderAndPadding.END, saEnd);
}
return borderAndPadding;
}
diff --git a/src/org/apache/fop/layout/BorderAndPadding.java b/src/org/apache/fop/layout/BorderAndPadding.java
index ace036800..42ee3df52 100644
--- a/src/org/apache/fop/layout/BorderAndPadding.java
+++ b/src/org/apache/fop/layout/BorderAndPadding.java
@@ -12,10 +12,15 @@ import org.apache.fop.datatypes.CondLength;
public class BorderAndPadding implements Cloneable {
- public static final int TOP = 0;
- public static final int RIGHT = 1;
- public static final int BOTTOM = 2;
- public static final int LEFT = 3;
+ public static final int BEFORE = 0;
+ public static final int AFTER = 1;
+ public static final int START = 2;
+ public static final int END = 3;
+
+ public static final int TOP = BEFORE;
+ public static final int BOTTOM = AFTER;
+ public static final int LEFT = START;
+ public static final int RIGHT = END;
private static class ResolvedCondLength implements Cloneable {
int iLength; // Resolved length value
@@ -126,7 +131,7 @@ public class BorderAndPadding implements Cloneable {
}
- private int getBorderWidth(int side, boolean bDiscard) {
+ public int getBorderWidth(int side, boolean bDiscard) {
if ((borderInfo[side] == null)
|| (bDiscard && borderInfo[side].mWidth.bDiscard)) {
return 0;
@@ -148,7 +153,7 @@ public class BorderAndPadding implements Cloneable {
return 0;
}
- private int getPadding(int side, boolean bDiscard) {
+ public int getPadding(int side, boolean bDiscard) {
if ((padding[side] == null) || (bDiscard && padding[side].bDiscard)) {
return 0;
} else