You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by pb...@apache.org on 2004/05/11 15:48:21 UTC

cvs commit: xml-fop/src/java/org/apache/fop/fo/flow FoFlow.java FoPageSequence.java

pbwest      2004/05/11 06:48:21

  Modified:    src/java/org/apache/fop/area Tag: FOP_0-20-0_Alt-Design
                        PageSet.java Area.java
               src/java/org/apache/fop/fo/flow Tag: FOP_0-20-0_Alt-Design
                        FoFlow.java FoPageSequence.java
  Added:       src/java/org/apache/fop/area Tag: FOP_0-20-0_Alt-Design
                        AreaListener.java
  Log:
  Work-in-progress on interaction between FOs and areas
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.2   +23 -2     xml-fop/src/java/org/apache/fop/area/Attic/PageSet.java
  
  Index: PageSet.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Attic/PageSet.java,v
  retrieving revision 1.1.2.1
  retrieving revision 1.1.2.2
  diff -u -r1.1.2.1 -r1.1.2.2
  --- PageSet.java	10 May 2004 11:42:18 -0000	1.1.2.1
  +++ PageSet.java	11 May 2004 13:48:21 -0000	1.1.2.2
  @@ -39,6 +39,7 @@
       private ArrayList pageset;
       /** The id of this list. As with <code>Page</code>s, 0 is not valid. */
       private final long id;
  +    private int currElement = 0;
   
       public PageSet(PageSetElement element) {
           pageset = new ArrayList();
  @@ -60,6 +61,26 @@
           return id;
       }
   
  +    /**
  +     * Get the index of the current element
  +     * @return the index
  +     */
  +    public int getCurrentElement() {
  +        return currElement;
  +    }
  +
  +    /**
  +     * Sets the current element of the set
  +     * @param elindex the index of the element to set
  +     * @throws IndexOutOfBoundsException if <code>elindex</code> put of bounds
  +     */
  +    public void setCurrentElement(int elindex)
  +    throws IndexOutOfBoundsException {
  +        if (elindex < 0 || elindex >= pageset.size()) {
  +            throw new IndexOutOfBoundsException(
  +                    "Index " + elindex + "; size " + pageset.size());
  +        }
  +    }
       /**
        * Gets the element at the specified index position
        * @param index position of the element to get
  
  
  
  1.1.2.11  +3 -0      xml-fop/src/java/org/apache/fop/area/Area.java
  
  Index: Area.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Area.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- Area.java	2 May 2004 19:24:53 -0000	1.1.2.10
  +++ Area.java	11 May 2004 13:48:21 -0000	1.1.2.11
  @@ -370,4 +370,7 @@
           }
       }
   
  +    public void registerAreaListener(AreaListener area) {
  +        
  +    }
   }
  
  
  
  No                   revision
  
  Index: Area.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Area.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- Area.java	2 May 2004 19:24:53 -0000	1.1.2.10
  +++ Area.java	11 May 2004 13:48:21 -0000	1.1.2.11
  @@ -370,4 +370,7 @@
           }
       }
   
  +    public void registerAreaListener(AreaListener area) {
  +        
  +    }
   }
  
  
  
  No                   revision
  
  Index: Area.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Area.java,v
  retrieving revision 1.1.2.10
  retrieving revision 1.1.2.11
  diff -u -r1.1.2.10 -r1.1.2.11
  --- Area.java	2 May 2004 19:24:53 -0000	1.1.2.10
  +++ Area.java	11 May 2004 13:48:21 -0000	1.1.2.11
  @@ -370,4 +370,7 @@
           }
       }
   
  +    public void registerAreaListener(AreaListener area) {
  +        
  +    }
   }
  
  
  
  1.1.2.1   +30 -0     xml-fop/src/java/org/apache/fop/area/Attic/AreaListener.java
  
  
  
  
  No                   revision
  No                   revision
  1.1.2.14  +7 -3      xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoFlow.java
  
  Index: FoFlow.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoFlow.java,v
  retrieving revision 1.1.2.13
  retrieving revision 1.1.2.14
  diff -u -r1.1.2.13 -r1.1.2.14
  --- FoFlow.java	10 May 2004 11:52:04 -0000	1.1.2.13
  +++ FoFlow.java	11 May 2004 13:48:21 -0000	1.1.2.14
  @@ -135,7 +135,11 @@
           // flow.  Each attempt will generate its own page set, only the first
           // of which contains a region-body-reference-area which qualifies as
           // the reference rectangle for percentages defined on the flow.
  -        throw new FOPException("Called from FoFlow");
  +        //
  +        // Get the first page of the page-sequence
  +        // TODO check whether the current page from the page-sequence will be
  +        // enough
  +        return pageSequence.getCurr1stPage().getRegionBodyRefArea();
       }
   
       public Area getLayoutContext() {
  
  
  
  1.1.2.15  +56 -3     xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoPageSequence.java
  
  Index: FoPageSequence.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Attic/FoPageSequence.java,v
  retrieving revision 1.1.2.14
  retrieving revision 1.1.2.15
  diff -u -r1.1.2.14 -r1.1.2.15
  --- FoPageSequence.java	8 May 2004 13:01:40 -0000	1.1.2.14
  +++ FoPageSequence.java	11 May 2004 13:48:21 -0000	1.1.2.15
  @@ -35,6 +35,10 @@
   import org.apache.fop.apps.FOPException;
   import org.apache.fop.area.Area;
   import org.apache.fop.area.Page;
  +import org.apache.fop.area.PageList;
  +import org.apache.fop.area.PageListElement;
  +import org.apache.fop.area.PageSet;
  +import org.apache.fop.area.PageSetElement;
   import org.apache.fop.datastructs.TreeException;
   import org.apache.fop.fo.FONode;
   import org.apache.fop.fo.FOTree;
  @@ -122,6 +126,10 @@
       public Map staticContents = null;
       /** Child index of fo:flow child. */
       private int flowChild = -1;
  +    /** The <code>PageList</code> for this page-sequence */
  +    private PageList pagelist = null;
  +    /** The index of the current element in the pagelist */
  +    private int pgListIndex = -1;
       /** The page currently being processed by this page-sequence */
       private Page page = null;
       /**
  @@ -133,6 +141,48 @@
       }
   
       /**
  +     * @return the pagelist
  +     */
  +    public PageList getPagelist() {
  +        return pagelist;
  +    }
  +    /**
  +     * @param pagelist to set
  +     */
  +    public void setPagelist(PageList pagelist) {
  +        this.pagelist = pagelist;
  +    }
  +    /**
  +     * @return the pgListIndex
  +     */
  +    public int getPgListIndex() {
  +        return pgListIndex;
  +    }
  +    /**
  +     * @param pgListIndex to set
  +     */
  +    public void setPgListIndex(int pgListIndex) {
  +        this.pgListIndex = pgListIndex;
  +    }
  +
  +    /**
  +     * Gets the current first page
  +     * @return the first page
  +     */
  +    public Page getCurr1stPage() {
  +        PageListElement firstPage = pagelist.get(0);
  +        while (firstPage.isPageSet()) {
  +            PageSet pageset = (PageSet)firstPage;
  +            PageSetElement setEl = pageset.get(pageset.getCurrentElement());
  +            if (setEl.isPageList()) {
  +                firstPage = ((PageList)setEl).get(0);
  +            } else {
  +                firstPage = (Page)setEl;
  +            }
  +        }
  +        return (Page)firstPage;
  +    }
  +    /**
        * @param foTree the FO tree being built
        * @param parent the parent FONode of this node
        * @param event the <tt>XmlEvent</tt> that triggered the creation of
  @@ -205,6 +255,9 @@
               }
               // Generate a null page for the flow(s)
               page = Page.setupNullPage(this, foTree.getNextPageId());
  +            // Intialize the PageList for this page-sequence
  +            pagelist = new PageList(page);
  +            pgListIndex = 0;
   
               // Look for one or more fo:flow
               // must have at least one: N.B. in 1.0, only one is allowed,
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org