Browse Source

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)


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@654946 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_0
Andreas L. Delmelle 16 years ago
parent
commit
ba10485d4a

+ 19
- 3
src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java View File

@@ -56,7 +56,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
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 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
* ie. the last one returned represents the end of the content.
*/
public boolean isFinished() {
return bFinished;
return isFinished;
}

/**
@@ -144,7 +144,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
* @param fin the flag value to be set
*/
public void setFinished(boolean fin) {
bFinished = fin;
isFinished = fin;
}

/**
@@ -302,6 +302,7 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
if (pos.getIndex() >= 0) {
throw new IllegalStateException("Position already got its index");
}
lastGeneratedPosition++;
pos.setIndex(lastGeneratedPosition);
return pos;
@@ -386,6 +387,21 @@ public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
}
}

/**
* Checks to see if the incoming {@link Position}
* is the last one for this LM, and if so, calls
* {@link #notifyEndOfLayout()}
*
* @param pos the {@link Position} to check
*/
protected void checkEndOfLayout(Position pos) {
if (pos != null
&& pos.getLM() == this
&& this.isLast(pos)) {
notifyEndOfLayout();
}
}
/** {@inheritDoc} */
public String toString() {
return (super.toString() + (fobj != null ? "[fobj=" + fobj.toString() + "]" : ""));

+ 2
- 2
src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java View File

@@ -392,8 +392,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager
curBlockArea = null;
resetSpaces();
// Notify end of block layout manager to the PSLM
notifyEndOfLayout();
//Notify end of block layout manager to the PSLM
checkEndOfLayout(lastPos);
}

/**

+ 1
- 0
src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java View File

@@ -518,6 +518,7 @@ public class InlineLayoutManager extends InlineStackingLayoutManager {
context.setFlags(LayoutContext.LAST_AREA, isLast);
areaCreated = true;
checkEndOfLayout(lastPos);
}

/** {@inheritDoc} */

+ 1
- 1
src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java View File

@@ -219,7 +219,7 @@ public class ListBlockLayoutManager extends BlockStackingLayoutManager
curBlockArea = null;
resetSpaces();
notifyEndOfLayout();
checkEndOfLayout(lastPos);
}

/**

+ 1
- 1
src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java View File

@@ -172,7 +172,7 @@ public class ListItemContentLayoutManager extends BlockStackingLayoutManager {

curBlockArea = null;
notifyEndOfLayout();
checkEndOfLayout(lastPos);
}

/**

+ 1
- 1
src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java View File

@@ -557,7 +557,7 @@ public class ListItemLayoutManager extends BlockStackingLayoutManager
curBlockArea = null;
resetSpaces();
notifyEndOfLayout();
checkEndOfLayout(lastPos);
}

/**

+ 5
- 0
status.xml View File

@@ -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).

+ 0
- 5
test/layoutengine/disabled-testcases.xml View File

@@ -188,11 +188,6 @@
<description>Background-images on page-number-citations are not
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>

+ 70
- 0
test/layoutengine/standard-testcases/page-number-citation_bugzilla44794.xml View File

@@ -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' = (//block[@prod-id='outer-block1']//word)[2]"/>
<true fail-msg="Wrong page-number-citation-last for block before" xpath="'2' = (//block[@prod-id='outer-block1']//word)[4]"/>
<true fail-msg="Wrong page-number-citation for inline before" xpath="'1' = (//block[@prod-id='outer-block2']//word)[2]"/>
<true fail-msg="Wrong page-number-citation-last for inline before" xpath="'2' = (//block[@prod-id='outer-block2']//word)[4]"/>
<true fail-msg="Wrong page-number-citation for block after" xpath="'1' = (//block[@prod-id='outer-block5']//word)[2]"/>
<true fail-msg="Wrong page-number-citation-last for block after" xpath="'2' = (//block[@prod-id='outer-block5']//word)[4]"/>
<true fail-msg="Wrong page-number-citation for inline after" xpath="'1' = (//block[@prod-id='outer-block4']//word)[2]"/>
<true fail-msg="Wrong page-number-citation-last for inline after" xpath="'2' = (//block[@prod-id='outer-block4']//word)[4]"/>
</checks>
</testcase>

+ 126
- 0
test/layoutengine/standard-testcases/page-number-citation_list.xml View File

@@ -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' = //pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[1]"/>
<true fail-msg="Wrong page-number-citation-last for list-block" xpath="'2' = //pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[2]"/>
<true fail-msg="Wrong page-number-citation for list-item" xpath="'1' = //pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[3]"/>
<true fail-msg="Wrong page-number-citation for list-item-label" xpath="'1' = //pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[4]"/>
<true fail-msg="Wrong page-number-citation for list-item-body" xpath="'1' = //pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[5]"/>
<true fail-msg="Wrong page-number-citation-last for list-item-body" xpath="'2' = //pageViewport[@nr=3]/page/regionViewport/regionBody/mainReference/span/flow/block[6]"/>
</checks>
</testcase>

Loading…
Cancel
Save