vmote       2003/08/26 17:01:14

  Modified:    src/java/org/apache/fop/fo/pagination PageSequence.java
               src/java/org/apache/fop/layoutmgr PageLayoutManager.java
  Log:
  move field that tracks which SimplePageMaster to use (currentSimplePageMaster) from 
fo/pagination/PageSequence to layoutmgr/PageLayoutManager
  
  Revision  Changes    Path
  1.11      +19 -22    xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java
  
  Index: PageSequence.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- PageSequence.java 26 Aug 2003 20:32:26 -0000      1.10
  +++ PageSequence.java 27 Aug 2003 00:01:14 -0000      1.11
  @@ -135,11 +135,11 @@
       /**
        * The currentSimplePageMaster is either the page master for the
        * whole page sequence if master-reference refers to a simple-page-master,
  -     * or the simple page master produced by the page sequence mster otherwise.
  +     * or the simple page master produced by the page sequence master otherwise.
        * The pageSequenceMaster is null if master-reference refers to a
        * simple-page-master.
        */
  -    private SimplePageMaster currentSimplePageMaster;
  +    private SimplePageMaster simplePageMaster;
       private PageSequenceMaster pageSequenceMaster;
   
       /**
  @@ -210,11 +210,11 @@
   
   
           String masterName = this.properties.get("master-reference").getString();
  -        this.currentSimplePageMaster =
  -          this.layoutMasterSet.getSimplePageMaster(masterName);
  -        if (this.currentSimplePageMaster == null) {
  +        this.simplePageMaster =
  +                this.layoutMasterSet.getSimplePageMaster(masterName);
  +        if (this.simplePageMaster == null) {
               this.pageSequenceMaster =
  -              this.layoutMasterSet.getPageSequenceMaster(masterName);
  +                    this.layoutMasterSet.getPageSequenceMaster(masterName);
               if (this.pageSequenceMaster == null) {
                   throw new FOPException("master-reference '" + masterName
                                          + "' for fo:page-sequence matches no"
  @@ -687,20 +687,6 @@
   //     }
   
       /**
  -     * Get the current simple page master
  -     * that is active for the last page created.
  -     *
  -     * @return the current simple page master
  -     */
  -    public SimplePageMaster getCurrentSimplePageMaster() {
  -        return currentSimplePageMaster;
  -    }
  -
  -    public void setCurrentSimplePageMaster(SimplePageMaster simplePageMaster) {
  -        this.currentSimplePageMaster = simplePageMaster;
  -    }
  -
  -    /**
        * Get the static content FO node from the flow map.
        * This gets the static content flow for the given flow name.
        *
  @@ -745,12 +731,23 @@
       }
   
       /**
  -     * Public accessor for getting the PageSequenceMaster to which this
  +     * Public accessor for getting the PageSequenceMaster (if any) to which this
        * PageSequence is attached.
  -     * @return the PageSequenceMaster to which this PageSequence is attached.
  +     * @return the PageSequenceMaster to which this PageSequence is attached, or
  +     * null if there is none.
        */
       public PageSequenceMaster getPageSequenceMaster() {
           return pageSequenceMaster;
  +    }
  +
  +    /**
  +     * Public accessor for getting the SimplePageMaster (if any) to which this
  +     * PageSequence is attached.
  +     * @return the SimplePageeMaster to which this PageSequence is attached or
  +     * null if there is none.
  +     */
  +    public SimplePageMaster getSimplePageMaster() {
  +        return simplePageMaster;
       }
   
       /**
  
  
  
  1.6       +25 -14    xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
  
  Index: PageLayoutManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- PageLayoutManager.java    26 Aug 2003 22:11:17 -0000      1.5
  +++ PageLayoutManager.java    27 Aug 2003 00:01:14 -0000      1.6
  @@ -138,6 +138,14 @@
       private PageSequence pageSequence;
   
       /**
  +     * This is the SimplePageMaster that should be used to create the page. It
  +     * will be equal to the PageSequence's simplePageMaster, if it exists, or
  +     * to the correct member of the PageSequence's pageSequenceMaster, if that
  +     * exists instead.
  +     */
  +    private SimplePageMaster currentSimplePageMaster;
  +
  +    /**
        * This is the top level layout manager.
        * It is created by the PageSequence FO.
        *
  @@ -497,11 +505,14 @@
           if (curPage != null) {
               // Layout static content into the regions
               // Need help from pageseq for this
  -            SimplePageMaster spm = pageSequence.getCurrentSimplePageMaster();
  -            layoutStaticContent(spm.getRegion(Region.BEFORE), 
RegionReference.BEFORE);
  -            layoutStaticContent(spm.getRegion(Region.AFTER), RegionReference.AFTER);
  -            layoutStaticContent(spm.getRegion(Region.START), RegionReference.START);
  -            layoutStaticContent(spm.getRegion(Region.END), RegionReference.END);
  +            layoutStaticContent(currentSimplePageMaster.getRegion(Region.BEFORE),
  +                                RegionReference.BEFORE);
  +            layoutStaticContent(currentSimplePageMaster.getRegion(Region.AFTER),
  +                                RegionReference.AFTER);
  +            layoutStaticContent(currentSimplePageMaster.getRegion(Region.START),
  +                                RegionReference.START);
  +            layoutStaticContent(currentSimplePageMaster.getRegion(Region.END),
  +                                RegionReference.END);
               // Queue for ID resolution and rendering
               areaTree.addPage(curPage);
               curPage = null;
  @@ -714,24 +725,25 @@
                                      boolean bIsBlank, boolean firstPage,
                                      boolean bIsLast)
                                      throws FOPException {
  -        if (pageSequence.getPageSequenceMaster() != null) {
  -            pageSequence.setCurrentSimplePageMaster 
(pageSequence.getPageSequenceMaster()
  +        if (pageSequence.getPageSequenceMaster() == null) {
  +            currentSimplePageMaster = pageSequence.getSimplePageMaster();
  +        } else {
  +            currentSimplePageMaster = pageSequence.getPageSequenceMaster()
                 .getNextSimplePageMaster(((pageNumber % 2) == 1),
                                          firstPage,
  -                                       bIsBlank));
  +                                       bIsBlank);
           }
  -        Region body = 
pageSequence.getCurrentSimplePageMaster().getRegion(Region.BODY);
  +        Region body = currentSimplePageMaster.getRegion(Region.BODY);
           if (!pageSequence.getMainFlow().getFlowName().equals(body.getRegionName())) 
{
             throw new FOPException("Flow '" + pageSequence.getMainFlow().getFlowName()
                                    + "' does not map to the region-body in 
page-master '"
  -                                 + 
pageSequence.getCurrentSimplePageMaster().getMasterName() + "'");
  +                                 + currentSimplePageMaster.getMasterName() + "'");
           }
  -        SimplePageMaster currentSimplePageMaster = 
pageSequence.getCurrentSimplePageMaster();
           PageMaster pageMaster = currentSimplePageMaster.getPageMaster();
  -        if (pageMaster == null) {
  +        if ( pageMaster == null) {
               createSimplePageMasterAreas(currentSimplePageMaster);
           }
  -        pageMaster = pageSequence.getCurrentSimplePageMaster().getPageMaster();
  +        pageMaster = currentSimplePageMaster.getPageMaster();
           PageViewport p = pageMaster.makePage();
           return p;
           // The page will have a viewport/reference area pair defined
  @@ -794,7 +806,6 @@
   
          node.setPageMaster(new PageMaster(new PageViewport(page,
                  new Rectangle(0, 0, pageWidth, pageHeight))));
  -
   
       }
   
  
  
  

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

Reply via email to