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 2008/03/19 18:27:27 UTC
svn commit: r638943 [3/4] - in
/xmlgraphics/fop/branches/Temp_ProcessingFeedback: ./ lib/
src/documentation/content/ src/documentation/content/xdocs/
src/documentation/content/xdocs/0.95/
src/documentation/content/xdocs/0.95/layoutengine/ src/documenta...
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/dev/release.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/dev/release.xml?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/dev/release.xml (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/dev/release.xml Wed Mar 19 10:26:45 2008
@@ -73,7 +73,7 @@
<code>fop-hyph.jar</code> to lib/ (e.g. from
<code>http://sourceforge.net/projects/offo</code></li>
<li>Alternatively, create a build-local.properties file that points to the above libs.</li>
- <li>Run build[.sh] dist. Do this once using Sun JDK 1.3.1_15 or later and once with Sun JDK 1.4.2_08 or later. A Forrest installation is needed.</li>
+ <li>Run build[.sh] dist. Do this using Sun JDK 1.4.2_08 or later. A Forrest installation is needed.</li>
<li>Create signatures. Don't forget to upload your KEY:
<code>gpg -a -b --force-v3-sigs fop-0.94-src.tar.gz</code> etc.</li>
<li>Upload the dist and signature files to your web directory
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/download.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/download.xml?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/download.xml (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/download.xml Wed Mar 19 10:26:45 2008
@@ -108,16 +108,16 @@
<tr>
<td>Repository URL</td>
<td>
- <link href="http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_95rc/">
- <code>http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_95rc/</code>
+ <link href="http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_95beta/">
+ <code>http://svn.apache.org/repos/asf/xmlgraphics/fop/tags/fop-0_95beta/</code>
</link>
</td>
</tr>
<tr>
<td>Web view</td>
<td>
- <link href="http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_95rc/">
- <code>http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_95rc/</code>
+ <link href="http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_95beta/">
+ <code>http://svn.apache.org/viewvc/xmlgraphics/fop/tags/fop-0_95beta/</code>
</link>
</td>
</tr>
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/index.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/index.xml?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/index.xml (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/index.xml Wed Mar 19 10:26:45 2008
@@ -29,14 +29,15 @@
<p>Apache FOP (Formatting Objects Processor) is a print formatter driven by XSL
formatting objects (XSL-FO) and an output independent formatter. It is a Java
application that reads a formatting object (FO) tree and renders the resulting
- pages to a specified output. <link href="0.94/output.html">Output formats</link>
+ pages to a specified output. <link href="0.95/output.html">Output formats</link>
currently supported include PDF, PS, PCL, AFP, XML (area tree representation),
Print, AWT and PNG, and to a lesser extent, RTF and TXT. The primary output target is PDF.
</p>
<figure width="480" height="260" src="images/document.jpg" alt="Render Diagram" />
<p>
- The latest stable version of FOP (<link href="0.94/">0.94</link>) is the second
- stable release after a large redesign effort and implements a large subset of the
+ A beta release of the latest version of FOP (<link href="0.95/">0.95</link>) is now
+ available. After a short testing period it will become the third
+ stable release after the large redesign effort and will implement a large subset of the
<link href="http://www.w3.org/TR/xsl11/">XSL-FO Version 1.1 W3C
Recommendation</link>.
</p>
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/compiling.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/compiling.xml?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/compiling.xml (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/compiling.xml Wed Mar 19 10:26:45 2008
@@ -41,7 +41,7 @@
<section id="env-jdk">
<title>JDK</title>
<p>
- Building FOP requires a minimum Java Development Kit (JDK/SDK) of 1.3
+ Building FOP requires a minimum Java Development Kit (JDK/SDK) of 1.4
(A Java Runtime Environment is not sufficient).
</p>
</section>
@@ -59,7 +59,7 @@
<p>
The build script uses <a href="ext:ant">Apache Ant</a>, a popular
Java-based build tool, which usually requires that the environment variable JAVA_HOME point to
- your local JDK root directory. This is true even if you use JDK 1.3 or above, which normally
+ your local JDK root directory. This is true even if you use JDK 1.4 or above, which normally
does not need this setting.
</p>
</section>
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/fonts.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/fonts.xml?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/fonts.xml (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/fonts.xml Wed Mar 19 10:26:45 2008
@@ -231,19 +231,11 @@
<title>Type 1 Font Metrics</title>
<p>FOP includes PFMReader, which reads the PFM file that normally comes with a Type 1 font, and generates an appropriate font metrics file for it.
To use it, run the class org.apache.fop.fonts.apps.PFMReader:</p>
- <p>Windows (on JDK 1.4 and later):</p>
+ <p>Windows:</p>
<source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar
org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source>
- <p>Windows (on JDK 1.3.x):</p>
- <source>java -cp build\fop.jar;lib\avalon-framework.jar;lib\commons-logging.jar;lib\commons-io.jar;lib\xml-apis.jar;
- lib\xercesImpl.jar;lib\xalan.jar;lib\serializer.jar
- org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source>
- <p>Unix (on JDK 1.4 and later):</p>
+ <p>Unix:</p>
<source>java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar
- org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source>
- <p>Unix (on JDK 1.3.1):</p>
- <source>java -cp build/fop.jar:lib/avalon-framework.jar:lib/commons-logging.jar:lib/commons-io.jar:lib/xml-apis.jar:
- lib/xercesImpl.jar:lib/xalan.jar:lib/serializer.jar
org.apache.fop.fonts.apps.PFMReader [options] pfm-file xml-file</source>
<p>PFMReader [options]:</p>
<ul>
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/pdfencryption.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/pdfencryption.xml?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/pdfencryption.xml (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/pdfencryption.xml Wed Mar 19 10:26:45 2008
@@ -204,15 +204,13 @@
</p>
<ol>
<li>
- Download the binary distribution for your JDK version. If you have JDK
- 1.3 or earlier you must also download a JCE from the same page.
+ Download the binary distribution for your JDK version.
</li>
<li>
Unpack the distribution. Add the jar file to your classpath. A
convenient way to use the jar on Linux is to simply drop it into the
FOP lib directory, it will be automatically picked up by
- <code>fop.sh</code>. If you have JDK 1.3 or earlier don't forget to
- install the JCE as well.
+ <code>fop.sh</code>.
</li>
<li>
Open the <code>java.security</code> file and add<br/>
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/running.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/running.xml?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/running.xml (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/documentation/content/xdocs/trunk/running.xml Wed Mar 19 10:26:45 2008
@@ -305,7 +305,7 @@
<ul>
<li>
Increase memory available to the JVM. See
- <a href="http://java.sun.com/j2se/1.3/docs/tooldocs/solaris/java.html">the -Xmx option</a>
+ <a href="http://java.sun.com/j2se/1.4/docs/tooldocs/solaris/java.html">the -Xmx option</a>
for more information.
<warning>
It is usually unwise to increase the memory allocated to the JVM beyond the amount of
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FopFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FopFactory.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FopFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/apps/FopFactory.java Wed Mar 19 10:26:45 2008
@@ -47,7 +47,6 @@
import org.apache.fop.fo.ElementMappingRegistry;
import org.apache.fop.fonts.FontCache;
import org.apache.fop.hyphenation.HyphenationTreeResolver;
-import org.apache.fop.image.ImageFactory;
import org.apache.fop.layoutmgr.LayoutManagerMaker;
import org.apache.fop.render.RendererFactory;
import org.apache.fop.render.XMLHandlerRegistry;
@@ -83,9 +82,6 @@
private ColorSpaceCache colorSpaceCache = null;
- /** Image factory for creating fop image objects */
- private ImageFactory imageFactory;
-
/** Image manager for loading and caching image objects */
private ImageManager imageManager;
@@ -156,7 +152,6 @@
this.elementMappingRegistry = new ElementMappingRegistry(this);
this.foURIResolver = new FOURIResolver(validateUserConfigStrictly());
this.colorSpaceCache = new ColorSpaceCache(foURIResolver);
- this.imageFactory = new ImageFactory();
this.imageManager = new ImageManager(this);
this.rendererFactory = new RendererFactory();
this.xmlHandlers = new XMLHandlerRegistry();
@@ -289,11 +284,6 @@
/** @return the content handler factory registry */
public ContentHandlerFactoryRegistry getContentHandlerFactoryRegistry() {
return this.contentHandlerFactoryRegistry;
- }
-
- /** @return the image factory */
- public ImageFactory getImageFactory() {
- return this.imageFactory;
}
/**
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOPropertyMapping.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOPropertyMapping.java Wed Mar 19 10:26:45 2008
@@ -412,6 +412,7 @@
l.setInherited(false);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
l.setDefault("auto");
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT);
addPropertyMaker("top", l);
// right
@@ -419,6 +420,7 @@
l.setInherited(false);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
l.setDefault("auto");
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("right", l);
// bottom
@@ -426,6 +428,7 @@
l.setInherited(false);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
l.setDefault("auto");
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT);
addPropertyMaker("bottom", l);
// left
@@ -433,6 +436,7 @@
l.setInherited(false);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
l.setDefault("auto");
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("left", l);
}
@@ -1161,6 +1165,7 @@
m = new LengthProperty.Maker(PR_START_INDENT);
m.setInherited(true);
m.setDefault("0pt");
+ m.setPercentBase(LengthBase.CONTAINING_REFAREA_WIDTH);
IndentPropertyMaker sCorr = new IndentPropertyMaker(m);
sCorr.setCorresponding(PR_MARGIN_LEFT, PR_MARGIN_RIGHT, PR_MARGIN_TOP);
sCorr.setUseParent(false);
@@ -1177,6 +1182,7 @@
m = new LengthProperty.Maker(PR_END_INDENT);
m.setInherited(true);
m.setDefault("0pt");
+ m.setPercentBase(LengthBase.CONTAINING_REFAREA_WIDTH);
IndentPropertyMaker eCorr = new IndentPropertyMaker(m);
eCorr.setCorresponding(PR_MARGIN_RIGHT, PR_MARGIN_LEFT, PR_MARGIN_BOTTOM);
eCorr.setUseParent(false);
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/FOTreeBuilder.java Wed Mar 19 10:26:45 2008
@@ -40,7 +40,6 @@
import org.apache.fop.fo.ElementMapping.Maker;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.fo.pagination.Root;
-import org.apache.fop.image.ImageFactory;
import org.apache.fop.util.ContentHandlerFactory;
import org.apache.fop.util.ContentHandlerFactory.ObjectBuiltListener;
import org.apache.fop.util.ContentHandlerFactory.ObjectSource;
@@ -168,10 +167,6 @@
log.debug("Parsing of document complete");
}
foEventHandler.endDocument();
-
- //Notify the image factory that this user agent has expired.
- ImageFactory imageFactory = userAgent.getFactory().getImageFactory();
- imageFactory.removeContext(this.userAgent);
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java Wed Mar 19 10:26:45 2008
@@ -238,18 +238,6 @@
return contentLength;
}
- /** @return true if cell/row has an explicit BPD/height */
- public boolean hasBPD() {
- if (!getCell().getBlockProgressionDimension().getOptimum(null).isAuto()) {
- return true;
- }
- if (getRow() != null
- && !getRow().getBlockProgressionDimension().getOptimum(null).isAuto()) {
- return true;
- }
- return false;
- }
-
/**
* Returns the grid units belonging to the same span as this one.
*
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/image/package.html
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/image/package.html?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/image/package.html (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/image/package.html Wed Mar 19 10:26:45 2008
@@ -18,6 +18,6 @@
<HTML>
<TITLE>org.apache.fop.image Package</TITLE>
<BODY>
-<P>Contains image loading adapters for various image sources and the image cache.</P>
+<P>Contains image loading adapters for various image sources.</P>
</BODY>
</HTML>
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java Wed Mar 19 10:26:45 2008
@@ -272,7 +272,7 @@
*/
public void doLayout(int flowBPD, boolean autoHeight) {
LayoutContext childLC = createLayoutContext();
- childLC.setStackLimit(new MinOptMax(flowBPD));
+ childLC.setStackLimitBP(new MinOptMax(flowBPD));
if (getCurrentDisplayAlign() == Constants.EN_X_FILL) {
//EN_X_FILL is non-standard (by LF)
@@ -495,7 +495,7 @@
int averageLineLength = optimizeLineLength(effectiveList,
startElementIndex, endElementIndex);
if (averageLineLength != 0) {
- childLC.setStackLimit(new MinOptMax(averageLineLength));
+ childLC.setStackLimitBP(new MinOptMax(averageLineLength));
}
}
/* *** *** non-standard extension *** *** */
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/AreaAdditionUtil.java Wed Mar 19 10:26:45 2008
@@ -117,7 +117,7 @@
// set space after for each LM, in order to implement
// display-align = distribute
lc.setSpaceAfter(layoutContext.getSpaceAfter());
- lc.setStackLimit(layoutContext.getStackLimit());
+ lc.setStackLimitsFrom(layoutContext);
childLM.addAreas(childPosIter, lc);
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -37,7 +37,6 @@
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.flow.BlockContainer;
import org.apache.fop.fo.properties.CommonAbsolutePosition;
-import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
@@ -200,7 +199,7 @@
= (getBlockContainerFO().getReferenceOrientation() % 180 != 0);
autoHeight = false;
//boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0);
- int maxbpd = context.getStackLimit().opt;
+ int maxbpd = context.getStackLimitBP().opt;
int allocBPD;
if (height.getEnum() == EN_AUTO
|| (!height.isAbsolute() && getAncestorBlockAreaBPD() <= 0)) {
@@ -279,8 +278,7 @@
LayoutContext childLC = new LayoutContext(0);
childLC.copyPendingMarksFrom(context);
// curLM is a ?
- childLC.setStackLimit(MinOptMax.subtract(context
- .getStackLimit(), stackLimit));
+ childLC.setStackLimitBP(MinOptMax.subtract(context.getStackLimitBP(), stackLimit));
childLC.setRefIPD(relDims.ipd);
childLC.setWritingMode(getBlockContainerFO().getWritingMode());
@@ -389,6 +387,9 @@
}
addKnuthElementsForBorderPaddingAfter(returnList, true);
addKnuthElementsForSpaceAfter(returnList, alignment);
+
+ //All child content is processed. Only break-after can occur now, so...
+ context.clearPendingMarks();
addKnuthElementsForBreakAfter(returnList, context);
setFinished(true);
@@ -412,7 +413,7 @@
if (isFixed()) {
availHeight = (int)getCurrentPV().getViewArea().getHeight();
} else {
- availHeight = context.getStackLimit().opt;
+ availHeight = context.getStackLimitBP().opt;
}
allocBPD = availHeight;
allocBPD -= offset.y;
@@ -445,7 +446,7 @@
}
}
} else {
- int maxbpd = context.getStackLimit().opt;
+ int maxbpd = context.getStackLimitBP().opt;
allocBPD = maxbpd;
if (!switchedProgressionDirection) {
autoHeight = true;
@@ -635,7 +636,7 @@
while ((curLM = getChildLM()) != null) {
LayoutContext childLC = new LayoutContext(0);
- childLC.setStackLimit(context.getStackLimit());
+ childLC.setStackLimitBP(context.getStackLimitBP());
childLC.setRefIPD(context.getRefIPD());
childLC.setWritingMode(getBlockContainerFO().getWritingMode());
@@ -864,7 +865,7 @@
// set last area flag
lc.setFlags(LayoutContext.LAST_AREA,
(layoutContext.isLastArea() && childLM == lastLM));
- /*LF*/lc.setStackLimit(layoutContext.getStackLimit());
+ /*LF*/lc.setStackLimitBP(layoutContext.getStackLimitBP());
// Add the line areas to Area
childLM.addAreas(childPosIter, lc);
}
@@ -1002,30 +1003,21 @@
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public boolean mustKeepTogether() {
//TODO Keeps will have to be more sophisticated sooner or later
- return (!getBlockContainerFO().getKeepTogether().getWithinPage().isAuto()
- || !getBlockContainerFO().getKeepTogether().getWithinColumn().isAuto()
- || (getParent() instanceof BlockLevelLayoutManager
- && ((BlockLevelLayoutManager) getParent()).mustKeepTogether())
- || (getParent() instanceof InlineLayoutManager
- && ((InlineLayoutManager) getParent()).mustKeepTogether()));
+ return super.mustKeepTogether()
+ || !getBlockContainerFO().getKeepTogether().getWithinPage().isAuto()
+ || !getBlockContainerFO().getKeepTogether().getWithinColumn().isAuto();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public boolean mustKeepWithPrevious() {
return !getBlockContainerFO().getKeepWithPrevious().getWithinPage().isAuto()
|| !getBlockContainerFO().getKeepWithPrevious().getWithinColumn().isAuto();
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
public boolean mustKeepWithNext() {
return !getBlockContainerFO().getKeepWithNext().getWithinPage().isAuto()
|| !getBlockContainerFO().getKeepWithNext().getWithinColumn().isAuto();
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -25,6 +25,7 @@
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.area.LineArea;
@@ -389,7 +390,7 @@
// set last area flag
lc.setFlags(LayoutContext.LAST_AREA,
(layoutContext.isLastArea() && childLM == lastLM));
- lc.setStackLimit(layoutContext.getStackLimit());
+ lc.setStackLimitBP(layoutContext.getStackLimitBP());
// Add the line areas to Area
childLM.addAreas(childPosIter, lc);
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -282,13 +282,14 @@
if (curLM instanceof LineLayoutManager) {
// curLM is a LineLayoutManager
// set stackLimit for lines (stack limit is now i-p-direction, not b-p-direction!)
- childLC.setStackLimit(new MinOptMax(getContentAreaIPD()));
+ childLC.setStackLimitBP(context.getStackLimitBP());
+ childLC.setStackLimitIP(new MinOptMax(getContentAreaIPD()));
childLC.setRefIPD(getContentAreaIPD());
} else {
// curLM is a ?
//childLC.setStackLimit(MinOptMax.subtract(context
// .getStackLimit(), stackSize));
- childLC.setStackLimit(context.getStackLimit());
+ childLC.setStackLimitBP(context.getStackLimitBP());
childLC.setRefIPD(referenceIPD);
}
@@ -301,15 +302,22 @@
if (returnedList != null
&& returnedList.size() == 1
&& ((ListElement) returnedList.getFirst()).isForcedBreak()) {
- // a descendant of this block has break-before
- contentList.addAll(returnedList);
if (curLM.isFinished() && !hasNextChildLM()) {
- forcedBreakAfterLast = (BreakElement)contentList.removeLast();
+ // a descendant of this block has break-before
+ forcedBreakAfterLast = (BreakElement) returnedList.getFirst();
context.clearPendingMarks();
break;
}
+ if (contentList.size() == 0) {
+ // Empty fo:block, zero-length box makes sure the IDs and/or markers
+ // are registered and borders/padding are painted.
+ returnList.add(new KnuthBox(0, notifyPos(new Position(this)), false));
+ }
+ // a descendant of this block has break-before
+ contentList.addAll(returnedList);
+
/* extension: conversione di tutta la sequenza fin'ora ottenuta */
if (bpUnit > 0) {
storedList = contentList;
@@ -400,6 +408,9 @@
addKnuthElementsForBorderPaddingAfter(returnList, true);
addKnuthElementsForSpaceAfter(returnList, alignment);
+
+ //All child content is processed. Only break-after can occur now, so...
+ context.clearPendingMarks();
if (forcedBreakAfterLast == null) {
addKnuthElementsForBreakAfter(returnList, context);
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -99,7 +99,7 @@
//MinOptMax bpd = context.getStackLimit();
LayoutContext childLC = new LayoutContext(0);
- childLC.setStackLimit(context.getStackLimit());
+ childLC.setStackLimitBP(context.getStackLimitBP());
childLC.setRefIPD(context.getRefIPD());
childLC.setWritingMode(getCurrentPage().getSimplePageMaster().getWritingMode());
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/LayoutContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/LayoutContext.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/LayoutContext.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/LayoutContext.java Wed Mar 19 10:26:45 2008
@@ -74,18 +74,29 @@
private int flags; // Contains some set of flags defined above
/**
* Total available stacking dimension for a "galley-level" layout
- * manager (Line or Flow). It is passed by the parent LM. For LineLM,
- * the block LM determines this based on indent properties.
+ * manager in block-progression-direction. It is passed by the
+ * parent LM.
* These LM <b>may</b> wish to pass this information down to lower
* level LM to allow them to optimize returned break possibilities.
*/
- private MinOptMax stackLimit;
+ private MinOptMax stackLimitBP;
+ /**
+ * Total available stacking dimension for a "galley-level" layout
+ * manager in inline-progression-direction. It is passed by the
+ * parent LM. For LineLM, the block LM determines this based on
+ * indent properties.
+ * These LM <b>may</b> wish to pass this information down to lower
+ * level LM to allow them to optimize returned break possibilities.
+ */
+ private MinOptMax stackLimitIP;
/** True if current element list is spanning in multi-column layout. */
private int nextSpan = Constants.NOT_SET;
/** inline-progression-dimension of nearest ancestor reference area */
private int refIPD;
+ //TODO After the split of stackLimit into stackLimitBP and stackLimitIP there's now some
+ //overlap with refIPD. Need to investigate how best to refactor that.
/** the writing mode established by the nearest ancestor reference area */
private int writingMode = Constants.EN_LR_TB;
@@ -145,7 +156,7 @@
this.flags = parentLC.flags;
this.refIPD = parentLC.refIPD;
this.writingMode = parentLC.writingMode;
- this.stackLimit = null; // Don't reference parent MinOptMax!
+ setStackLimitsFrom(parentLC);
this.leadingSpace = parentLC.leadingSpace; //???
this.trailingSpace = parentLC.trailingSpace; //???
this.hyphContext = parentLC.hyphContext;
@@ -166,7 +177,8 @@
public LayoutContext(int flags) {
this.flags = flags;
this.refIPD = 0;
- stackLimit = new MinOptMax(0);
+ stackLimitBP = new MinOptMax(0);
+ stackLimitIP = new MinOptMax(0);
leadingSpace = null;
trailingSpace = null;
}
@@ -273,12 +285,8 @@
* Clears all pending marks on the LayoutContext.
*/
public void clearPendingMarks() {
- if (this.pendingBeforeMarks != null) {
- this.pendingBeforeMarks.clear();
- }
- if (this.pendingAfterMarks != null) {
- this.pendingAfterMarks.clear();
- }
+ this.pendingBeforeMarks = null;
+ this.pendingAfterMarks = null;
}
/**
@@ -306,15 +314,48 @@
}
}
- public void setStackLimit(MinOptMax limit) {
- stackLimit = limit;
+ /**
+ * Sets the stack limit in block-progression-dimension.
+ * @param limit the stack limit
+ */
+ public void setStackLimitBP(MinOptMax limit) {
+ stackLimitBP = limit;
+ }
+
+ /**
+ * Returns the stack limit in block-progression-dimension.
+ * @return the stack limit
+ */
+ public MinOptMax getStackLimitBP() {
+ return stackLimitBP;
+ }
+
+ /**
+ * Sets the stack limit in inline-progression-dimension.
+ * @param limit the stack limit
+ */
+ public void setStackLimitIP(MinOptMax limit) {
+ stackLimitIP = limit;
}
- public MinOptMax getStackLimit() {
- return stackLimit;
+ /**
+ * Returns the stack limit in inline-progression-dimension.
+ * @return the stack limit
+ */
+ public MinOptMax getStackLimitIP() {
+ return stackLimitIP;
}
/**
+ * Sets (Copies) the stack limits in both directions from another layout context.
+ * @param context the layout context to taje the values from
+ */
+ public void setStackLimitsFrom(LayoutContext context) {
+ setStackLimitBP(context.getStackLimitBP());
+ setStackLimitIP(context.getStackLimitIP());
+ }
+
+ /**
* Sets the inline-progression-dimension of the nearest ancestor reference area.
*/
public void setRefIPD(int ipd) {
@@ -536,22 +577,27 @@
/** {@inheritDoc} */
public String toString() {
- return "Layout Context:" +
- "\nStack Limit: \t" + (getStackLimit() == null ? "null" : getStackLimit().toString()) +
- "\nTrailing Space: \t" + (getTrailingSpace() == null ? "null" : getTrailingSpace().toString()) +
- "\nLeading Space: \t" + (getLeadingSpace() == null ? "null" : getLeadingSpace().toString()) +
- "\nReference IPD: \t" + getRefIPD() +
- "\nSpace Adjust: \t" + getSpaceAdjust() +
- "\nIPD Adjust: \t" + getIPDAdjust() +
- "\nResolve Leading Space: \t" + resolveLeadingSpace() +
- "\nSuppress Leading Space: \t" + suppressLeadingSpace() +
- "\nIs First Area: \t" + isFirstArea() +
- "\nStarts New Area: \t" + startsNewArea() +
- "\nIs Last Area: \t" + isLastArea() +
- "\nTry Hyphenate: \t" + tryHyphenate() +
- "\nKeeps: \t[" + (isKeepWithNextPending() ? "keep-with-next" : "") + "]["
- + (isKeepWithPreviousPending() ? "keep-with-previous" : "") + "] pending" +
- "\nBreaks: \tforced [" + (breakBefore != Constants.EN_AUTO ? "break-before" : "") + "]["
+ return "Layout Context:"
+ + "\nStack Limit BPD: \t"
+ + (getStackLimitBP() == null ? "null" : getStackLimitBP().toString())
+ + "\nStack Limit IPD: \t"
+ + (getStackLimitIP() == null ? "null" : getStackLimitIP().toString())
+ + "\nTrailing Space: \t"
+ + (getTrailingSpace() == null ? "null" : getTrailingSpace().toString())
+ + "\nLeading Space: \t"
+ + (getLeadingSpace() == null ? "null" : getLeadingSpace().toString())
+ + "\nReference IPD: \t" + getRefIPD()
+ + "\nSpace Adjust: \t" + getSpaceAdjust()
+ + "\nIPD Adjust: \t" + getIPDAdjust()
+ + "\nResolve Leading Space: \t" + resolveLeadingSpace()
+ + "\nSuppress Leading Space: \t" + suppressLeadingSpace()
+ + "\nIs First Area: \t" + isFirstArea()
+ + "\nStarts New Area: \t" + startsNewArea()
+ + "\nIs Last Area: \t" + isLastArea()
+ + "\nTry Hyphenate: \t" + tryHyphenate()
+ + "\nKeeps: \t[" + (isKeepWithNextPending() ? "keep-with-next" : "") + "]["
+ + (isKeepWithPreviousPending() ? "keep-with-previous" : "") + "] pending"
+ + "\nBreaks: \tforced [" + (breakBefore != Constants.EN_AUTO ? "break-before" : "") + "]["
+ (breakAfter != Constants.EN_AUTO ? "break-after" : "") + "]";
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/MinOptMaxUtil.java Wed Mar 19 10:26:45 2008
@@ -68,19 +68,16 @@
}
/**
- * Extend the minimum length to the given length.
+ * Extends the minimum length to the given length if necessary, and adjusts opt and
+ * max accordingly.
+ *
* @param mom the min/opt/max trait
* @param len the new minimum length
- * @param optToLen if set adjusts the optimum length to be the smaller of the
- * minimum length and the given length
*/
- public static void extendMinimum(MinOptMax mom, int len, boolean optToLen) {
+ public static void extendMinimum(MinOptMax mom, int len) {
if (mom.min < len) {
mom.min = len;
mom.opt = Math.max(mom.min, mom.opt);
- if (optToLen) {
- mom.opt = Math.min(mom.min, len);
- }
mom.max = Math.max(mom.opt, mom.max);
}
}
@@ -111,7 +108,7 @@
? 0 : prop.getMinimum(context).getLength().getValue(context)),
(prop.getOptimum(context).isAuto()
? 0 : prop.getOptimum(context).getLength().getValue(context)),
- (prop.getMinimum(context).isAuto()
+ (prop.getMaximum(context).isAuto()
? Integer.MAX_VALUE
: prop.getMaximum(context).getLength().getValue(context)));
return mom;
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/PageBreaker.java Wed Mar 19 10:26:45 2008
@@ -153,7 +153,7 @@
// element represents a line with footnote citations
bFootnotesPresent = true;
LayoutContext footnoteContext = new LayoutContext(context);
- footnoteContext.setStackLimit(context.getStackLimit());
+ footnoteContext.setStackLimitBP(context.getStackLimitBP());
footnoteContext.setRefIPD(pslm.getCurrentPV()
.getRegionReference(Constants.FO_REGION_BODY).getIPD());
LinkedList footnoteBodyLMs = ((KnuthBlockBox) element).getFootnoteBodyLMs();
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -95,7 +95,7 @@
//TODO Empty this method?!?
// set layout dimensions
setContentAreaIPD(context.getRefIPD());
- setContentAreaBPD(context.getStackLimit().opt);
+ setContentAreaBPD(context.getStackLimitBP().opt);
//TODO Copied from elsewhere. May be worthwhile to factor out the common parts.
// currently active LM
@@ -113,10 +113,10 @@
}
// Set up a LayoutContext
- MinOptMax bpd = context.getStackLimit();
+ MinOptMax bpd = context.getStackLimitBP();
LayoutContext childLC = new LayoutContext(0);
- childLC.setStackLimit(MinOptMax.subtract(bpd, stackSize));
+ childLC.setStackLimitBP(MinOptMax.subtract(bpd, stackSize));
childLC.setRefIPD(context.getRefIPD());
// get elements from curLM
@@ -331,7 +331,7 @@
while ((curLM = getChildLM()) != null) {
LayoutContext childLC = new LayoutContext(0);
- childLC.setStackLimit(context.getStackLimit());
+ childLC.setStackLimitBP(context.getStackLimitBP());
childLC.setRefIPD(context.getRefIPD());
childLC.setWritingMode(context.getWritingMode());
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -28,6 +28,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.area.LineArea;
@@ -113,7 +114,7 @@
childLC.setLeadingSpace(new SpaceSpecifier(false));
childLC.setTrailingSpace(new SpaceSpecifier(false));
// set stackLimit for lines
- childLC.setStackLimit(new MinOptMax(ipd));
+ childLC.setStackLimitIP(new MinOptMax(ipd));
childLC.setRefIPD(ipd);
int lineHeight = 14000;
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -19,12 +19,13 @@
package org.apache.fop.layoutmgr.inline;
-import java.util.ListIterator;
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.area.Area;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.InlineBlockParent;
@@ -47,12 +48,12 @@
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthSequence;
import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.NonLeafPosition;
-import org.apache.fop.layoutmgr.SpaceSpecifier;
-import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
+import org.apache.fop.layoutmgr.SpaceSpecifier;
+import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -583,9 +583,6 @@
// Get a break from currently active child LM
// Set up constraints for inline level managers
- // IPD remaining in line
- MinOptMax availIPD = context.getStackLimit();
-
clearPrevIPD();
//PHASE 1: Create Knuth elements
@@ -647,7 +644,7 @@
InlineLevelLayoutManager curLM;
LinkedList returnedList = null;
- iLineWidth = context.getStackLimit().opt;
+ iLineWidth = context.getStackLimitIP().opt;
// convert all the text in a sequence of paragraphs made
// of KnuthBox, KnuthGlue and KnuthPenalty objects
@@ -1690,7 +1687,7 @@
*/
if (false && textAlignment == EN_JUSTIFY) {
// re-compute space adjust ratio
- int updatedDifference = context.getStackLimit().opt
+ int updatedDifference = context.getStackLimitIP().opt
- lbp.lineWidth + lbp.difference;
double updatedRatio = 0.0;
if (updatedDifference > 0) {
@@ -1704,12 +1701,12 @@
} else if (false && textAlignment == EN_CENTER) {
// re-compute indent
int updatedIndent = lbp.startIndent
- + (context.getStackLimit().opt - lbp.lineWidth) / 2;
+ + (context.getStackLimitIP().opt - lbp.lineWidth) / 2;
lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent));
} else if (false && textAlignment == EN_END) {
// re-compute indent
int updatedIndent = lbp.startIndent
- + (context.getStackLimit().opt - lbp.lineWidth);
+ + (context.getStackLimitIP().opt - lbp.lineWidth);
lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent));
}
@@ -1773,7 +1770,7 @@
// set last area flag
blocklc.setFlags(LayoutContext.LAST_AREA,
(context.isLastArea() && childLM == lastLM));
- blocklc.setStackLimit(context.getStackLimit());
+ blocklc.setStackLimitsFrom(context);
// Add the line areas to Area
childLM.addAreas(childPosIter, blocklc);
blocklc.setLeadingSpace(blocklc.getTrailingSpace());
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -19,29 +19,29 @@
package org.apache.fop.layoutmgr.list;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
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.ListBlock;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.ConditionalElementListener;
import org.apache.fop.layoutmgr.ElementListUtils;
-import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.PositionIterator;
-import org.apache.fop.layoutmgr.Position;
+import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.NonLeafPosition;
+import org.apache.fop.layoutmgr.Position;
+import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.RelSide;
import org.apache.fop.layoutmgr.TraitSetter;
-import org.apache.fop.area.Area;
-import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
/**
* LayoutManager for a list-block FO.
* A list block contains list items which are stacked within
@@ -200,7 +200,7 @@
lc.setSpaceAdjust(layoutContext.getSpaceAdjust());
lc.setFlags(LayoutContext.FIRST_AREA, childLM == firstLM);
lc.setFlags(LayoutContext.LAST_AREA, childLM == lastLM);
- lc.setStackLimit(layoutContext.getStackLimit());
+ lc.setStackLimitBP(layoutContext.getStackLimitBP());
childLM.addAreas(childPosIter, lc);
}
@@ -280,7 +280,7 @@
/** {@inheritDoc} */
public boolean mustKeepTogether() {
//TODO Keeps will have to be more sophisticated sooner or later
- return ((BlockLevelLayoutManager)getParent()).mustKeepTogether()
+ return super.mustKeepTogether()
|| !getListBlockFO().getKeepTogether().getWithinPage().isAuto()
|| !getListBlockFO().getKeepTogether().getWithinColumn().isAuto();
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -19,24 +19,24 @@
package org.apache.fop.layoutmgr.list;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.fop.area.Area;
+import org.apache.fop.area.Block;
import org.apache.fop.fo.flow.AbstractListItemPart;
import org.apache.fop.fo.flow.ListItemBody;
import org.apache.fop.fo.flow.ListItemLabel;
import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
-import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.PositionIterator;
-import org.apache.fop.layoutmgr.Position;
+import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.NonLeafPosition;
+import org.apache.fop.layoutmgr.Position;
+import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.layoutmgr.SpaceResolver.SpaceHandlingBreakPosition;
-import org.apache.fop.area.Area;
-import org.apache.fop.area.Block;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.LinkedList;
/**
* LayoutManager for a list-item-label or list-item-body FO.
@@ -162,7 +162,7 @@
lc.setFlags(LayoutContext.LAST_AREA, childLM == lastLM);
// set the space adjustment ratio
lc.setSpaceAdjust(layoutContext.getSpaceAdjust());
- lc.setStackLimit(layoutContext.getStackLimit());
+ lc.setStackLimitBP(layoutContext.getStackLimitBP());
childLM.addAreas(childPosIter, lc);
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -19,8 +19,16 @@
package org.apache.fop.layoutmgr.list;
+import java.util.ArrayList;
+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.area.Area;
+import org.apache.fop.area.Block;
import org.apache.fop.fo.flow.ListItem;
import org.apache.fop.fo.flow.ListItemBody;
import org.apache.fop.fo.flow.ListItemLabel;
@@ -30,28 +38,21 @@
import org.apache.fop.layoutmgr.ConditionalElementListener;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.layoutmgr.ElementListUtils;
-import org.apache.fop.layoutmgr.LayoutManager;
+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.PositionIterator;
-import org.apache.fop.layoutmgr.Position;
+import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.layoutmgr.NonLeafPosition;
+import org.apache.fop.layoutmgr.Position;
+import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.RelSide;
import org.apache.fop.layoutmgr.SpaceResolver;
import org.apache.fop.layoutmgr.TraitSetter;
-import org.apache.fop.layoutmgr.KnuthElement;
-import org.apache.fop.layoutmgr.KnuthBox;
-import org.apache.fop.layoutmgr.KnuthPenalty;
-import org.apache.fop.layoutmgr.KnuthPossPosIter;
-import org.apache.fop.area.Area;
-import org.apache.fop.area.Block;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.LinkedList;
-import java.util.ListIterator;
-
/**
* LayoutManager for a list-item FO.
* The list item contains a list item label and a list item body.
@@ -116,6 +117,11 @@
}
/** {@inheritDoc} */
+ public boolean generatesAreas() {
+ return true;
+ }
+
+ /** {@inheritDoc} */
public String toString() {
StringBuffer sb = new StringBuffer("ListItemPosition:");
sb.append(getIndex()).append("(");
@@ -510,7 +516,7 @@
// set the space adjustment ratio
lc.setSpaceAdjust(layoutContext.getSpaceAdjust());
// TO DO: use the right stack limit for the label
- lc.setStackLimit(layoutContext.getStackLimit());
+ lc.setStackLimitBP(layoutContext.getStackLimitBP());
label.addAreas(labelIter, lc);
}
@@ -531,7 +537,7 @@
// set the space adjustment ratio
lc.setSpaceAdjust(layoutContext.getSpaceAdjust());
// TO DO: use the right stack limit for the body
- lc.setStackLimit(layoutContext.getStackLimit());
+ lc.setStackLimitBP(layoutContext.getStackLimitBP());
body.addAreas(bodyIter, lc);
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java Wed Mar 19 10:26:45 2008
@@ -33,6 +33,8 @@
import org.apache.fop.layoutmgr.KnuthBox;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthPenalty;
+import org.apache.fop.layoutmgr.MinOptMaxUtil;
+import org.apache.fop.traits.MinOptMax;
/**
* A cell playing in the construction of steps for a row-group.
@@ -133,6 +135,49 @@
}
}
+ // TODO to be removed along with the RowPainter#computeContentLength method
+ /** See {@link ActiveCell#handleExplicitHeight(MinOptMax, MinOptMax)}. */
+ private static class FillerPenalty extends KnuthPenalty {
+
+ private int contentLength;
+
+ FillerPenalty(KnuthPenalty p, int length) {
+ super(length, p.getP(), p.isFlagged(), p.getBreakClass(),
+ p.getPosition(), p.isAuxiliary());
+ contentLength = p.getW();
+ }
+
+ FillerPenalty(int length) {
+ super(length, 0, false, null, true);
+ contentLength = 0;
+ }
+ }
+
+ /** See {@link ActiveCell#handleExplicitHeight(MinOptMax, MinOptMax)}. */
+ private static class FillerBox extends KnuthBox {
+ FillerBox(int length) {
+ super(length, null, true);
+ }
+ }
+
+ /**
+ * Returns the actual length of the content represented by the given element. In the
+ * case where this element is used as a filler to match a row's fixed height, the
+ * value returned by the getW() method will be higher than the actual content.
+ *
+ * @param el an element
+ * @return the actual content length corresponding to the element
+ */
+ static int getElementContentLength(KnuthElement el) {
+ if (el instanceof FillerPenalty) {
+ return ((FillerPenalty) el).contentLength;
+ } else if (el instanceof FillerBox) {
+ return 0;
+ } else {
+ return el.getW();
+ }
+ }
+
ActiveCell(PrimaryGridUnit pgu, EffRow row, int rowIndex, int previousRowsLength,
TableLayoutManager tableLM) {
this.pgu = pgu;
@@ -149,22 +194,10 @@
+ pgu.getBeforeBorderWidth(0, ConditionalBorder.REST);
bpAfterNormal = paddingAfterNormal + pgu.getAfterBorderWidth(ConditionalBorder.NORMAL);
bpAfterTrailing = paddingAfterTrailing + pgu.getAfterBorderWidth(0, ConditionalBorder.REST);
- boolean makeBoxForWholeRow = false;
- if (row.getExplicitHeight().min > 0) {
- boolean contentsSmaller = ElementListUtils.removeLegalBreaks(
- pgu.getElements(), row.getExplicitHeight());
- if (contentsSmaller) {
- makeBoxForWholeRow = true;
- }
- }
- if (makeBoxForWholeRow) {
- elementList = new java.util.ArrayList(1);
- int height = row.getHeight().opt;
- height -= bpBeforeNormal + bpAfterNormal;
- elementList.add(new KnuthBoxCellWithBPD(height));
- } else {
- elementList = pgu.getElements();
- }
+ elementList = pgu.getElements();
+ handleExplicitHeight(
+ MinOptMaxUtil.toMinOptMax(pgu.getCell().getBlockProgressionDimension(), tableLM),
+ row.getExplicitHeight());
knuthIter = elementList.listIterator();
includedLength = -1; // Avoid troubles with cells having content of zero length
totalLength = previousRowsLength + ElementListUtils.calcContentLength(elementList);
@@ -181,6 +214,46 @@
}
}
+ /**
+ * Modifies the cell's element list by putting filler elements, so that the cell's or
+ * row's explicit height is always reached.
+ *
+ * TODO this will work properly only for the first break. Then the limitation
+ * explained on http://wiki.apache.org/xmlgraphics-fop/TableLayout/KnownProblems
+ * occurs. The list of elements needs to be re-adjusted after each break.
+ */
+ private void handleExplicitHeight(MinOptMax cellBPD, MinOptMax rowBPD) {
+ int minBPD = Math.max(cellBPD.min, rowBPD.min);
+ if (minBPD > 0) {
+ ListIterator iter = elementList.listIterator();
+ int cumulateLength = 0;
+ boolean prevIsBox = false;
+ while (iter.hasNext() && cumulateLength < minBPD) {
+ KnuthElement el = (KnuthElement) iter.next();
+ if (el.isBox()) {
+ prevIsBox = true;
+ cumulateLength += el.getW();
+ } else if (el.isGlue()) {
+ if (prevIsBox) {
+ elementList.add(iter.nextIndex() - 1,
+ new FillerPenalty(minBPD - cumulateLength));
+ }
+ prevIsBox = false;
+ cumulateLength += el.getW();
+ } else {
+ prevIsBox = false;
+ if (cumulateLength + el.getW() < minBPD) {
+ iter.set(new FillerPenalty((KnuthPenalty) el, minBPD - cumulateLength));
+ }
+ }
+ }
+ }
+ int optBPD = Math.max(minBPD, Math.max(cellBPD.opt, rowBPD.opt));
+ if (pgu.getContentLength() < optBPD) {
+ elementList.add(new FillerBox(optBPD - pgu.getContentLength()));
+ }
+ }
+
PrimaryGridUnit getPrimaryGridUnit() {
return pgu;
}
@@ -264,14 +337,22 @@
}
/**
- * Returns the last step for this cell.
+ * Returns the last step for this cell. This includes the normal border- and
+ * padding-before, the whole content, the normal padding-after, and the
+ * <em>trailing</em> after border. Indeed, if the normal border is taken instead,
+ * and appears to be smaller than the trailing one, the last step may be smaller than
+ * the current step (see TableStepper#considerRowLastStep). This will produce a wrong
+ * infinite penalty, plus the cell's content won't be taken into account since the
+ * final step will be smaller than the current one (see {@link #signalNextStep(int)}).
+ * This actually means that the content will be swallowed.
*
- * @return the step including all of the cell's content plus the normal borders and paddings
+ * @return the length of last step
*/
int getLastStep() {
assert nextStep.end == elementList.size() - 1;
assert nextStep.contentLength == totalLength && nextStep.penaltyLength == 0;
- int lastStep = bpBeforeNormal + totalLength + bpAfterNormal;
+ int lastStep = bpBeforeNormal + totalLength + paddingAfterNormal
+ + pgu.getAfterBorderWidth(ConditionalBorder.LEADING_TRAILING);
log.debug(this + ": last step = " + lastStep);
return lastStep;
}
@@ -393,8 +474,12 @@
*/
void endRow(int rowIndex) {
if (endsOnRow(rowIndex)) {
+ // Subtract the old value of bpAfterTrailing...
+ nextStep.totalLength -= bpAfterTrailing;
bpAfterTrailing = paddingAfterNormal
+ pgu.getAfterBorderWidth(ConditionalBorder.LEADING_TRAILING);
+ // ... and add the new one
+ nextStep.totalLength += bpAfterTrailing;
lastCellPart = true;
} else {
bpBeforeLeading = paddingBeforeLeading
@@ -444,13 +529,6 @@
return new CellPart(pgu, nextStep.start, previousStep.end, lastCellPart,
0, 0, previousStep.penaltyLength,
bpBeforeNormal, bpBeforeFirst, bpAfterNormal, bpAfterTrailing);
- } else if (nextStep.start == 0 && nextStep.end == 0
- && elementList.size() == 1
- && elementList.get(0) instanceof KnuthBoxCellWithBPD) {
- //Special case: Cell with fixed BPD
- return new CellPart(pgu, 0, pgu.getElements().size() - 1, lastCellPart,
- nextStep.condBeforeContentLength, length, nextStep.penaltyLength,
- bpBeforeNormal, bpBeforeFirst, bpAfterNormal, bpAfterTrailing);
} else {
return new CellPart(pgu, nextStep.start, nextStep.end, lastCellPart,
nextStep.condBeforeContentLength, length, nextStep.penaltyLength,
@@ -466,16 +544,5 @@
/** {@inheritDoc} */
public String toString() {
return "Cell " + (pgu.getRowIndex() + 1) + "." + (pgu.getColIndex() + 1);
- }
-
-
- /**
- * Marker class denoting table cells fitting in just one box (no legal break inside).
- */
- private static class KnuthBoxCellWithBPD extends KnuthBox {
-
- public KnuthBoxCellWithBPD(int w) {
- super(w, null, true);
- }
}
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java Wed Mar 19 10:26:45 2008
@@ -19,8 +19,8 @@
package org.apache.fop.layoutmgr.table;
+import java.util.Iterator;
import java.util.LinkedList;
-import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -29,6 +29,7 @@
import org.apache.fop.fo.flow.table.EffRow;
import org.apache.fop.fo.flow.table.GridUnit;
import org.apache.fop.fo.flow.table.PrimaryGridUnit;
+import org.apache.fop.fo.flow.table.TableColumn;
import org.apache.fop.fo.flow.table.TableRow;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.LengthRangeProperty;
@@ -95,133 +96,123 @@
private void createElementsForRowGroup(LayoutContext context, int alignment,
int bodyType, LinkedList returnList) {
log.debug("Handling row group with " + rowGroup.length + " rows...");
+ EffRow row;
+ for (int rgi = 0; rgi < rowGroup.length; rgi++) {
+ row = rowGroup[rgi];
+ for (Iterator iter = row.getGridUnits().iterator(); iter.hasNext();) {
+ GridUnit gu = (GridUnit) iter.next();
+ if (gu.isPrimary()) {
+ PrimaryGridUnit primary = gu.getPrimary();
+ // TODO a new LM must be created for every new static-content
+ primary.createCellLM();
+ primary.getCellLM().setParent(tableLM);
+ //Calculate width of cell
+ int spanWidth = 0;
+ Iterator colIter = tableLM.getTable().getColumns().listIterator(
+ primary.getColIndex());
+ for (int i = 0, c = primary.getCell().getNumberColumnsSpanned(); i < c; i++) {
+ spanWidth += ((TableColumn) colIter.next()).getColumnWidth().getValue(
+ tableLM);
+ }
+ LayoutContext childLC = new LayoutContext(0);
+ childLC.setStackLimitBP(context.getStackLimitBP()); //necessary?
+ childLC.setRefIPD(spanWidth);
+
+ //Get the element list for the cell contents
+ LinkedList elems = primary.getCellLM().getNextKnuthElements(
+ childLC, alignment);
+ ElementListObserver.observe(elems, "table-cell", primary.getCell().getId());
+ primary.setElements(elems);
+ }
+ }
+ }
+ computeRowHeights();
+ LinkedList elements = tableStepper.getCombinedKnuthElementsForRowGroup(context,
+ rowGroup, bodyType);
+ returnList.addAll(elements);
+ }
+
+ /**
+ * Calculate the heights of the rows in the row group, see CSS21, 17.5.3 Table height
+ * algorithms.
+ *
+ * TODO this method will need to be adapted once clarification has been made by the
+ * W3C regarding whether borders or border-separation must be included or not
+ */
+ private void computeRowHeights() {
+ log.debug("rowGroup:");
MinOptMax[] rowHeights = new MinOptMax[rowGroup.length];
- MinOptMax[] explicitRowHeights = new MinOptMax[rowGroup.length];
EffRow row;
- List pgus = new java.util.ArrayList(); //holds a list of a row's primary grid units
for (int rgi = 0; rgi < rowGroup.length; rgi++) {
row = rowGroup[rgi];
- rowHeights[rgi] = new MinOptMax(0, 0, Integer.MAX_VALUE);
- explicitRowHeights[rgi] = new MinOptMax(0, 0, Integer.MAX_VALUE);
-
- pgus.clear();
- TableRow tableRow = null;
- // The row's minimum content height; 0 if the row's height is auto, otherwise
- // the .minimum component of the explicitly specified value
- int minRowBPD = 0;
// The BPD of the biggest cell in the row
- int maxCellBPD = 0;
- for (int j = 0; j < row.getGridUnits().size(); j++) {
- GridUnit gu = row.getGridUnit(j);
- if ((gu.isPrimary() || (gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()))
- && !gu.isEmpty()) {
+// int maxCellBPD = 0;
+ MinOptMax explicitRowHeight;
+ TableRow tableRowFO = rowGroup[rgi].getTableRow();
+ if (tableRowFO == null) {
+ rowHeights[rgi] = new MinOptMax(0, 0, Integer.MAX_VALUE);
+ explicitRowHeight = new MinOptMax(0, 0, Integer.MAX_VALUE);
+ } else {
+ LengthRangeProperty rowBPD = tableRowFO.getBlockProgressionDimension();
+ rowHeights[rgi] = MinOptMaxUtil.toMinOptMax(rowBPD, tableLM);
+ explicitRowHeight = MinOptMaxUtil.toMinOptMax(rowBPD, tableLM);
+ }
+ for (Iterator iter = row.getGridUnits().iterator(); iter.hasNext();) {
+ GridUnit gu = (GridUnit) iter.next();
+ if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) {
PrimaryGridUnit primary = gu.getPrimary();
-
- if (gu.isPrimary()) {
- // TODO a new LM must be created for every new static-content
- primary.createCellLM();
- primary.getCellLM().setParent(tableLM);
-
- //Determine the table-row if any
- if (tableRow == null && primary.getRow() != null) {
- tableRow = primary.getRow();
-
- //Check for bpd on row, see CSS21, 17.5.3 Table height algorithms
- LengthRangeProperty rowBPD = tableRow.getBlockProgressionDimension();
- if (!rowBPD.getMinimum(tableLM).isAuto()) {
- minRowBPD = Math.max(minRowBPD,
- rowBPD.getMinimum(tableLM).getLength().getValue(tableLM));
- }
- MinOptMaxUtil.restrict(explicitRowHeights[rgi], rowBPD, tableLM);
-
- }
-
- //Calculate width of cell
- int spanWidth = 0;
- for (int i = primary.getColIndex();
- i < primary.getColIndex()
- + primary.getCell().getNumberColumnsSpanned();
- i++) {
- if (tableLM.getColumns().getColumn(i + 1) != null) {
- spanWidth += tableLM.getColumns().getColumn(i + 1)
- .getColumnWidth().getValue(tableLM);
- }
- }
- LayoutContext childLC = new LayoutContext(0);
- childLC.setStackLimit(context.getStackLimit()); //necessary?
- childLC.setRefIPD(spanWidth);
-
- //Get the element list for the cell contents
- LinkedList elems = primary.getCellLM().getNextKnuthElements(
- childLC, alignment);
- ElementListObserver.observe(elems, "table-cell", primary.getCell().getId());
- primary.setElements(elems);
- }
-
- //Calculate height of row, see CSS21, 17.5.3 Table height algorithms
- if (gu.isLastGridUnitRowSpan()) {
- // The effective cell's bpd, after taking into account bpd
- // (possibly explicitly) set on the row or on the cell, and the
- // cell's content length
- int effectiveCellBPD = minRowBPD;
- LengthRangeProperty cellBPD = primary.getCell()
- .getBlockProgressionDimension();
- if (!cellBPD.getMinimum(tableLM).isAuto()) {
- effectiveCellBPD = Math.max(effectiveCellBPD,
- cellBPD.getMinimum(tableLM).getLength().getValue(tableLM));
- }
- if (!cellBPD.getOptimum(tableLM).isAuto()) {
- effectiveCellBPD = Math.max(effectiveCellBPD,
- cellBPD.getOptimum(tableLM).getLength().getValue(tableLM));
- }
- if (gu.getRowSpanIndex() == 0) {
- //TODO ATM only non-row-spanned cells are taken for this
- MinOptMaxUtil.restrict(explicitRowHeights[rgi], cellBPD, tableLM);
- }
- effectiveCellBPD = Math.max(effectiveCellBPD,
- primary.getContentLength());
-
- int borderWidths = primary.getBeforeAfterBorderWidth();
- int padding = 0;
- maxCellBPD = Math.max(maxCellBPD, effectiveCellBPD);
- CommonBorderPaddingBackground cbpb
- = primary.getCell().getCommonBorderPaddingBackground();
- padding += cbpb.getPaddingBefore(false, primary.getCellLM());
- padding += cbpb.getPaddingAfter(false, primary.getCellLM());
- int effRowHeight = effectiveCellBPD
- + padding + borderWidths;
- for (int previous = 0; previous < gu.getRowSpanIndex(); previous++) {
- effRowHeight -= rowHeights[rgi - previous - 1].opt;
- }
- if (effRowHeight > rowHeights[rgi].min) {
- //This is the new height of the (grid) row
- MinOptMaxUtil.extendMinimum(rowHeights[rgi], effRowHeight, false);
- }
+ int effectiveCellBPD = 0;
+ LengthRangeProperty cellBPD = primary.getCell().getBlockProgressionDimension();
+ if (!cellBPD.getMinimum(tableLM).isAuto()) {
+ effectiveCellBPD = cellBPD.getMinimum(tableLM).getLength()
+ .getValue(tableLM);
}
-
- if (gu.isPrimary()) {
- pgus.add(primary);
+ if (!cellBPD.getOptimum(tableLM).isAuto()) {
+ effectiveCellBPD = cellBPD.getOptimum(tableLM).getLength()
+ .getValue(tableLM);
+ }
+ if (gu.getRowSpanIndex() == 0) {
+ effectiveCellBPD = Math.max(effectiveCellBPD, explicitRowHeight.opt);
+ }
+ effectiveCellBPD = Math.max(effectiveCellBPD, primary.getContentLength());
+ int borderWidths = primary.getBeforeAfterBorderWidth();
+ int padding = 0;
+ CommonBorderPaddingBackground cbpb = primary.getCell()
+ .getCommonBorderPaddingBackground();
+ padding += cbpb.getPaddingBefore(false, primary.getCellLM());
+ padding += cbpb.getPaddingAfter(false, primary.getCellLM());
+ int effRowHeight = effectiveCellBPD + padding + borderWidths;
+ for (int prev = rgi - 1; prev >= rgi - gu.getRowSpanIndex(); prev--) {
+ effRowHeight -= rowHeights[prev].opt;
+ }
+ if (effRowHeight > rowHeights[rgi].min) {
+ // This is the new height of the (grid) row
+ MinOptMaxUtil.extendMinimum(rowHeights[rgi], effRowHeight);
}
}
}
row.setHeight(rowHeights[rgi]);
- row.setExplicitHeight(explicitRowHeights[rgi]);
- if (maxCellBPD > row.getExplicitHeight().max) {
- BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Factory.create(
- tableRow.getUserAgent().getEventBroadcaster());
- eventProducer.rowTooTall(this, row.getIndex() + 1,
- maxCellBPD, row.getExplicitHeight().max, tableRow.getLocator());
- }
- }
- if (log.isDebugEnabled()) {
- log.debug("rowGroup:");
- for (int i = 0; i < rowHeights.length; i++) {
- log.debug(" height=" + rowHeights[i] + " explicit=" + explicitRowHeights[i]);
- }
+ row.setExplicitHeight(explicitRowHeight);
+ // TODO re-enable and improve after clarification
+ //See http://markmail.org/message/h25ycwwu7qglr4k4
+// if (maxCellBPD > row.getExplicitHeight().max) {
+//old:
+// log.warn(FONode.decorateWithContextInfo(
+// "The contents of row " + (row.getIndex() + 1)
+// + " are taller than they should be (there is a"
+// + " block-progression-dimension or height constraint
+// + " on the indicated row)."
+// + " Due to its contents the row grows"
+// + " to " + maxCellBPD + " millipoints, but the row shouldn't get"
+// + " any taller than " + row.getExplicitHeight() + " millipoints.",
+// row.getTableRow()));
+//new (with events):
+// BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Factory.create(
+// tableRow.getUserAgent().getEventBroadcaster());
+// eventProducer.rowTooTall(this, row.getIndex() + 1,
+// maxCellBPD, row.getExplicitHeight().max, tableRow.getLocator());
+// }
}
- LinkedList elements = tableStepper.getCombinedKnuthElementsForRowGroup(context,
- rowGroup, bodyType);
- returnList.addAll(elements);
}
}
Modified: xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/RowPainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/RowPainter.java?rev=638943&r1=638942&r2=638943&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/RowPainter.java (original)
+++ xmlgraphics/fop/branches/Temp_ProcessingFeedback/src/java/org/apache/fop/layoutmgr/table/RowPainter.java Wed Mar 19 10:26:45 2008
@@ -23,6 +23,7 @@
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
+import java.util.ListIterator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -298,18 +299,22 @@
// cell, in most cases)
return 0;
} else {
- int actualStart = startIndex;
+ ListIterator iter = pgu.getElements().listIterator(startIndex);
// Skip from the content length calculation glues and penalties occurring at the
// beginning of the page
- while (actualStart <= endIndex
- && !((KnuthElement) pgu.getElements().get(actualStart)).isBox()) {
- actualStart++;
+ boolean nextIsBox = false;
+ while (iter.nextIndex() <= endIndex && !nextIsBox) {
+ nextIsBox = ((KnuthElement) iter.next()).isBox();
}
- int len = ElementListUtils.calcContentLength(
- pgu.getElements(), actualStart, endIndex);
- KnuthElement el = (KnuthElement)pgu.getElements().get(endIndex);
- if (el.isPenalty()) {
- len += el.getW();
+ int len = 0;
+ if (((KnuthElement) iter.previous()).isBox()) {
+ while (iter.nextIndex() < endIndex) {
+ KnuthElement el = (KnuthElement) iter.next();
+ if (el.isBox() || el.isGlue()) {
+ len += el.getW();
+ }
+ }
+ len += ActiveCell.getElementContentLength((KnuthElement) iter.next());
}
return len;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org