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 2006/11/13 10:39:22 UTC
svn commit: r474218 [1/5] - in /xmlgraphics/fop/branches/Temp_Floats: ./
src/documentation/content/xdocs/trunk/ src/foschema/
src/java-1.4/org/apache/fop/image/ src/java/org/apache/fop/fo/
src/java/org/apache/fop/fo/expr/ src/java/org/apache/fop/fo/flo...
Author: vhennebert
Date: Mon Nov 13 01:39:19 2006
New Revision: 474218
URL: http://svn.apache.org/viewvc?view=rev&rev=474218
Log:
Patch for the implementation of the improved float-placement algorithm
Changes:
- merge in changes up to revision 432403 of the trunk
- extract LineBreakingAlgorithm and LineBreakPosition from LineLayoutManager and
put them in the breaking subpackage (was in preparation for the side-floats
implementation)
New features:
- minimum accepted fill ratio for pages: underfull pages which have at least
this fill ratio are considered to be feasible breaks
- float-only pages; this may be parameterized
- big floats may now be split on several pages
- shrink- and stretchability of out-of-line object are now taken into account
Added:
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/breaking/BeforeFloatsRecord.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/breaking/ElasticLength.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/breaking/FootnotesRecord.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/breaking/LineBreakPosition.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/breaking/LineBreakingAlgorithm.java
xmlgraphics/fop/branches/Temp_Floats/test/fotree/testcases/table-cell_column-number_rowspan_bug38397.fo
- copied unchanged from r432971, xmlgraphics/fop/trunk/test/fotree/testcases/table-cell_column-number_rowspan_bug38397.fo
xmlgraphics/fop/branches/Temp_Floats/test/java/org/apache/fop/memory/
- copied from r432971, xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/
xmlgraphics/fop/branches/Temp_Floats/test/java/org/apache/fop/memory/MemoryEater.java
- copied unchanged from r432971, xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/before-float_footnote_last-page.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/before-float_large.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml
- copied unchanged from r432971, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/block_keep-together_overflow_1.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/marker_percentage-resolution.xml
- copied unchanged from r432971, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/marker_percentage-resolution.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/table-header_in_list_bug.xml
- copied unchanged from r432971, xmlgraphics/fop/trunk/test/layoutengine/standard-testcases/table-header_in_list_bug.xml
xmlgraphics/fop/branches/Temp_Floats/test/xsl/fo-page-sequence-splitter.xsl
- copied unchanged from r432971, xmlgraphics/fop/trunk/test/xsl/fo-page-sequence-splitter.xsl
xmlgraphics/fop/branches/Temp_Floats/test/xsl/fo-replicator.xsl
- copied unchanged from r432971, xmlgraphics/fop/trunk/test/xsl/fo-replicator.xsl
Removed:
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/PropertySets.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/FopPropValFunction.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/properties/ColumnNumberPropertyMaker.java
Modified:
xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/configuration.xml
xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/pdfx.xml
xmlgraphics/fop/branches/Temp_Floats/src/foschema/fop-configuration.xsd
xmlgraphics/fop/branches/Temp_Floats/src/java-1.4/org/apache/fop/image/ImageIOImage.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOEventHandler.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FONode.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOPropertyMapping.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOText.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOTreeBuilder.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObj.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObjMixed.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/PropertyList.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/StaticPropertyList.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PropertyParser.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Block.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Marker.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Table.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/TableBody.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/TableCell.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/TableColumn.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/TableFObj.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/TableFooter.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/TableHeader.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/TableRow.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/pagination/PageSequence.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/properties/FontShorthandProperty.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fonts/FontSetup.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/BalancingColumnBreakingAlgorithm.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/SpaceResolver.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/breaking/OutOfLineRecord.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/layoutmgr/table/TableStepper.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/render/pdf/PDFSVGHandler.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/svg/PDFAElementBridge.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/svg/PDFDocumentGraphics2D.java
xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/svg/PDFGraphics2D.java
xmlgraphics/fop/branches/Temp_Floats/status.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/disabled-testcases.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/before-float_not-deferred_stretch.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/marker_font-size.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/marker_white-space-collapse.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/markers_7.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/markers_8.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/markers_9.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/table-body_basic_1.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/table-cell_background-image.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/table-cell_padding_percentages.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/table-row_background-image.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/table_background-image.xml
xmlgraphics/fop/branches/Temp_Floats/test/layoutengine/standard-testcases/table_padding_percentages.xml
Modified: xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/configuration.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/configuration.xml?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/configuration.xml (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/configuration.xml Mon Nov 13 01:39:19 2006
@@ -221,6 +221,20 @@
<fonts....
</renderer>]]></source>
+ <p>
+ Another (optional) setting specific to the PDF Renderer is an output color profile, an ICC
+ color profile which indicates the target color space the PDF file is generated for. This
+ setting is mainly used in conjunction with the <a href="pdfx.html">PDF/X</a> feature.
+ An example:
+ </p>
+ <source><![CDATA[
+ <renderer mime="application/pdf">
+ <filterList...
+
+ <output-profile>C:\FOP\Color\EuropeISOCoatedFOGRA27.icc</output-profile>
+
+ <fonts....
+ </renderer>]]></source>
</section>
<section id="ps-renderer">
<title>Special Settings for the PostScript Renderer</title>
Modified: xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/pdfx.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/pdfx.xml?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/pdfx.xml (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/documentation/content/xdocs/trunk/pdfx.xml Mon Nov 13 01:39:19 2006
@@ -108,9 +108,10 @@
<li>
Don't use CMYK images without an ICC color profile. PDF/X doesn't allow mixing
color spaces and FOP currently only properly supports the sRGB color space. However,
- you will need to specify an output device profile (usually a CMYK profile) in the
- configuration. sRGB won't work here since it's a display device profile, not an
- output device profile.
+ you will need to specify an
+ <a href="configuration.html#pdf-renderer">output device profile</a>
+ (usually a CMYK profile) in the configuration. sRGB won't work here since it's a
+ display device profile, not an output device profile.
</li>
<li>
Don't use non-RGB colors in SVG images. Same issue as with CMYK images.
Modified: xmlgraphics/fop/branches/Temp_Floats/src/foschema/fop-configuration.xsd
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/foschema/fop-configuration.xsd?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/foschema/fop-configuration.xsd (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/foschema/fop-configuration.xsd Mon Nov 13 01:39:19 2006
@@ -60,126 +60,159 @@
<xsd:attribute name="version" use="optional">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
- <xsd:enumeration value="1.0"></xsd:enumeration>
+ <xsd:enumeration value="1.0"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
-
<xsd:complexType name="rendererType">
- <xsd:annotation>
- <xsd:documentation>This type is stricter than required by FOP, in that it imposes an
+ <xsd:annotation>
+ <xsd:documentation>This type is stricter than required by FOP, in that it imposes an
order of the elements, which is not required by FOP.</xsd:documentation>
- </xsd:annotation>
- <xsd:sequence>
+ </xsd:annotation>
+ <xsd:sequence>
<xsd:choice minOccurs="0">
- <xsd:element name="filterList" maxOccurs="2">
- <xsd:annotation>
- <xsd:documentation>filterLists are used by the PDF renderer, MIME type
- application/pdf.</xsd:documentation>
- </xsd:annotation>
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element name="value" type="xsd:string"
- maxOccurs="unbounded">
- </xsd:element>
- </xsd:sequence>
- <xsd:attribute name="type" use="optional">
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="image"></xsd:enumeration>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:attribute>
- </xsd:complexType>
- </xsd:element>
- <xsd:element name="auto-rotate-landscape">
- <xsd:annotation>
- <xsd:documentation>auto-rotate-landscape is used by the PostScript renderer,
- MIME type application/postscript.</xsd:documentation>
- </xsd:annotation>
- <xsd:simpleType>
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="false"></xsd:enumeration>
- <xsd:enumeration value="true"></xsd:enumeration>
- </xsd:restriction>
- </xsd:simpleType>
- </xsd:element>
<xsd:sequence>
- <xsd:annotation>
- <xsd:documentation>rendering and text-rendering are used by the PCL renderer,
+ <xsd:annotation>
+ <xsd:documentation>Configuration elements used by the PDF renderer,
+ MIME type application/pdf</xsd:documentation>
+ </xsd:annotation>
+ <xsd:element name="filterList" minOccurs="0" maxOccurs="unbounded">
+ <xsd:annotation>
+ <xsd:documentation>filterLists are used by the PDF renderer, MIME type
+ application/pdf.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ <xsd:attribute name="type" use="optional">
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="default"/>
+ <xsd:enumeration value="content"/>
+ <xsd:enumeration value="image"/>
+ <xsd:enumeration value="jpeg"/>
+ <xsd:enumeration value="tiff"/>
+ <xsd:enumeration value="font"/>
+ <xsd:enumeration value="metadata"/>
+ <!-- Available values: see PDFFilterList.java -->
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:attribute>
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="output-profile" type="xsd:string" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation>Output color profile used by the PDF renderer. Specifies a
+ filename to an ICC file.</xsd:documentation>
+ </xsd:annotation>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:sequence>
+ <xsd:annotation>
+ <xsd:documentation>Configuration elements used by the PostScript renderer,
+ MIME type application/postscript</xsd:documentation>
+ </xsd:annotation>
+ <xsd:element name="auto-rotate-landscape">
+ <xsd:annotation>
+ <xsd:documentation>auto-rotate-landscape is used by the PostScript renderer,
+ MIME type application/postscript.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="false"/>
+ <xsd:enumeration value="true"/>
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+ </xsd:sequence>
+ <xsd:sequence>
+ <xsd:annotation>
+ <xsd:documentation>rendering and text-rendering are used by the PCL renderer,
MIME type application/vnd.hp-PCL</xsd:documentation>
- </xsd:annotation>
- <xsd:element name="rendering" minOccurs="0">
+ </xsd:annotation>
+ <xsd:element name="rendering" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
- <xsd:enumeration value="speed"></xsd:enumeration>
- <xsd:enumeration value="quality"></xsd:enumeration>
+ <xsd:enumeration value="speed"/>
+ <xsd:enumeration value="quality"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="text-rendering" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
- <xsd:enumeration value="auto"></xsd:enumeration>
- <xsd:enumeration value="bitmap"></xsd:enumeration>
+ <xsd:enumeration value="auto"/>
+ <xsd:enumeration value="bitmap"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
</xsd:sequence>
+ <xsd:sequence>
+ <xsd:annotation>
+ <xsd:documentation>The elements in this sequence apply only to the text renderer,
+ MIME type text/plain.</xsd:documentation>
+ </xsd:annotation>
+ <xsd:element name="encoding" type="xsd:string" default="UTF-8" minOccurs="0"/>
+ </xsd:sequence>
</xsd:choice>
<xsd:element name="fonts" minOccurs="0">
<xsd:complexType>
<xsd:sequence>
- <xsd:element name="font" type="fontType"
- maxOccurs="unbounded">
- </xsd:element>
+ <xsd:element name="font" type="fontType" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
+ <xsd:element name="xml-handler" minOccurs="0" maxOccurs="unbounded">
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="xsd:anyType"/>
+ </xsd:complexContent>
+ </xsd:complexType>
+ </xsd:element>
</xsd:sequence>
- <xsd:attribute name="mime" type="MimeConstants" use="required"></xsd:attribute>
+ <xsd:attribute name="mime" type="MimeConstants" use="required"/>
</xsd:complexType>
-
<xsd:complexType name="fontType">
<xsd:sequence>
- <xsd:element name="font-triplet" type="fontTripletType" maxOccurs="unbounded"></xsd:element>
+ <xsd:element name="font-triplet" type="fontTripletType" maxOccurs="unbounded"/>
</xsd:sequence>
- <xsd:attribute name="metrics-url" type="xsd:anyURI" use="required"></xsd:attribute>
- <xsd:attribute name="embed-url" type="xsd:anyURI" use="optional"></xsd:attribute>
- <xsd:attribute name="kerning" use="optional">
+ <xsd:attribute name="metrics-url" type="xsd:anyURI" use="required"/>
+ <xsd:attribute name="embed-url" type="xsd:anyURI" use="optional"/>
+ <xsd:attribute name="kerning" use="optional" default="no">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
- <xsd:enumeration value="yes"></xsd:enumeration>
+ <xsd:enumeration value="yes"/>
+ <xsd:enumeration value="no"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
-
<xsd:complexType name="fontTripletType">
- <xsd:attribute name="name" type="xsd:string" use="required"></xsd:attribute>
- <xsd:attribute name="style" type="xsd:string" use="required"></xsd:attribute>
- <xsd:attribute name="weight" type="xsd:string" use="required"></xsd:attribute>
+ <xsd:attribute name="name" type="xsd:string" use="required"/>
+ <xsd:attribute name="style" type="xsd:string" use="required"/>
+ <xsd:attribute name="weight" type="xsd:string" use="required"/>
</xsd:complexType>
-
<xsd:simpleType name="MimeConstants">
<xsd:restriction base="xsd:string">
- <xsd:enumeration value="application/pdf"></xsd:enumeration>
- <xsd:enumeration value="application/postscript"></xsd:enumeration>
- <xsd:enumeration value="application/x-pcl"></xsd:enumeration>
- <xsd:enumeration value="application/vnd.hp-PCL"></xsd:enumeration>
- <xsd:enumeration value="application/x-afp"></xsd:enumeration>
- <xsd:enumeration value="application/vnd.ibm.modcap"></xsd:enumeration>
- <xsd:enumeration value="text/plain"></xsd:enumeration>
- <xsd:enumeration value="application/rtf"></xsd:enumeration>
- <xsd:enumeration value="text/richtext"></xsd:enumeration>
- <xsd:enumeration value="text/rtf"></xsd:enumeration>
- <xsd:enumeration value="application/mif"></xsd:enumeration>
- <xsd:enumeration value="application/X-fop-awt-preview"></xsd:enumeration>
- <xsd:enumeration value="application/X-fop-print"></xsd:enumeration>
- <xsd:enumeration value="application/X-fop-areatree"></xsd:enumeration>
+ <xsd:enumeration value="application/pdf"/>
+ <xsd:enumeration value="application/postscript"/>
+ <xsd:enumeration value="application/x-pcl"/>
+ <xsd:enumeration value="application/vnd.hp-PCL"/>
+ <xsd:enumeration value="application/x-afp"/>
+ <xsd:enumeration value="application/vnd.ibm.modcap"/>
+ <xsd:enumeration value="text/plain"/>
+ <xsd:enumeration value="application/rtf"/>
+ <xsd:enumeration value="text/richtext"/>
+ <xsd:enumeration value="text/rtf"/>
+ <xsd:enumeration value="application/mif"/>
+ <xsd:enumeration value="application/X-fop-awt-preview"/>
+ <xsd:enumeration value="application/X-fop-print"/>
+ <xsd:enumeration value="application/X-fop-areatree"/>
+ <xsd:enumeration value="image/png"/>
+ <xsd:enumeration value="image/tiff"/>
</xsd:restriction>
</xsd:simpleType>
-
</xsd:schema>
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java-1.4/org/apache/fop/image/ImageIOImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java-1.4/org/apache/fop/image/ImageIOImage.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java-1.4/org/apache/fop/image/ImageIOImage.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java-1.4/org/apache/fop/image/ImageIOImage.java Mon Nov 13 01:39:19 2006
@@ -21,6 +21,7 @@
// AWT
import java.awt.Color;
+import java.awt.color.ColorSpace;
import java.awt.image.ColorModel;
import java.awt.image.IndexColorModel;
import java.awt.image.BufferedImage;
@@ -121,7 +122,9 @@
ColorModel cm = imageData.getColorModel();
this.bitsPerPixel = cm.getComponentSize(0); //only use first, we assume all are equal
- this.colorSpace = cm.getColorSpace();
+ //this.colorSpace = cm.getColorSpace();
+ //We currently force the image to sRGB
+ this.colorSpace = ColorSpace.getInstance(ColorSpace.CS_sRGB);
int[] tmpMap = imageData.getRGB(0, 0, this.width,
this.height, null, 0, this.width);
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOEventHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOEventHandler.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOEventHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOEventHandler.java Mon Nov 13 01:39:19 2006
@@ -40,9 +40,9 @@
import org.apache.fop.fo.flow.ListItem;
import org.apache.fop.fo.flow.PageNumber;
import org.apache.fop.fo.flow.Table;
-import org.apache.fop.fo.flow.TableColumn;
import org.apache.fop.fo.flow.TableBody;
import org.apache.fop.fo.flow.TableCell;
+import org.apache.fop.fo.flow.TableColumn;
import org.apache.fop.fo.flow.TableRow;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.fo.pagination.PageSequence;
@@ -78,7 +78,7 @@
*/
private Set idReferences = new HashSet();
- /*
+ /**
* The property list maker.
*/
protected PropertyListMaker propertyListMaker;
@@ -89,6 +89,11 @@
protected XMLWhiteSpaceHandler whiteSpaceHandler = new XMLWhiteSpaceHandler();
/**
+ * Indicates whether processing descendants of a marker
+ */
+ private boolean inMarker = false;
+
+ /**
* Main constructor
* @param foUserAgent the apps.FOUserAgent instance for this process
*/
@@ -144,6 +149,23 @@
}
/**
+ * Switch to or from marker context
+ * (used by FOTreeBuilder when processing
+ * a marker)
+ *
+ */
+ protected void switchMarkerContext(boolean inMarker) {
+ this.inMarker = inMarker;
+ }
+
+ /**
+ * Check whether in marker context
+ */
+ protected boolean inMarker() {
+ return this.inMarker;
+ }
+
+ /**
* This method is called to indicate the start of a new document run.
* @throws SAXException In case of a problem
*/
@@ -185,9 +207,10 @@
}
/**
- * This method is called to indicate the start of a new fo:flow or fo:static-content.
- * This method also handles fo:static-content tags, because the StaticContent class
- * is derived from the Flow class.
+ * This method is called to indicate the start of a new fo:flow
+ * or fo:static-content.
+ * This method also handles fo:static-content tags, because the
+ * StaticContent class is derived from the Flow class.
*
* @param fl Flow that is starting.
*/
@@ -219,15 +242,15 @@
*
* @param blc BlockContainer that is starting.
*/
- public void startBlockContainer(BlockContainer blc) {
- }
+ public void startBlockContainer(BlockContainer blc) {
+ }
- /**
+ /**
*
* @param blc BlockContainer that is ending.
*/
- public void endBlockContainer(BlockContainer blc) {
- }
+ public void endBlockContainer(BlockContainer blc) {
+ }
/**
*
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FONode.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FONode.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FONode.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FONode.java Mon Nov 13 01:39:19 2006
@@ -81,7 +81,6 @@
throws FOPException {
FONode foNode = (FONode) clone();
foNode.parent = cloneparent;
- cloneparent.addChildNode(foNode);
return foNode;
}
@@ -124,6 +123,10 @@
public FOEventHandler getFOEventHandler() {
return parent.getFOEventHandler();
}
+
+ protected boolean inMarker() {
+ return getFOEventHandler().inMarker();
+ }
/**
* Returns the user agent for the node.
@@ -258,7 +261,7 @@
/**
* Return an iterator over the object's child nodes starting
- * at the pased node.
+ * at the passed node.
* @param childNode First node in the iterator
* @return A ListIterator or null if child node isn't a child of
* this FObj.
@@ -581,5 +584,35 @@
return null;
}
+ /**
+ * @return true if markers are valid children
+ */
+ protected boolean canHaveMarkers() {
+ int foId = getNameId();
+ switch (foId) {
+ case Constants.FO_BASIC_LINK:
+ case Constants.FO_BIDI_OVERRIDE:
+ case Constants.FO_BLOCK:
+ case Constants.FO_BLOCK_CONTAINER:
+ case Constants.FO_FLOW:
+ case Constants.FO_INLINE:
+ case Constants.FO_INLINE_CONTAINER:
+ case Constants.FO_LIST_BLOCK:
+ case Constants.FO_LIST_ITEM:
+ case Constants.FO_LIST_ITEM_BODY:
+ case Constants.FO_LIST_ITEM_LABEL:
+ case Constants.FO_TABLE:
+ case Constants.FO_TABLE_BODY:
+ case Constants.FO_TABLE_HEADER:
+ case Constants.FO_TABLE_FOOTER:
+ case Constants.FO_TABLE_CELL:
+ case Constants.FO_TABLE_AND_CAPTION:
+ case Constants.FO_TABLE_CAPTION:
+ case Constants.FO_WRAPPER:
+ return true;
+ default:
+ return false;
+ }
+ }
}
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOPropertyMapping.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOPropertyMapping.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOPropertyMapping.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOPropertyMapping.java Mon Nov 13 01:39:19 2006
@@ -30,7 +30,7 @@
import org.apache.fop.fo.properties.BoxPropShorthandParser;
import org.apache.fop.fo.properties.CharacterProperty;
import org.apache.fop.fo.properties.ColorProperty;
-import org.apache.fop.fo.properties.ColumnNumberPropertyMaker;
+import org.apache.fop.fo.flow.TableFObj.ColumnNumberPropertyMaker;
import org.apache.fop.fo.properties.CondLengthProperty;
import org.apache.fop.fo.properties.CorrespondingPropertyMaker;
import org.apache.fop.fo.properties.DimensionPropertyMaker;
@@ -326,11 +326,13 @@
* @return a propId that matches the property name.
*/
public static int getPropertyId(String name) {
- Integer i = (Integer) s_htPropNames.get(name);
- if (i == null) {
- return -1;
+ if (name != null) {
+ Integer i = (Integer) s_htPropNames.get(name);
+ if (i != null) {
+ return i.intValue();
+ }
}
- return i.intValue();
+ return -1;
}
/**
@@ -339,11 +341,13 @@
* @return a subpropId that matches the subproperty name.
*/
public static int getSubPropertyId(String name) {
- Integer i = (Integer) s_htSubPropNames.get(name);
- if (i == null) {
- return -1;
+ if (name != null) {
+ Integer i = (Integer) s_htSubPropNames.get(name);
+ if (i != null) {
+ return i.intValue();
+ }
}
- return i.intValue();
+ return -1;
}
// returns a property, compound, or property.compound name
@@ -2263,8 +2267,8 @@
sub = new LengthProperty.Maker(CP_INLINE_PROGRESSION_DIRECTION);
sub.setDefault("0pt");
- m.addSubpropMaker(sub);
sub.setByShorthand(true);
+ m.addSubpropMaker(sub);
addPropertyMaker("border-separation", m);
// border-start-precedence
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOText.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOText.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOText.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOText.java Mon Nov 13 01:39:19 2006
@@ -151,6 +151,23 @@
}
/**
+ * @see org.apache.fop.fo.FONode#clone(FONode, boolean)
+ */
+ public FONode clone(FONode parent, boolean removeChildren)
+ throws FOPException {
+ FOText ft = (FOText) super.clone(parent, removeChildren);
+ if (removeChildren) {
+ //not really removing, but just make sure the char array
+ //pointed to is really a different one
+ if (ca != null) {
+ ft.ca = new char[ca.length];
+ System.arraycopy(ca, 0, ft.ca, 0, ca.length);
+ }
+ }
+ return ft;
+ }
+
+ /**
* @see org.apache.fop.fo.FObj#bind(PropertyList)
*/
public void bind(PropertyList pList) throws FOPException {
@@ -171,8 +188,8 @@
/** @see org.apache.fop.fo.FONode#endOfNode() */
protected void endOfNode() throws FOPException {
- createBlockPointers();
textTransform();
+ getFOEventHandler().characters(ca, startIndex, endIndex);
}
/**
@@ -210,28 +227,11 @@
}
/**
- * This method is run as part of the Constructor, to create xref pointers to
+ * This method is run as part of the ancestor Block's flushText(), to create xref pointers to
* the previous FOText objects within the same Block
*/
- private void createBlockPointers() {
- // build pointers between the FOText objects withing the same Block
- //
- // find the ancestorBlock of the current node
- FONode ancestorFONode = this;
- while (this.ancestorBlock == null) {
- ancestorFONode = ancestorFONode.parent;
- if (ancestorFONode instanceof org.apache.fop.fo.pagination.Title) {
- return;
- } else if (ancestorFONode instanceof org.apache.fop.fo.flow.Marker) {
- return;
- } else if (ancestorFONode instanceof Root) {
- getLogger().warn("Unexpected: fo:text with no fo:block ancestor. The text is: "
- + new String(ca));
- return;
- } else if (ancestorFONode instanceof Block) {
- this.ancestorBlock = (Block)ancestorFONode;
- }
- }
+ protected void createBlockPointers(Block ancestorBlock) {
+ this.ancestorBlock = ancestorBlock;
// if the last FOText is a sibling, point to it, and have it point here
if (lastFOTextProcessed != null) {
if (lastFOTextProcessed.ancestorBlock == this.ancestorBlock) {
@@ -252,7 +252,8 @@
* text-transform property.
*/
private void textTransform() {
- if (textTransform == Constants.EN_NONE) {
+ if (getFOEventHandler().inMarker()
+ || textTransform == Constants.EN_NONE) {
return;
}
for (int i = 0; i < endIndex; i++) {
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOTreeBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOTreeBuilder.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOTreeBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FOTreeBuilder.java Mon Nov 13 01:39:19 2006
@@ -246,7 +246,7 @@
*/
public FormattingResults getResults() {
if (getEventHandler() instanceof AreaTreeHandler) {
- return ((AreaTreeHandler)getEventHandler()).getResults();
+ return ((AreaTreeHandler) getEventHandler()).getResults();
} else {
//No formatting results available for output formats no
//involving the layout engine.
@@ -268,6 +268,11 @@
* Current propertyList for the node being handled.
*/
protected PropertyList currentPropertyList;
+
+ /**
+ * Current marker nesting-depth
+ */
+ private int nestedMarkerDepth = 0;
/**
* SAX Handler for the start of an element
@@ -278,16 +283,17 @@
/* the node found in the FO document */
FONode foNode;
- PropertyList propertyList;
+ PropertyList propertyList = null;
// Check to ensure first node encountered is an fo:root
if (rootFObj == null) {
if (!namespaceURI.equals(FOElementMapping.URI)
|| !localName.equals("root")) {
- throw new SAXException(new ValidationException(
- "Error: First element must be the fo:root formatting object. Found "
- + FONode.getNodeString(namespaceURI, localName) + " instead."
- + " Please make sure you're producing a valid XSL-FO document."));
+ throw new ValidationException(
+ "Error: First element must be the fo:root formatting object. "
+ + "Found " + FONode.getNodeString(namespaceURI, localName)
+ + " instead."
+ + " Please make sure you're producing a valid XSL-FO document.");
}
} else { // check that incoming node is valid for currentFObj
if (namespaceURI.equals(FOElementMapping.URI)) {
@@ -301,7 +307,8 @@
}
}
- ElementMapping.Maker fobjMaker = findFOMaker(namespaceURI, localName);
+ ElementMapping.Maker fobjMaker =
+ findFOMaker(namespaceURI, localName);
try {
foNode = fobjMaker.make(currentFObj);
@@ -309,8 +316,17 @@
rootFObj = (Root) foNode;
rootFObj.setFOEventHandler(foEventHandler);
}
- propertyList = foNode.createPropertyList(currentPropertyList, foEventHandler);
- foNode.processNode(localName, getEffectiveLocator(), attlist, propertyList);
+ propertyList = foNode.createPropertyList(
+ currentPropertyList, foEventHandler);
+ foNode.processNode(localName, getEffectiveLocator(),
+ attlist, propertyList);
+ if (foNode.getNameId() == Constants.FO_MARKER) {
+ if (foEventHandler.inMarker()) {
+ nestedMarkerDepth++;
+ } else {
+ foEventHandler.switchMarkerContext(true);
+ }
+ }
foNode.startOfNode();
} catch (IllegalArgumentException e) {
throw new SAXException(e);
@@ -321,11 +337,13 @@
ContentHandler subHandler = chFactory.createContentHandler();
if (subHandler instanceof ObjectSource
&& foNode instanceof ObjectBuiltListener) {
- ((ObjectSource)subHandler).setObjectBuiltListener((ObjectBuiltListener)foNode);
+ ((ObjectSource) subHandler).setObjectBuiltListener(
+ (ObjectBuiltListener) foNode);
}
subHandler.startDocument();
- subHandler.startElement(namespaceURI, localName, rawName, attlist);
+ subHandler.startElement(namespaceURI, localName,
+ rawName, attlist);
depth = 1;
delegate = subHandler;
}
@@ -335,7 +353,7 @@
}
currentFObj = foNode;
- if (propertyList != null) {
+ if (propertyList != null && !foEventHandler.inMarker()) {
currentPropertyList = propertyList;
}
}
@@ -356,11 +374,24 @@
+ " (" + currentFObj.getNamespaceURI()
+ ") vs. " + localName + " (" + uri + ")");
}
+
currentFObj.endOfNode();
-
- if (currentPropertyList.getFObj() == currentFObj) {
- currentPropertyList = currentPropertyList.getParentPropertyList();
+
+ if (currentPropertyList != null
+ && currentPropertyList.getFObj() == currentFObj
+ && !foEventHandler.inMarker()) {
+ currentPropertyList =
+ currentPropertyList.getParentPropertyList();
+ }
+
+ if (currentFObj.getNameId() == Constants.FO_MARKER) {
+ if (nestedMarkerDepth == 0) {
+ foEventHandler.switchMarkerContext(false);
+ } else {
+ nestedMarkerDepth--;
+ }
}
+
if (currentFObj.getParent() == null) {
log.debug("endElement for top-level " + currentFObj.getName());
}
@@ -373,19 +404,15 @@
*/
public void characters(char[] data, int start, int length)
throws FOPException {
- if (currentFObj != null) {
- currentFObj.addCharacters(data, start, start + length,
- currentPropertyList, getEffectiveLocator());
- }
+ if (currentFObj != null) {
+ currentFObj.addCharacters(data, start, start + length,
+ currentPropertyList, getEffectiveLocator());
+ }
}
public void endDocument() throws SAXException {
currentFObj = null;
- }
-
-
-
+ }
}
-
}
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObj.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObj.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObj.java Mon Nov 13 01:39:19 2006
@@ -20,7 +20,6 @@
package org.apache.fop.fo;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -119,11 +118,15 @@
* @see org.apache.fop.fo.FONode#processNode
*/
public void processNode(String elementName, Locator locator,
- Attributes attlist, PropertyList pList) throws FOPException {
+ Attributes attlist, PropertyList pList)
+ throws FOPException {
setLocator(locator);
pList.addAttributesToList(attlist);
- pList.setWritingMode();
- bind(pList);
+ if (!inMarker()
+ || "marker".equals(elementName)) {
+ pList.setWritingMode();
+ bind(pList);
+ }
}
/**
@@ -154,7 +157,7 @@
* @throws ValidationException if the ID is already defined elsewhere
*/
protected void checkId(String id) throws ValidationException {
- if (!id.equals("")) {
+ if (!inMarker() && !id.equals("")) {
Set idrefs = getFOEventHandler().getIDReferences();
if (!idrefs.contains(id)) {
idrefs.add(id);
@@ -178,13 +181,15 @@
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
protected void addChildNode(FONode child) throws FOPException {
- if (PropertySets.canHaveMarkers(getNameId()) && child.getNameId() == FO_MARKER) {
- addMarker((Marker)child);
+ if (canHaveMarkers() && child.getNameId() == FO_MARKER) {
+ addMarker((Marker) child);
} else {
ExtensionAttachment attachment = child.getExtensionAttachment();
if (attachment != null) {
- //This removes the element from the normal children, so no layout manager
- //is being created for them as they are only additional information.
+ /* This removes the element from the normal children,
+ * so no layout manager is being created for them
+ * as they are only additional information.
+ */
addExtensionAttachment(attachment);
} else {
if (childNodes == null) {
@@ -195,6 +200,10 @@
}
}
+ protected static void addChildTo(FONode child, FObj parent) throws FOPException {
+ parent.addChildNode(child);
+ }
+
/** @see org.apache.fop.fo.FONode#removeChild(org.apache.fop.fo.FONode) */
public void removeChild(FONode child) {
if (childNodes != null) {
@@ -245,6 +254,20 @@
int i = childNodes.indexOf(childNode);
if (i >= 0) {
return childNodes.listIterator(i);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return a FONode based on the index in the list of childNodes.
+ * @param nodeIndex index of the node to return
+ * @return the node or null if the index is invalid
+ */
+ public FONode getChildNodeAt(int nodeIndex) {
+ if (childNodes != null) {
+ if (nodeIndex >= 0 && nodeIndex < childNodes.size()) {
+ return (FONode) childNodes.get(nodeIndex);
}
}
return null;
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObjMixed.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObjMixed.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObjMixed.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/FObjMixed.java Mon Nov 13 01:39:19 2006
@@ -42,7 +42,7 @@
protected FObjMixed(FONode parent) {
super(parent);
}
-
+
/** @see org.apache.fop.fo.FONode */
protected void addCharacters(char[] data, int start, int end,
PropertyList pList,
@@ -50,7 +50,9 @@
if (ft == null) {
ft = new FOText(this);
ft.setLocator(locator);
- ft.bind(pList);
+ if (!inMarker()) {
+ ft.bind(pList);
+ }
}
ft.addCharacters(data, start, end, null, null);
}
@@ -58,12 +60,27 @@
/** @see org.apache.fop.fo.FONode#endOfNode() */
protected void endOfNode() throws FOPException {
flushText();
- getFOEventHandler().whiteSpaceHandler
- .handleWhiteSpace(this, currentTextNode);
+ if (!inMarker()
+ || getNameId() == FO_MARKER) {
+ getFOEventHandler().whiteSpaceHandler
+ .handleWhiteSpace(this, currentTextNode);
+ }
super.endOfNode();
}
/**
+ * Handles white-space for the node that is passed in,
+ * starting at its current text-node
+ * (used by RetrieveMarker to trigger 'end-of-node' white-space
+ * handling)
+ * @param fobj the node for which to handle white-space
+ */
+ protected static void handleWhiteSpaceFor(FObjMixed fobj) {
+ fobj.getFOEventHandler().getXMLWhiteSpaceHandler()
+ .handleWhiteSpace(fobj, fobj.currentTextNode);
+ }
+
+ /**
* Adds accumulated text as one FOText instance.
* Makes sure that nested calls to itself do nothing.
* @throws FOPException if there is a problem during processing
@@ -72,8 +89,29 @@
if (ft != null) {
FOText lft = ft;
ft = null;
+ if (getNameId() == FO_BLOCK) {
+ lft.createBlockPointers((org.apache.fop.fo.flow.Block) this);
+ } else if (getNameId() != FO_MARKER
+ && getNameId() != FO_TITLE
+ && getNameId() != FO_BOOKMARK_TITLE) {
+ FONode fo = parent;
+ int foNameId = fo.getNameId();
+ while (foNameId != FO_BLOCK
+ && foNameId != FO_MARKER
+ && foNameId != FO_TITLE
+ && foNameId != FO_BOOKMARK_TITLE
+ && foNameId != FO_PAGE_SEQUENCE) {
+ fo = fo.getParent();
+ foNameId = fo.getNameId();
+ }
+ if (foNameId == FO_BLOCK) {
+ lft.createBlockPointers((org.apache.fop.fo.flow.Block) fo);
+ } else if (foNameId == FO_PAGE_SEQUENCE) {
+ log.error("Could not create block pointers."
+ + " FOText w/o Block ancestor.");
+ }
+ }
lft.endOfNode();
- getFOEventHandler().characters(lft.ca, lft.startIndex, lft.endIndex);
addChildNode(lft);
}
}
@@ -83,15 +121,18 @@
*/
protected void addChildNode(FONode child) throws FOPException {
flushText();
- if (child instanceof FOText || child.getNameId() == FO_CHARACTER) {
- if (currentTextNode == null) {
- currentTextNode = child;
+ if (!inMarker()
+ || getNameId() == FO_MARKER) {
+ if (child instanceof FOText || child.getNameId() == FO_CHARACTER) {
+ if (currentTextNode == null) {
+ currentTextNode = child;
+ }
+ } else {
+ // handle white-space for all text up to here
+ getFOEventHandler().whiteSpaceHandler
+ .handleWhiteSpace(this, currentTextNode, child);
+ currentTextNode = null;
}
- } else {
- // handle white-space for all text up to here
- getFOEventHandler().whiteSpaceHandler
- .handleWhiteSpace(this, currentTextNode, child);
- currentTextNode = null;
}
super.addChildNode(child);
}
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/PropertyList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/PropertyList.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/PropertyList.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/PropertyList.java Mon Nov 13 01:39:19 2006
@@ -169,8 +169,11 @@
boolean bTryDefault) throws PropertyException {
PropertyMaker propertyMaker = findMaker(propId & Constants.PROPERTY_MASK);
- return propertyMaker.get(propId & Constants.COMPOUND_MASK, this,
- bTryInherit, bTryDefault);
+ if (propertyMaker != null) {
+ return propertyMaker.get(propId & Constants.COMPOUND_MASK, this,
+ bTryInherit, bTryDefault);
+ }
+ return null;
}
/**
@@ -260,8 +263,11 @@
* Adds the attributes, passed in by the parser to the PropertyList
*
* @param attributes Collection of attributes passed to us from the parser.
+ * @throws ValidationException if there is an attribute that does not
+ * map to a property id (strict validation only)
*/
- public void addAttributesToList(Attributes attributes) {
+ public void addAttributesToList(Attributes attributes)
+ throws ValidationException {
/*
* If column-number/number-columns-spanned are specified, then we
* need them before all others (possible from-table-column() on any
@@ -308,69 +314,104 @@
if (factory.getElementMappingRegistry().isKnownNamespace(attributeNS)) {
getFObj().addForeignAttribute(attributeNS, attributeName, attributeValue);
} else {
- handleInvalidProperty(attributeName);
+ handleInvalidProperty(
+ "Error processing foreign attribute: "
+ + attributeNS + "/@" + attributeName, attributeName);
}
}
}
}
+
+ /**
+ * Validates a property name.
+ * @param propertyName the property name to check
+ * @return true if the base property name and the subproperty name (if any)
+ * can be correctly mapped to an id
+ * @throws ValidationException in case the property name
+ * is invalid for the FO namespace
+ */
+ protected boolean isValidPropertyName(String propertyName)
+ throws ValidationException {
+
+ int propId = FOPropertyMapping.getPropertyId(
+ findBasePropertyName(propertyName));
+ int subpropId = FOPropertyMapping.getSubPropertyId(
+ findSubPropertyName(propertyName));
+
+ if (propId == -1
+ || (subpropId == -1
+ && findSubPropertyName(propertyName) != null)) {
+ StringBuffer errorMessage = new StringBuffer().append(
+ "Invalid property name \'").append(propertyName);
+ handleInvalidProperty(errorMessage.toString(), propertyName);
+ return false;
+ }
+ return true;
+ }
/**
*
* @param attributes Collection of attributes
* @param attributeName Attribute name to convert
* @param attributeValue Attribute value to assign to property
+ * @throws ValidationException in case the property name is invalid
+ * for the FO namespace
*/
private void convertAttributeToProperty(Attributes attributes,
String attributeName,
- String attributeValue) {
-
- PropertyMaker propertyMaker = null;
- FObj parentFO = fobj.findNearestAncestorFObj();
+ String attributeValue)
+ throws ValidationException {
- /* Handle "compound" properties, ex. space-before.minimum */
- String basePropertyName = findBasePropertyName(attributeName);
- String subPropertyName = findSubPropertyName(attributeName);
-
- int propId = FOPropertyMapping.getPropertyId(basePropertyName);
-
- propertyMaker = findMaker(propId);
- if (propertyMaker == null) {
- handleInvalidProperty(attributeName);
- return;
- }
- if (attributeValue == null) {
- return;
- }
- try {
- Property prop = null;
- if (subPropertyName == null) { // base attribute only found
- /* Do nothing if the base property has already been created.
- * This is e.g. the case when a compound attribute was
- * specified before the base attribute; in these cases
- * the base attribute was already created in
- * findBaseProperty()
- */
- if (getExplicit(propId) != null) {
- return;
+ if (attributeValue != null) {
+
+ if (!isValidPropertyName(attributeName)) {
+ //will log an error or throw an exception
+ return;
+ }
+ FObj parentFO = fobj.findNearestAncestorFObj();
+
+
+ /* Handle "compound" properties, ex. space-before.minimum */
+ String basePropertyName = findBasePropertyName(attributeName);
+ String subPropertyName = findSubPropertyName(attributeName);
+
+ int propId = FOPropertyMapping.getPropertyId(basePropertyName);
+ int subpropId = FOPropertyMapping.getSubPropertyId(subPropertyName);
+
+ PropertyMaker propertyMaker = findMaker(propId);
+ if (propertyMaker == null) {
+ log.warn("No PropertyMaker registered for " + attributeName
+ + ". Ignoring property.");
+ return;
+ }
+
+ try {
+ Property prop = null;
+ if (subPropertyName == null) { // base attribute only found
+ /* Do nothing if the base property has already been created.
+ * This is e.g. the case when a compound attribute was
+ * specified before the base attribute; in these cases
+ * the base attribute was already created in
+ * findBaseProperty()
+ */
+ if (getExplicit(propId) != null) {
+ return;
+ }
+ prop = propertyMaker.make(this, attributeValue, parentFO);
+ } else { // e.g. "leader-length.maximum"
+ Property baseProperty =
+ findBaseProperty(attributes, parentFO, propId,
+ basePropertyName, propertyMaker);
+ prop = propertyMaker.make(baseProperty, subpropId,
+ this, attributeValue, parentFO);
}
- prop = propertyMaker.make(this, attributeValue, parentFO);
- } else { // e.g. "leader-length.maximum"
- Property baseProperty = findBaseProperty(attributes,
- parentFO, propId, basePropertyName, propertyMaker);
- int subpropertyId = FOPropertyMapping.getSubPropertyId(subPropertyName);
- if (subpropertyId == -1) {
- handleInvalidProperty(attributeName);
- return;
+ if (prop != null) {
+ putExplicit(propId, prop);
}
- prop = propertyMaker.make(baseProperty, subpropertyId,
- this, attributeValue, parentFO);
- }
- if (prop != null) {
- putExplicit(propId, prop);
+ } catch (PropertyException e) {
+ log.error("Ignoring property: "
+ + attributeName + "=\"" + attributeValue + "\"");
}
- } catch (PropertyException e) {
- // TODO: Add strict validation.
- log.error(e.getMessage());
}
}
@@ -405,9 +446,19 @@
return null; // could not find base property
}
- private void handleInvalidProperty(String attributeName) {
- if (!attributeName.startsWith("xmlns")) {
- log.error("property '" + attributeName + "' ignored");
+ /**
+ * @param message ...
+ * @param propName ...
+ * @throws ValidationException ...
+ */
+ protected void handleInvalidProperty(String message, String propName)
+ throws ValidationException {
+ if (!propName.startsWith("xmlns")) {
+ if (fobj.getUserAgent().validateStrictly()) {
+ fobj.attributeError(message);
+ } else {
+ log.error(message + " Property ignored.");
+ }
}
}
@@ -418,7 +469,7 @@
* @param attributeName String to be atomized
* @return the base portion of the attribute
*/
- private static String findBasePropertyName(String attributeName) {
+ protected static String findBasePropertyName(String attributeName) {
int separatorCharIndex = attributeName.indexOf('.');
String basePropertyName = attributeName;
if (separatorCharIndex > -1) {
@@ -434,7 +485,7 @@
* @param attributeName String to be atomized
* @return the sub portion of the attribute
*/
- private static String findSubPropertyName(String attributeName) {
+ protected static String findSubPropertyName(String attributeName) {
int separatorCharIndex = attributeName.indexOf('.');
String subpropertyName = null;
if (separatorCharIndex > -1) {
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/StaticPropertyList.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/StaticPropertyList.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/StaticPropertyList.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/StaticPropertyList.java Mon Nov 13 01:39:19 2006
@@ -21,7 +21,7 @@
/**
* A very fast implementation of PropertyList that uses arrays to store
- * the explit set properties and another array to store cached values.
+ * the explicit set properties and another array to store cached values.
*/
public class StaticPropertyList extends PropertyList {
private Property[] explicit;
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/XMLWhiteSpaceHandler.java Mon Nov 13 01:39:19 2006
@@ -72,11 +72,34 @@
* @param firstTextNode the node at which to start
*/
public void handleWhiteSpace(FObjMixed fo, FONode firstTextNode) {
- if (fo.getNameId() == Constants.FO_BLOCK) {
- this.currentBlock = (Block) fo;
- this.linefeedTreatment = currentBlock.getLinefeedTreatment();
- this.whiteSpaceCollapse = currentBlock.getWhitespaceCollapse();
- this.whiteSpaceTreatment = currentBlock.getWhitespaceTreatment();
+ if (fo.getNameId() == Constants.FO_BLOCK
+ || fo.getNameId() == Constants.FO_RETRIEVE_MARKER) {
+ if (fo.getNameId() == Constants.FO_BLOCK) {
+ this.currentBlock = (Block) fo;
+ } else {
+ FONode ancestor = fo.parent;
+ while (ancestor.getNameId() != Constants.FO_BLOCK
+ && ancestor.getNameId() != Constants.FO_STATIC_CONTENT) {
+ ancestor = ancestor.getParent();
+ }
+ if (ancestor.getNameId() == Constants.FO_BLOCK) {
+ this.currentBlock = (Block) ancestor;
+ }
+ }
+ if (currentBlock != null) {
+ this.linefeedTreatment = currentBlock.getLinefeedTreatment();
+ this.whiteSpaceCollapse = currentBlock.getWhitespaceCollapse();
+ this.whiteSpaceTreatment =
+ currentBlock.getWhitespaceTreatment();
+ } else {
+ /* fo:retrieve-marker as direct child of static-content
+ * set properties to their initial values
+ */
+ this.linefeedTreatment = Constants.EN_TREAT_AS_SPACE;
+ this.whiteSpaceCollapse = Constants.EN_TRUE;
+ this.whiteSpaceTreatment =
+ Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED;
+ }
} else if (fo.getNameId() == Constants.FO_TITLE
|| fo.getNameId() == Constants.FO_BOOKMARK_TITLE) {
/* Two special types of FO that can contain #PCDATA
@@ -84,7 +107,8 @@
*/
this.linefeedTreatment = Constants.EN_TREAT_AS_SPACE;
this.whiteSpaceCollapse = Constants.EN_TRUE;
- this.whiteSpaceTreatment = Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED;
+ this.whiteSpaceTreatment =
+ Constants.EN_IGNORE_IF_SURROUNDING_LINEFEED;
}
currentFO = fo;
if (firstTextNode == null) {
@@ -94,7 +118,10 @@
charIter = new RecursiveCharIterator(fo, firstTextNode);
inWhiteSpace = false;
int textNodeIndex = -1;
- if (currentFO == currentBlock) {
+ if (currentFO == currentBlock
+ || currentBlock == null
+ || (currentFO.getNameId() == Constants.FO_RETRIEVE_MARKER
+ && currentFO.getParent() == currentBlock)) {
textNodeIndex = fo.childNodes.indexOf(firstTextNode);
afterLinefeed = ((textNodeIndex == 0)
|| (textNodeIndex > 0
@@ -104,7 +131,8 @@
endOfBlock = (nextChild == null && currentFO == currentBlock);
if (nextChild != null) {
int nextChildId = nextChild.getNameId();
- nextChildIsBlockLevel = (nextChildId == Constants.FO_BLOCK
+ nextChildIsBlockLevel = (
+ nextChildId == Constants.FO_BLOCK
|| nextChildId == Constants.FO_TABLE_AND_CAPTION
|| nextChildId == Constants.FO_TABLE
|| nextChildId == Constants.FO_LIST_BLOCK
@@ -148,6 +176,11 @@
inline FO that is about to end */
addPendingInline(fo);
}
+ }
+
+ if (currentFO == currentBlock && nextChild == null) {
+ /* end of block: clear the reference */
+ currentBlock = null;
}
}
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/FromTableColumnFunction.java Mon Nov 13 01:39:19 2006
@@ -24,9 +24,9 @@
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.flow.Table;
-import org.apache.fop.fo.flow.TableFObj;
import org.apache.fop.fo.flow.TableCell;
import org.apache.fop.fo.flow.TableColumn;
+import org.apache.fop.fo.flow.TableFObj;
import org.apache.fop.fo.properties.Property;
/**
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PPColWidthFunction.java Mon Nov 13 01:39:19 2006
@@ -19,7 +19,8 @@
package org.apache.fop.fo.expr;
-
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.flow.Table;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.TableColLength;
@@ -51,13 +52,20 @@
Number d = args[0].getNumber();
if (d == null) {
throw new PropertyException("Non numeric operand to "
- + "proportional-column-width function");
+ + "proportional-column-width() function.");
+ }
+ PropertyList pList = pInfo.getPropertyList();
+ if (!"fo:table-column".equals(pList.getFObj().getName())) {
+ throw new PropertyException("proportional-column-width() function "
+ + "may only be used on fo:table-column.");
}
- if (!pInfo.getPropertyList().getFObj().getName().equals("fo:table-column")) {
- throw new PropertyException("proportional-column-width function "
- + "may only be used on table-column FO");
+
+ Table t = (Table) pList.getParentFObj();
+ if (t.isAutoLayout()) {
+ throw new PropertyException("proportional-column-width() function "
+ + "may only be used when fo:table has "
+ + "table-layout=\"fixed\".");
}
- // Check if table-layout is "fixed"...
return new TableColLength(d.doubleValue(), pInfo.getFO());
}
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PropertyParser.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PropertyParser.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PropertyParser.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/expr/PropertyParser.java Mon Nov 13 01:39:19 2006
@@ -62,8 +62,6 @@
new PPColWidthFunction());
FUNCTION_TABLE.put("label-end", new LabelEndFunction());
FUNCTION_TABLE.put("body-start", new BodyStartFunction());
- // NOTE: used from code generated for corresponding properties
- FUNCTION_TABLE.put("_fop-property-value", new FopPropValFunction());
/**
* * NOT YET IMPLEMENTED!!!
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/AbstractListItemPart.java Mon Nov 13 01:39:19 2006
@@ -86,8 +86,19 @@
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws FOPException {
- if (!blockItemFound) {
- missingChildElementError("marker* (%block;)+");
+ if (!this.blockItemFound) {
+ String contentModel = "marker* (%block;)+";
+ if (getUserAgent().validateStrictly()) {
+ missingChildElementError(contentModel);
+ } else {
+ StringBuffer message = new StringBuffer(
+ errorText(getLocator()));
+ message.append(getName())
+ .append(" is missing child elements. ")
+ .append("Required Content Model: ")
+ .append(contentModel);
+ getLogger().warn(message.toString());
+ }
}
}
@@ -100,6 +111,6 @@
public String getId() {
return id;
}
-
+
}
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Block.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Block.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Block.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Block.java Mon Nov 13 01:39:19 2006
@@ -42,20 +42,6 @@
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.fo.properties.SpaceProperty;
-/*
- Modified by Mark Lillywhite mark-fop@inomial.com. The changes
- here are based on memory profiling and do not change functionality.
- Essentially, the Block object had a pointer to a BlockArea object
- that it created. The BlockArea was not referenced after the Block
- was finished except to determine the size of the BlockArea, however
- a reference to the BlockArea was maintained and this caused a lot of
- GC problems, and was a major reason for FOP memory leaks. So,
- the reference to BlockArea was made local, the required information
- is now stored (instead of a reference to the complex BlockArea object)
- and it appears that there are a lot of changes in this file, in fact
- there are only a few sematic changes; mostly I just got rid of
- "this." from blockArea since BlockArea is now local.
- */
/**
* Class modelling the fo:block object.
*/
@@ -361,6 +347,48 @@
return whiteSpaceCollapse;
}
+ /**
+ * @return Returns the commonAccessibility.
+ */
+ public CommonAccessibility getCommonAccessibility() {
+ return this.commonAccessibility;
+ }
+
+ /**
+ * @return Returns the commonAural.
+ */
+ public CommonAural getCommonAural() {
+ return this.commonAural;
+ }
+
+ /**
+ * @return Returns the commonRelativePosition.
+ */
+ public CommonRelativePosition getCommonRelativePosition() {
+ return this.commonRelativePosition;
+ }
+
+ /**
+ * @return Returns the hyphenationKeep.
+ */
+ public int getHyphenationKeep() {
+ return this.hyphenationKeep;
+ }
+
+ /**
+ * @return Returns the intrusionDisplace.
+ */
+ public int getIntrusionDisplace() {
+ return this.intrusionDisplace;
+ }
+
+ /**
+ * @return Returns the lineHeightShiftAdjustment.
+ */
+ public int getLineHeightShiftAdjustment() {
+ return this.lineHeightShiftAdjustment;
+ }
+
/** @see org.apache.fop.fo.FONode#charIterator() */
public CharIterator charIterator() {
return NullCharIterator.getInstance();
@@ -377,4 +405,5 @@
public int getNameId() {
return FO_BLOCK;
}
+
}
Modified: xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Marker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Marker.java?view=diff&rev=474218&r1=474217&r2=474218
==============================================================================
--- xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Marker.java (original)
+++ xmlgraphics/fop/branches/Temp_Floats/src/java/org/apache/fop/fo/flow/Marker.java Mon Nov 13 01:39:19 2006
@@ -20,9 +20,8 @@
package org.apache.fop.fo.flow;
import java.util.HashMap;
-import java.util.Iterator;
-
+import org.xml.sax.Attributes;
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
@@ -30,6 +29,7 @@
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FObjMixed;
+import org.apache.fop.fo.FOPropertyMapping;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.PropertyListMaker;
import org.apache.fop.fo.ValidationException;
@@ -44,7 +44,7 @@
// End of property values
private PropertyListMaker savePropertyListMaker;
- private HashMap descPLists = new HashMap();
+ private HashMap descendantPropertyLists = new HashMap();
/**
* Create a marker fo.
@@ -76,14 +76,11 @@
* @param foNode the FO node whose property list is requested
* @return the MarkerPropertyList of foNode
*/
- protected MarkerPropertyList getPList(FONode foNode) {
- return (MarkerPropertyList) descPLists.get(foNode);
- }
-
- protected PropertyList createPropertyList(PropertyList parent, FOEventHandler foEventHandler) throws FOPException {
- return new MarkerPropertyList(this, parent);
+ protected MarkerPropertyList getPropertyListFor(FONode foNode) {
+ return (MarkerPropertyList)
+ descendantPropertyLists.get(foNode);
}
-
+
/** @see org.apache.fop.fo.FONode#startOfNode() */
protected void startOfNode() {
FOEventHandler foEventHandler = getFOEventHandler();
@@ -92,30 +89,18 @@
foEventHandler.setPropertyListMaker(new PropertyListMaker() {
public PropertyList make(FObj fobj, PropertyList parentPropertyList) {
PropertyList pList = new MarkerPropertyList(fobj, parentPropertyList);
- descPLists.put(fobj, pList);
+ descendantPropertyLists.put(fobj, pList);
return pList;
}
});
}
-
+
/** @see org.apache.fop.fo.FONode#endOfNode() */
protected void endOfNode() throws FOPException {
super.endOfNode();
// Pop the MarkerPropertyList maker.
getFOEventHandler().setPropertyListMaker(savePropertyListMaker);
savePropertyListMaker = null;
- // unparent the child property lists
- Iterator iter = getChildNodes();
- if (iter != null) {
- while (iter.hasNext()) {
- FONode child = (FONode) iter.next();
- MarkerPropertyList pList
- = (MarkerPropertyList) descPLists.get(child);
- if (pList != null) {
- pList.setParentPropertyList(null);
- }
- }
- }
}
/**
@@ -132,7 +117,11 @@
invalidChildError(loc, nsURI, localName);
}
}
-
+
+ protected boolean inMarker() {
+ return true;
+ }
+
/**
* Return the "marker-class-name" property.
*/
@@ -160,30 +149,252 @@
}
/**
- * An implementation of PropertyList which only stores the explicit
- * assigned properties. It is memory efficient but slow.
+ * An implementation of PropertyList which only stores the explicitly
+ * specified properties/attributes as bundles of name-value-namespace
+ * strings
*/
- public class MarkerPropertyList extends PropertyList {
- HashMap explicit = new HashMap();
+ protected class MarkerPropertyList extends PropertyList
+ implements Attributes {
+
+ protected class MarkerAttribute {
+
+ protected String namespace;
+ protected String qname;
+ protected String name;
+ protected String value;
+
+ /**
+ * Main constructor
+ * @param namespace the namespace URI
+ * @param qname the qualified name
+ * @param name the name
+ * @param value the value
+ */
+ public MarkerAttribute(String namespace, String qname,
+ String name, String value) {
+ this.namespace = namespace;
+ this.qname = qname;
+ this.name = (name == null ? qname : name);
+ this.value = value;
+ }
+
+ /**
+ * Convenience constructor for FO attributes
+ * @param name the attribute name
+ * @param value the attribute value
+ */
+ public MarkerAttribute(String name, String value) {
+ this.namespace = null;
+ this.qname = name;
+ this.name = name;
+ this.value = value;
+ }
+ }
+
+ /** the array of attributes **/
+ private MarkerAttribute[] attribs;
+
+ /**
+ * Overriding default constructor
+ *
+ * @param fobj the FObj to attach
+ * @param parentPropertyList ignored
+ */
public MarkerPropertyList(FObj fobj, PropertyList parentPropertyList) {
- super(fobj, parentPropertyList);
+ /* ignore parentPropertyList
+ * won't be used because the attributes will be stored
+ * without resolving
+ */
+ super(fobj, null);
}
/**
- * Set the parent property list. Used to assign a new parent
- * before re-binding all the child elements.
+ * Override that doesn't convert the attributes to Property instances,
+ * but simply stores the attributes for later processing;
+ *
+ * @see org.apache.fop.fo.PropertyList#addAttributesToList(Attributes)
*/
- public void setParentPropertyList(PropertyList parentPropertyList) {
- this.parentPropertyList = parentPropertyList;
+ public void addAttributesToList(Attributes attributes)
+ throws ValidationException {
+
+ this.attribs = new MarkerAttribute[attributes.getLength()];
+
+ String name;
+ String value;
+ String namespace;
+ String qname;
+
+ for (int i = attributes.getLength(); --i >= 0;) {
+ namespace = attributes.getURI(i);
+ qname = attributes.getQName(i);
+ name = attributes.getLocalName(i);
+ value = attributes.getValue(i);
+
+ this.attribs[i] =
+ new MarkerAttribute(namespace, qname, name, value);
+ }
}
-
+
+ /**
+ * Null implementation; not used by this type of PropertyList
+ * @see org.apache.fop.fo.PropertyList#putExplicit(int, Property)
+ */
public void putExplicit(int propId, Property value) {
- explicit.put(new Integer(propId), value);
+ //nop
}
+ /**
+ * Null implementation; not used by this type of PropertyList
+ * @see org.apache.fop.fo.PropertyList#getExplicit(int)
+ */
public Property getExplicit(int propId) {
- return (Property) explicit.get(new Integer(propId));
+ return null;
+ }
+
+ /**
+ * @see org.xml.sax.Attributes#getLength()
+ */
+ public int getLength() {
+ if (attribs == null) {
+ return 0;
+ } else {
+ return attribs.length;
+ }
+ }
+
+ /**
+ * @see org.xml.sax.Attributes#getURI()
+ */
+ public String getURI(int index) {
+ if (attribs != null
+ && index < attribs.length
+ && index >= 0
+ && attribs[index] != null) {
+ return attribs[index].namespace;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @see org.xml.sax.Attributes#getLocalName()
+ */
+ public String getLocalName(int index) {
+ if (attribs != null
+ && index < attribs.length
+ && index >= 0
+ && attribs[index] != null) {
+ return attribs[index].name;
+ } else {
+ return null;
+ }
}
- }
-}
+ /**
+ * @see org.xml.sax.Attributes#getQName()
+ */
+ public String getQName(int index) {
+ if (attribs != null
+ && index < attribs.length
+ && index >= 0
+ && attribs[index] != null) {
+ return attribs[index].qname;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Default implementation; not used
+ * @see org.xml.sax.Attributes#getType()
+ */
+ public String getType(int index) {
+ return "CDATA";
+ }
+
+ /**
+ * @see org.xml.sax.Attributes#getValue()
+ */
+ public String getValue(int index) {
+ if (attribs != null
+ && index < attribs.length
+ && index >= 0
+ && attribs[index] != null) {
+ return attribs[index].value;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * @see org.xml.sax.Attributes#getIndex()
+ */
+ public int getIndex(String name, String namespace) {
+ int index = -1;
+ if (attribs != null && name != null && namespace != null) {
+ for (int i = attribs.length; --i >= 0;) {
+ if (attribs[i] != null
+ && namespace.equals(attribs[i].namespace)
+ && name.equals(attribs[i].name)) {
+ break;
+ }
+ }
+ }
+ return index;
+ }
+
+ /**
+ * @see org.xml.sax.Attributes#getIndex()
+ */
+ public int getIndex(String qname) {
+ int index = -1;
+ if (attribs != null && qname != null) {
+ for (int i = attribs.length; --i >= 0;) {
+ if (attribs[i] != null
+ && qname.equals(attribs[i].qname)) {
+ break;
+ }
+ }
+ }
+ return index;
+ }
+
+ /**
+ * Default implementation; not used
+ * @see org.xml.sax.Attributes#getType()
+ */
+ public String getType(String name, String namespace) {
+ return "CDATA";
+ }
+
+ /**
+ * Default implementation; not used
+ * @see org.xml.sax.Attributes#getType()
+ */
+ public String getType(String qname) {
+ return "CDATA";
+ }
+
+ /**
+ * @see org.xml.sax.Attributes#getValue()
+ */
+ public String getValue(String name, String namespace) {
+ int index = getIndex(name, namespace);
+ if (index > 0) {
+ return getValue(index);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.xml.sax.Attributes#getValue()
+ */
+ public String getValue(String qname) {
+ int index = getIndex(qname);
+ if (index > 0) {
+ return getValue(index);
+ }
+ return null;
+ }
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org
Re: svn commit: r474218 [1/5] - in /xmlgraphics/fop/branches/Temp_Floats:
./ src/documentation/content/xdocs/trunk/ src/foschema/ src/java-1.4/org/apache/fop/image/
src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/expr/ src/java/org/apache/fop/fo/flo...
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Vincent Hennebert wrote:
> Comments are welcome, of course.
I'm quite impressed. The layout improvements are very exciting.
J.Pietschmann
Re: svn commit: r474218 [1/5] - in /xmlgraphics/fop/branches/Temp_Floats:
./ src/documentation/content/xdocs/trunk/ src/foschema/ src/java-1.4/org/apache/fop/image/
src/java/org/apache/fop/fo/ src/java/org/apache/fop/fo/expr/ src/java/org/apache/fop/fo/flo...
Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi all,
After some cleanup I've finally applied my GSoC patch about improved
out-of-lines handling. There is still some work to do, but I think it is
time to commit so that those who are interested can have a look at it.
Basically there is some code to merge between BreakingAlgorithm and
PageBreakingAlgorithm, I'd like to improve the recovering code
(too-short and too-long nodes), and there are failing testcases to look
at and bugs to correct.
So, still some work before merging back into trunk...
Comments are welcome, of course.
Cheers,
Vincent