gmazza      2005/03/11 18:14:39

  Modified:    src/java/org/apache/fop/area PageViewport.java Span.java
               src/java/org/apache/fop/layoutmgr
                        PageSequenceLayoutManager.java
  Log:
  More simplifications to PSLM.
  
  Revision  Changes    Path
  1.13      +9 -0      xml-fop/src/java/org/apache/fop/area/PageViewport.java
  
  Index: PageViewport.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/PageViewport.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- PageViewport.java 20 Feb 2005 19:50:47 -0000      1.12
  +++ PageViewport.java 12 Mar 2005 02:14:38 -0000      1.13
  @@ -81,6 +81,15 @@
       }
   
       /**
  +     * Convenience method to get BodyRegion of this PageViewport
  +     * @return BodyRegion object
  +     */
  +    public BodyRegion getBodyRegion() {
  +        return (BodyRegion)
  +            
getPage().getRegionViewport(Constants.FO_REGION_BODY).getRegion();
  +    }    
  +
  +    /**
        * Set if this viewport should clip.
        * @param c true if this viewport should clip
        */
  
  
  
  1.5       +0 -9      xml-fop/src/java/org/apache/fop/area/Span.java
  
  Index: Span.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Span.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Span.java 11 Mar 2005 07:23:43 -0000      1.4
  +++ Span.java 12 Mar 2005 02:14:39 -0000      1.5
  @@ -46,15 +46,6 @@
       }
   
       /**
  -     * Add a normal-flow-reference-area to this span-reference-area.
  -     *
  -     * @param flow the normal-flow-reference-area to add
  -     */
  -    public void addNormalFlow(NormalFlow flow) {
  -        flowAreas.add(flow);
  -    }
  -
  -    /**
        * Create a new normal flow and add it to this span area
        *
        * @return the newly made NormalFlow object
  
  
  
  1.44      +33 -40    
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.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- PageSequenceLayoutManager.java    12 Mar 2005 01:56:33 -0000      1.43
  +++ PageSequenceLayoutManager.java    12 Mar 2005 02:14:39 -0000      1.44
  @@ -81,9 +81,6 @@
       /** Current page being worked on. */
       private PageViewport curPage;
   
  -    /** Body region of the current page */
  -    private BodyRegion curBody;
  -
       /** Current span being filled */
       private Span curSpan;
   
  @@ -480,14 +477,37 @@
           if (log.isDebugEnabled()) {
               log.debug("[" + curPage.getPageNumberString() + "]");
           }
  -        RegionViewport rv = curPage.getPage().getRegionViewport(
  -                    FO_REGION_BODY);
  -        curBody = (BodyRegion) rv.getRegion();
  -        flowBPD = (int) curBody.getBPD();
  +
  +        flowBPD = (int) curPage.getBodyRegion().getBPD();
           createSpan(1); // todo determine actual # of NormalFlows needed
           return curPage;
       }
   
  +    private void createSpan(int numCols) {
  +        // check number of columns (= all in Body or 1)
  +        // If already have a span, get its size and position (as MinMaxOpt)
  +        // This determines the position of the new span area
  +        // Attention: space calculation between the span areas.
  +
  +        //MinOptMax newpos ;
  +        //if (curSpan != null) {
  +        //newpos = curSpan.getPosition(BPD);
  +        //newpos.add(curSpan.getDimension(BPD));
  +        //}
  +        //else newpos = new MinOptMax();
  +        curSpan = new Span(numCols);
  +        // get Width or Height as IPD for span
  +
  +        RegionViewport rv = 
curPage.getPage().getRegionViewport(FO_REGION_BODY);
  +        int ipdWidth = (int) rv.getRegion().getIPD() -
  +            rv.getBorderAndPaddingWidthStart() - 
rv.getBorderAndPaddingWidthEnd();
  +
  +        curSpan.setIPD(ipdWidth);
  +        //curSpan.setPosition(BPD, newpos);
  +        curPage.getBodyRegion().getMainReference().addSpan(curSpan);
  +        curFlow = curSpan.addNewNormalFlow();
  +    }
  +
       private void layoutStaticContent(Region region) {
           if (region == null) {
               return;
  @@ -532,7 +552,6 @@
   
       private void finishPage() {
           if (curPage == null) {
  -            curBody = null;
               curSpan = null;
               curFlow = null;
               return;
  @@ -546,7 +565,6 @@
           // Queue for ID resolution and rendering
           areaTreeModel.addPage(curPage);
           curPage = null;
  -        curBody = null;
           curSpan = null;
           curFlow = null;
       }
  @@ -583,7 +601,7 @@
               int numCols = 1;
               if (span == Constants.EN_ALL) {
                   // Assume the number of columns is stored on the curBody 
object.
  -                //numCols = curBody.getProperty(NUMBER_OF_COLUMNS);
  +                //numCols = 
curPage.getBodyRegion().getProperty(NUMBER_OF_COLUMNS);
               }
               if (curSpan == null) {
                   bNeedSpan = true;
  @@ -607,17 +625,17 @@
               }
               // Now handle different kinds of areas
               if (aclass == Area.CLASS_BEFORE_FLOAT) {
  -                BeforeFloat bf = curBody.getBeforeFloat();
  +                BeforeFloat bf = curPage.getBodyRegion().getBeforeFloat();
                   if (bf == null) {
                       bf = new BeforeFloat();
  -                    curBody.setBeforeFloat(bf);
  +                    curPage.getBodyRegion().setBeforeFloat(bf);
                   }
                   return bf;
               } else if (aclass == Area.CLASS_FOOTNOTE) {
  -                Footnote fn = curBody.getFootnote();
  +                Footnote fn = curPage.getBodyRegion().getFootnote();
                   if (fn == null) {
                       fn = new Footnote();
  -                    curBody.setFootnote(fn);
  +                    curPage.getBodyRegion().setFootnote(fn);
                   }
                   return fn;
               }
  @@ -699,31 +717,6 @@
           }
       }
   
  -    private void createSpan(int numCols) {
  -        // check number of columns (= all in Body or 1)
  -        // If already have a span, get its size and position (as MinMaxOpt)
  -        // This determines the position of the new span area
  -        // Attention: space calculation between the span areas.
  -
  -        //MinOptMax newpos ;
  -        //if (curSpan != null) {
  -        //newpos = curSpan.getPosition(BPD);
  -        //newpos.add(curSpan.getDimension(BPD));
  -        //}
  -        //else newpos = new MinOptMax();
  -        curSpan = new Span(numCols);
  -        // get Width or Height as IPD for span
  -
  -        RegionViewport rv = 
curPage.getPage().getRegionViewport(FO_REGION_BODY);
  -        int ipdWidth = (int) rv.getRegion().getIPD() -
  -            rv.getBorderAndPaddingWidthStart() - 
rv.getBorderAndPaddingWidthEnd();
  -
  -        curSpan.setIPD(ipdWidth);
  -        //curSpan.setPosition(BPD, newpos);
  -        curBody.getMainReference().addSpan(curSpan);
  -        curFlow = curSpan.addNewNormalFlow();
  -    }
  -
       private PageViewport createPageAreas(SimplePageMaster spm) {
           int pageWidth = spm.getPageWidth().getValue();
           int pageHeight = spm.getPageHeight().getValue();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to