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 vh...@apache.org on 2009/08/26 19:05:44 UTC

svn commit: r808127 [1/3] - in /xmlgraphics/fop/branches/Temp_ChangingIPDHack: ./ examples/embedding/java/embedding/atxml/ examples/embedding/xml/xslt/ src/documentation/content/xdocs/ src/documentation/content/xdocs/trunk/ src/java/META-INF/services/ ...

Author: vhennebert
Date: Wed Aug 26 17:05:40 2009
New Revision: 808127

URL: http://svn.apache.org/viewvc?rev=808127&view=rev
Log:
Merged changes from Trunk

Added:
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/util/CubicBezierApproximator.java
      - copied unchanged from r808112, xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/util/CubicBezierApproximator.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java
      - copied unchanged from r808112, xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/SerializeHyphPattern.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/hyphenation/UnicodeClasses.java
      - copied unchanged from r808112, xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/UnicodeClasses.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/hyphenation/classes.xml
      - copied unchanged from r808112, xmlgraphics/fop/trunk/src/java/org/apache/fop/hyphenation/classes.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/Keep.java
      - copied unchanged from r808112, xmlgraphics/fop/trunk/src/java/org/apache/fop/layoutmgr/Keep.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/extensions/prepress/PageBoundaries.java
      - copied unchanged from r808112, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/extensions/prepress/PageBoundaries.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/extensions/prepress/PageScale.java
      - copied unchanged from r808112, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/extensions/prepress/PageScale.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/java/org/apache/fop/render/extensions/prepress/
      - copied from r808112, xmlgraphics/fop/trunk/test/java/org/apache/fop/render/extensions/prepress/
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTest.java
      - copied unchanged from r808112, xmlgraphics/fop/trunk/test/java/org/apache/fop/render/extensions/prepress/PageBoundariesTest.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/java/org/apache/fop/render/extensions/prepress/PageScaleTest.java
      - copied unchanged from r808112, xmlgraphics/fop/trunk/test/java/org/apache/fop/render/extensions/prepress/PageScaleTest.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/keep_within-column_basic.xml
      - copied unchanged from r808112, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-column_basic.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml
      - copied unchanged from r808112, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/keep_within-page_multi-column_overflow.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/marker_white-space_npe.xml
      - copied unchanged from r808112, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/marker_white-space_npe.xml
Removed:
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/KeepUtil.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/extensions/prepress/PageBoundariesAttributes.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/extensions/prepress/PageScaleAttributes.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/tools/anttasks/SerializeHyphPattern.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/java/org/apache/fop/render/extensions/PrepressTest.java
Modified:
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.properties
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/examples/embedding/java/embedding/atxml/ExampleConcat.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/examples/embedding/java/embedding/atxml/ExampleStamp.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/examples/embedding/xml/xslt/ifstamp.xsl   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/compliance.ihtml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/extensions.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/output.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPGraphics2D.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/FOTreeBuilder.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/EffRow.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/hyphenation/PatternParser.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakElement.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LayoutContext.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageProvider.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/table/ActiveCell.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/afp/AFPRenderer.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/afp/extensions/AFPInvokeMediumMapElement.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/awt/AWTRenderer.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/java2d/Java2DRenderer.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/render/pdf/PDFDocumentHandler.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/sandbox/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/sandbox/org/apache/fop/render/svg/AbstractSVGDocumentHandler.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandler.java   (contents, props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/sandbox/org/apache/fop/render/svg/SVGDocumentHandlerMaker.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandler.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/sandbox/org/apache/fop/render/svg/SVGPrintDocumentHandlerMaker.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/status.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/java/org/apache/fop/StandardTestSuite.java
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/java/org/apache/fop/intermediate/AbstractIntermediateTestCase.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/java/org/apache/fop/intermediate/AreaTreeXMLFormatTestSuite.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/java/org/apache/fop/intermediate/IFParserTestCase.java   (props changed)
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/disabled-testcases.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/inline_block_nested_6.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/table-row_keep-together.xml
    xmlgraphics/fop/branches/Temp_ChangingIPDHack/test/layoutengine/standard-testcases/table_keep-together.xml

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 26 17:05:40 2009
@@ -1,4 +1,4 @@
 /xmlgraphics/fop/branches/Temp_AFPGOCAResources:630874-721418
 /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign:603620-746655
 /xmlgraphics/fop/branches/fop-0_95:684572,688085,688696
-/xmlgraphics/fop/trunk:784730-800312
+/xmlgraphics/fop/trunk:784730-808112

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.properties
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.properties?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.properties (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.properties Wed Aug 26 17:05:40 2009
@@ -50,5 +50,6 @@
 # layoutengine.disabled = test/layoutengine/disabled-testcases.txt
 
 ## Specify an alternate directory to scan for user supplied
-## hyphenation pattern files.
+## hyphenation pattern files and Unicode data files.
 # user.hyph.dir = /home/bart/offo
+# unidata.dir = /usr/share/doc/Unicode/UNIDATA

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.xml?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.xml (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/build.xml Wed Aug 26 17:05:40 2009
@@ -157,6 +157,8 @@
   <property name="fo.examples.force" value="false"/>
   <property name="lib.dir" value="${basedir}/lib"/>
   <property name="user.hyph.dir" value="${basedir}/hyph"/>
+  <property name="unidata.dir" value="${basedir}/UNIDATA"/>
+  <property name="hyph.stacksize" value="512k"/>
   <property name="build.dir" value="${basedir}/build"/>
   <property name="build.gensrc.dir" value="${build.dir}/gensrc"/>
   <property name="build.classes.dir" value="${build.dir}/classes"/>
@@ -425,21 +427,51 @@
     </copy>
   </target>
   <target name="compile" depends="compile-java, compile-copy-resources" description="Compiles the source code"/>
-<!-- =================================================================== -->
-<!-- compiles hyphenation patterns                                       -->
-<!-- =================================================================== -->
-  <target name="compile-hyphenation" depends="compile">
+  <!-- =================================================================== -->
+  <!-- Helper task to generate source files that have already been checked -->
+  <!-- into the repository. This task uses Unicode Character Database      -->
+  <!-- files. This task need only be run when the latter files have been   -->
+  <!-- updated. This target should never be part of the normal build       -->
+  <!-- process. Output is UnicodeClasses.CLASSES_XML                       -->
+  <!-- (src/java/org/apache/fop/hyphenation/classes.xml). -->
+  <!-- =================================================================== -->
+  <target name="codegen-hyphenation-classes">
+	<java classname="org.apache.fop.hyphenation.UnicodeClasses" resultproperty="classes.result" classpath="${build.classes.dir}">
+	  <arg value="${unidata.dir}"/>
+	</java>
+	<condition property="classes.result.message" value="Generation of classes successful">
+	  <not>
+	  <isfailure code="${classes.result}"/>
+	  </not>
+	</condition>
+	<condition property="classes.result.message" value="Generation of classes failed">
+	  <isfailure code="${classes.result}"/>
+	</condition>
+	<echo message="${classes.result.message}"/>
+  </target>
+  <!-- =================================================================== -->
+  <!-- compiles hyphenation patterns                                       -->
+  <!-- =================================================================== -->
+  <target name="compile-hyphenation" depends="compile" description="Compiles the hyphenation pattern files">
     <path id="hyph-classpath">
       <path refid="libs-build-classpath"/>
       <pathelement location="${build.classes.dir}"/>
     </path>
-    <taskdef name="serHyph" classname="org.apache.fop.tools.anttasks.SerializeHyphPattern" classpathref="hyph-classpath"/>
     <mkdir dir="${build.classes.dir}/hyph"/>
-    <serHyph targetDir="${build.classes.dir}/hyph">
-      <fileset dir="${user.hyph.dir}">
-        <include name="*.xml"/>
-      </fileset>
-    </serHyph>
+	<java classname="org.apache.fop.hyphenation.SerializeHyphPattern" fork="true" resultproperty="hyph.result" classpathref="hyph-classpath">
+	  <arg value="${user.hyph.dir}"/>
+	  <arg value="${build.classes.dir}/hyph"/>
+	  <jvmarg value="-Xss${hyph.stacksize}"/>
+	</java>
+	<condition property="hyph.result.message" value="Hyphenation successful">
+	  <not>
+	  <isfailure code="${hyph.result}"/>
+	  </not>
+	</condition>
+	<condition property="hyph.result.message" value="Hyphenation failed">
+	  <isfailure code="${hyph.result}"/>
+	</condition>
+	<echo message="${hyph.result.message}"/>
   </target>
   <target name="uptodate-jar-hyphenation" depends="compile-hyphenation">
     <uptodate property="jar.hyphenation.uptodate" targetfile="${build.dir}/fop-hyph.jar">

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/examples/embedding/java/embedding/atxml/ExampleConcat.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 26 17:05:40 2009
@@ -1,5 +1,5 @@
 /xmlgraphics/fop/branches/Temp_AFPGOCAResources/examples/embedding/java/embedding/intermediate/ExampleConcat.java:630874-721418
 /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/examples/embedding/java/embedding/atxml/ExampleConcat.java:603620-746655
 /xmlgraphics/fop/branches/fop-0_95/examples/embedding/java/embedding/intermediate/ExampleConcat.java:684572,688085,688696
-/xmlgraphics/fop/trunk/examples/embedding/java/embedding/atxml/ExampleConcat.java:784730-800312
+/xmlgraphics/fop/trunk/examples/embedding/java/embedding/atxml/ExampleConcat.java:784730-808112
 /xmlgraphics/fop/trunk/examples/embedding/java/embedding/intermediate/ExampleConcat.java:603620-741103

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/examples/embedding/java/embedding/atxml/ExampleStamp.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 26 17:05:40 2009
@@ -1,5 +1,5 @@
 /xmlgraphics/fop/branches/Temp_AFPGOCAResources/examples/embedding/java/embedding/intermediate/ExampleStamp.java:630874-721418
 /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/examples/embedding/java/embedding/atxml/ExampleStamp.java:603620-746655
 /xmlgraphics/fop/branches/fop-0_95/examples/embedding/java/embedding/intermediate/ExampleStamp.java:684572,688085,688696
-/xmlgraphics/fop/trunk/examples/embedding/java/embedding/atxml/ExampleStamp.java:784730-800312
+/xmlgraphics/fop/trunk/examples/embedding/java/embedding/atxml/ExampleStamp.java:784730-808112
 /xmlgraphics/fop/trunk/examples/embedding/java/embedding/intermediate/ExampleStamp.java:603620-741103

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/examples/embedding/xml/xslt/ifstamp.xsl
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 26 17:05:40 2009
@@ -2,4 +2,4 @@
 /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/examples/embedding/xml/xslt/ifstamp.xsl:603620-746655
 /xmlgraphics/fop/branches/fop-0_95/examples/embedding/xml/xslt/atstamp.xsl:684572,688085,688696
 /xmlgraphics/fop/trunk/examples/embedding/xml/xslt/atstamp.xsl:603620-741103
-/xmlgraphics/fop/trunk/examples/embedding/xml/xslt/ifstamp.xsl:784730-800312
+/xmlgraphics/fop/trunk/examples/embedding/xml/xslt/ifstamp.xsl:784730-808112

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/compliance.ihtml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/compliance.ihtml?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/compliance.ihtml (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/compliance.ihtml Wed Aug 26 17:05:40 2009
@@ -533,11 +533,11 @@
 
       <td class="no">no</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
       <td align="center">&nbsp;</td>
     </tr>
@@ -552,11 +552,11 @@
 
       <td class="no">no</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
       <td align="center">&nbsp;</td>
     </tr>
@@ -870,11 +870,11 @@
 
       <td class="no">no</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
-      <td class="no">no</td>
+      <td class="yes">yes</td>
 
       <td align="center">&nbsp;</td>
     </tr>
@@ -1714,11 +1714,11 @@
 
       <td class="partial">partial</td>
 
-      <td class="partial">partial</td>
+      <td class="yes">yes</td>
 
       <td align="left">
         <ul>
-          <li>[0.94 and later] Only works as expected with inline-level content.</li>
+          <li>[0.95] Only works as expected with inline-level content.</li>
         </ul>
       </td>
     </tr>
@@ -4827,7 +4827,7 @@
           <li>[0.95] works on all implemented FOs, except list- and inline-level
           FOs.</li>
           <li>[Trunk] does not work on inline-level FOs.</li>
-          
+
           <li>[0.95 and earlier] &lt;integer&gt; values are not supported.</li>
           <li>[Trunk] minimal support for &lt;integer&gt; value.</li>
         </ul>

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/extensions.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/extensions.xml?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/extensions.xml (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/extensions.xml Wed Aug 26 17:05:40 2009
@@ -240,19 +240,20 @@
           registration marks, color bars and page information are placed.
           For details, please read on below.
         </p>
+        <note>
+          Those extensions have been implemented in the PDF and Java2D renderers only.
+        </note>
         
         <section id="scale">
           <title>fox:scale</title>
-          <p>Default: 1</p>
-          <p>
-            <code>fox:scale="sx [sy]"</code> attribute is used in <code>fo:simple-page-master</code> element and specifies
-            the a scale operation by sx and sy. If sy is not provided, it is assumed to be equal to sx.
-            sx and sy should be a positive number. A scale factor smaller than 1 shrinks the page.
-            A scale factor greater than 1 enlarges the page.
-          </p>
-          <note>
-            It is implemented for PDF and Java2D renderers.
-          </note>
+          <p>Value: &lt;number&gt;{1,2}</p>
+          <p>Initial: 1</p>
+          <p>Applies to: fo:simple-page-master</p>
+          <p>
+            This property specifies a scale factor along resp. the x and y axes. If only one number 
+            is provided it is used for both the x and y scales. A scale factor smaller than 1 
+            shrinks the page. A scale factor greater than 1 enlarges the page.
+          </p>
         </section>
         <section id="bleed">
           <title>fox:bleed</title>
@@ -260,15 +261,17 @@
               Value: &lt;length&gt;{1,4}
           </p>
           <p>
-              Default: 0pt
+              Initial: 0pt
           </p>
+          <p>Applies to: fo:simple-page-master</p>
           <p>
               If there is only one value, it applies to all sides. If there are two values, the top and bottom
               bleed widths are set to the first value and the right and left bleed widths are set to the second.
               If there are three values, the top is set to the first value, the left and right are set to the second,
               and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and
               left, respectively.
-              (Corresponds to <a href="http://www.w3.org/TR/xsl11/#padding">http://www.w3.org/TR/xsl11/#padding</a>).
+              (Corresponds to <a href="http://www.w3.org/TR/xsl11/#padding">the definition of 
+                padding</a>).
           </p>
           <p>
               This extension indirectly defines the BleedBox and is calculated by expanding the TrimBox by
@@ -281,10 +284,12 @@
             Value: &lt;length&gt;{1,4}
           </p>
           <p>
-            Default: 0pt
+            Initial: bleed (see below)
           </p>
+          <p>Applies to: fo:simple-page-master</p>
           <p>
-            Same behaviour as with fox:bleed.
+            Same behaviour as with fox:bleed. The initial value is set to the same values as the 
+            fox:bleed property.
           </p>
           <p>
             This extension indirectly defines the MediaBox and is calculated by expanding
@@ -294,11 +299,12 @@
         <section id="cropBox">
           <title>fox:crop-box</title>
           <p>
-            Value: (trim-box|bleed-box|media-box)
+            Value: [trim-box | bleed-box | media-box]
           </p>
           <p>
-            Default: media-box
+            Initial: media-box
           </p>
+          <p>Applies to: fo:simple-page-master</p>
           <p>
             The crop box controls how Acrobat displays the page (CropBox in PDF) or how the Java2DRenderer sizes
             the output media. The PDF specification defines that the CropBox defaults to the MediaBox. This extension
@@ -307,7 +313,7 @@
           </p>
           <p>
             If requested in the future, we could offer to specify the CropBox in absolute coordinates rather
-            than just be referencing another box.
+            than just by referencing another box.
           </p>
         </section>
       </section>

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/output.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/output.xml?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/output.xml (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/documentation/content/xdocs/trunk/output.xml Wed Aug 26 17:05:40 2009
@@ -857,10 +857,10 @@
 ]]></source>
         <p>
           The invoke-medium-map element is allowed as child of fo:page-sequence (page group
-          level). It is NOT supported on document level (fo:root), yet. FOP also doesn't support
-          specifying medium maps inside XML (using BMM/EMM). It can only reference an existing
-          medium map by name. The medium map has to be constructed through different means and
-          available on the target platform.
+          level) or fo:simple-page-master. It is NOT supported on document level (fo:root), yet. 
+          FOP also doesn't support specifying medium maps inside XML (using BMM/EMM). It can 
+          only reference an existing medium map by name. The medium map has to be constructed 
+          through different means and available on the target platform.
         </p>
       </section>
       <section id="afp-form-maps">

Propchange: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 26 17:05:40 2009
@@ -1 +1 @@
-/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:784730-800312
+/xmlgraphics/fop/trunk/src/java/META-INF/services/org.apache.fop.render.intermediate.IFDocumentHandler:784730-808112

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPDitheredRectanglePainter.java Wed Aug 26 17:05:40 2009
@@ -55,6 +55,9 @@
     /** {@inheritDoc} */
     public void paint(PaintingInfo paintInfo) throws IOException {
         RectanglePaintingInfo rectanglePaintInfo = (RectanglePaintingInfo)paintInfo;
+        if (rectanglePaintInfo.getWidth() <= 0 || rectanglePaintInfo.getHeight() <= 0) {
+            return;
+        }
 
         int ditherMatrix = DitherUtil.DITHER_MATRIX_8X8;
         Dimension ditherSize = new Dimension(ditherMatrix, ditherMatrix);

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPGraphics2D.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPGraphics2D.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPGraphics2D.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/AFPGraphics2D.java Wed Aug 26 17:05:40 2009
@@ -62,6 +62,7 @@
 import org.apache.fop.afp.goca.GraphicsSetLineType;
 import org.apache.fop.afp.modca.GraphicsObject;
 import org.apache.fop.afp.svg.AFPGraphicsConfiguration;
+import org.apache.fop.afp.util.CubicBezierApproximator;
 import org.apache.fop.fonts.FontInfo;
 import org.apache.fop.svg.NativeImageHandler;
 
@@ -437,6 +438,7 @@
      */
     private void processPathIterator(PathIterator iter) {
         double[] dstPts = new double[6];
+        double[] currentPosition = new double[2];
         for (int[] openingCoords = new int[2]; !iter.isDone(); iter.next()) {
             switch (iter.currentSegment(dstPts)) {
             case PathIterator.SEG_LINETO:
@@ -444,6 +446,7 @@
                         (int)Math.round(dstPts[X]),
                         (int)Math.round(dstPts[Y])
                      }, true);
+                currentPosition = new double[]{dstPts[X], dstPts[Y]};
                 break;
             case PathIterator.SEG_QUADTO:
                 graphicsObj.addFillet(new int[] {
@@ -452,26 +455,39 @@
                         (int)Math.round(dstPts[X2]),
                         (int)Math.round(dstPts[Y2])
                      }, true);
+                currentPosition = new double[]{dstPts[X2], dstPts[Y2]};
                 break;
             case PathIterator.SEG_CUBICTO:
-                graphicsObj.addFillet(new int[] {
-                        (int)Math.round(dstPts[X1]),
-                        (int)Math.round(dstPts[Y1]),
-                        (int)Math.round(dstPts[X2]),
-                        (int)Math.round(dstPts[Y2]),
-                        (int)Math.round(dstPts[X3]),
-                        (int)Math.round(dstPts[Y3])
-                     }, true);
+                double[] cubicCoords = new double[] {currentPosition[0], currentPosition[1],
+                    dstPts[X1], dstPts[Y1], dstPts[X2], dstPts[Y2], dstPts[X3], dstPts[Y3]};
+                double[][] quadParts = CubicBezierApproximator.fixedMidPointApproximation(
+                        cubicCoords);
+                if (quadParts.length >= 4) {
+                    for (int segIndex = 0; segIndex < quadParts.length; segIndex++) {
+                        double[] quadPts = quadParts[segIndex];
+                        if (quadPts != null && quadPts.length == 4) {
+                            graphicsObj.addFillet(new int[]{
+                                    (int) Math.round(quadPts[X1]),
+                                    (int) Math.round(quadPts[Y1]),
+                                    (int) Math.round(quadPts[X2]),
+                                    (int) Math.round(quadPts[Y2])
+                            }, true);
+                            currentPosition = new double[]{quadPts[X2], quadPts[Y2]};
+                        }
+                    }
+                }
                 break;
             case PathIterator.SEG_MOVETO:
                 openingCoords = new int[] {
                         (int)Math.round(dstPts[X]),
                         (int)Math.round(dstPts[Y])
                 };
+                currentPosition = new double[]{dstPts[X], dstPts[Y]};
                 graphicsObj.setCurrentPosition(openingCoords);
                 break;
             case PathIterator.SEG_CLOSE:
                 graphicsObj.addLine(openingCoords, true);
+                currentPosition = new double[]{openingCoords[0], openingCoords[1]};
                 break;
             default:
                 log.debug("Unrecognised path iterator type");

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/afp/goca/AbstractGraphicsDrawingOrderContainer.java Wed Aug 26 17:05:40 2009
@@ -46,6 +46,8 @@
     /** object has started */
     private boolean started = false;
 
+    private int dataLength = 0;
+
     /**
      * Default constructor
      */
@@ -78,6 +80,7 @@
      */
     public void addObject(StructuredData object) {
         objects.add(object);
+        dataLength += object.getDataLength();
     }
 
     /**
@@ -88,6 +91,7 @@
     public void addAll(AbstractGraphicsDrawingOrderContainer graphicsContainer) {
         Collection/*<StructuredDataObject>*/ objects = graphicsContainer.getObjects();
         objects.addAll(objects);
+        dataLength += graphicsContainer.getDataLength();
     }
 
     /**
@@ -107,9 +111,11 @@
     public StructuredData removeLast() {
         int lastIndex = objects.size() - 1;
         StructuredData object = null;
-        if (lastIndex > -1) {
-            object = (StructuredData)objects.get(lastIndex);
-            objects.remove(lastIndex);
+        if (lastIndex >= 0) {
+            object = (StructuredData)objects.remove(lastIndex);
+        }
+        if (object != null) {
+            dataLength -= object.getDataLength();
         }
         return object;
     }
@@ -121,12 +127,7 @@
      * all enclosed objects (and their containers)
      */
     public int getDataLength() {
-        int dataLen = 0;
-        Iterator it = objects.iterator();
-        while (it.hasNext()) {
-            dataLen += ((StructuredData)it.next()).getDataLength();
-        }
-        return dataLen;
+        return this.dataLength;
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/FOTreeBuilder.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/FOTreeBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/FOTreeBuilder.java Wed Aug 26 17:05:40 2009
@@ -288,6 +288,9 @@
                         builderContext.switchMarkerContext(true);
                     }
                 }
+                if (foNode.getNameId() == Constants.FO_PAGE_SEQUENCE) {
+                    builderContext.getXMLWhiteSpaceHandler().reset();
+                }
             } catch (IllegalArgumentException e) {
                 throw new SAXException(e);
             }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java Wed Aug 26 17:05:40 2009
@@ -234,6 +234,18 @@
     }
 
     /**
+     * Reset the handler, release all references
+     */
+    protected final void reset() {
+        if (pendingInlines != null) {
+            pendingInlines.clear();
+        }
+        nestedBlockStack.clear();
+        charIter = null;
+        firstWhiteSpaceInSeq = null;
+    }
+
+    /**
      * Handle white-space for the fo that is passed in, starting at
      * firstTextNode (when a nested FO is encountered)
      * @param fo    the FO for which to handle white-space

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/EffRow.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/EffRow.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/EffRow.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/EffRow.java Wed Aug 26 17:05:40 2009
@@ -23,8 +23,7 @@
 import java.util.List;
 
 import org.apache.fop.fo.Constants;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
-import org.apache.fop.layoutmgr.KeepUtil;
+import org.apache.fop.layoutmgr.Keep;
 import org.apache.fop.layoutmgr.table.TableRowIterator;
 import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.util.BreakUtil;
@@ -170,20 +169,19 @@
      *
      * @return the strength of the keep-with-previous constraint
      */
-    public int getKeepWithPreviousStrength() {
-        int strength = BlockLevelLayoutManager.KEEP_AUTO;
+    public Keep getKeepWithPrevious() {
+        Keep keep = Keep.KEEP_AUTO;
         TableRow row = getTableRow();
         if (row != null) {
-            strength = Math.max(strength,
-                    KeepUtil.getCombinedBlockLevelKeepStrength(row.getKeepWithPrevious()));
+            keep = Keep.getKeep(row.getKeepWithPrevious());
         }
         for (Iterator iter = gridUnits.iterator(); iter.hasNext();) {
             GridUnit gu = (GridUnit) iter.next();
             if (gu.isPrimary()) {
-                strength = Math.max(strength, gu.getPrimary().getKeepWithPreviousStrength());
+                keep = keep.compare(gu.getPrimary().getKeepWithPrevious());
             }
         }
-        return strength;
+        return keep;
     }
 
     /**
@@ -192,20 +190,19 @@
      *
      * @return the strength of the keep-with-next constraint
      */
-    public int getKeepWithNextStrength() {
-        int strength = BlockLevelLayoutManager.KEEP_AUTO;
+    public Keep getKeepWithNext() {
+        Keep keep = Keep.KEEP_AUTO;
         TableRow row = getTableRow();
         if (row != null) {
-            strength = Math.max(strength,
-                    KeepUtil.getCombinedBlockLevelKeepStrength(row.getKeepWithNext()));
+            keep = Keep.getKeep(row.getKeepWithNext());
         }
         for (Iterator iter = gridUnits.iterator(); iter.hasNext();) {
             GridUnit gu = (GridUnit) iter.next();
             if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) {
-                strength = Math.max(strength, gu.getPrimary().getKeepWithNextStrength());
+                keep = keep.compare(gu.getPrimary().getKeepWithNext());
             }
         }
-        return strength;
+        return keep;
     }
 
     /**
@@ -213,16 +210,13 @@
      * not take the parent table's keeps into account!
      * @return the keep-together strength
      */
-    public int getKeepTogetherStrength() {
+    public Keep getKeepTogether() {
         TableRow row = getTableRow();
-        int strength = BlockLevelLayoutManager.KEEP_AUTO;
+        Keep keep = Keep.KEEP_AUTO;
         if (row != null) {
-            strength = Math.max(strength, KeepUtil.getKeepStrength(
-                    row.getKeepTogether().getWithinPage()));
-            strength = Math.max(strength, KeepUtil.getKeepStrength(
-                    row.getKeepTogether().getWithinColumn()));
+            keep = Keep.getKeep(row.getKeepTogether());
         }
-        return strength;
+        return keep;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/fo/flow/table/PrimaryGridUnit.java Wed Aug 26 17:05:40 2009
@@ -19,14 +19,13 @@
 
 package org.apache.fop.fo.flow.table;
 
-import java.util.LinkedList;
 import java.util.List;
 
 import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FONode;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
-import org.apache.fop.layoutmgr.BlockLevelLayoutManager;
 import org.apache.fop.layoutmgr.ElementListUtils;
+import org.apache.fop.layoutmgr.Keep;
 import org.apache.fop.layoutmgr.table.TableCellLayoutManager;
 
 /**
@@ -54,8 +53,8 @@
     private boolean isSeparateBorderModel;
     private int halfBorderSeparationBPD;
 
-    private int keepWithPrevious = BlockLevelLayoutManager.KEEP_AUTO;
-    private int keepWithNext = BlockLevelLayoutManager.KEEP_AUTO;
+    private Keep keepWithPrevious = Keep.KEEP_AUTO;
+    private Keep keepWithNext = Keep.KEEP_AUTO;
     private int breakBefore = Constants.EN_AUTO;
     private int breakAfter = Constants.EN_AUTO;
 
@@ -334,16 +333,16 @@
      *
      * @return the keep-with-previous strength
      */
-    public int getKeepWithPreviousStrength() {
+    public Keep getKeepWithPrevious() {
         return keepWithPrevious;
     }
 
     /**
      * Don't use, reserved for TableCellLM. TODO
-     * @param strength the keep strength
+     * @param keep the keep strength
      */
-    public void setKeepWithPreviousStrength(int strength) {
-        this.keepWithPrevious = strength;
+    public void setKeepWithPrevious(Keep keep) {
+        this.keepWithPrevious = keep;
     }
 
     /**
@@ -352,16 +351,16 @@
      *
      * @return the keep-with-next strength
      */
-    public int getKeepWithNextStrength() {
+    public Keep getKeepWithNext() {
         return keepWithNext;
     }
 
     /**
      * Don't use, reserved for TableCellLM. TODO
-     * @param strength the keep strength
+     * @param keep the keep strength
      */
-    public void setKeepWithNextStrength(int strength) {
-        this.keepWithNext = strength;
+    public void setKeepWithNext(Keep keep) {
+        this.keepWithNext = keep;
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/hyphenation/PatternParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/hyphenation/PatternParser.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/hyphenation/PatternParser.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/hyphenation/PatternParser.java Wed Aug 26 17:05:40 2009
@@ -30,7 +30,10 @@
 // Java
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
 import java.net.MalformedURLException;
 import java.util.ArrayList;
 
@@ -51,6 +54,7 @@
     ArrayList exception;
     char hyphenChar;
     String errMsg;
+    boolean hasClasses = false;
 
     static final int ELEM_CLASSES = 1;
     static final int ELEM_EXCEPTIONS = 2;
@@ -58,24 +62,19 @@
     static final int ELEM_HYPHEN = 4;
 
     public PatternParser() throws HyphenationException {
+        this.consumer = this;
         token = new StringBuffer();
         parser = createParser();
         parser.setContentHandler(this);
         parser.setErrorHandler(this);
         hyphenChar = '-';    // default
-
     }
 
-    public PatternParser(PatternConsumer consumer)
-            throws HyphenationException {
+    public PatternParser(PatternConsumer consumer) throws HyphenationException {
         this();
         this.consumer = consumer;
     }
 
-    public void setConsumer(PatternConsumer consumer) {
-        this.consumer = consumer;
-    }
-
     /**
      * Parses a hyphenation pattern file.
      * @param filename the filename
@@ -249,15 +248,32 @@
         return il.toString();
     }
 
+    protected void getExternalClasses() throws SAXException {
+        XMLReader mainParser = parser;
+        parser = createParser();
+        parser.setContentHandler(this);
+        parser.setErrorHandler(this);
+        InputStream stream = this.getClass().getResourceAsStream("classes.xml");
+        InputSource source = new InputSource(stream);
+        try {
+            parser.parse(source);
+        } catch (IOException ioe) {
+            throw new SAXException(ioe.getMessage());
+        } finally {
+            parser = mainParser;
+        }
+    }
+    
     //
     // ContentHandler methods
     //
 
     /**
      * {@inheritDoc}
+     * @throws SAXException 
      */
     public void startElement(String uri, String local, String raw,
-                             Attributes attrs) {
+                             Attributes attrs) throws SAXException {
         if (local.equals("hyphen-char")) {
             String h = attrs.getValue("value");
             if (h != null && h.length() == 1) {
@@ -266,8 +282,14 @@
         } else if (local.equals("classes")) {
             currElement = ELEM_CLASSES;
         } else if (local.equals("patterns")) {
+            if (!hasClasses) {
+                getExternalClasses();
+            }
             currElement = ELEM_PATTERNS;
         } else if (local.equals("exceptions")) {
+            if (!hasClasses) {
+                getExternalClasses();
+            }
             currElement = ELEM_EXCEPTIONS;
             exception = new ArrayList();
         } else if (local.equals("hyphen")) {
@@ -311,6 +333,9 @@
                 token.setLength(0);
             }
         }
+        if (currElement == ELEM_CLASSES) {
+            hasClasses = true;
+        }
         if (currElement == ELEM_HYPHEN) {
             currElement = ELEM_EXCEPTIONS;
         } else {
@@ -403,23 +428,46 @@
 
     // PatternConsumer implementation for testing purposes
     public void addClass(String c) {
-        System.out.println("class: " + c);
+        testOut.println("class: " + c);
     }
 
     public void addException(String w, ArrayList e) {
-        System.out.println("exception: " + w + " : " + e.toString());
+        testOut.println("exception: " + w + " : " + e.toString());
     }
 
     public void addPattern(String p, String v) {
-        System.out.println("pattern: " + p + " : " + v);
+        testOut.println("pattern: " + p + " : " + v);
+    }
+    
+    private PrintStream testOut = System.out;
+    
+    /**
+     * @param testOut the testOut to set
+     */
+    public void setTestOut(PrintStream testOut) {
+        this.testOut = testOut;
+    }
+    
+    public void closeTestOut() {
+        testOut.flush();
+        testOut.close();
     }
 
     public static void main(String[] args) throws Exception {
         if (args.length > 0) {
             PatternParser pp = new PatternParser();
-            pp.setConsumer(pp);
+            PrintStream p = null;
+            if (args.length > 1) {
+                FileOutputStream f = new FileOutputStream(args[1]);
+                p = new PrintStream(f, false, "utf-8");
+                pp.setTestOut(p);
+            }
             pp.parse(args[0]);
+            if (pp != null) {
+                pp.closeTestOut();
+            }
         }
     }
 
+ 
 }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Wed Aug 26 17:05:40 2009
@@ -38,6 +38,7 @@
 import org.apache.fop.datatypes.Length;
 import org.apache.fop.fo.flow.BlockContainer;
 import org.apache.fop.fo.properties.CommonAbsolutePosition;
+import org.apache.fop.fo.properties.KeepProperty;
 import org.apache.fop.traits.MinOptMax;
 import org.apache.fop.traits.SpaceVal;
 import org.apache.fop.util.ListUtil;
@@ -262,7 +263,7 @@
 
         if (!firstVisibleMarkServed) {
             addKnuthElementsForSpaceBefore(returnList, alignment);
-            context.updateKeepWithPreviousPending(getKeepWithPreviousStrength());
+            context.updateKeepWithPreviousPending(getKeepWithPrevious());
         }
 
         addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed);
@@ -272,9 +273,9 @@
             //Spaces, border and padding to be repeated at each break
             addPendingMarks(context);
 
-            BlockLevelLayoutManager curLM; // currently active LM
-            BlockLevelLayoutManager prevLM = null; // previously active LM
-            while ((curLM = (BlockLevelLayoutManager) getChildLM()) != null) {
+            LayoutManager curLM; // currently active LM
+            LayoutManager prevLM = null; // previously active LM
+            while ((curLM = getChildLM()) != null) {
                 LayoutContext childLC = new LayoutContext(0);
                 childLC.copyPendingMarksFrom(context);
                 // curLM is a ?
@@ -324,8 +325,7 @@
                         //Avoid NoSuchElementException below (happens with empty blocks)
                         continue;
                     }
-                    if (((ListElement) ListUtil.getLast(returnedList))
-                            .isForcedBreak()) {
+                    if (ElementListUtils.endsWithForcedBreak(returnedList)) {
                         // a descendant of this block has break-after
                         if (curLM.isFinished()) {
                             // there is no other content in this block;
@@ -392,7 +392,7 @@
         context.clearPendingMarks();
         addKnuthElementsForBreakAfter(returnList, context);
 
-        context.updateKeepWithNextPending(getKeepWithNextStrength());
+        context.updateKeepWithNextPending(getKeepWithNext());
 
         setFinished(true);
         return returnList;
@@ -471,7 +471,7 @@
 
         if (!firstVisibleMarkServed) {
             addKnuthElementsForSpaceBefore(returnList, alignment);
-            context.updateKeepWithPreviousPending(getKeepWithPreviousStrength());
+            context.updateKeepWithPreviousPending(getKeepWithPrevious());
         }
 
         addKnuthElementsForBorderPaddingBefore(returnList, !firstVisibleMarkServed);
@@ -692,7 +692,7 @@
         context.clearPendingMarks();
         addKnuthElementsForBreakAfter(returnList, context);
 
-        context.updateKeepWithNextPending(getKeepWithNextStrength());
+        context.updateKeepWithNextPending(getKeepWithNext());
 
         setFinished(true);
         return returnList;
@@ -1317,23 +1317,18 @@
     }
 
     /** {@inheritDoc} */
-    public int getKeepTogetherStrength() {
-        int strength = KeepUtil.getCombinedBlockLevelKeepStrength(
-                getBlockContainerFO().getKeepTogether());
-        strength = Math.max(strength, getParentKeepTogetherStrength());
-        return strength;
+    public KeepProperty getKeepTogetherProperty() {
+        return getBlockContainerFO().getKeepTogether();
     }
 
     /** {@inheritDoc} */
-    public int getKeepWithNextStrength() {
-        return KeepUtil.getCombinedBlockLevelKeepStrength(
-                getBlockContainerFO().getKeepWithNext());
+    public KeepProperty getKeepWithPreviousProperty() {
+        return getBlockContainerFO().getKeepWithPrevious();
     }
 
     /** {@inheritDoc} */
-    public int getKeepWithPreviousStrength() {
-        return KeepUtil.getCombinedBlockLevelKeepStrength(
-                getBlockContainerFO().getKeepWithPrevious());
+    public KeepProperty getKeepWithNextProperty() {
+        return getBlockContainerFO().getKeepWithNext();
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Wed Aug 26 17:05:40 2009
@@ -219,21 +219,18 @@
     }
 
     /** {@inheritDoc} */
-    public int getKeepTogetherStrength() {
-        KeepProperty keep = getBlockFO().getKeepTogether();
-        int strength = KeepUtil.getCombinedBlockLevelKeepStrength(keep);
-        strength = Math.max(strength, getParentKeepTogetherStrength());
-        return strength;
+    public KeepProperty getKeepTogetherProperty() {
+        return getBlockFO().getKeepTogether();
     }
 
     /** {@inheritDoc} */
-    public int getKeepWithNextStrength() {
-        return KeepUtil.getCombinedBlockLevelKeepStrength(getBlockFO().getKeepWithNext());
+    public KeepProperty getKeepWithPreviousProperty() {
+        return getBlockFO().getKeepWithPrevious();
     }
 
     /** {@inheritDoc} */
-    public int getKeepWithPreviousStrength() {
-        return KeepUtil.getCombinedBlockLevelKeepStrength(getBlockFO().getKeepWithPrevious());
+    public KeepProperty getKeepWithNextProperty() {
+        return getBlockFO().getKeepWithNext();
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockLevelLayoutManager.java Wed Aug 26 17:05:40 2009
@@ -19,6 +19,8 @@
 
 package org.apache.fop.layoutmgr;
 
+import org.apache.fop.fo.properties.KeepProperty;
+
 /**
  * The interface for LayoutManagers which generate block areas
  */
@@ -35,11 +37,6 @@
     /** Adjustment class: adjustment for line height */
     int LINE_HEIGHT_ADJUSTMENT = 3;
 
-    /** The integer value for "auto" keep strength */
-    int KEEP_AUTO = Integer.MIN_VALUE;
-    /** The integer value for "always" keep strength */
-    int KEEP_ALWAYS = Integer.MAX_VALUE;
-
     int negotiateBPDAdjustment(int adj, KnuthElement lastElement);
 
     void discardSpace(KnuthGlue spaceGlue);
@@ -48,7 +45,7 @@
      * Returns the keep-together strength for this element.
      * @return the keep-together strength
      */
-    int getKeepTogetherStrength();
+    Keep getKeepTogether();
 
     /**
      * @return true if this element must be kept together
@@ -59,7 +56,7 @@
      * Returns the keep-with-previous strength for this element.
      * @return the keep-with-previous strength
      */
-    int getKeepWithPreviousStrength();
+    Keep getKeepWithPrevious();
 
     /**
      * @return true if this element must be kept with the previous element.
@@ -70,11 +67,28 @@
      * Returns the keep-with-next strength for this element.
      * @return the keep-with-next strength
      */
-    int getKeepWithNextStrength();
+    Keep getKeepWithNext();
 
     /**
      * @return true if this element must be kept with the next element.
      */
     boolean mustKeepWithNext();
 
+    /**
+     * Returns the keep-together property specified on the FObj.
+     * @return the keep-together property
+     */
+    KeepProperty getKeepTogetherProperty();
+
+    /**
+     * Returns the keep-with-previous property specified on the FObj.
+     * @return the keep-together property
+     */
+    KeepProperty getKeepWithPreviousProperty();
+
+    /**
+     * Returns the keep-with-next property specified on the FObj.
+     * @return the keep-together property
+     */
+    KeepProperty getKeepWithNextProperty();
 }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Wed Aug 26 17:05:40 2009
@@ -31,9 +31,11 @@
 import org.apache.fop.area.Area;
 import org.apache.fop.area.Block;
 import org.apache.fop.area.BlockParent;
+import org.apache.fop.fo.Constants;
 import org.apache.fop.fo.FObj;
 import org.apache.fop.fo.properties.BreakPropertySet;
 import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
+import org.apache.fop.fo.properties.KeepProperty;
 import org.apache.fop.fo.properties.SpaceProperty;
 import org.apache.fop.layoutmgr.inline.InlineLayoutManager;
 import org.apache.fop.layoutmgr.inline.LineLayoutManager;
@@ -259,7 +261,7 @@
 
         if (!firstVisibleMarkServed) {
             addKnuthElementsForSpaceBefore(elements, alignment);
-            context.updateKeepWithPreviousPending(getKeepWithPreviousStrength());
+            context.updateKeepWithPreviousPending(getKeepWithPrevious());
         }
 
         addKnuthElementsForBorderPaddingBefore(elements, !firstVisibleMarkServed);
@@ -350,7 +352,7 @@
             elements.add(forcedBreakAfterLast);
         }
 
-        context.updateKeepWithNextPending(getKeepWithNextStrength());
+        context.updateKeepWithNextPending(getKeepWithNext());
 
         setFinished(true);
 
@@ -377,7 +379,7 @@
 
         if (!firstVisibleMarkServed) {
             addKnuthElementsForSpaceBefore(elements, alignment);
-            context.updateKeepWithPreviousPending(getKeepWithPreviousStrength());
+            context.updateKeepWithPreviousPending(getKeepWithPrevious());
         }
 
         addKnuthElementsForBorderPaddingBefore(elements, !firstVisibleMarkServed);
@@ -538,7 +540,7 @@
             elements.add(forcedBreakAfterLast);
         }
 
-        context.updateKeepWithNextPending(getKeepWithNextStrength());
+        context.updateKeepWithNextPending(getKeepWithNext());
 
         setFinished(true);
 
@@ -580,31 +582,31 @@
 
     /**
      * Adds a break element to the content list between individual child elements.
-     * @param contentList the content list to populate
-     * @param context the current layout context
+     * @param contentList
+     * @param parentLC
      * @param childLC the currently active child layout context
      */
-    protected void addInBetweenBreak(List contentList, LayoutContext context,
-            LayoutContext childLC) {
+    protected void addInBetweenBreak(List contentList, LayoutContext parentLC,
+                                     LayoutContext childLC) {
+
         if (mustKeepTogether()
-                || context.isKeepWithNextPending()
+                || parentLC.isKeepWithNextPending()
                 || childLC.isKeepWithPreviousPending()) {
 
-            int strength = getKeepTogetherStrength();
+            Keep keep = getKeepTogether();
 
             //Handle pending keep-with-next
-            strength = Math.max(strength, context.getKeepWithNextPending());
-            context.clearKeepWithNextPending();
+            keep = keep.compare(parentLC.getKeepWithNextPending());
+            parentLC.clearKeepWithNextPending();
 
             //Handle pending keep-with-previous from child LM
-            strength = Math.max(strength, childLC.getKeepWithPreviousPending());
+            keep = keep.compare(childLC.getKeepWithPreviousPending());
             childLC.clearKeepWithPreviousPending();
 
-            int penalty = KeepUtil.getPenaltyForKeep(strength);
-
             // add a penalty to forbid or discourage a break between blocks
             contentList.add(new BreakElement(
-                    new Position(this), penalty, context));
+                    new Position(this), keep.getPenalty(),
+                    keep.getContext(), parentLC));
             return;
         }
 
@@ -635,7 +637,7 @@
 
             // add a null penalty to allow a break between blocks
             contentList.add(new BreakElement(
-                    new Position(this), 0, context));
+                    new Position(this), 0, Constants.EN_AUTO, parentLC));
         }
     }
 
@@ -971,33 +973,77 @@
      * Retrieves and returns the keep-together strength from the parent element.
      * @return the keep-together strength
      */
-    protected int getParentKeepTogetherStrength() {
-        int strength = KEEP_AUTO;
+    protected Keep getParentKeepTogether() {
+        Keep keep = Keep.KEEP_AUTO;
         if (getParent() instanceof BlockLevelLayoutManager) {
-            strength = ((BlockLevelLayoutManager)getParent()).getKeepTogetherStrength();
+            keep = ((BlockLevelLayoutManager)getParent()).getKeepTogether();
         } else if (getParent() instanceof InlineLayoutManager) {
             if (((InlineLayoutManager) getParent()).mustKeepTogether()) {
-                strength = KEEP_ALWAYS;
+                keep = Keep.KEEP_ALWAYS;
             }
             //TODO Fix me
             //strength = ((InlineLayoutManager) getParent()).getKeepTogetherStrength();
         }
-        return strength;
+        return keep;
     }
 
     /** {@inheritDoc} */
     public boolean mustKeepTogether() {
-        return getKeepTogetherStrength() > KEEP_AUTO;
+        return !getKeepTogether().isAuto();
     }
 
     /** {@inheritDoc} */
     public boolean mustKeepWithPrevious() {
-        return getKeepWithPreviousStrength() > KEEP_AUTO;
+        return !getKeepWithPrevious().isAuto();
     }
 
     /** {@inheritDoc} */
     public boolean mustKeepWithNext() {
-        return getKeepWithNextStrength() > KEEP_AUTO;
+        return !getKeepWithNext().isAuto();
+    }
+
+    /** {@inheritDoc} */
+    public Keep getKeepTogether() {
+        Keep keep = Keep.getKeep(getKeepTogetherProperty());
+        keep = keep.compare(getParentKeepTogether());
+        return keep;
+    }
+
+    /** {@inheritDoc} */
+    public Keep getKeepWithPrevious() {
+        return Keep.getKeep(getKeepWithPreviousProperty());
+    }
+
+    /** {@inheritDoc} */
+    public Keep getKeepWithNext() {
+        return Keep.getKeep(getKeepWithNextProperty());
+    }
+
+    /**
+     * {@inheritDoc}
+     * Default implementation throws {@code IllegalStateException}
+     * Must be implemented by the subclass, if applicable.
+     */
+    public KeepProperty getKeepTogetherProperty() {
+        throw new IllegalStateException();
+    }
+
+    /**
+     * {@inheritDoc}
+     * Default implementation throws {@code IllegalStateException}
+     * Must be implemented by the subclass, if applicable.
+     */
+    public KeepProperty getKeepWithPreviousProperty() {
+        throw new IllegalStateException();
+    }
+
+    /**
+     * {@inheritDoc}
+     * Default implementation throws {@code IllegalStateException}
+     * Must be implemented by the subclass, if applicable.
+     */
+    public KeepProperty getKeepWithNextProperty() {
+        throw new IllegalStateException();
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakElement.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakElement.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakElement.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakElement.java Wed Aug 26 17:05:40 2009
@@ -41,7 +41,22 @@
      * @param context the layout context which contains the pending conditional elements
      */
     public BreakElement(Position position, int penaltyValue, LayoutContext context) {
-        this(position, 0, penaltyValue, -1, context);
+        this(position, penaltyValue, -1, context);
+    }
+
+    /**
+     * Create a new BreakElement for the given {@code position}, {@code penaltyValue}
+     * and {@code breakClass}. (Used principally to generate break-possibilities in
+     * ranges of content that must be kept together within the context corresponding
+     * to the {@code breakClass}; expected to be one of {@link Constants#EN_AUTO},
+     * {@link Constants#EN_LINE}, {@link Constants#EN_COLUMN} or {@link Constants#EN_PAGE})
+     * @param position  the corresponding {@link Position}
+     * @param penaltyValue  the penalty value
+     * @param breakClass    the break class
+     * @param context       the {@link LayoutContext}
+     */
+    public BreakElement(Position position, int penaltyValue, int breakClass, LayoutContext context) {
+        this(position, 0, penaltyValue, breakClass, context);
     }
 
     /**
@@ -65,6 +80,10 @@
         this.pendingAfterMarks = context.getPendingAfterMarks();
     }
 
+    private static String getBreakClassName(int breakClass) {
+        return AbstractBreaker.getBreakClassName(breakClass);
+    }
+
     /** {@inheritDoc} */
     public boolean isConditional() {
         return false; //Does not really apply here
@@ -143,27 +162,17 @@
 
     /** {@inheritDoc} */
     public String toString() {
-        StringBuffer sb = new StringBuffer();
+        StringBuffer sb = new StringBuffer(64);
         sb.append("BreakPossibility[p:");
-        sb.append(this.penaltyValue);
+        sb.append(KnuthPenalty.valueOf(this.penaltyValue));
         if (isForcedBreak()) {
-            sb.append(" (forced break");
-            switch (getBreakClass()) {
-            case Constants.EN_PAGE:
-                sb.append(", page");
-                break;
-            case Constants.EN_COLUMN:
-                sb.append(", column");
-                break;
-            case Constants.EN_EVEN_PAGE:
-                sb.append(", even page");
-                break;
-            case Constants.EN_ODD_PAGE:
-                sb.append(", odd page");
-                break;
-            default:
-            }
-            sb.append(")");
+            sb.append(" (forced break, ")
+                    .append(getBreakClassName(this.breakClass))
+                    .append(")");
+        } else if (this.penaltyValue >= 0 && this.breakClass != -1) {
+            sb.append(" (keep constraint, ")
+                    .append(getBreakClassName(this.breakClass))
+                    .append(")");
         }
         sb.append("; w:");
         sb.append(penaltyWidth);

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Wed Aug 26 17:05:40 2009
@@ -622,6 +622,14 @@
     }
 
     /**
+     * Return the last node that yielded a too short line.
+     * @return  the node corresponding to the last too short line
+     */
+    protected final KnuthNode getLastTooShort() {
+        return this.lastTooShort;
+    }
+
+    /**
      * Generic handler for a {@link KnuthElement} at the given {@code position},
      * taking into account whether the preceding element was a box, and which
      * type(s) of breaks are allowed.
@@ -658,7 +666,7 @@
 
     /**
      * Handle a {@link KnuthBox}.
-     * <em>Note: default implementation just adds the box's width
+     * <br/><em>Note: default implementation just adds the box's width
      * to the total content width. Subclasses that do not keep track
      * of this themselves, but override this method, should remember
      * to call {@code super.handleBox(box)} to avoid unwanted side-effects.</em>
@@ -819,14 +827,16 @@
         lastDeactivated = null;
         lastTooLong = null;
         for (int line = startLine; line < endLine; line++) {
-            if (!elementCanEndLine(element, line)) {
-                continue;
-            }
             for (KnuthNode node = getNode(line); node != null; node = node.next) {
                 if (node.position == elementIdx) {
                     continue;
                 }
                 int difference = computeDifference(node, element, elementIdx);
+                if (!elementCanEndLine(element, endLine, difference)) {
+                    log.trace("Skipping legal break");
+                    break;
+                }
+
                 double r = computeAdjustmentRatio(node, difference);
                 int availableShrink = totalShrink - node.totalShrink;
                 int availableStretch = totalStretch - node.totalStretch;
@@ -865,9 +875,10 @@
      * number.
      * @param element   the element
      * @param line      the line number
+     * @param difference
      * @return  {@code true} if the element can end the line
      */
-    protected boolean elementCanEndLine(KnuthElement element, int line) {
+    protected boolean elementCanEndLine(KnuthElement element, int line, int difference) {
         return (!element.isPenalty()
                 || element.getP() < KnuthElement.INFINITE);
     }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Wed Aug 26 17:05:40 2009
@@ -246,18 +246,18 @@
     }
 
     /** {@inheritDoc} */
-    public int getKeepTogetherStrength() {
-        return KEEP_AUTO;
+    public Keep getKeepTogether() {
+        return Keep.KEEP_AUTO;
     }
 
     /** {@inheritDoc} */
-    public int getKeepWithNextStrength() {
-        return KEEP_AUTO;
+    public Keep getKeepWithNext() {
+        return Keep.KEEP_AUTO;
     }
 
     /** {@inheritDoc} */
-    public int getKeepWithPreviousStrength() {
-        return KEEP_AUTO;
+    public Keep getKeepWithPrevious() {
+        return Keep.KEEP_AUTO;
     }
 
     /** {@inheritDoc} */

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java Wed Aug 26 17:05:40 2009
@@ -92,18 +92,18 @@
     }
 
     /** {@inheritDoc} */
-    public int getKeepTogetherStrength() {
-        return getParentKeepTogetherStrength();
+    public Keep getKeepTogether() {
+        return getParentKeepTogether();
     }
 
     /** {@inheritDoc} */
-    public int getKeepWithNextStrength() {
-        return KEEP_AUTO;
+    public Keep getKeepWithNext() {
+        return Keep.KEEP_AUTO;
     }
 
     /** {@inheritDoc} */
-    public int getKeepWithPreviousStrength() {
-        return KEEP_AUTO;
+    public Keep getKeepWithPrevious() {
+        return Keep.KEEP_AUTO;
     }
 
 }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/KnuthPenalty.java Wed Aug 26 17:05:40 2009
@@ -45,7 +45,7 @@
     public static final int FLAGGED_PENALTY = 50;
 
     private int penalty;
-    private boolean bFlagged;
+    private boolean isFlagged;
     private int breakClass = -1;
 
     /**
@@ -55,12 +55,12 @@
      * @param p the penalty value of this penalty
      * @param f is this penalty flagged?
      * @param pos the Position stored in this penalty
-     * @param bAux is this penalty auxiliary?
+     * @param isAuxiliary is this penalty auxiliary?
      */
-    public KnuthPenalty(int w, int p, boolean f, Position pos, boolean bAux) {
-        super(w, pos, bAux);
+    public KnuthPenalty(int w, int p, boolean f, Position pos, boolean isAuxiliary) {
+        super(w, pos, isAuxiliary);
         penalty = p;
-        bFlagged = f;
+        isFlagged = f;
     }
 
     /**
@@ -69,18 +69,37 @@
      * @param w the width of this penalty
      * @param p the penalty value of this penalty
      * @param f is this penalty flagged?
-     * @param iBreakClass the break class of this penalty (one of
+     * @param breakClass the break class of this penalty (one of
      * {@link Constants#EN_AUTO}, {@link Constants#EN_COLUMN}, {@link Constants#EN_PAGE},
      * {@link Constants#EN_EVEN_PAGE}, {@link Constants#EN_ODD_PAGE})
      * @param pos the Position stored in this penalty
-     * @param bAux is this penalty auxiliary?
+     * @param isAuxiliary is this penalty auxiliary?
      */
     public KnuthPenalty(int w, int p, boolean f,
-            int iBreakClass, Position pos, boolean bAux) {
-        super(w, pos, bAux);
-        penalty = p;
-        bFlagged = f;
-        breakClass = iBreakClass;
+            int breakClass, Position pos, boolean isAuxiliary) {
+        this(w, p, f, pos, isAuxiliary);
+        this.breakClass = breakClass;
+    }
+
+    private static String getBreakClassName(int breakClass) {
+        return AbstractBreaker.getBreakClassName(breakClass);
+    }
+
+    /**
+     * Get the penalty's value as a {@code java.lang.String}.
+     * (Mainly used in {@code toString()} methods, to improve readability
+     * of the trace logs.)
+     *
+     * @param penaltyValue  the penalty value
+     * @return  the penalty value as a {@code java.lang.String}
+     */
+    protected static String valueOf(int penaltyValue) {
+        String result = (penaltyValue < 0) ? "-" : "";
+        int tmpValue = Math.abs(penaltyValue);
+        result += (tmpValue == KnuthElement.INFINITE)
+                ? "INFINITE"
+                : String.valueOf(tmpValue);
+        return result;
     }
 
     /** {@inheritDoc} */
@@ -105,7 +124,7 @@
 
     /** @return true is this penalty is a flagged one. */
     public boolean isFlagged() {
-        return bFlagged;
+        return isFlagged;
     }
 
     /** {@inheritDoc} */
@@ -121,14 +140,6 @@
         return breakClass;
     }
 
-    /**
-     * Sets the break class for this penalty.
-     * @param cl the break class (EN_AUTO, EN_COLUMN, EN_PAGE, EN_EVEN_PAGE, EN_ODD_PAGE)
-     */
-    public void setBreakClass(int cl) {
-        this.breakClass = cl;
-    }
-
     /** {@inheritDoc} */
     public String toString() {
         StringBuffer sb = new StringBuffer(64);
@@ -137,39 +148,22 @@
         }
         sb.append("penalty");
         sb.append(" p=");
-        if (getP() < 0) {
-            sb.append("-");
-        }
-        if (Math.abs(getP()) == INFINITE) {
-            sb.append("INFINITE");
-        } else {
-            sb.append(getP());
-        }
-        if (isFlagged()) {
+        sb.append(valueOf(this.penalty));
+        if (this.isFlagged) {
             sb.append(" [flagged]");
         }
         sb.append(" w=");
         sb.append(getW());
         if (isForcedBreak()) {
-            sb.append(" (forced break");
-            switch (getBreakClass()) {
-            case Constants.EN_PAGE:
-                sb.append(", page");
-                break;
-            case Constants.EN_COLUMN:
-                sb.append(", column");
-                break;
-            case Constants.EN_EVEN_PAGE:
-                sb.append(", even page");
-                break;
-            case Constants.EN_ODD_PAGE:
-                sb.append(", odd page");
-                break;
-            default:
-            }
-            sb.append(")");
+            sb.append(" (forced break, ")
+                    .append(getBreakClassName(this.breakClass))
+                    .append(")");
+        } else if (this.penalty >= 0 && this.breakClass != -1) {
+            //penalty corresponding to a keep constraint
+            sb.append(" (keep constraint, ")
+                    .append(getBreakClassName(this.breakClass))
+                    .append(")");
         }
         return sb.toString();
     }
-
 }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LayoutContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LayoutContext.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LayoutContext.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/LayoutContext.java Wed Aug 26 17:05:40 2009
@@ -136,8 +136,8 @@
     private int breakBefore;
     private int breakAfter;
 
-    private int pendingKeepWithNext = BlockLevelLayoutManager.KEEP_AUTO;
-    private int pendingKeepWithPrevious = BlockLevelLayoutManager.KEEP_AUTO;
+    private Keep pendingKeepWithNext = Keep.KEEP_AUTO;
+    private Keep pendingKeepWithPrevious = Keep.KEEP_AUTO;
 
     private int disableColumnBalancing;
 
@@ -227,7 +227,7 @@
      * Returns the strength of a keep-with-next currently pending.
      * @return the keep-with-next strength
      */
-    public int getKeepWithNextPending() {
+    public Keep getKeepWithNextPending() {
         return this.pendingKeepWithNext;
     }
 
@@ -235,7 +235,7 @@
      * Returns the strength of a keep-with-previous currently pending.
      * @return the keep-with-previous strength
      */
-    public int getKeepWithPreviousPending() {
+    public Keep getKeepWithPreviousPending() {
         return this.pendingKeepWithPrevious;
     }
 
@@ -243,14 +243,14 @@
      * Clears any pending keep-with-next strength.
      */
     public void clearKeepWithNextPending() {
-        this.pendingKeepWithNext = BlockLevelLayoutManager.KEEP_AUTO;
+        this.pendingKeepWithNext = Keep.KEEP_AUTO;
     }
 
     /**
      * Clears any pending keep-with-previous strength.
      */
     public void clearKeepWithPreviousPending() {
-        this.pendingKeepWithPrevious = BlockLevelLayoutManager.KEEP_AUTO;
+        this.pendingKeepWithPrevious = Keep.KEEP_AUTO;
     }
 
     /**
@@ -263,18 +263,18 @@
 
     /**
      * Updates the currently pending keep-with-next strength.
-     * @param strength the new strength to consider
+     * @param keep the new strength to consider
      */
-    public void updateKeepWithNextPending(int strength) {
-        this.pendingKeepWithNext = Math.max(this.pendingKeepWithNext, strength);
+    public void updateKeepWithNextPending(Keep keep) {
+        this.pendingKeepWithNext = this.pendingKeepWithNext.compare(keep);
     }
 
     /**
      * Updates the currently pending keep-with-previous strength.
-     * @param strength the new strength to consider
+     * @param keep the new strength to consider
      */
-    public void updateKeepWithPreviousPending(int strength) {
-        this.pendingKeepWithPrevious = Math.max(this.pendingKeepWithPrevious, strength);
+    public void updateKeepWithPreviousPending(Keep keep) {
+        this.pendingKeepWithPrevious = this.pendingKeepWithPrevious.compare(keep);
     }
 
     /**
@@ -282,7 +282,7 @@
      * @return true if a keep-with-next constraint is pending
      */
     public boolean isKeepWithNextPending() {
-        return getKeepWithNextPending() != BlockLevelLayoutManager.KEEP_AUTO;
+        return !getKeepWithNextPending().isAuto();
     }
 
     /**
@@ -290,7 +290,7 @@
      * @return true if a keep-with-previous constraint is pending
      */
     public boolean isKeepWithPreviousPending() {
-        return getKeepWithPreviousPending() != BlockLevelLayoutManager.KEEP_AUTO;
+        return !getKeepWithPreviousPending().isAuto();
     }
 
     public void setLeadingSpace(SpaceSpecifier space) {
@@ -640,9 +640,8 @@
         + "\nStarts New Area: \t" + startsNewArea()
         + "\nIs Last Area: \t" + isLastArea()
         + "\nTry Hyphenate: \t" + tryHyphenate()
-        + "\nKeeps: \t[keep-with-next=" + KeepUtil.keepStrengthToString(getKeepWithNextPending())
-                + "][keep-with-previous="
-                + KeepUtil.keepStrengthToString(getKeepWithPreviousPending()) + "] pending"
+        + "\nKeeps: \t[keep-with-next=" + getKeepWithNextPending()
+                + "][keep-with-previous=" + getKeepWithPreviousPending() + "] pending"
         + "\nBreaks: \tforced [" + (breakBefore != Constants.EN_AUTO ? "break-before" : "") + "]["
         + (breakAfter != Constants.EN_AUTO ? "break-after" : "") + "]";
     }

Modified: xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=808127&r1=808126&r2=808127&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_ChangingIPDHack/src/java/org/apache/fop/layoutmgr/PageBreaker.java Wed Aug 26 17:05:40 2009
@@ -476,9 +476,7 @@
         pslm.getCurrentPV().getCurrentSpan().notifyFlowsFinished();
     }
 
-    /**
-     * @return the current child flow layout manager
-     */
+    /** @return the current child flow layout manager */
     protected LayoutManager getCurrentChildLM() {
         return childFLM;
     }
@@ -497,44 +495,51 @@
      */
     private void handleBreakTrait(int breakVal) {
         Page curPage = pslm.getCurrentPage();
-        if (breakVal == Constants.EN_ALL) {
+        switch (breakVal) {
+        case Constants.EN_ALL:
             //break due to span change in multi-column layout
             curPage.getPageViewport().createSpan(true);
             return;
-        } else if (breakVal == Constants.EN_NONE) {
+        case Constants.EN_NONE:
             curPage.getPageViewport().createSpan(false);
             return;
-        } else if (breakVal == Constants.EN_COLUMN
-                || breakVal <= 0
-                || breakVal == Constants.EN_AUTO) {
+        case Constants.EN_COLUMN:
+        case Constants.EN_AUTO:
+        case Constants.EN_PAGE:
+        case -1:
             PageViewport pv = curPage.getPageViewport();
 
             //Check if previous page was spanned
             boolean forceNewPageWithSpan = false;
             RegionBody rb = (RegionBody)curPage.getSimplePageMaster().getRegion(
                     Constants.FO_REGION_BODY);
-            if (rb.getColumnCount() > 1
-                    && pv.getCurrentSpan().getColumnCount() == 1) {
-                forceNewPageWithSpan = true;
-            }
+            forceNewPageWithSpan
+                    = (rb.getColumnCount() > 1
+                        && pv.getCurrentSpan().getColumnCount() == 1);
 
             if (forceNewPageWithSpan) {
+                log.trace("Forcing new page with span");
                 curPage = pslm.makeNewPage(false, false);
                 curPage.getPageViewport().createSpan(true);
             } else if (pv.getCurrentSpan().hasMoreFlows()) {
+                log.trace("Moving to next flow");
                 pv.getCurrentSpan().moveToNextFlow();
             } else {
-                curPage = pslm.makeNewPage(false, false);
+                log.trace("Making new page");
+                /*curPage = */pslm.makeNewPage(false, false);
             }
             return;
-        }
-        log.debug("handling break-before after page " + pslm.getCurrentPageNum()
-            + " breakVal=" + getBreakClassName(breakVal));
-        if (needBlankPageBeforeNew(breakVal)) {
-            curPage = pslm.makeNewPage(true, false);
-        }
-        if (needNewPage(breakVal)) {
-            curPage = pslm.makeNewPage(false, false);
+        default:
+            log.debug("handling break-before after page " + pslm.getCurrentPageNum()
+                + " breakVal=" + getBreakClassName(breakVal));
+            if (needBlankPageBeforeNew(breakVal)) {
+                log.trace("Inserting blank page");
+                /*curPage = */pslm.makeNewPage(true, false);
+            }
+            if (needNewPage(breakVal)) {
+                log.trace("Making new page");
+                /*curPage = */pslm.makeNewPage(false, false);
+            }
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org