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 je...@apache.org on 2005/08/10 17:00:02 UTC
svn commit: r231255 - in
/xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop:
area/LineArea.java layoutmgr/inline/LineLayoutManager.java
Author: jeremias
Date: Wed Aug 10 07:59:56 2005
New Revision: 231255
URL: http://svn.apache.org/viewcvs?rev=231255&view=rev
Log:
Restored breakability of block-level content in inlines:
Treat block sequences diffently from inline sequences. A block sequence's elements should not be combined to a single box as this removes breakability. The elements are now simply wrapped and handled separately in the previously disabled code part in addAreas().
Modified:
xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/area/LineArea.java
xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
Modified: xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/area/LineArea.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/area/LineArea.java?rev=231255&r1=231254&r2=231255&view=diff
==============================================================================
--- xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/area/LineArea.java (original)
+++ xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/area/LineArea.java Wed Aug 10 07:59:56 2005
@@ -91,5 +91,19 @@
public int getStartIndent() {
return startIndent;
}
+
+ /**
+ * Updates the extents of the line area from its children.
+ */
+ public void updateExtentsFromChildren() {
+ int ipd = 0;
+ int bpd = 0;
+ for (int i = 0, len = inlineAreas.size(); i < len; i++) {
+ ipd = Math.max(ipd, ((InlineArea)inlineAreas.get(i)).getAllocIPD());
+ bpd += ((InlineArea)inlineAreas.get(i)).getAllocBPD();
+ }
+ setIPD(ipd);
+ setBPD(bpd);
+ }
}
Modified: xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=231255&r1=231254&r2=231255&view=diff
==============================================================================
--- xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/inlineblock/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Wed Aug 10 07:59:56 2005
@@ -37,6 +37,7 @@
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LeafPosition;
+import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.SpaceSpecifier;
@@ -1079,7 +1080,20 @@
lineLayouts = (LineLayoutPossibilities)lineLayoutsList.get(p);
KnuthSequence seq = (KnuthSequence) knuthParagraphs.get(p);
- if (seq.isInlineSequence() && alignment == EN_JUSTIFY) {
+ if (!seq.isInlineSequence()) {
+ LinkedList targetList = new LinkedList();
+ ListIterator listIter = seq.listIterator();
+ while (listIter.hasNext()) {
+ KnuthElement tempElement;
+ tempElement = (KnuthElement) listIter.next();
+ if (tempElement.getLayoutManager() != this) {
+ tempElement.setPosition(new NonLeafPosition(this,
+ tempElement.getPosition()));
+ }
+ targetList.add(tempElement);
+ }
+ returnList.addAll(targetList);
+ } else if (seq.isInlineSequence() && alignment == EN_JUSTIFY) {
/* justified vertical alignment (not in the XSL FO recommendation):
create a multi-layout sequence whose elements will contain
a conventional Position */
@@ -1651,8 +1665,8 @@
lineArea.setBPD(lineArea.getBPD() + context.getSpaceAfter());
}
parentLM.addChildArea(lineArea);
-/* } else if (pos instanceof NonLeafPosition) {
- // LineBreakPosition inside a nested block;
+ } else if (pos instanceof NonLeafPosition) {
+ // Nested block-level content;
// go down the LM stack again;
// collect all consecutive NonLeafPosition objects,
// "unwrap" them and put the child positions in a new list.
@@ -1661,7 +1675,7 @@
innerPosition = ((NonLeafPosition) pos).getPosition();
positionList.add(innerPosition);
while (parentIter.hasNext()) {
- pos = (Position) parentIter.getPos(parentIter.peekNext());
+ pos = (Position)parentIter.peekNext();
if (!(pos instanceof NonLeafPosition)) {
break;
}
@@ -1697,8 +1711,9 @@
blocklc.setLeadingSpace(blocklc.getTrailingSpace());
blocklc.setTrailingSpace(new SpaceSpecifier(false));
}
+ lineArea.updateExtentsFromChildren();
parentLM.addChildArea(lineArea);
-*/ } else {
+ } else {
// pos was the Position inside a penalty item, nothing to do
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org