cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
pietsch 2003/03/06 15:06:15 Modified:src/org/apache/fop/fo/pagination Tag: fop-0_20_2-maintain PageSequence.java Log: Avoid NPE if links are placed in spilled footnote. Link areas are still displaced, so they don't appear to work. Also, page numbers should now work in spilled footnotes. Revision ChangesPath No revision No revision 1.39.2.14 +14 -6 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.39.2.13 retrieving revision 1.39.2.14 diff -u -r1.39.2.13 -r1.39.2.14 --- PageSequence.java 25 Feb 2003 12:57:04 - 1.39.2.13 +++ PageSequence.java 6 Mar 2003 23:06:14 - 1.39.2.14 @@ -377,10 +377,6 @@ } Page newPage = this.currentSimplePageMaster.getPageMaster() .makePage(areaTree); -if (currentPage != null) { -ArrayList foots = currentPage.getPendingFootnotes(); -newPage.setPendingFootnotes(foots); -} newPage.setNumber(this.currentPageNumber); String formattedPageNumber = pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber); @@ -390,9 +386,21 @@ log.info([ + currentPageNumber + ]); BodyAreaContainer bodyArea = newPage.getBody(); bodyArea.setIDReferences(areaTree.getIDReferences()); +if (currentPage != null) { +ArrayList foots = currentPage.getPendingFootnotes(); +newPage.setPendingFootnotes(foots); +} flow.layout(bodyArea); } else { -log.info([ + currentPageNumber + (blank)]); +log.info([ + currentPageNumber + ] (blank)); +if (currentPage != null) { +ArrayList foots = currentPage.getPendingFootnotes(); +if (foots != null) { +BodyAreaContainer bodyArea = newPage.getBody(); +bodyArea.setIDReferences(areaTree.getIDReferences()); +newPage.setPendingFootnotes(foots); +} +} } // because of markers, do after fo:flow (likely also // justifiable because of spec) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
keiron 2002/11/06 02:02:29 Modified:src/org/apache/fop/layoutmgr PageLayoutManager.java src/org/apache/fop/fo/pagination PageSequence.java Log: layout correct static region improved docs and style Revision ChangesPath 1.23 +129 -27 xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java Index: PageLayoutManager.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- PageLayoutManager.java4 Nov 2002 11:50:11 - 1.22 +++ PageLayoutManager.java6 Nov 2002 10:02:28 - 1.23 @@ -8,7 +8,18 @@ package org.apache.fop.layoutmgr; import org.apache.fop.apps.FOPException; -import org.apache.fop.area.*; +import org.apache.fop.area.AreaTree; +import org.apache.fop.area.Area; +import org.apache.fop.area.PageViewport; +import org.apache.fop.area.Flow; +import org.apache.fop.area.RegionViewport; +import org.apache.fop.area.RegionReference; +import org.apache.fop.area.BodyRegion; +import org.apache.fop.area.MainReference; +import org.apache.fop.area.Span; +import org.apache.fop.area.BeforeFloat; +import org.apache.fop.area.Footnote; +import org.apache.fop.area.Resolveable; import org.apache.fop.fo.flow.StaticContent; import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.Region; @@ -16,6 +27,8 @@ import org.apache.fop.fo.pagination.PageNumberGenerator; import org.apache.fop.fo.properties.Constants; +import org.apache.fop.area.MinOptMax; + import java.util.ArrayList; import java.util.List; @@ -26,9 +39,9 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable { private static class BlockBreakPosition extends LeafPosition { -BreakPoss breakps; +protected BreakPoss breakps; -BlockBreakPosition(LayoutManager lm, BreakPoss bp) { +protected BlockBreakPosition(LayoutManager lm, BreakPoss bp) { super(lm, 0); breakps = bp; } @@ -37,6 +50,7 @@ private PageNumberGenerator pageNumberGenerator; private int pageCount = 1; private String pageNumberString; +private boolean isFirstPage = true; /** True if haven't yet laid out any pages.*/ private boolean bFirstPage; @@ -68,6 +82,9 @@ /** * This is the top level layout manager. * It is created by the PageSequence FO. + * + * @param areaTree the area tree to add pages to + * @param pageseq the page sequence fo */ public PageLayoutManager(AreaTree areaTree, PageSequence pageseq) { super(pageseq); @@ -75,12 +92,26 @@ pageSequence = pageseq; } +/** + * Set the page counting for this page sequence. + * This sets the initial page number and the page number formatter. + * + * @param pc the starting page number + * @param generator the page number generator + */ public void setPageCounting(int pc, PageNumberGenerator generator) { pageCount = pc; pageNumberGenerator = generator; pageNumberString = pageNumberGenerator.makeFormattedPageNumber(pageCount); } +/** + * Get the page count. + * Used to get the last page number for reference for + * the next page sequence. + * + * @return the page number + */ public int getPageCount() { return pageCount; } @@ -99,7 +130,12 @@ flush(); } -public void doLayout() { +/** + * Do 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. + */ +protected void doLayout() { // this should be done another way makeNewPage(false, false); @@ -123,7 +159,14 @@ pageCount--; } - +/** + * Get the next break possibility. + * This finds the next break for a page which is always at the end + * of the page. + * + * @param context the layout context for finding breaks + * @return the break for the page + */ public BreakPoss getNextBreakPoss(LayoutContext context) { LayoutManager curLM ; // currently active LM @@ -147,10 +190,24 @@ return null; } +/** + * Get the current page number string. + * This returns the formatted string for the current page. + * + * @return the formatted page number string + */ public String getCurrentPageNumber() { return pageNumberString; } +/** + * Resolve a reference ID. + * This resolves
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
keiron 2002/11/04 03:50:11 Modified:src/org/apache/fop/layoutmgr PageLayoutManager.java src/org/apache/fop/fo/pagination PageSequence.java Log: page numbering across sequences and number formatting Revision ChangesPath 1.22 +20 -7 xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java Index: PageLayoutManager.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/layoutmgr/PageLayoutManager.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- PageLayoutManager.java25 Oct 2002 09:29:45 - 1.21 +++ PageLayoutManager.java4 Nov 2002 11:50:11 - 1.22 @@ -13,6 +13,7 @@ import org.apache.fop.fo.pagination.PageSequence; import org.apache.fop.fo.pagination.Region; import org.apache.fop.fo.pagination.SimplePageMaster; +import org.apache.fop.fo.pagination.PageNumberGenerator; import org.apache.fop.fo.properties.Constants; import java.util.ArrayList; @@ -33,6 +34,10 @@ } } +private PageNumberGenerator pageNumberGenerator; +private int pageCount = 1; +private String pageNumberString; + /** True if haven't yet laid out any pages.*/ private boolean bFirstPage; /** Current page being worked on. */ @@ -60,8 +65,6 @@ private AreaTree areaTree; private PageSequence pageSequence; -private int pageCount = 1; - /** * This is the top level layout manager. * It is created by the PageSequence FO. @@ -72,6 +75,15 @@ pageSequence = pageseq; } +public void setPageCounting(int pc, PageNumberGenerator generator) { +pageCount = pc; +pageNumberGenerator = generator; +pageNumberString = pageNumberGenerator.makeFormattedPageNumber(pageCount); +} + +public int getPageCount() { +return pageCount; +} /** * The layout process is designed to be able to be run in a thread. @@ -104,10 +116,11 @@ // finish page and add to area tree finishPage(); +pageCount++; +pageNumberString = pageNumberGenerator.makeFormattedPageNumber(pageCount); } -pageCount++; } - +pageCount--; } @@ -135,7 +148,7 @@ } public String getCurrentPageNumber() { -return + pageCount; +return pageNumberString; } public PageViewport resolveRefID(String ref) { @@ -251,7 +264,7 @@ private PageViewport makeNewPage(boolean bIsBlank, boolean bIsLast) { finishPage(); try { -curPage = pageSequence.createPage(bIsBlank, bIsLast); +curPage = pageSequence.createPage(pageCount, bIsBlank, bIsLast); } catch (FOPException fopex) { /* */ fopex.printStackTrace(); } 1.57 +39 -135 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- PageSequence.java 25 Oct 2002 09:29:43 - 1.56 +++ PageSequence.java 4 Nov 2002 11:50:11 - 1.57 @@ -1,14 +1,9 @@ /* * $Id$ - * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. + * Copyright (C) 2001-2002 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. */ -/* - Modified by Mark Lillywhite [EMAIL PROTECTED] Does not add - itself to the root any more. Does not hang onto currentPage - pointer, which caused GC issues. - */ package org.apache.fop.fo.pagination; @@ -115,7 +110,7 @@ /** * The main content flow for this page-sequence. */ -private Flow mainFlow=null; +private Flow mainFlow = null; /** * The fo:title object for this page-sequence. @@ -146,8 +141,8 @@ _flowMap = new HashMap(); -thisIsFirstPage = -true;// we are now on the first page of the page sequence +// we are now on the first page of the page sequence +thisIsFirstPage = true; ipnValue = this.properties.get(initial-page-number).getString(); if (ipnValue.equals(auto)) { @@ -171,10 +166,10 @@ String masterName = this.properties.get(master-reference).getString(); this.currentSimplePageMaster = this.layoutMasterSet.getSimplePageMaster(masterName); -if (this.currentSimplePageMaster==null) { +if
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
pietsch 2002/08/21 15:10:53 Modified:src/org/apache/fop/fo/pagination Tag: fop-0_20_2-maintain PageSequence.java Log: Fixed page number setup for consecutive page sequences. Revision ChangesPath No revision No revision 1.39.2.9 +3 -1 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.39.2.8 retrieving revision 1.39.2.9 diff -u -r1.39.2.8 -r1.39.2.9 --- PageSequence.java 2 Aug 2002 20:28:50 - 1.39.2.8 +++ PageSequence.java 21 Aug 2002 22:10:52 - 1.39.2.9 @@ -224,6 +224,8 @@ previousPageSequence.makePage(areaTree,true,null); } currentPageNumber = firstPageNumber; +} else { +currentPageNumber = previousPageSequence.currentPageNumber; } } else { currentPageNumber = previousPageSequence.currentPageNumber; - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
pietsch 2002/07/27 03:50:19 Modified:src/org/apache/fop/fo/pagination Tag: fop-0_20_2-maintain PageSequence.java Log: Check whether there is a flow in a page sequence. Revision ChangesPath No revision No revision 1.39.2.7 +7 -4 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.39.2.6 retrieving revision 1.39.2.7 diff -u -r1.39.2.6 -r1.39.2.7 --- PageSequence.java 24 Jul 2002 02:39:44 - 1.39.2.6 +++ PageSequence.java 27 Jul 2002 10:50:18 - 1.39.2.7 @@ -202,6 +202,9 @@ * Runs the formatting of this page sequence into the given area tree */ public void format(AreaTree areaTree) throws FOPException { +if (flow == null) { +throw new FOPException(No flow in page-sequence); +} PageSequence previousPageSequence=this.root.getPageSequence(); if( previousPageSequence!=null ) { if (previousPageSequence.forcePageCountType == ForcePageCount.AUTO) { @@ -310,11 +313,11 @@ * @return a Page layout object based on the page master selected from the params */ private Page makePage(AreaTree areaTree, - boolean isBlankPage, - Page currentPage) + boolean isBlankPage, + Page currentPage) throws FOPException { if (this.pageSequenceMaster!=null) { -this.currentSimplePageMaster=this.pageSequenceMaster +this.currentSimplePageMaster = this.pageSequenceMaster .getNextSimplePageMaster(((this.currentPageNumber % 2)==1), isBlankPage); Region region = currentSimplePageMaster - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
pietsch 2002/07/23 19:39:45 Modified:src/org/apache/fop/fo/flow Tag: fop-0_20_2-maintain Flow.java StaticContent.java src/org/apache/fop/fo/pagination Tag: fop-0_20_2-maintain PageSequence.java Added: src/org/apache/fop/fo/flow Tag: fop-0_20_2-maintain AbstractFlow.java Log: Removed fo:flow hackery. Simplified structure checking and page layout loop. Some minor cosmetic changes. Revision ChangesPath No revision No revision 1.24.2.3 +2 -181xml-fop/src/org/apache/fop/fo/flow/Flow.java Index: Flow.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Flow.java,v retrieving revision 1.24.2.2 retrieving revision 1.24.2.3 diff -u -r1.24.2.2 -r1.24.2.3 --- Flow.java 24 Jul 2002 01:06:22 - 1.24.2.2 +++ Flow.java 24 Jul 2002 02:39:44 - 1.24.2.3 @@ -12,82 +12,25 @@ import org.apache.fop.fo.properties.*; import org.apache.fop.fo.pagination.*; import org.apache.fop.layout.Area; -import org.apache.fop.layout.BodyAreaContainer; import org.apache.fop.apps.FOPException; -// Java -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Vector; - -public class Flow extends FObj { +public class Flow extends AbstractFlow { public static class Maker extends FObj.Maker { public FObj make(FObj parent, PropertyList propertyList) throws FOPException { return new Flow(parent, propertyList); } - } public static FObj.Maker maker() { return new Flow.Maker(); } -/** - * PageSequence container - */ -private PageSequence pageSequence; - -/** - * Area in which we lay out our kids - */ -private Area area; - -/** - * Vector to store snapshot - */ -private Vector markerSnapshot; - -/** - * flow-name attribute - */ -private String _flowName; - -/** - * Content-width of current column area during layout - */ -private int contentWidth; - -private Status _status = new Status(Status.AREA_FULL_NONE); - - protected Flow(FObj parent, PropertyList propertyList) throws FOPException { super(parent, propertyList); - -if (parent.getName().equals(fo:page-sequence)) { -this.pageSequence = (PageSequence)parent; -} else { -throw new FOPException(flow must be child of page-sequence, not - + parent.getName()); -} setFlowName(getProperty(flow-name).getString()); - -// according to communication from Paul Grosso (XSL-List, -// 001228, Number 406), confusion in spec section 6.4.5 about -// multiplicity of fo:flow in XSL 1.0 is cleared up - one (1) -// fo:flow per fo:page-sequence only. - -if (pageSequence.isFlowSet()) { -if (getName().equals(fo:flow)) { -throw new FOPException(Only a single fo:flow permitted - + per fo:page-sequence); -} else { -throw new FOPException(getName() - + not allowed after fo:flow); -} -} pageSequence.addFlow(this); } @@ -105,128 +48,6 @@ _flowName = name; } -} - -public String getFlowName() { -return _flowName; -} - -public Status layout(Area area) throws FOPException { -return layout(area, null); - -} - -public Status layout(Area area, Region region) throws FOPException { -if (this.marker == START) { -this.marker = 0; -} - -// flow is *always* laid out into a BodyAreaContainer -BodyAreaContainer bac = (BodyAreaContainer)area; - -boolean prevChildMustKeepWithNext = false; -Vector pageMarker = this.getMarkerSnapshot(new Vector()); - -int numChildren = this.children.size(); -if (numChildren == 0) { -throw new FOPException(fo:flow must contain block-level children); -} -for (int i = this.marker; i numChildren; i++) { -FObj fo = (FObj)children.elementAt(i); - -if (bac.isBalancingRequired(fo)) { -// reset the the just-done span area in preparation -// for a backtrack for balancing -bac.resetSpanArea(); - -this.rollback(markerSnapshot); -// one less because of the continue -i = this.marker - 1;
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java Root.java
pietsch 2002/07/11 18:15:33 Modified:src/org/apache/fop/fo/pagination Tag: fop-0_20_2-maintain PageSequence.java Root.java Log: Rearranged and simplified calculations related to page numbering and forced pages. Fixed force-page-count=auto Removed some cruft. Revision ChangesPath No revision No revision 1.39.2.3 +97 -134 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.39.2.2 retrieving revision 1.39.2.3 diff -u -r1.39.2.2 -r1.39.2.3 --- PageSequence.java 3 Jan 2002 10:39:56 - 1.39.2.2 +++ PageSequence.java 12 Jul 2002 01:15:33 - 1.39.2.3 @@ -101,10 +101,12 @@ private Page currentPage; // page number and related formatting variables -private String ipnValue; -private int currentPageNumber = 0; +//private String ipnValue; +private int firstPageNumber = 0; private PageNumberGenerator pageNumberGenerator; +private int currentPageNumber = 0; + private int forcePageCount = 0; private int pageCount = 0; private boolean isForcing = false; @@ -115,11 +117,6 @@ private int pageNumberType; /** - * used to determine whether to calculate auto, auto-even, auto-odd - */ -private boolean thisIsFirstPage; - -/** * the current subsequence while formatting a given page sequence */ private SubSequenceSpecifier currentSubsequence; @@ -143,7 +140,6 @@ if (parent.getName().equals(fo:root)) { this.root = (Root)parent; -// this.root.addPageSequence(this); } else { throw new FOPException(page-sequence must be child of root, not @@ -157,21 +153,22 @@ _flowMap = new Hashtable(); -thisIsFirstPage = -true;// we are now on the first page of the page sequence -ipnValue = this.properties.get(initial-page-number).getString(); +String ipnValue = this.properties.get(initial-page-number).getString(); if (ipnValue.equals(auto)) { pageNumberType = AUTO; +this.firstPageNumber = 1; } else if (ipnValue.equals(auto-even)) { pageNumberType = AUTO_EVEN; +this.firstPageNumber = 2; } else if (ipnValue.equals(auto-odd)) { pageNumberType = AUTO_ODD; +this.firstPageNumber = 1; } else { pageNumberType = EXPLICIT; try { int pageStart = new Integer(ipnValue).intValue(); -this.currentPageNumber = (pageStart 0) ? pageStart - 1 : 0; +this.firstPageNumber = (pageStart 0) ? pageStart : 1; } catch (NumberFormatException nfe) { throw new FOPException(\ + ipnValue + \ is not a valid value for initial-page-number); @@ -219,68 +216,71 @@ this.layoutMasterSet.resetPageMasters(); -int firstAvailPageNumber = 0; -do { -// makePage() moved to after the page-number computations, -// but store the page-number at this point for that method, -// since we want the 'current' current page-number... -firstAvailPageNumber = this.root.getRunningPageNumberCounter(); -boolean tempIsFirstPage = false; - -if (thisIsFirstPage) { -tempIsFirstPage = thisIsFirstPage; -if (pageNumberType == AUTO) { -this.currentPageNumber = -this.root.getRunningPageNumberCounter(); -} else if (pageNumberType == AUTO_ODD) { -this.currentPageNumber = -this.root.getRunningPageNumberCounter(); -if (this.currentPageNumber % 2 == 1) { -this.currentPageNumber++; +PageSequence previousPageSequence=this.root.getPageSequence(); +if( previousPageSequence!=null ) { +currentPageNumber = previousPageSequence.currentPageNumber; +if (previousPageSequence.forcePageCount == ForcePageCount.AUTO) { +if (pageNumberType == AUTO_ODD) { +if (currentPageNumber % 2 == 0) { +makeBlankPage(areaTree); +} +} else if (pageNumberType == AUTO_EVEN) { +if (currentPageNumber % 2 == 1) { +makeBlankPage(areaTree); +} +} else if (pageNumberType
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
keiron 02/01/03 02:39:56 Modified:src/org/apache/fop/apps Tag: fop-0_20_2-maintain Driver.java StreamRenderer.java src/org/apache/fop/fo Tag: fop-0_20_2-maintain FOTreeBuilder.java src/org/apache/fop/fo/pagination Tag: fop-0_20_2-maintain PageSequence.java Added: src/org/apache/fop/apps Tag: fop-0_20_2-maintain FormattingResults.java PageSequenceResults.java Log: Formatting results patch to enable embedders to obtain info from render doc Submitted by: Jeremias Maerki [EMAIL PROTECTED] Revision ChangesPath No revision No revision 1.36.2.1 +17 -14xml-fop/src/org/apache/fop/apps/Driver.java Index: Driver.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/Driver.java,v retrieving revision 1.36 retrieving revision 1.36.2.1 diff -u -r1.36 -r1.36.2.1 --- Driver.java 5 Oct 2001 09:49:21 - 1.36 +++ Driver.java 3 Jan 2002 10:39:56 - 1.36.2.1 @@ -1,5 +1,5 @@ /* - * $Id: Driver.java,v 1.36 2001/10/05 09:49:21 keiron Exp $ + * $Id: Driver.java,v 1.36.2.1 2002/01/03 10:39:56 keiron Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -241,6 +241,19 @@ _treeBuilder.reset(); } +/** + * Returns the results of the last rendering process. Information includes + * the total number of pages generated and the number of pages per + * page-sequence. + */ +public FormattingResults getResults() { +try { +return _treeBuilder.getStreamRenderer().getResults(); +} catch (NullPointerException e) { +return null; +} +} + public boolean hasData() { return (_treeBuilder.hasData()); } @@ -483,19 +496,9 @@ */ public synchronized void render(Document document) throws FOPException { - -try { -DocumentInputSource source = new DocumentInputSource(document); -DocumentReader reader = new DocumentReader(); -reader.setContentHandler(getContentHandler()); -reader.parse(source); -} catch (SAXException e) { -throw new FOPException(e); -} -catch (IOException e) { -throw new FOPException(e); -} - + DocumentInputSource source = new DocumentInputSource(document); + DocumentReader reader = new DocumentReader(); + render(reader, source); } /** 1.6.2.1 +11 -0 xml-fop/src/org/apache/fop/apps/StreamRenderer.java Index: StreamRenderer.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/apps/StreamRenderer.java,v retrieving revision 1.6 retrieving revision 1.6.2.1 diff -u -r1.6 -r1.6.2.1 --- StreamRenderer.java 11 Sep 2001 10:04:24 - 1.6 +++ StreamRenderer.java 3 Jan 2002 10:39:56 - 1.6.2.1 @@ -66,6 +66,11 @@ private Renderer renderer; /** + * The formatting results to be handed back to the caller. + */ +private FormattingResults results = new FormattingResults(); + +/** The FontInfo for this renderer. */ private FontInfo fontInfo = new FontInfo(); @@ -102,6 +107,10 @@ return idReferences; } +public FormattingResults getResults() { +return this.results; +} + public void addExtension(ExtensionObj ext) { extensions.addElement(ext); } @@ -192,6 +201,8 @@ } catch (FOPException e) { throw new SAXException(e); } +this.results.haveFormattedPageSequence(pageSequence); +log.debug(Last page-sequence produced +pageSequence.getPageCount()+ pages.); } public synchronized void queuePage(Page page) No revision No revision 1.1.2.1 +73 -0 xml-fop/src/org/apache/fop/apps/Attic/FormattingResults.java 1.1.2.1 +50 -0 xml-fop/src/org/apache/fop/apps/Attic/PageSequenceResults.java No revision No revision 1.30.2.1 +5 -1 xml-fop/src/org/apache/fop/fo/FOTreeBuilder.java Index: FOTreeBuilder.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOTreeBuilder.java,v retrieving revision 1.30 retrieving revision 1.30.2.1 diff -u -r1.30 -r1.30.2.1 ---
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
klease 01/11/11 06:15:10 Modified:src/org/apache/fop/fo FOText.java FObj.java src/org/apache/fop/fo/flow Block.java src/org/apache/fop/fo/pagination PageSequence.java Log: Integrate layout managers for text and block Revision ChangesPath 1.26 +6 -1 xml-fop/src/org/apache/fop/fo/FOText.java Index: FOText.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FOText.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- FOText.java 2001/11/09 11:32:37 1.25 +++ FOText.java 2001/11/11 14:15:09 1.26 @@ -1,5 +1,5 @@ /* - * $Id: FOText.java,v 1.25 2001/11/09 11:32:37 keiron Exp $ + * $Id: FOText.java,v 1.26 2001/11/11 14:15:09 klease Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -16,6 +16,8 @@ import org.apache.fop.fo.properties.*; import org.apache.fop.apps.FOPException; import org.apache.fop.system.BufferManager; +import org.apache.fop.layoutmgr.LayoutManager; +import org.apache.fop.layoutmgr.TextLayoutManager; /** * a text node in the formatting object tree @@ -234,5 +236,8 @@ return -1; } +public LayoutManager getLayoutManager() { + return new TextLayoutManager(this, ca); +} } 1.24 +4 -3 xml-fop/src/org/apache/fop/fo/FObj.java Index: FObj.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/FObj.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- FObj.java 2001/11/09 22:04:58 1.23 +++ FObj.java 2001/11/11 14:15:09 1.24 @@ -1,5 +1,5 @@ /* - * $Id: FObj.java,v 1.23 2001/11/09 22:04:58 klease Exp $ + * $Id: FObj.java,v 1.24 2001/11/11 14:15:09 klease Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -25,6 +25,7 @@ import org.xml.sax.Attributes; import java.util.Iterator; +import java.util.ListIterator; import java.util.Vector; import java.util.Hashtable; @@ -199,8 +200,8 @@ } -public Iterator getChildren() { - return children.iterator(); +public ListIterator getChildren() { + return children.listIterator(); } public void setIsInTableCell() { 1.45 +3 -4 xml-fop/src/org/apache/fop/fo/flow/Block.java Index: Block.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Block.java,v retrieving revision 1.44 retrieving revision 1.45 diff -u -r1.44 -r1.45 --- Block.java2001/11/09 22:08:49 1.44 +++ Block.java2001/11/11 14:15:10 1.45 @@ -1,5 +1,5 @@ /* - * $Id: Block.java,v 1.44 2001/11/09 22:08:49 klease Exp $ + * $Id: Block.java,v 1.45 2001/11/11 14:15:10 klease Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -14,7 +14,7 @@ import org.apache.fop.datatypes.*; import org.apache.fop.apps.FOPException; import org.apache.fop.layoutmgr.LayoutManager; -//import org.apache.fop.layoutmgr.BlockLayoutManager; +import org.apache.fop.layoutmgr.BlockLayoutManager; import org.xml.sax.Attributes; @@ -353,8 +353,7 @@ } public LayoutManager getLayoutManager() { - //return new BlockLayoutManager(this); - return null; + return new BlockLayoutManager(this); } } 1.44 +27 -23xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- PageSequence.java 2001/11/09 22:37:40 1.43 +++ PageSequence.java 2001/11/11 14:15:10 1.44 @@ -1,5 +1,5 @@ /* - * $Id: PageSequence.java,v 1.43 2001/11/09 22:37:40 klease Exp $ + * $Id: PageSequence.java,v 1.44 2001/11/11 14:15:10 klease Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -242,6 +242,7 @@ else { this.mainFlow = (Flow)child; addFlow(mainFlow); + super.addChild(child); // For getChildren
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
klease 01/11/09 14:37:40 Modified:src/org/apache/fop/fo/pagination PageSequence.java Log: Start to use layout managers and comment out a bunch of (temporarily) unusable code Revision ChangesPath 1.43 +389 -283 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.42 retrieving revision 1.43 diff -u -r1.42 -r1.43 --- PageSequence.java 2001/11/09 11:32:40 1.42 +++ PageSequence.java 2001/11/09 22:37:40 1.43 @@ -1,5 +1,5 @@ /* - * $Id: PageSequence.java,v 1.42 2001/11/09 11:32:40 keiron Exp $ + * $Id: PageSequence.java,v 1.43 2001/11/09 22:37:40 klease Exp $ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -17,14 +17,13 @@ import org.apache.fop.fo.properties.*; import org.apache.fop.fo.flow.Flow; import org.apache.fop.fo.flow.StaticContent; -import org.apache.fop.layout.Area; -import org.apache.fop.layout.AreaContainer; -import org.apache.fop.layout.BodyAreaContainer; -import org.apache.fop.layout.AreaTree; -import org.apache.fop.layout.Page; import org.apache.fop.layout.PageMaster; +import org.apache.fop.area.AreaTree; +import org.apache.fop.area.PageViewport; import org.apache.fop.apps.FOPException; +import org.apache.fop.layoutmgr.PageLayoutManager; + // Java import java.util.*; @@ -83,11 +82,13 @@ // state attributes used during layout // -private Page currentPage; +private PageViewport currentPage; // page number and related formatting variables private String ipnValue; private int currentPageNumber = 0; +private int explicitFirstNumber = 0; // explicitly specified +private int firstPageNumber = 0; // actual private PageNumberGenerator pageNumberGenerator; private int forcePageCount = 0; @@ -120,6 +121,16 @@ */ private String currentPageMasterName; +/** + * The main content flow for this page-sequence. + */ +private Flow mainFlow=null; + +/** + * The fo:title object for this page-sequence. + */ +private FObj titleFO; + public PageSequence(FONode parent) { super(parent); @@ -158,14 +169,18 @@ pageNumberType = EXPLICIT; try { int pageStart = new Integer(ipnValue).intValue(); -this.currentPageNumber = (pageStart 0) ? pageStart - 1 : 0; +this.explicitFirstNumber = (pageStart 0) ? pageStart - 1 : 0; } catch (NumberFormatException nfe) { throw new FOPException(\ + ipnValue + \ is not a valid value for initial-page-number); } } + masterName = this.properties.get(master-reference).getString(); + // TODO: Add code here to set a reference to the PageSequenceMaster + // if the masterName names a page-sequence-master, else get a + // reference to the SimplePageMaster. Throw an exception if neither? // get the 'format' properties this.pageNumberGenerator = @@ -183,7 +198,13 @@ } -public void addFlow(Flow flow) throws FOPException { +/** + * Add a flow or static content, mapped by its flow-name. + * The flow-name is used to associate the flow with a region on a page, + * based on the names given to the regions in the page-master used to + * generate that page. + */ +private void addFlow(Flow flow) throws FOPException { if (_flowMap.containsKey(flow.getFlowName())) { throw new FOPException(flow-names must be unique within an fo:page-sequence); } @@ -193,112 +214,193 @@ + ' doesn't exist in the layout-master-set.); } _flowMap.put(flow.getFlowName(), flow); -setIsFlowSet(true); +//setIsFlowSet(true); } /** - * Runs the formatting of this page sequence into the given area tree - */ -public void format(AreaTree areaTree) throws FOPException { - -Status status = new Status(Status.OK); - -this.layoutMasterSet.resetPageMasters(); + * Validate the child being added and initialize internal variables. + * XSL content model for page-sequence: + * pre(title?,static-content*,flow)/pre + * Note: title isn't currently implemented. + * @param child The flow object child to be added to the PageSequence. + */ +public void addChild(FONode child) { + try { +
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
arved 01/07/22 18:59:38 Modified:src/org/apache/fop/fo/pagination PageSequence.java Log: AHS: continued work on fo:marker support Revision ChangesPath 1.33 +5 -2 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -r1.32 -r1.33 --- PageSequence.java 2001/07/16 10:45:08 1.32 +++ PageSequence.java 2001/07/23 01:59:38 1.33 @@ -1,4 +1,4 @@ -/*-- $Id: PageSequence.java,v 1.32 2001/07/16 10:45:08 arved Exp $ -- +/*-- $Id: PageSequence.java,v 1.33 2001/07/23 01:59:38 arved Exp $ -- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -264,7 +264,9 @@ } - // because of markers, do after fo:flow + // because of markers, do after fo:flow (likely also + // justifiable because of spec) + currentPage.setPageSequence(this); formatStaticContent(areaTree); MessageHandler.log(]); @@ -627,6 +629,7 @@ String formattedPageNumber = pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber); currentPage.setFormattedNumber(formattedPageNumber); + currentPage.setPageSequence(this); formatStaticContent(areaTree); MessageHandler.log([forced- + firstAvailPageNumber + ]); areaTree.addPage(currentPage); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
arved 01/07/08 20:01:15 Modified:src/org/apache/fop/fo/pagination PageSequence.java Log: AHS: support 'force-page-count' Revision ChangesPath 1.31 +97 -6 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- PageSequence.java 2001/07/08 05:04:10 1.30 +++ PageSequence.java 2001/07/09 03:01:12 1.31 @@ -1,4 +1,4 @@ -/*-- $Id: PageSequence.java,v 1.30 2001/07/08 05:04:10 arved Exp $ -- +/*-- $Id: PageSequence.java,v 1.31 2001/07/09 03:01:12 arved Exp $ -- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -83,10 +83,15 @@ private Page currentPage; - // page number and elated formatting variables + // page number and related formatting variables + private String ipnValue; private int currentPageNumber = 0; private PageNumberGenerator pageNumberGenerator; + private int forcePageCount = 0; + private int pageCount = 0; + private boolean isForcing = false; + /** specifies page numbering type (auto|auto-even|auto-odd|explicit) */ private int pageNumberType; @@ -125,8 +130,7 @@ _flowMap = new Hashtable(); thisIsFirstPage = true; // we are now on the first page of the page sequence -String ipnValue = - this.properties.get(initial-page-number).getString(); +ipnValue = this.properties.get(initial-page-number).getString(); if (ipnValue.equals(auto)) { pageNumberType = AUTO; @@ -154,6 +158,8 @@ this.properties.get(grouping-size).getNumber().intValue(), this.properties.get(letter-value).getEnum() ); + + this.forcePageCount = this.properties.get(force-page-count).getEnum(); } public void addFlow(Flow flow) throws FOPException { @@ -177,11 +183,12 @@ this.layoutMasterSet.resetPageMasters(); + int firstAvailPageNumber = 0; do { // makePage() moved to after the page-number computations, // but store the page-number at this point for that method, // since we want the 'current' current page-number... -int firstAvailPageNumber = +firstAvailPageNumber = this.root.getRunningPageNumberCounter(); boolean tempIsFirstPage = false; @@ -260,9 +267,12 @@ } MessageHandler.log(]); areaTree.addPage(currentPage); + this.pageCount++; // used for 'force-page-count' calculations } while (flowsAreIncomplete()) ; - + // handle the 'force-page-count' + forcePage(areaTree, firstAvailPageNumber); + MessageHandler.logln(); } @@ -398,6 +408,12 @@ private SimplePageMaster getNextSimplePageMaster( PageSequenceMaster sequenceMaster, int currentPageNumber, boolean thisIsFirstPage, boolean isEmptyPage) { + // handle forcing + if (isForcing) { + String nextPageMaster = getNextPageMasterName(sequenceMaster, + currentPageNumber, false, true); + return this.layoutMasterSet.getSimplePageMaster(nextPageMaster); + } String nextPageMaster = getNextPageMasterName(sequenceMaster, currentPageNumber, thisIsFirstPage, isEmptyPage); return this.layoutMasterSet.getSimplePageMaster(nextPageMaster); @@ -522,6 +538,7 @@ private boolean isFlowForMasterNameDone(String masterName) { // parameter is master-name of PMR; we need to locate PM // referenced by this, and determine whether flow(s) are OK + if (isForcing) return false; if (masterName != null) { SimplePageMaster spm = @@ -545,4 +562,78 @@ public void setIsFlowSet(boolean isFlowSet) { this.isFlowSet = isFlowSet; } + + public String getIpnValue() { + return ipnValue; + } + + public int getCurrentPageNumber() { + return currentPageNumber; + } + + private void forcePage(AreaTree areaTree, int firstAvailPageNumber) { + boolean makePage = false; + if (this.forcePageCount == ForcePageCount.AUTO) { + PageSequence nextSequence = +
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java
arved 01/07/07 22:04:11 Modified:src/org/apache/fop/fo/pagination PageSequence.java Log: Supports page-number formatting Revision ChangesPath 1.30 +14 -3 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- PageSequence.java 2001/06/22 08:52:08 1.29 +++ PageSequence.java 2001/07/08 05:04:10 1.30 @@ -1,4 +1,4 @@ -/*-- $Id: PageSequence.java,v 1.29 2001/06/22 08:52:08 keiron Exp $ -- +/*-- $Id: PageSequence.java,v 1.30 2001/07/08 05:04:10 arved Exp $ -- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. * For details on use and redistribution please refer to the * LICENSE file included with these sources. @@ -83,8 +83,10 @@ private Page currentPage; + // page number and elated formatting variables private int currentPageNumber = 0; - + private PageNumberGenerator pageNumberGenerator; + /** specifies page numbering type (auto|auto-even|auto-odd|explicit) */ private int pageNumberType; @@ -144,8 +146,14 @@ } masterName = this.properties.get(master-name).getString(); - + // get the 'format' properties + this.pageNumberGenerator = + new PageNumberGenerator( this.properties.get(format).getString(), + this.properties.get(grouping-separator).getCharacter(), + this.properties.get(grouping-size).getNumber().intValue(), + this.properties.get(letter-value).getEnum() + ); } public void addFlow(Flow flow) throws FOPException { @@ -219,6 +227,9 @@ tempIsFirstPage, isEmptyPage); currentPage.setNumber(this.currentPageNumber); + String formattedPageNumber = + pageNumberGenerator.makeFormattedPageNumber(this.currentPageNumber); + currentPage.setFormattedNumber(formattedPageNumber); this.root.setRunningPageNumberCounter(this.currentPageNumber); MessageHandler.log( [ + currentPageNumber); - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: xml-fop/src/org/apache/fop/fo/pagination PageSequence.java Root.java
keiron 01/06/22 01:52:08 Modified:src/org/apache/fop/fo/pagination PageSequence.java Root.java Log: should handle page number properly, with threads and multiple page sequences also cleaned up code Submitted by: Jeremias Maerki [EMAIL PROTECTED] Revision ChangesPath 1.29 +353 -386 xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java Index: PageSequence.java === RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/PageSequence.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- PageSequence.java 2001/05/01 01:00:32 1.28 +++ PageSequence.java 2001/06/22 08:52:08 1.29 @@ -1,8 +1,7 @@ -/*-- $Id: PageSequence.java,v 1.28 2001/05/01 01:00:32 arved Exp $ -- - * +/*-- $Id: PageSequence.java,v 1.29 2001/06/22 08:52:08 keiron Exp $ -- * Copyright (C) 2001 The Apache Software Foundation. All rights reserved. - * For details on use and redistribution please refer to the - * LICENSE file included with these sources. + * For details on use and redistribution please refer to the + * LICENSE file included with these sources. */ package org.apache.fop.fo.pagination; @@ -19,7 +18,7 @@ import org.apache.fop.layout.AreaTree; import org.apache.fop.layout.Page; import org.apache.fop.layout.PageMaster; -import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOPException; // Java import java.util.*; @@ -29,15 +28,13 @@ * This provides pagination of flows onto pages. Much of the logic for paginating * flows is contained in this class. The main entry point is the format method. */ -public class PageSequence extends FObj -{ +public class PageSequence extends FObj { // // Factory methods // -public static class Maker extends FObj.Maker -{ -public FObj make(FObj parent, PropertyList propertyList) -throws FOPException { +public static class Maker extends FObj.Maker { +public FObj make(FObj parent, + PropertyList propertyList) throws FOPException { return new PageSequence(parent, propertyList); } } @@ -74,11 +71,11 @@ /** the master-name attribute */ private String masterName; - // according to communication from Paul Grosso (XSL-List, - // 001228, Number 406), confusion in spec section 6.4.5 about - // multiplicity of fo:flow in XSL 1.0 is cleared up - one (1) - // fo:flow per fo:page-sequence only. - private boolean isFlowSet = false; +// according to communication from Paul Grosso (XSL-List, +// 001228, Number 406), confusion in spec section 6.4.5 about +// multiplicity of fo:flow in XSL 1.0 is cleared up - one (1) +// fo:flow per fo:page-sequence only. +private boolean isFlowSet = false; // // state attributes used during layout @@ -88,9 +85,6 @@ private int currentPageNumber = 0; -/** keeps count of page number from previous PageSequence */ -private int runningPageNumberCounter = 0; - /** specifies page numbering type (auto|auto-even|auto-odd|explicit) */ private int pageNumberType; @@ -107,78 +101,65 @@ private String currentPageMasterName; -protected PageSequence(FObj parent, PropertyList propertyList) -throws FOPException { +protected PageSequence(FObj parent, + PropertyList propertyList) throws FOPException { super(parent, propertyList); this.name = fo:page-sequence; -if ( parent.getName().equals(fo:root) ) -{ -this.runningPageNumberCounter=0; //else not initialized correctly +if (parent.getName().equals(fo:root)) { this.root = (Root) parent; this.root.addPageSequence(this); -} -else -{ -throw -new FOPException(page-sequence must be child of root, not -+ parent.getName()); +} else { +throw new FOPException( + page-sequence must be child of root, not + + parent.getName()); } - + layoutMasterSet = root.getLayoutMasterSet(); - // best time to run some checks on LayoutMasterSet +// best time to run some checks on LayoutMasterSet layoutMasterSet.checkRegionNames(); - - _flowMap = new Hashtable(); -thisIsFirstPage=true; // we are now on the first page of the page sequence -String ipnValue= this.properties.get(initial-page-number).getString(); +_flowMap = new Hashtable(); -if ( ipnValue.equals(auto) ) -{ -pageNumberType=AUTO; -} -