You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2008/06/02 16:05:53 UTC
svn commit: r662442 [3/3] - in
/xmlgraphics/fop/branches/Temp_AFPGOCAResources: ./
src/documentation/content/xdocs/trunk/ src/java/org/apache/fop/fo/
src/java/org/apache/fop/fonts/ src/java/org/apache/fop/layoutmgr/inline/
src/java/org/apache/fop/layou...
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=662442&r1=662441&r2=662442&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Mon Jun 2 07:05:52 2008
@@ -26,7 +26,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.fo.flow.ListItem;
@@ -39,12 +38,14 @@
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.layoutmgr.ElementListUtils;
import org.apache.fop.layoutmgr.KeepUtil;
+import org.apache.fop.layoutmgr.KnuthBlockBox;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthPenalty;
import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
@@ -279,8 +280,7 @@
int keepWithNextActive = BlockLevelLayoutManager.KEEP_AUTO;
LinkedList returnList = new LinkedList();
- while ((step = getNextStep(elementLists, start, end, partialHeights))
- > 0) {
+ while ((step = getNextStep(elementLists, start, end, partialHeights)) > 0) {
if (end[0] + 1 == elementLists[0].size()) {
keepWithNextActive = Math.max(keepWithNextActive, keepWithNextPendingOnLabel);
@@ -312,11 +312,33 @@
int boxHeight = step - addedBoxHeight - penaltyHeight;
penaltyHeight += additionalPenaltyHeight; //Add AFTER calculating boxHeight!
+ // collect footnote information
+ // TODO this should really not be done like this. ListItemLM should remain as
+ // footnote-agnostic as possible
+ LinkedList footnoteList = null;
+ ListElement el;
+ for (int i = 0; i < elementLists.length; i++) {
+ for (int j = start[i]; j <= end[i]; j++) {
+ el = (ListElement) elementLists[i].get(j);
+ if (el instanceof KnuthBlockBox && ((KnuthBlockBox) el).hasAnchors()) {
+ if (footnoteList == null) {
+ footnoteList = new LinkedList();
+ }
+ footnoteList.addAll(((KnuthBlockBox) el).getFootnoteBodyLMs());
+ }
+ }
+ }
+
// add the new elements
addedBoxHeight += boxHeight;
ListItemPosition stepPosition = new ListItemPosition(this,
start[0], end[0], start[1], end[1]);
- returnList.add(new KnuthBox(boxHeight, stepPosition, false));
+ if (footnoteList == null) {
+ returnList.add(new KnuthBox(boxHeight, stepPosition, false));
+ } else {
+ returnList.add(new KnuthBlockBox(boxHeight, footnoteList, stepPosition, false));
+ }
+
if (addedBoxHeight < totalHeight) {
int strength = BlockLevelLayoutManager.KEEP_AUTO;
strength = Math.max(strength, keepWithNextActive);
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java?rev=662442&r1=662441&r2=662442&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java Mon Jun 2 07:05:52 2008
@@ -19,12 +19,12 @@
package org.apache.fop.layoutmgr.table;
+import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.table.ConditionalBorder;
import org.apache.fop.fo.flow.table.EffRow;
@@ -32,6 +32,7 @@
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.ElementListUtils;
+import org.apache.fop.layoutmgr.KnuthBlockBox;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthPenalty;
@@ -101,6 +102,8 @@
private int penaltyLength;
/** Value of the penalty ending this step, 0 if the step does not end on a penalty. */
private int penaltyValue;
+ /** List of footnotes for this step. */
+ private List footnoteList;
/**
* One of {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN},
* {@link Constants#EN_PAGE}, {@link Constants#EN_EVEN_PAGE},
@@ -130,6 +133,7 @@
this.totalLength = other.totalLength;
this.penaltyLength = other.penaltyLength;
this.penaltyValue = other.penaltyValue;
+ this.footnoteList = other.footnoteList;
this.condBeforeContentLength = other.condBeforeContentLength;
this.breakClass = other.breakClass;
}
@@ -293,6 +297,7 @@
afterNextStep.penaltyValue = 0;
afterNextStep.condBeforeContentLength = 0;
afterNextStep.breakClass = Constants.EN_AUTO;
+ afterNextStep.footnoteList = null;
boolean breakFound = false;
boolean prevIsBox = false;
boolean boxFound = false;
@@ -322,6 +327,12 @@
}
prevIsBox = false;
} else {
+ if (el instanceof KnuthBlockBox && ((KnuthBlockBox) el).hasAnchors()) {
+ if (afterNextStep.footnoteList == null) {
+ afterNextStep.footnoteList = new LinkedList();
+ }
+ afterNextStep.footnoteList.addAll(((KnuthBlockBox) el).getFootnoteBodyLMs());
+ }
prevIsBox = true;
boxFound = true;
afterNextStep.contentLength += el.getW();
@@ -543,6 +554,18 @@
}
}
+ /**
+ * Adds the footnotes (if any) that are part of the next step, if this cell
+ * contributes content to the next step.
+ *
+ * @param footnoteList the list to which this cell must add its footnotes
+ */
+ void addFootnotes(List footnoteList) {
+ if (includedInLastStep() && nextStep.footnoteList != null) {
+ footnoteList.addAll(nextStep.footnoteList);
+ }
+ }
+
int getKeepWithNextStrength() {
return keepWithNextStrength;
}
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableStepper.java?rev=662442&r1=662441&r2=662442&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableStepper.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/layoutmgr/table/TableStepper.java Mon Jun 2 07:05:52 2008
@@ -33,6 +33,7 @@
import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.BreakElement;
import org.apache.fop.layoutmgr.KeepUtil;
+import org.apache.fop.layoutmgr.KnuthBlockBox;
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthGlue;
@@ -199,12 +200,14 @@
}
}
+ LinkedList footnoteList = new LinkedList();
//Put all involved grid units into a list
List cellParts = new java.util.ArrayList(columnCount);
for (Iterator iter = activeCells.iterator(); iter.hasNext();) {
ActiveCell activeCell = (ActiveCell) iter.next();
CellPart part = activeCell.createCellPart();
cellParts.add(part);
+ activeCell.addFootnotes(footnoteList);
}
//Create elements for step
@@ -217,7 +220,13 @@
tcpos.setFlag(TableContentPosition.FIRST_IN_ROWGROUP, true);
}
lastTCPos = tcpos;
- returnList.add(new KnuthBox(boxLen, tcpos, false));
+
+ // TODO TableStepper should remain as footnote-agnostic as possible
+ if (footnoteList.isEmpty()) {
+ returnList.add(new KnuthBox(boxLen, tcpos, false));
+ } else {
+ returnList.add(new KnuthBlockBox(boxLen, footnoteList, tcpos, false));
+ }
int effPenaltyLen = Math.max(0, penaltyOrGlueLen);
TableHFPenaltyPosition penaltyPos = new TableHFPenaltyPosition(getTableLM());
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml?rev=662442&r1=662441&r2=662442&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/status.xml Mon Jun 2 07:05:52 2008
@@ -60,6 +60,13 @@
<action context="Renderers" dev="AC" importance="high" type="add">
Added de-duplication and externalization support for IOCA and GOCA data resource objects.
</action -->
+ <action context="Code" dev="AD" type="fix" fixes-bug="45097">
+ Corrected white-space-treatment for situations where an inline-node is the first/last
+ child node of an fo:block, without preceding/following text.
+ </action>
+ <action context="Layout" dev="MB" type="add">
+ Implemented word-by-ford font-selection strategy on text.
+ </action>
<action context="Layout" dev="MB" type="add">
Support character-by-character font-selection strategy on fo:character element.
</action>
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml?rev=662442&r1=662441&r2=662442&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/disabled-testcases.xml Mon Jun 2 07:05:52 2008
@@ -98,24 +98,6 @@
regions.</description>
</testcase>
<testcase>
- <name>Footnotes swallowed in lists</name>
- <file>footnote_in_list.xml</file>
- <description>Element lists for lists are created by combining the
- element lists from list-item-label and list-item-body. The
- footnotes contained in the KnuthBlockBoxes are not propagated to
- the combined element list.</description>
- <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=37579</reference>
- </testcase>
- <testcase>
- <name>Footnotes swallowed in tables</name>
- <file>footnote_in_table.xml</file>
- <description>Element lists for tables are created by combining the
- element lists from the individual table-cells. The footnotes
- contained in the KnuthBlockBoxes are not propagated to the combined
- element list.</description>
- <reference>http://issues.apache.org/bugzilla/show_bug.cgi?id=37579</reference>
- </testcase>
- <testcase>
<name>NPE for table inside an inline</name>
<file>inline_block_nested_3.xml</file>
<description>Placing a table as a child of an fo:inline produces a
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/footnote_in_list.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/footnote_in_list.xml?rev=662442&r1=662441&r2=662442&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/footnote_in_list.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/footnote_in_list.xml Mon Jun 2 07:05:52 2008
@@ -65,5 +65,7 @@
</fo>
<checks>
<eval expected="2" xpath="count(//footnote/block)"/>
+ <eval expected="1) The footnote from the normal block." xpath="//footnote/block[1]"/>
+ <eval expected="2) The footnote from the list." xpath="//footnote/block[2]"/>
</checks>
</testcase>
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/footnote_in_table.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/footnote_in_table.xml?rev=662442&r1=662441&r2=662442&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/footnote_in_table.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/test/layoutengine/standard-testcases/footnote_in_table.xml Mon Jun 2 07:05:52 2008
@@ -69,5 +69,7 @@
</fo>
<checks>
<eval expected="2" xpath="count(//footnote/block)"/>
+ <eval expected="1) The footnote from the normal block." xpath="//footnote/block[1]"/>
+ <eval expected="2) The footnote from the table." xpath="//footnote/block[2]"/>
</checks>
</testcase>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org