Jeremias Maerki wrote: > jeremias 2004/10/10 04:21:29 > > Modified: src/java/org/apache/fop/layoutmgr LineLayoutManager.java > Log: > This is supposed to fix a problem that surfaced with Finn's latest > change in PageSequence. There was an ArrayIndexOutOfBoundsException here in > LineLayoutManager when a static region was layouted for the second page > (instance is reused). It seems to me that "iCurrParIndex" could be made a > method-local variable instead of an instance variable.
It took me a while to notice that these changes cause another problem for blocks containing preserved linefeeds and whose lines are parted on different pages. For these blocks, the array named knuthParagraphs has more than one element (the block will generate more than one paragraph) and the method LineLM.addAreas() is called more than once, so it isn't always right to set iCurrParIndex to 0. I'm attaching a fo file showing this problem. So, iCurrParIndex must be set to 0 in addAreas only for LineLM descendant of a StaticContentLM. But maybe it isn't necessary to call addAreas more than once for static content: as the static content is repeated on each page, wouldn't it be better to store the static area sub-tree and re-use it? Regards, Luca
<?xml version="1.0" encoding="UTF-8"?><fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="simple"> <fo:region-body region-name="xsl-region-body" background-color="pink" margin="1in"/> <fo:region-after region-name="xsl-region-after" background-color="lightblue" extent="1in"/> </fo:simple-page-master> </fo:layout-master-set> <fo:page-sequence master-reference="simple"> <fo:static-content flow-name="xsl-region-after"> <fo:block linefeed-treatment="preserve">First paragraph in the static content. Second paragraph in the static content.</fo:block> </fo:static-content> <fo:flow flow-name="xsl-region-body"> <fo:block font-size="60pt">Text</fo:block> <fo:block font-size="60pt">Text</fo:block> <fo:block>The following block has a preserved linefeed.</fo:block> <fo:block font-size="28pt" linefeed-treatment="preserve">Text with preserved linefeeds, bla first first first first first first first first first first first first; this is the first paragraph. This is the second paragraph, after a preserved linefeed: second second second second second second second second.</fo:block> <fo:block><fo:leader leader-length="400pt" leader-pattern="rule"></fo:leader></fo:block> <fo:block>The following block has a preserved linefeed.</fo:block> <fo:block font-size="28pt" linefeed-treatment="preserve">Text with preserved linefeeds, bla first first first first first first first first first first first first; this is the first paragraph. This is the second paragraph, after a preserved linefeed: second second second second second second second second fisecond rst.</fo:block> </fo:flow> </fo:page-sequence></fo:root>