]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
changed property to trait for areas
authorKeiron Liddle <keiron@apache.org>
Thu, 21 Mar 2002 09:34:19 +0000 (09:34 +0000)
committerKeiron Liddle <keiron@apache.org>
Thu, 21 Mar 2002 09:34:19 +0000 (09:34 +0000)
added ipd to area

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194713 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/area/Area.java
src/org/apache/fop/area/Block.java
src/org/apache/fop/area/LineArea.java
src/org/apache/fop/area/LineProperty.java [deleted file]
src/org/apache/fop/area/LineTrait.java [new file with mode: 0644]
src/org/apache/fop/area/Property.java [deleted file]
src/org/apache/fop/area/Trait.java [new file with mode: 0644]
src/org/apache/fop/area/inline/InlineArea.java
src/org/apache/fop/render/pdf/PDFRenderer.java
src/org/apache/fop/render/xml/XMLRenderer.java
src/org/apache/fop/tools/AreaTreeBuilder.java

index 2b429d5bc3b546d644a768b4e77079cbc594bb2d..f041f92272963bd0073458ceb91623926bb3a76b 100644 (file)
@@ -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.
index ccad5f34581d08c967f961ea2bcfaa5b05440c09..9073c23a7137e3348912574586dfa91a8dde2f0a 100644 (file)
@@ -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;
     }
 }
+
index 8184d332a0f0bd9f8eaa2bd9051837fffb01baa2..5da4fee09ea84b188533956ac09b51f4d9b6951b 100644 (file)
@@ -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/LineProperty.java
deleted file mode 100644 (file)
index d5eb3da..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- * $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;
-}
-
diff --git a/src/org/apache/fop/area/LineTrait.java b/src/org/apache/fop/area/LineTrait.java
new file mode 100644 (file)
index 0000000..e02725c
--- /dev/null
@@ -0,0 +1,13 @@
+/*
+ * $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;
+}
+
diff --git a/src/org/apache/fop/area/Property.java b/src/org/apache/fop/area/Property.java
deleted file mode 100644 (file)
index 61d7b3b..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * $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;
-    }
-}
-
diff --git a/src/org/apache/fop/area/Trait.java b/src/org/apache/fop/area/Trait.java
new file mode 100644 (file)
index 0000000..7ac537a
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * $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;
+    }
+}
+
index 5a63ef0edf2ed9dff847d1aeae188d47952f9bdf..b105846fb90335995eb3c3acc5a73b606151b84d 100644 (file)
@@ -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;
     }
 }
index 4713c38efdcd01224009f443a156feadc53e99fd..0db612f8da5894c23cffb52f85a76e1c9fd04517 100644 (file)
@@ -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);
index 999e983d4aac2662b926ade001d551e6b89f7eb3..8e9218eea24919ff58b63f54c7c1c884271a53dc 100644 (file)
@@ -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:
index 3528f8b977af3bca69c63cde5eec484c7fc6cb52..0f152964302f6e5aec30bebd4640465e6fbc6ac6 100644 (file)
@@ -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);
             }