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 gm...@apache.org on 2005/05/14 07:22:17 UTC

cvs commit: xml-fop/src/java/org/apache/fop/area BodyRegion.java RegionReference.java Page.java

gmazza      2005/05/13 22:22:17

  Modified:    src/java/org/apache/fop/layoutmgr
                        StaticContentLayoutManager.java
                        PageSequenceLayoutManager.java
               src/java/org/apache/fop/area BodyRegion.java
                        RegionReference.java Page.java
  Log:
  Providing the region FO to RegionReference, so it is no longer
  necessary for PSLM to separately supply it to SCLM.
  Some simplification of SCLM's Breaker class.
  
  Revision  Changes    Path
  1.10      +12 -12    xml-fop/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
  
  Index: StaticContentLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StaticContentLayoutManager.java	13 May 2005 19:16:51 -0000	1.9
  +++ StaticContentLayoutManager.java	14 May 2005 05:22:16 -0000	1.10
  @@ -228,9 +228,10 @@
           return targetRegion;
       }
   
  -    public void doLayout(SideRegion region) {
  -        MinOptMax range = new MinOptMax(targetRegion.getIPD());
  -        StaticContentBreaker breaker = new StaticContentBreaker(region, this, range);
  +    public void doLayout() {
  +        Region region = targetRegion.getRegionFO();
  +        StaticContentBreaker breaker = new StaticContentBreaker(
  +                this, targetRegion.getIPD(), region.getDisplayAlign());
           breaker.doLayout(targetRegion.getBPD());
           if (breaker.isOverflow()) {
               if (region.getOverflow() == EN_ERROR_IF_OVERFLOW) {
  @@ -240,17 +241,17 @@
           }
       }
       
  -    private class StaticContentBreaker extends AbstractBreaker {
  -        
  -        private Region region;
  +    private class StaticContentBreaker extends AbstractBreaker {       
           private StaticContentLayoutManager lm;
  -        private MinOptMax ipd;
  +        private int displayAlign;
  +        private int ipd;
           boolean overflow = false;
           
  -        public StaticContentBreaker(Region region, StaticContentLayoutManager lm, MinOptMax ipd) {
  -            this.region = region;
  +        public StaticContentBreaker(StaticContentLayoutManager lm, int ipd, 
  +                int displayAlign) {
               this.lm = lm;
               this.ipd = ipd;
  +            this.displayAlign = displayAlign;
           }
   
           public boolean isOverflow() {
  @@ -263,7 +264,7 @@
   
           protected LayoutContext createLayoutContext() {
               LayoutContext lc = super.createLayoutContext();
  -            lc.setRefIPD(ipd.opt);
  +            lc.setRefIPD(ipd);
               return lc;
           }
           
  @@ -290,7 +291,7 @@
           }
   
           protected int getCurrentDisplayAlign() {
  -            return region.getDisplayAlign();
  +            return displayAlign;
           }
           
           protected boolean hasMoreContent() {
  @@ -317,7 +318,6 @@
           protected LayoutManager getCurrentChildLM() {
               return null; //TODO NYI
           }
  -        
       }    
   }
   
  
  
  
  1.52      +2 -2      xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
  
  Index: PageSequenceLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- PageSequenceLayoutManager.java	13 May 2005 19:16:51 -0000	1.51
  +++ PageSequenceLayoutManager.java	14 May 2005 05:22:16 -0000	1.52
  @@ -442,7 +442,7 @@
               areaTreeHandler.getLayoutManagerMaker().makeLayoutManager(sc);
           lm.setTargetRegion(rv.getRegionReference());
           lm.setParent(this);       
  -        lm.doLayout(reg);
  +        lm.doLayout();
           lm.reset(null);
       }
   
  
  
  
  1.14      +6 -25     xml-fop/src/java/org/apache/fop/area/BodyRegion.java
  
  Index: BodyRegion.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/BodyRegion.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- BodyRegion.java	13 May 2005 19:16:53 -0000	1.13
  +++ BodyRegion.java	14 May 2005 05:22:16 -0000	1.14
  @@ -18,7 +18,7 @@
   
   package org.apache.fop.area;
   
  -import org.apache.fop.fo.Constants;
  +import org.apache.fop.fo.pagination.RegionBody;
   
   /**
    * This class is a container for the areas that may be generated by
  @@ -37,23 +37,14 @@
        * Constructor which can read traits directly
        * from an fo:region-body formatting object.
        */
  -    public BodyRegion(int columnCount, int columnGap, RegionViewport parent) {
  -        super(Constants.FO_REGION_BODY, parent);
  -        this.columnCount = columnCount;
  -        this.columnGap = columnGap;
  +    public BodyRegion(RegionBody rb, RegionViewport parent) {
  +        super(rb, parent);
  +        this.columnCount = rb.getColumnCount();
  +        this.columnGap = rb.getColumnGap();
           mainReference = new MainReference(this);
       }
   
       /**
  -     * Set the number of columns for blocks when not spanning
  -     *
  -     * @param colCount the number of columns
  -     */
  -    public void setColumnCount(int colCount) {
  -        this.columnCount = colCount;
  -    }
  -
  -    /**
        * Get the number of columns when not spanning
        *
        * @return the number of columns
  @@ -62,16 +53,6 @@
           return this.columnCount;
       }
   
  -    /**
  -     * Set the column gap between columns
  -     * The length is in millipoints.
  -     *
  -     * @param colGap the column gap in millipoints
  -     */
  -    public void setColumnGap(int colGap) {
  -        this.columnGap = colGap;
  -    }
  -
       /** @return the column-gap value */
       public int getColumnGap() {
           return this.columnGap;
  @@ -126,7 +107,7 @@
        * @return a shallow copy of this object
        */
       public Object clone() {
  -        BodyRegion br = new BodyRegion(columnCount, columnGap, regionViewport);
  +        BodyRegion br = new BodyRegion((RegionBody) regionFO, regionViewport);
           br.setCTM(getCTM());
           br.setIPD(getIPD());
           br.beforeFloat = beforeFloat;
  
  
  
  1.8       +17 -6     xml-fop/src/java/org/apache/fop/area/RegionReference.java
  
  Index: RegionReference.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/RegionReference.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RegionReference.java	13 May 2005 19:16:53 -0000	1.7
  +++ RegionReference.java	14 May 2005 05:22:16 -0000	1.8
  @@ -21,7 +21,7 @@
   import java.util.ArrayList;
   import java.util.List;
   
  -import org.apache.fop.fo.Constants;
  +import org.apache.fop.fo.pagination.Region;
   
   /**
    * This is a region reference area for a page regions.
  @@ -29,8 +29,9 @@
    * so the page master can make copies from the original page and regions.
    */
   public class RegionReference extends Area implements Cloneable {
  -    private int regionClass = Constants.FO_REGION_BEFORE;
  +    protected Region regionFO;
       private CTM ctm;
  +    
   
       // the list of block areas from the static flow
       private List blocks = new ArrayList();
  @@ -43,8 +44,8 @@
        *
        * @param type the region class type
        */
  -    public RegionReference(int type, RegionViewport parent) {
  -        regionClass = type;
  +    public RegionReference(Region regionFO, RegionViewport parent) {
  +        this.regionFO = regionFO;
           addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
           regionViewport = parent;
       }
  @@ -93,7 +94,17 @@
        * @return the region class
        */
       public int getRegionClass() {
  -        return regionClass;
  +        return regionFO.getNameId();
  +    }
  +
  +    /**
  +     * Return the Region FO which provides the
  +     * traits for this region.
  +     *
  +     * @return the region formatting object
  +     */
  +    public Region getRegionFO() {
  +        return regionFO;
       }
   
       /**
  @@ -113,7 +124,7 @@
        * @return a copy of this region reference area
        */
       public Object clone() {
  -        RegionReference rr = new RegionReference(regionClass, regionViewport);
  +        RegionReference rr = new RegionReference(regionFO, regionViewport);
           rr.ctm = ctm;
           rr.setIPD(getIPD());
           return rr;
  
  
  
  1.10      +2 -4      xml-fop/src/java/org/apache/fop/area/Page.java
  
  Index: Page.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Page.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- Page.java	13 May 2005 19:16:53 -0000	1.9
  +++ Page.java	14 May 2005 05:22:16 -0000	1.10
  @@ -99,11 +99,9 @@
               r.setLayoutDimension(PercentBase.BLOCK_IPD, rvp.getIPD());
               r.setLayoutDimension(PercentBase.BLOCK_BPD, rvp.getBPD());
               if (r.getNameId() == Constants.FO_REGION_BODY) {
  -                RegionBody rb = (RegionBody) r;
  -                rr = new BodyRegion(rb.getColumnCount(), rb.getColumnGap(),
  -                       rvp);
  +                rr = new BodyRegion((RegionBody) r, rvp);
               } else {
  -                rr = new RegionReference(r.getNameId(), rvp);
  +                rr = new RegionReference(r, rvp);
               }
               setRegionReferencePosition(rr, r, rvp.getViewArea());
               rvp.setRegionReference(rr);
  
  
  

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