private int areaClass=CLASS_NORMAL;
private FObj genFObj;
+ private int ipd;
protected Area parent =null; // Doesn't need to be saved in serialization
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.
}
// 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;
}
}
+
// 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;
}
}
+++ /dev/null
-/*
- * $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;
-
-public class LineProperty extends Property {
- int[] range;
-}
-
--- /dev/null
+/*
+ * $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;
+
+public class LineTrait extends Trait {
+ int[] range;
+}
+
+++ /dev/null
-/*
- * $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;
-
-import org.apache.fop.datatypes.ColorType;
-
-import java.io.Serializable;
-
-// properties should be serialized by the holder
-public class Property implements Serializable {
- public static final int ID_LINK = 0;
- public static final int INTERNAL_LINK = 1; //resolved
- public static final int EXTERNAL_LINK = 2;
- public static final int FONT_FAMILY = 3;
- public static final int FONT_SIZE = 4;
- public static final int FONT_WEIGHT = 5;
- public static final int FONT_STYLE = 6;
- public static final int COLOR = 7;
- public static final int ID_AREA = 8;
- public static final int BACKGROUND = 9;
- public static final int UNDERLINE = 10;
- public static final int OVERLINE = 11;
- public static final int LINETHROUGH = 12;
- public static final int OFFSET = 13;
- public static final int SHADOW = 14;
-
- public static final int FONT_STATE = 100;
-
- public int propType;
- public Object data;
-
- public static class Background {
- ColorType color;
- String url;
- int repeat;
- int horiz;
- int vertical;
- }
-}
-
--- /dev/null
+/*
+ * $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;
+
+import org.apache.fop.datatypes.ColorType;
+
+import java.io.Serializable;
+
+// properties should be serialized by the holder
+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;
+ public static final int FONT_FAMILY = 3;
+ public static final int FONT_SIZE = 4;
+ public static final int FONT_WEIGHT = 5;
+ public static final int FONT_STYLE = 6;
+ public static final int COLOR = 7;
+ public static final int ID_AREA = 8;
+ public static final int BACKGROUND = 9;
+ public static final int UNDERLINE = 10;
+ public static final int OVERLINE = 11;
+ public static final int LINETHROUGH = 12;
+ public static final int OFFSET = 13;
+ public static final int SHADOW = 14;
+
+ public static final int FONT_STATE = 100;
+
+ public int propType;
+ public Object data;
+
+ public static class Background {
+ ColorType color;
+ String url;
+ int repeat;
+ int horiz;
+ int vertical;
+ }
+}
+
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;
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
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;
}
}
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;
}
}
int rx = currentBlockIPPosition;
// int bl = pageHeight - currentBPPosition;
- int bl = currentBPPosition;
+ int bl = currentBPPosition + word.getOffset();
// Set letterSpacing
//float ls = fs.getLetterSpacing() / this.currentFontSize;
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);
protected void renderBlock(Block block) {
String prop = "";
- List list = block.getPropertyList();
+ List list = block.getTraitList();
if (list != null) {
prop = " props=\"" + getPropString(list) + "\"";
}
protected void renderLineArea(LineArea line) {
String prop = "";
- List list = line.getPropertyList();
+ List list = line.getTraitList();
if (list != null) {
prop = " props=\"" + getPropString(list) + "\"";
}
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) + "\"";
}
public void renderWord(Word word) {
String prop = "";
- List list = word.getPropertyList();
+ List list = word.getTraitList();
if (list != null) {
prop = " props=\"" + getPropString(list) + "\"";
}
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:
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);
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);
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);
}
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");
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);
}