aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeiron Liddle <keiron@apache.org>2002-03-21 09:34:19 +0000
committerKeiron Liddle <keiron@apache.org>2002-03-21 09:34:19 +0000
commit5bbf82caf4d455907eb5581c6993b4d30fc19ac9 (patch)
tree81da3fdb2fa7aeef91b8dfe7c2f07d43941b5e8d /src
parent83a7d296b8b9ed22ab0e437787952635d4aef4fe (diff)
downloadxmlgraphics-fop-5bbf82caf4d455907eb5581c6993b4d30fc19ac9.tar.gz
xmlgraphics-fop-5bbf82caf4d455907eb5581c6993b4d30fc19ac9.zip
changed property to trait for areas
added ipd to area git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194713 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/org/apache/fop/area/Area.java9
-rw-r--r--src/org/apache/fop/area/Block.java15
-rw-r--r--src/org/apache/fop/area/LineArea.java4
-rw-r--r--src/org/apache/fop/area/LineTrait.java (renamed from src/org/apache/fop/area/LineProperty.java)2
-rw-r--r--src/org/apache/fop/area/Trait.java (renamed from src/org/apache/fop/area/Property.java)2
-rw-r--r--src/org/apache/fop/area/inline/InlineArea.java14
-rw-r--r--src/org/apache/fop/render/pdf/PDFRenderer.java10
-rw-r--r--src/org/apache/fop/render/xml/XMLRenderer.java36
-rw-r--r--src/org/apache/fop/tools/AreaTreeBuilder.java40
9 files changed, 75 insertions, 57 deletions
diff --git a/src/org/apache/fop/area/Area.java b/src/org/apache/fop/area/Area.java
index 2b429d5bc..f041f9227 100644
--- a/src/org/apache/fop/area/Area.java
+++ b/src/org/apache/fop/area/Area.java
@@ -46,6 +46,7 @@ public class Area implements Serializable {
private int areaClass=CLASS_NORMAL;
private FObj genFObj;
+ private int ipd;
protected Area parent =null; // Doesn't need to be saved in serialization
@@ -57,6 +58,14 @@ public class Area implements Serializable {
this.areaClass = areaClass;
}
+ public void setIPD(int i) {
+ ipd = i;
+ }
+
+ public int getIPD() {
+ return ipd;
+ }
+
/**
* Return a length range describing the minimum, optimum and maximum
* lengths available for content in the block-progression-direction.
diff --git a/src/org/apache/fop/area/Block.java b/src/org/apache/fop/area/Block.java
index ccad5f345..9073c23a7 100644
--- a/src/org/apache/fop/area/Block.java
+++ b/src/org/apache/fop/area/Block.java
@@ -59,16 +59,17 @@ public class Block extends BlockParent implements Serializable {
}
// store properties in array list, need better solution
- ArrayList props = null;
+ ArrayList traits = null;
- public void addProperty(Property prop) {
- if (props == null) {
- props = new ArrayList();
+ public void addTrait(Trait prop) {
+ if (traits == null) {
+ traits = new ArrayList();
}
- props.add(prop);
+ traits.add(prop);
}
- public List getPropertyList() {
- return props;
+ public List getTraitList() {
+ return traits;
}
}
+
diff --git a/src/org/apache/fop/area/LineArea.java b/src/org/apache/fop/area/LineArea.java
index 8184d332a..5da4fee09 100644
--- a/src/org/apache/fop/area/LineArea.java
+++ b/src/org/apache/fop/area/LineArea.java
@@ -50,14 +50,14 @@ public class LineArea extends Area {
// store properties in array list, need better solution
ArrayList props = null;
- public void addProperty(Property prop) {
+ public void addTrait(Trait prop) {
if (props == null) {
props = new ArrayList();
}
props.add(prop);
}
- public List getPropertyList() {
+ public List getTraitList() {
return props;
}
}
diff --git a/src/org/apache/fop/area/LineProperty.java b/src/org/apache/fop/area/LineTrait.java
index d5eb3dad9..e02725c28 100644
--- a/src/org/apache/fop/area/LineProperty.java
+++ b/src/org/apache/fop/area/LineTrait.java
@@ -7,7 +7,7 @@
package org.apache.fop.area;
-public class LineProperty extends Property {
+public class LineTrait extends Trait {
int[] range;
}
diff --git a/src/org/apache/fop/area/Property.java b/src/org/apache/fop/area/Trait.java
index 61d7b3bc2..7ac537a79 100644
--- a/src/org/apache/fop/area/Property.java
+++ b/src/org/apache/fop/area/Trait.java
@@ -12,7 +12,7 @@ import org.apache.fop.datatypes.ColorType;
import java.io.Serializable;
// properties should be serialized by the holder
-public class Property implements Serializable {
+public class Trait implements Serializable {
public static final int ID_LINK = 0;
public static final int INTERNAL_LINK = 1; //resolved
public static final int EXTERNAL_LINK = 2;
diff --git a/src/org/apache/fop/area/inline/InlineArea.java b/src/org/apache/fop/area/inline/InlineArea.java
index 5a63ef0ed..b105846fb 100644
--- a/src/org/apache/fop/area/inline/InlineArea.java
+++ b/src/org/apache/fop/area/inline/InlineArea.java
@@ -9,7 +9,7 @@ package org.apache.fop.area.inline;
import org.apache.fop.area.Area;
import org.apache.fop.area.MinOptMax;
-import org.apache.fop.area.Property;
+import org.apache.fop.area.Trait;
import org.apache.fop.render.Renderer;
import java.util.List;
@@ -46,6 +46,14 @@ public class InlineArea extends Area {
return width;
}
+ public void setHeight(int h) {
+ height = h;
+ }
+
+ public int getHeight() {
+ return height;
+ }
+
public MinOptMax getAllocationIPD() {
// Should also account for any borders and padding in the
// inline progression dimension
@@ -60,14 +68,14 @@ public class InlineArea extends Area {
return verticalPosition;
}
- public void addProperty(Property prop) {
+ public void addTrait(Trait prop) {
if (props == null) {
props = new ArrayList();
}
props.add(prop);
}
- public List getPropertyList() {
+ public List getTraitList() {
return props;
}
}
diff --git a/src/org/apache/fop/render/pdf/PDFRenderer.java b/src/org/apache/fop/render/pdf/PDFRenderer.java
index 4713c38ef..0db612f8d 100644
--- a/src/org/apache/fop/render/pdf/PDFRenderer.java
+++ b/src/org/apache/fop/render/pdf/PDFRenderer.java
@@ -266,10 +266,10 @@ public class PDFRenderer extends PrintRenderer {
FontState fs = null;
- List props = word.getPropertyList();
+ List props = word.getTraitList();
for(int count = 0; count < props.size(); count++) {
- Property pro = (Property)props.get(count);
- if(pro.propType == Property.FONT_STATE) {
+ Trait pro = (Trait)props.get(count);
+ if(pro.propType == Trait.FONT_STATE) {
fs = (FontState)pro.data;
}
}
@@ -289,7 +289,7 @@ public class PDFRenderer extends PrintRenderer {
int rx = currentBlockIPPosition;
// int bl = pageHeight - currentBPPosition;
- int bl = currentBPPosition;
+ int bl = currentBPPosition + word.getOffset();
// Set letterSpacing
//float ls = fs.getLetterSpacing() / this.currentFontSize;
@@ -530,7 +530,7 @@ public class PDFRenderer extends PrintRenderer {
public void renderDocument(Document doc, String ns) {
RendererContext context;
context = new RendererContext(mimeType);
- context.setLogger(log);
+ context.setUserAgent(userAgent);
context.setProperty(PDFXMLHandler.PDF_DOCUMENT, pdfDoc);
context.setProperty(PDFXMLHandler.PDF_STREAM, currentStream);
diff --git a/src/org/apache/fop/render/xml/XMLRenderer.java b/src/org/apache/fop/render/xml/XMLRenderer.java
index 999e983d4..8e9218eea 100644
--- a/src/org/apache/fop/render/xml/XMLRenderer.java
+++ b/src/org/apache/fop/render/xml/XMLRenderer.java
@@ -277,7 +277,7 @@ public class XMLRenderer extends AbstractRenderer {
protected void renderBlock(Block block) {
String prop = "";
- List list = block.getPropertyList();
+ List list = block.getTraitList();
if (list != null) {
prop = " props=\"" + getPropString(list) + "\"";
}
@@ -288,7 +288,7 @@ public class XMLRenderer extends AbstractRenderer {
protected void renderLineArea(LineArea line) {
String prop = "";
- List list = line.getPropertyList();
+ List list = line.getTraitList();
if (list != null) {
prop = " props=\"" + getPropString(list) + "\"";
}
@@ -326,7 +326,7 @@ public class XMLRenderer extends AbstractRenderer {
public void renderCharacter(org.apache.fop.area.inline.Character ch) {
String prop = "";
- List list = ch.getPropertyList();
+ List list = ch.getTraitList();
if (list != null) {
prop = " props=\"" + getPropString(list) + "\"";
}
@@ -339,7 +339,7 @@ public class XMLRenderer extends AbstractRenderer {
public void renderWord(Word word) {
String prop = "";
- List list = word.getPropertyList();
+ List list = word.getTraitList();
if (list != null) {
prop = " props=\"" + getPropString(list) + "\"";
}
@@ -376,45 +376,45 @@ public class XMLRenderer extends AbstractRenderer {
protected String getPropString(List list) {
String str = "";
for (int count = 0; count < list.size(); count++) {
- Property prop = (Property) list.get(count);
+ Trait prop = (Trait) list.get(count);
switch (prop.propType) {
- case Property.INTERNAL_LINK:
+ case Trait.INTERNAL_LINK:
str += "internal-link:" + prop.data;
break;
- case Property.EXTERNAL_LINK:
+ case Trait.EXTERNAL_LINK:
str += "external-link:" + prop.data;
break;
- case Property.FONT_FAMILY:
+ case Trait.FONT_FAMILY:
str += "font-family:" + prop.data;
break;
- case Property.FONT_SIZE:
+ case Trait.FONT_SIZE:
str += "font-size:" + prop.data;
break;
- case Property.FONT_WEIGHT:
+ case Trait.FONT_WEIGHT:
str += "font-weight:" + prop.data;
break;
- case Property.FONT_STYLE:
+ case Trait.FONT_STYLE:
str += "font-style:" + prop.data;
break;
- case Property.COLOR:
+ case Trait.COLOR:
str += "color:" + prop.data;
break;
- case Property.BACKGROUND:
+ case Trait.BACKGROUND:
str += "background:" + prop.data;
break;
- case Property.UNDERLINE:
+ case Trait.UNDERLINE:
str += "underline:" + prop.data;
break;
- case Property.OVERLINE:
+ case Trait.OVERLINE:
str += "overline:" + prop.data;
break;
- case Property.LINETHROUGH:
+ case Trait.LINETHROUGH:
str += "linethrough:" + prop.data;
break;
- case Property.OFFSET:
+ case Trait.OFFSET:
str += "offset:" + prop.data;
break;
- case Property.SHADOW:
+ case Trait.SHADOW:
str += "shadow:" + prop.data;
break;
default:
diff --git a/src/org/apache/fop/tools/AreaTreeBuilder.java b/src/org/apache/fop/tools/AreaTreeBuilder.java
index 3528f8b97..0f1529643 100644
--- a/src/org/apache/fop/tools/AreaTreeBuilder.java
+++ b/src/org/apache/fop/tools/AreaTreeBuilder.java
@@ -428,7 +428,7 @@ class TreeLoader {
Block block = new Block();
List props = getProperties((Element) obj);
for (int count = 0; count < props.size(); count++) {
- block.addProperty((Property) props.get(count));
+ block.addTrait((Trait) props.get(count));
}
addBlockChildren(block, (Element) obj);
list.add(block);
@@ -457,7 +457,7 @@ class TreeLoader {
LineArea line = new LineArea();
List props = getProperties((Element) obj);
for (int count = 0; count < props.size(); count++) {
- line.addProperty((Property) props.get(count));
+ line.addTrait((Trait) props.get(count));
}
String height = ((Element) obj).getAttribute("height");
int h = Integer.parseInt(height);
@@ -521,10 +521,10 @@ class TreeLoader {
e.printStackTrace();
}
Word word = getWord((Element) obj);
- Property prop = new Property();
- prop.propType = Property.FONT_STATE;
+ Trait prop = new Trait();
+ prop.propType = Trait.FONT_STATE;
prop.data = currentFontState;
- word.addProperty(prop);
+ word.addTrait(prop);
if (word != null) {
list.add(word);
}
@@ -672,7 +672,7 @@ class TreeLoader {
public void addProperties(Element ele, InlineArea inline) {
List props = getProperties(ele);
for (int count = 0; count < props.size(); count++) {
- inline.addProperty((Property) props.get(count));
+ inline.addTrait((Trait) props.get(count));
}
String str = ele.getAttribute("width");
@@ -687,57 +687,57 @@ class TreeLoader {
int index = tok.indexOf(":");
String id = tok.substring(0, index);
String val = tok.substring(index + 1);
- Property prop = new Property();
+ Trait prop = new Trait();
if ("internal-link".equals(id)) {
- prop.propType = Property.INTERNAL_LINK;
+ prop.propType = Trait.INTERNAL_LINK;
prop.data = val;
list.add(prop);
} else if ("external-link".equals(id)) {
- prop.propType = Property.EXTERNAL_LINK;
+ prop.propType = Trait.EXTERNAL_LINK;
prop.data = val;
list.add(prop);
} else if ("font-family".equals(id)) {
- prop.propType = Property.FONT_FAMILY;
+ prop.propType = Trait.FONT_FAMILY;
prop.data = val;
list.add(prop);
} else if ("font-size".equals(id)) {
- prop.propType = Property.FONT_SIZE;
+ prop.propType = Trait.FONT_SIZE;
prop.data = Integer.valueOf(val);
list.add(prop);
} else if ("font-weight".equals(id)) {
- prop.propType = Property.FONT_WEIGHT;
+ prop.propType = Trait.FONT_WEIGHT;
prop.data = val;
list.add(prop);
} else if ("font-style".equals(id)) {
- prop.propType = Property.FONT_STYLE;
+ prop.propType = Trait.FONT_STYLE;
prop.data = val;
list.add(prop);
} else if ("color".equals(id)) {
- prop.propType = Property.COLOR;
+ prop.propType = Trait.COLOR;
prop.data = val;
list.add(prop);
} else if ("background".equals(id)) {
- prop.propType = Property.BACKGROUND;
+ prop.propType = Trait.BACKGROUND;
prop.data = val;
list.add(prop);
} else if ("underline".equals(id)) {
- prop.propType = Property.UNDERLINE;
+ prop.propType = Trait.UNDERLINE;
prop.data = new Boolean(val);
list.add(prop);
} else if ("overline".equals(id)) {
- prop.propType = Property.OVERLINE;
+ prop.propType = Trait.OVERLINE;
prop.data = new Boolean(val);
list.add(prop);
} else if ("linethrough".equals(id)) {
- prop.propType = Property.LINETHROUGH;
+ prop.propType = Trait.LINETHROUGH;
prop.data = new Boolean(val);
list.add(prop);
} else if ("offset".equals(id)) {
- prop.propType = Property.OFFSET;
+ prop.propType = Trait.OFFSET;
prop.data = Integer.valueOf(val);
list.add(prop);
} else if ("shadow".equals(id)) {
- prop.propType = Property.SHADOW;
+ prop.propType = Trait.SHADOW;
prop.data = val;
list.add(prop);
}