gmazza 2005/03/05 11:53:13 Modified: src/java/org/apache/fop/area BodyRegion.java Flow.java RegionReference.java RegionViewport.java Span.java src/java/org/apache/fop/layoutmgr PageSequenceLayoutManager.java Log: More simplifications to PSLM. Revision Changes Path 1.9 +1 -0 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.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- BodyRegion.java 22 Sep 2004 08:18:41 -0000 1.8 +++ BodyRegion.java 5 Mar 2005 19:53:13 -0000 1.9 @@ -38,6 +38,7 @@ */ public BodyRegion() { super(Constants.FO_REGION_BODY); + addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); } /** 1.4 +7 -0 xml-fop/src/java/org/apache/fop/area/Flow.java Index: Flow.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/Flow.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Flow.java 22 Sep 2004 08:18:41 -0000 1.3 +++ Flow.java 5 Mar 2005 19:53:13 -0000 1.4 @@ -25,5 +25,12 @@ public class Flow extends BlockParent { // the list of blocks created from the flow private int stacking = TB; + + /** + * Constructor. + */ + public Flow() { + addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); + } } 1.6 +1 -0 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- RegionReference.java 29 Aug 2004 20:58:19 -0000 1.5 +++ RegionReference.java 5 Mar 2005 19:53:13 -0000 1.6 @@ -43,6 +43,7 @@ */ public RegionReference(int type) { regionClass = type; + addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); } /** 1.6 +1 -0 xml-fop/src/java/org/apache/fop/area/RegionViewport.java Index: RegionViewport.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/RegionViewport.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- RegionViewport.java 22 Sep 2004 08:19:48 -0000 1.5 +++ RegionViewport.java 5 Mar 2005 19:53:13 -0000 1.6 @@ -39,6 +39,7 @@ */ public RegionViewport(Rectangle2D viewArea) { this.viewArea = viewArea; + addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE); } /** 1.3 +14 -1 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.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Span.java 27 Feb 2004 17:41:26 -0000 1.2 +++ Span.java 5 Mar 2005 19:53:13 -0000 1.3 @@ -37,10 +37,11 @@ */ public Span(int cols) { flowAreas = new java.util.ArrayList(cols); + addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); } /** - * Add the flow area to this span area. + * Add a flow area to this span area. * * @param flow the flow area to add */ @@ -49,6 +50,18 @@ } /** + * Create a new flow and add it to this span area + * + * @return the newly made Flow object + */ + public Flow addNewFlow() { + Flow newFlow = new Flow(); + newFlow.setIPD(getIPD()); + flowAreas.add(newFlow); + return newFlow; + } + + /** * Get the column count for this span area. * * @return the number of columns in this span area 1.40 +4 -21 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.39 retrieving revision 1.40 diff -u -r1.39 -r1.40 --- PageSequenceLayoutManager.java 5 Mar 2005 00:32:25 -0000 1.39 +++ PageSequenceLayoutManager.java 5 Mar 2005 19:53:13 -0000 1.40 @@ -80,9 +80,6 @@ private String pageNumberString; private boolean isFirstPage = true; - /** True if haven't yet laid out any pages.*/ - private boolean bFirstPage; - /** Current page being worked on. */ private PageViewport curPage; @@ -602,7 +599,7 @@ // Make a new span and the first flow createSpan(numCols); } else if (curFlow == null) { - createFlow(); + curFlow = curSpan.addNewFlow(); } return curFlow; } else { @@ -642,7 +639,7 @@ if (curSpan != null && curSpan.getColumnCount() != curSpanColumns) { // Move to next column - createFlow(); + curFlow = curSpan.addNewFlow(); return; } // else need new page @@ -707,16 +704,6 @@ curBody.setMainReference(new MainReference()); } - private Flow createFlow() { - curFlow = new Flow(); - curFlow.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); - curFlow.setIPD(curSpan.getIPD()); // adjust for columns - //curFlow.setBPD(100000); - // Set IPD and max BPD on the curFlow from curBody - curSpan.addFlow(curFlow); - return curFlow; - } - 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) @@ -730,7 +717,6 @@ //} //else newpos = new MinOptMax(); curSpan = new Span(numCols); - curSpan.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); curSpanColumns = numCols; // get Width or Height as IPD for span @@ -741,7 +727,7 @@ curSpan.setIPD(ipdWidth); //curSpan.setPosition(BPD, newpos); curBody.getMainReference().addSpan(curSpan); - createFlow(); + curFlow = curSpan.addNewFlow(); } private PageViewport createPageAreas(SimplePageMaster spm) { @@ -803,7 +789,6 @@ // Get the region viewport rectangle in absolute coords by // transforming it using the page CTM RegionViewport rv = new RegionViewport(absRegionRect); - rv.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE); rv.setBPD((int)relRegionRect.getHeight()); rv.setIPD((int)relRegionRect.getWidth()); setRegionViewportTraits(r, rv); @@ -826,7 +811,6 @@ Rectangle2D absRegVPRect) { // Should set some column stuff here I think, or put it elsewhere BodyRegion body = new BodyRegion(); - body.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); setRegionPosition(r, body, absRegVPRect); int columnCount = r.getColumnCount(); if ((columnCount > 1) && (r.getOverflow() == EN_SCROLL)) { @@ -853,7 +837,6 @@ private RegionReference makeRegionReferenceArea(Region r, Rectangle2D absRegVPRect) { RegionReference rr = new RegionReference(r.getNameId()); - rr.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE); setRegionPosition(r, rr, absRegVPRect); return rr; }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]