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/03/13 05:14:04 UTC

cvs commit: xml-fop/src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java ContentLayoutManager.java

gmazza      2005/03/12 20:14:04

  Modified:    src/java/org/apache/fop/layoutmgr
                        PageSequenceLayoutManager.java
                        ContentLayoutManager.java
  Log:
  More simplifications to PSLM.
  
  Revision  Changes    Path
  1.45      +14 -48    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.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- PageSequenceLayoutManager.java	12 Mar 2005 02:14:39 -0000	1.44
  +++ PageSequenceLayoutManager.java	13 Mar 2005 04:14:04 -0000	1.45
  @@ -48,7 +48,6 @@
   import org.apache.fop.fo.pagination.RegionBody;
   import org.apache.fop.fo.pagination.SimplePageMaster;
   import org.apache.fop.fo.pagination.StaticContent;
  -import org.apache.fop.fo.pagination.Title;
   import org.apache.fop.fo.properties.CommonMarginBlock;
   
   import java.util.List;
  @@ -143,29 +142,6 @@
       }
   
       /**
  -     * Each fo:page-sequence may have an fo:title object.
  -     * @return the Title area
  -     */
  -    private LineArea getTitleArea(Title foTitle) {
  -        // get breaks then add areas to title
  -        LineArea title = new LineArea();
  -
  -        ContentLayoutManager clm = new ContentLayoutManager(title);
  -        clm.setUserAgent(foTitle.getUserAgent());
  -        clm.setAreaTreeHandler(areaTreeHandler);
  -
  -        // use special layout manager to add the inline areas
  -        // to the Title.
  -        InlineLayoutManager lm;
  -        lm = new InlineLayoutManager(foTitle);
  -        clm.addChildLM(lm);
  -
  -        clm.fillArea(lm);
  -
  -        return title;
  -    }
  -
  -    /**
        * Start the layout of this page sequence.
        * This completes the layout of the page sequence
        * which creates and adds all the pages to the area tree.
  @@ -176,8 +152,12 @@
           pageNumberString = pageSeq.makeFormattedPageNumber(currentPageNum);
   
           LineArea title = null;
  +
           if (pageSeq.getTitleFO() != null) {
  -            title = getTitleArea(pageSeq.getTitleFO());
  +            ContentLayoutManager clm = 
  +            	new ContentLayoutManager(pageSeq.getTitleFO());
  +            clm.setAreaTreeHandler(areaTreeHandler);
  +            title = (LineArea) clm.getParentArea(null); // can improve
           }
   
           areaTreeModel.startPageSequence(title);
  @@ -201,9 +181,9 @@
           }
           // TODO: Don't decrement currentPageNum when no pages are generated
           currentPageNum--;
  -        log.debug("Ending layout");
           finishPage();
           pageSeq.getRoot().notifyPageSequenceFinished(currentPageNum, (currentPageNum - startPageNum) + 1);
  +        log.debug("Ending layout");
       }
   
       /** @see org.apache.fop.layoutmgr.LayoutManager#isBogus() */
  @@ -316,9 +296,9 @@
        * @param res the resolvable object that needs resolving
        */
       public void addUnresolvedArea(String id, Resolvable res) {
  -        // add unresolved to tree
  -        // adds to the page viewport so it can serialize
  +        // add to the page viewport so it can serialize
           curPage.addUnresolvedIDRef(id, res);
  +        // add unresolved to tree
           areaTreeHandler.addUnresolvedIDRef(id, curPage);
       }
   
  @@ -512,19 +492,20 @@
           if (region == null) {
               return;
           }
  -        StaticContent flow = pageSeq.getStaticContent(region.getRegionName());
  -        if (flow == null) {
  +        StaticContent sc = pageSeq.getStaticContent(region.getRegionName());
  +        if (sc == null) {
               return;
           }
           
           RegionViewport reg = curPage.getPage().getRegionViewport(region.getNameId());
           StaticContentLayoutManager lm;
           try {
  -            lm = getStaticContentLayoutManager(flow);
  +            lm = (StaticContentLayoutManager)
  +            	areaTreeHandler.getLayoutManagerMaker().makeLayoutManager(sc);
           } catch (FOPException e) {
               log.error
                   ("Failed to create a StaticContentLayoutManager for flow "
  -                 + flow.getFlowName()
  +                 + sc.getFlowName()
                    + "; no static content will be laid out:");
               log.error(e.getMessage());
               return;
  @@ -842,19 +823,4 @@
           rr.setIPD(reldims.ipd);
           rr.setBPD(reldims.bpd);
       }
  -
  -    /**
  -     * @return a StaticContent layout manager
  -     */
  -    private StaticContentLayoutManager getStaticContentLayoutManager(StaticContent sc)
  -        throws FOPException {
  -        StaticContentLayoutManager lm;
  -        //lm = (StaticContentLayoutManager) staticContentLMs.get(sc.getFlowName());
  -        //if (lm == null) {
  -            lm = (StaticContentLayoutManager)
  -                getAreaTreeHandler().getLayoutManagerMaker().makeLayoutManager(sc);
  -            //staticContentLMs.put(sc.getFlowName(), lm);
  -        //}
  -        return lm;
  -    }
   }
  
  
  
  1.22      +19 -0     xml-fop/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java
  
  Index: ContentLayoutManager.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/ContentLayoutManager.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ContentLayoutManager.java	20 Feb 2005 19:50:47 -0000	1.21
  +++ ContentLayoutManager.java	13 Mar 2005 04:14:04 -0000	1.22
  @@ -21,9 +21,11 @@
   import org.apache.fop.apps.FOUserAgent;
   import org.apache.fop.fo.FObj;
   import org.apache.fop.fo.Constants;
  +import org.apache.fop.fo.pagination.Title;
   import org.apache.fop.fo.flow.Marker;
   import org.apache.fop.area.Area;
   import org.apache.fop.area.AreaTreeHandler;
  +import org.apache.fop.area.LineArea;
   import org.apache.fop.area.inline.InlineArea;
   import org.apache.fop.area.Resolvable;
   import org.apache.fop.area.PageViewport;
  @@ -66,6 +68,23 @@
       }
   
       /**
  +     * Constructor using a fo:title formatting object
  +     */
  +    public ContentLayoutManager(Title foTitle) {
  +        // get breaks then add areas to title
  +        holder = new LineArea();
  +
  +        setUserAgent(foTitle.getUserAgent());
  +
  +        // use special layout manager to add the inline areas
  +        // to the Title.
  +        InlineLayoutManager lm;
  +        lm = new InlineLayoutManager(foTitle);
  +        addChildLM(lm);
  +        fillArea(lm);
  +    }
  +
  +    /**
        * Set the FO object for this layout manager
        *
        * @param fo the fo for this layout manager
  
  
  

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