adelmelle
Fri, 09 May 2008 14:40:42 -0700
Author: adelmelle Date: Fri May 9 14:40:14 2008 New Revision: 654946 URL: http://svn.apache.org/viewvc?rev=654946&view=rev Log: Bugzilla 44794: Added support for page-number-citation and page-number-citation-last of fo:inline. Corrected behavior for page-number-citation-last of fo:block - forward references properly resolved. (+ support for page-number-citation-last on list-related FOs) Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml (with props) xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_list.xml (with props) Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java xmlgraphics/fop/trunk/status.xml xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java?rev=654946&r1=654945&r2=654946&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java Fri May 9 14:40:14 2008 @@ -56,7 +56,7 @@ private Map markers = null; /** True if this LayoutManager has handled all of its content. */ - private boolean bFinished = false; + private boolean isFinished = false; /** child LM during getNextKnuthElement phase */ protected LayoutManager curChildLM = null; @@ -136,7 +136,7 @@ * ie. the last one returned represents the end of the content. */ public boolean isFinished() { - return bFinished; + return isFinished; } /** @@ -144,7 +144,7 @@ * @param fin the flag value to be set */ public void setFinished(boolean fin) { - bFinished = fin; + isFinished = fin; } /** @@ -302,6 +302,7 @@ if (pos.getIndex() >= 0) { throw new IllegalStateException("Position already got its index"); } + lastGeneratedPosition++; pos.setIndex(lastGeneratedPosition); return pos; @@ -386,6 +387,21 @@ } } + /** + * Checks to see if the incoming [EMAIL PROTECTED] Position} + * is the last one for this LM, and if so, calls + * [EMAIL PROTECTED] #notifyEndOfLayout()} + * + * @param pos the [EMAIL PROTECTED] Position} to check + */ + protected void checkEndOfLayout(Position pos) { + if (pos != null + && pos.getLM() == this + && this.isLast(pos)) { + notifyEndOfLayout(); + } + } + /** [EMAIL PROTECTED] */ public String toString() { return (super.toString() + (fobj != null ? "[fobj=" + fobj.toString() + "]" : "")); Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=654946&r1=654945&r2=654946&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Fri May 9 14:40:14 2008 @@ -392,8 +392,8 @@ curBlockArea = null; resetSpaces(); - // Notify end of block layout manager to the PSLM - notifyEndOfLayout(); + //Notify end of block layout manager to the PSLM + checkEndOfLayout(lastPos); } /** Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=654946&r1=654945&r2=654946&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Fri May 9 14:40:14 2008 @@ -518,6 +518,7 @@ context.setFlags(LayoutContext.LAST_AREA, isLast); areaCreated = true; + checkEndOfLayout(lastPos); } /** [EMAIL PROTECTED] */ Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=654946&r1=654945&r2=654946&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Fri May 9 14:40:14 2008 @@ -219,7 +219,7 @@ curBlockArea = null; resetSpaces(); - notifyEndOfLayout(); + checkEndOfLayout(lastPos); } /** Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=654946&r1=654945&r2=654946&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java Fri May 9 14:40:14 2008 @@ -172,7 +172,7 @@ curBlockArea = null; - notifyEndOfLayout(); + checkEndOfLayout(lastPos); } /** Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=654946&r1=654945&r2=654946&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Fri May 9 14:40:14 2008 @@ -557,7 +557,7 @@ curBlockArea = null; resetSpaces(); - notifyEndOfLayout(); + checkEndOfLayout(lastPos); } /** Modified: xmlgraphics/fop/trunk/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=654946&r1=654945&r2=654946&view=diff ============================================================================== --- xmlgraphics/fop/trunk/status.xml (original) +++ xmlgraphics/fop/trunk/status.xml Fri May 9 14:40:14 2008 @@ -57,6 +57,11 @@ <action context="Renderers" dev="AC" importance="high" type="add"> Added SVG support for AFP (GOCA). </action --> + <action context="Layout" dev="AD" type="fix" fixes-bug="44794"> + Added support for page-number-citation and page-number-citation-last + of fo:inline. Corrected behavior for page-number-citation-last + of fo:block: forward references now properly resolved. + </action> <action context="Fonts" dev="JM" type="add"> For auto-detected fonts it is now possible to specify that a font needs to be referenced rather than embedded (for the output formats that support this distinction). Modified: xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml?rev=654946&r1=654945&r2=654946&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml (original) +++ xmlgraphics/fop/trunk/test/layoutengine/disabled-testcases.xml Fri May 9 14:40:14 2008 @@ -189,11 +189,6 @@ placed correctly.</description> </testcase> <testcase> - <name>page-number-citation-last: FOs spanning multiple pages are not properly handled.</name> - <file>page-number-citation-last_basic.xml</file> - <description>Resolution of forward references does not wait until an FO is fully finished when an FO spans multiple pages.</description> - </testcase> - <testcase> <name>IDs are not working on all FO elements</name> <file>page-number-citation_complex_1.xml</file> <description>The "id" attributes are not properly handled for all block-level FO elements.</description> Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml?rev=654946&view=auto ============================================================================== --- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml (added) +++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml Fri May 9 14:40:14 2008 @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<testcase> + <info> + <p> + This test checks page-number-citation and page-number-citation-last on block and inline + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="3in" + margin="20pt"> + <fo:region-body background-color="yellow"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence id="page-sequence1" master-reference="normal" white-space-collapse="true"> + <fo:flow flow-name="xsl-region-body"> + + <fo:block id="outer-block1"> + block: <fo:page-number-citation ref-id="block-inline1"/> to <fo:page-number-citation-last ref-id="block-inline1"/>. + </fo:block> + <fo:block id="outer-block2"> + inline: <fo:page-number-citation ref-id="inline1"/> to <fo:page-number-citation-last ref-id="inline1"/>. + </fo:block> + + <fo:block id="outer-block3" border="0.5pt solid black"> + <fo:block id="block-inline1" border="0.5pt solid black" space-after.optimum="2em">text<fo:inline id="inline1" >XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX</fo:inline>text</fo:block> + </fo:block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body" font-size="8pt"> + <fo:block id="outer-block4"> + inline: <fo:page-number-citation ref-id="inline1" /> to <fo:page-number-citation-last ref-id="inline1" /> + </fo:block> + <fo:block id="outer-block5"> + block: <fo:page-number-citation ref-id="block-inline1" /> to <fo:page-number-citation-last ref-id="block-inline1" /> + </fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <true fail-msg="Wrong page-number-citation for block before" xpath="'1' = (//[EMAIL PROTECTED]'outer-block1']//word)[2]"/> + <true fail-msg="Wrong page-number-citation-last for block before" xpath="'2' = (//[EMAIL PROTECTED]'outer-block1']//word)[4]"/> + <true fail-msg="Wrong page-number-citation for inline before" xpath="'1' = (//[EMAIL PROTECTED]'outer-block2']//word)[2]"/> + <true fail-msg="Wrong page-number-citation-last for inline before" xpath="'2' = (//[EMAIL PROTECTED]'outer-block2']//word)[4]"/> + <true fail-msg="Wrong page-number-citation for block after" xpath="'1' = (//[EMAIL PROTECTED]'outer-block5']//word)[2]"/> + <true fail-msg="Wrong page-number-citation-last for block after" xpath="'2' = (//[EMAIL PROTECTED]'outer-block5']//word)[4]"/> + <true fail-msg="Wrong page-number-citation for inline after" xpath="'1' = (//[EMAIL PROTECTED]'outer-block4']//word)[2]"/> + <true fail-msg="Wrong page-number-citation-last for inline after" xpath="'2' = (//[EMAIL PROTECTED]'outer-block4']//word)[4]"/> + </checks> +</testcase> Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml ------------------------------------------------------------------------------ svn:keywords = Id Added: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_list.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_list.xml?rev=654946&view=auto ============================================================================== --- xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_list.xml (added) +++ xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_list.xml Fri May 9 14:40:14 2008 @@ -0,0 +1,126 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!-- $Id$ --> +<testcase> + <info> + <p> + This test checks page-number-citations of list-block, list-item, + list-item-label and list-item-body. + </p> + </info> + <fo> + <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg"> + <fo:layout-master-set> + <fo:simple-page-master master-name="normal" page-width="5in" page-height="2in" + margin="20pt"> + <fo:region-body background-color="yellow"/> + </fo:simple-page-master> + </fo:layout-master-set> + <fo:page-sequence id="page-sequence1" master-reference="normal" white-space-collapse="true"> + <fo:flow flow-name="xsl-region-body"> + <fo:list-block id="list1" provisional-distance-between-starts="50pt" provisional-label-separation="5pt"> + <fo:list-item id="item1"> + <fo:list-item-label id="item1-label" end-indent="label-end()"> + <fo:block>â¢</fo:block> + </fo:list-item-label> + <fo:list-item-body id="item1-body" start-indent="body-start()"> + <fo:block>here is text in the list item body</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="item2"> + <fo:list-item-label id="item2-label" end-indent="label-end()"> + <fo:block>â¢</fo:block> + </fo:list-item-label> + <fo:list-item-body id="item2-body" start-indent="body-start()"> + <fo:block>here is text in the list item body</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="item3"> + <fo:list-item-label id="item3-label" end-indent="label-end()"> + <fo:block>â¢</fo:block> + </fo:list-item-label> + <fo:list-item-body id="item3-body" start-indent="body-start()"> + <fo:block>here is text in the list item body</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="item4"> + <fo:list-item-label id="item4-label" end-indent="label-end()"> + <fo:block>â¢</fo:block> + </fo:list-item-label> + <fo:list-item-body id="item4-body" start-indent="body-start()"> + <fo:block>here is text in the list item body</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="item5"> + <fo:list-item-label id="item5-label" end-indent="label-end()"> + <fo:block>â¢</fo:block> + </fo:list-item-label> + <fo:list-item-body id="item5-body" start-indent="body-start()"> + <fo:block>here is text in the list item body</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="item6"> + <fo:list-item-label id="item6-label" end-indent="label-end()"> + <fo:block>â¢</fo:block> + </fo:list-item-label> + <fo:list-item-body id="item6-body" start-indent="body-start()"> + <fo:block>here is text in the list item body</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="item7"> + <fo:list-item-label id="item7-label" end-indent="label-end()"> + <fo:block>â¢</fo:block> + </fo:list-item-label> + <fo:list-item-body id="item7-body" start-indent="body-start()"> + <fo:block>here is text in the list item body</fo:block> + <fo:block>here is text in the list item body</fo:block> + <fo:block>here is text in the list item body</fo:block> + </fo:list-item-body> + </fo:list-item> + <fo:list-item id="item8"> + <fo:list-item-label id="item8-label" end-indent="label-end()"> + <fo:block>â¢</fo:block> + </fo:list-item-label> + <fo:list-item-body id="item8-body" start-indent="body-start()"> + <fo:block>here is text in the list item body</fo:block> + </fo:list-item-body> + </fo:list-item> + </fo:list-block> + </fo:flow> + </fo:page-sequence> + <fo:page-sequence master-reference="normal"> + <fo:flow flow-name="xsl-region-body" font-size="8pt"> + <fo:block><fo:page-number-citation ref-id="list1"/></fo:block> + <fo:block><fo:page-number-citation-last ref-id="list1"/></fo:block> + <fo:block><fo:page-number-citation ref-id="item1"/></fo:block> + <fo:block><fo:page-number-citation ref-id="item1-label"/></fo:block> + <fo:block><fo:page-number-citation ref-id="item1-body"/></fo:block> + <fo:block><fo:page-number-citation-last ref-id="item7-body"/></fo:block> + </fo:flow> + </fo:page-sequence> + </fo:root> + </fo> + <checks> + <true fail-msg="Wrong page-number-citation for list-block" xpath="'1' = //[EMAIL PROTECTED]/page/regionViewport/regionBody/mainReference/span/flow/block[1]"/> + <true fail-msg="Wrong page-number-citation-last for list-block" xpath="'2' = //[EMAIL PROTECTED]/page/regionViewport/regionBody/mainReference/span/flow/block[2]"/> + <true fail-msg="Wrong page-number-citation for list-item" xpath="'1' = //[EMAIL PROTECTED]/page/regionViewport/regionBody/mainReference/span/flow/block[3]"/> + <true fail-msg="Wrong page-number-citation for list-item-label" xpath="'1' = //[EMAIL PROTECTED]/page/regionViewport/regionBody/mainReference/span/flow/block[4]"/> + <true fail-msg="Wrong page-number-citation for list-item-body" xpath="'1' = //[EMAIL PROTECTED]/page/regionViewport/regionBody/mainReference/span/flow/block[5]"/> + <true fail-msg="Wrong page-number-citation-last for list-item-body" xpath="'2' = //[EMAIL PROTECTED]/page/regionViewport/regionBody/mainReference/span/flow/block[6]"/> + </checks> +</testcase> Propchange: xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/page-number-citation_list.xml ------------------------------------------------------------------------------ svn:keywords = Id --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]