]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
AHS: initial marker support
authorarved <arved@unknown>
Mon, 16 Jul 2001 10:37:57 +0000 (10:37 +0000)
committerarved <arved@unknown>
Mon, 16 Jul 2001 10:37:57 +0000 (10:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194355 13f79535-47bb-0310-9956-ffa450edef68

src/codegen/foproperties.xml
src/org/apache/fop/fo/FONode.java
src/org/apache/fop/fo/FObj.java
src/org/apache/fop/fo/flow/Block.java

index c0d25fa611684454d079db05f0d956b3b9b7a59b..ba312b9285411f9cf7c7e380269429483e04401f 100644 (file)
   <property>
     <name>marker-class-name</name>
     <inherited>false</inherited>
-    <datatype>ToBeImplemented</datatype>
+    <datatype>String</datatype>
     <default></default>
   </property>
   <property>
     <name>retrieve-class-name</name>
     <inherited>false</inherited>
-    <datatype>ToBeImplemented</datatype>
+    <datatype>String</datatype>
     <default></default>
   </property>
   <property>
     <name>retrieve-position</name>
     <inherited>false</inherited>
-    <datatype>ToBeImplemented</datatype>
+    <datatype>Enum</datatype>
+      <enumeration>
+        <value const="FSWP">first-starting-within-page</value>
+        <value const="FIC">first-including-carryover</value>
+        <value const="LSWP">last-starting-within-page</value>
+        <value const="LEWP">last-ending-within-page</value>
+      </enumeration>
     <default>first-starting-within-page</default>
   </property>
   <property>
     <name>retrieve-boundary</name>
     <inherited>false</inherited>
-    <datatype>ToBeImplemented</datatype>
+    <datatype>Enum</datatype>
+      <enumeration>
+        <value const="PAGE">page</value>
+        <value const="PAGE_SEQUENCE">page-sequence</value>
+        <value const="DOCUMENT">document</value>
+      </enumeration>
     <default>page-sequence</default>
   </property>
 
index 5b3d48107c78743ce685fbaf51b0754b2a5f5bc6..34d13623f53bcd3537aa807386dd81623155c94f 100644 (file)
@@ -10,11 +10,14 @@ package org.apache.fop.fo;
 // FOP
 import org.apache.fop.apps.FOPException;
 import org.apache.fop.layout.Area;
+import org.apache.fop.layout.AreaClass;
 import org.apache.fop.layout.LinkSet;
 import org.apache.fop.system.BufferManager;
+import org.apache.fop.fo.flow.Marker;
 
 // Java
 import java.util.Vector;
+import java.util.Hashtable;
 
 /**
  * base class for nodes in the formatting object tree
@@ -23,6 +26,8 @@ abstract public class FONode {
 
     protected FObj parent;
 
+    protected String areaClass = AreaClass.UNASSIGNED;
+  
        public BufferManager bufferManager;
        
     public Vector children = new Vector();             // made public for searching for id's
@@ -50,11 +55,22 @@ abstract public class FONode {
 
     protected LinkSet linkSet;
 
+    // count of areas generated-by/returned-by
+    public int areasGenerated = 0;
+  
+    // markers
+    protected Hashtable markers;
+
     protected FONode(FObj parent) {
-       this.parent = parent;
+               this.parent = parent;
                if (parent != null) {
                        this.bufferManager = parent.bufferManager;
                }
+       
+               markers = new Hashtable();
+       
+               if (null != parent)
+                       this.areaClass = parent.areaClass;
     }
 
     public void setIsInTableCell() {
@@ -202,4 +218,22 @@ abstract public class FONode {
                }
                ((FONode) children.elementAt(this.marker)).rollback(snapshot);
        }
+
+
+  public void addMarker(Marker marker) throws FOPException {
+         String mcname = marker.getMarkerClassName();
+         if (!markers.containsKey(mcname) && children.isEmpty())
+                 markers.put(mcname, marker);
+         else
+                 throw new FOPException("fo:marker must be an initial child," +
+                 "and 'marker-class-name' must be unique for same parent");
+  }
+  
+  public boolean hasMarkers() {
+         return !markers.isEmpty();
+  }
+  
+  public Vector getMarkers() {
+         return new Vector(markers.values());
+  }
 }
index 3cea975bb2238d7d5082010d4a5636f31e082be4..f1256d56a63805c0a0e164828249bf05202d0a71 100644 (file)
@@ -158,7 +158,5 @@ public class FObj extends FONode {
         p=parent);
     this.properties.setWritingMode(p.getProperty("writing-mode").getEnum());
   }
-
-
 }
 
index 73830f7c7b3d55f802d87c73c69c8786a5b1c841..b84a5cdb924b2cf1269f2da3c24cf8f509f431eb 100644 (file)
@@ -159,6 +159,17 @@ public class Block extends FObjMixed {
                                this.blockArea = new BlockArea(propMgr.getFontState(area.getFontInfo()), area.getAllocationWidth(),
                                                                area.spaceLeft(), startIndent, endIndent, textIndent,
                                                                align, alignLast, lineHeight);
+                               this.blockArea.generatedBy = this;
+                               this.areasGenerated++;
+                               if (this.areasGenerated == 1)
+                                       this.blockArea.isFirst = true;
+                               // for normal areas this should be the only pair
+                               this.blockArea.addLineagePair(this, this.areasGenerated);
+                               
+                               // markers
+                               if (this.hasMarkers())
+                                       this.blockArea.addMarkers(this.getMarkers());
+                                       
                                this.blockArea.setParent(area); // BasicLink needs it
                                blockArea.setPage(area.getPage());
                                blockArea.setBackgroundColor(backgroundColor);
@@ -248,6 +259,7 @@ public class Block extends FObjMixed {
                                }
 
                                //MessageHandler.error(" b:OK" + marker + " ");
+                               this.blockArea.isLast = true;
                                return new Status(Status.OK);
                }