Browse Source

Bugzilla #49733:

Resolved compilation (safe one), Checkstyle and many Javadoc warnings.
Submitted by: Glenn Adams <glenn.at.skynav.com>

Changes to patch:
- Restored the deprecated Graphics2DAdapter method (to be removed after Barcode4J 2.1 is released).
- Restored Renderer.startPageSequence(LineArea) pending discussion about removal.
- build.xml: set max VM to 1024MB instead of 2048MB to allow for 32-bit JVMs.
- build.xml: restored longer taskdef names.
- Restored Checkstyle 4 file for people running older IDEs.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@985537 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_1rc1old
Jeremias Maerki 13 years ago
parent
commit
29e8badcec
100 changed files with 861 additions and 414 deletions
  1. 14
    6
      build.xml
  2. 14
    0
      checkstyle-5.1.xml
  3. 7
    0
      checkstyle-suppressions.xml
  4. 1
    0
      src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java
  5. 28
    27
      src/codegen/unicode/data/LineBreakPairTable.txt
  6. 4
    4
      src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java
  7. 51
    33
      src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java
  8. 17
    14
      src/codegen/unicode/java/org/apache/fop/util/License.java
  9. 4
    1
      src/java/org/apache/fop/ResourceEventProducer.java
  10. 53
    44
      src/java/org/apache/fop/afp/AFPBorderPainter.java
  11. 4
    3
      src/java/org/apache/fop/afp/AFPDataObjectInfo.java
  12. 4
    1
      src/java/org/apache/fop/afp/AFPEventProducer.java
  13. 1
    1
      src/java/org/apache/fop/afp/AFPGraphics2D.java
  14. 7
    7
      src/java/org/apache/fop/afp/AFPLineDataInfo.java
  15. 26
    17
      src/java/org/apache/fop/afp/AFPRectanglePainter.java
  16. 1
    1
      src/java/org/apache/fop/afp/AFPStreamer.java
  17. 2
    0
      src/java/org/apache/fop/afp/AbstractAFPPainter.java
  18. 5
    3
      src/java/org/apache/fop/afp/DataStream.java
  19. 5
    2
      src/java/org/apache/fop/afp/Factory.java
  20. 1
    1
      src/java/org/apache/fop/afp/Startable.java
  21. 2
    1
      src/java/org/apache/fop/afp/fonts/CharacterSet.java
  22. 3
    2
      src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java
  23. 2
    2
      src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java
  24. 1
    1
      src/java/org/apache/fop/afp/fonts/DoubleByteFont.java
  25. 5
    1
      src/java/org/apache/fop/afp/fonts/OutlineFont.java
  26. 2
    1
      src/java/org/apache/fop/afp/fonts/RasterFont.java
  27. 2
    1
      src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java
  28. 0
    2
      src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java
  29. 1
    0
      src/java/org/apache/fop/afp/goca/GraphicsFillet.java
  30. 3
    0
      src/java/org/apache/fop/afp/goca/GraphicsSetMix.java
  31. 1
    1
      src/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java
  32. 3
    3
      src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java
  33. 4
    1
      src/java/org/apache/fop/afp/ioca/ImageRasterPattern.java
  34. 5
    2
      src/java/org/apache/fop/afp/modca/AbstractAFPObject.java
  35. 5
    0
      src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java
  36. 2
    2
      src/java/org/apache/fop/afp/modca/AbstractPageObject.java
  37. 4
    0
      src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java
  38. 6
    2
      src/java/org/apache/fop/afp/modca/GraphicsObject.java
  39. 3
    0
      src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java
  40. 3
    2
      src/java/org/apache/fop/afp/modca/IncludeObject.java
  41. 4
    1
      src/java/org/apache/fop/afp/modca/MapCodedFont.java
  42. 2
    2
      src/java/org/apache/fop/afp/modca/ObjectContainer.java
  43. 1
    0
      src/java/org/apache/fop/afp/modca/PageGroup.java
  44. 4
    0
      src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java
  45. 5
    0
      src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java
  46. 2
    1
      src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java
  47. 60
    1
      src/java/org/apache/fop/afp/modca/triplets/Triplet.java
  48. 2
    1
      src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java
  49. 4
    5
      src/java/org/apache/fop/afp/svg/AFPBridgeContext.java
  50. 2
    1
      src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java
  51. 3
    10
      src/java/org/apache/fop/afp/svg/AFPTextHandler.java
  52. 1
    1
      src/java/org/apache/fop/afp/svg/AFPTextPainter.java
  53. 3
    0
      src/java/org/apache/fop/afp/util/BinaryUtils.java
  54. 4
    1
      src/java/org/apache/fop/afp/util/CubicBezierApproximator.java
  55. 4
    1
      src/java/org/apache/fop/afp/util/StringUtils.java
  56. 4
    1
      src/java/org/apache/fop/area/AreaEventProducer.java
  57. 7
    2
      src/java/org/apache/fop/area/AreaTreeParser.java
  58. 1
    0
      src/java/org/apache/fop/area/Block.java
  59. 1
    1
      src/java/org/apache/fop/area/DestinationData.java
  60. 2
    1
      src/java/org/apache/fop/area/IDTracker.java
  61. 1
    1
      src/java/org/apache/fop/area/LineArea.java
  62. 4
    1
      src/java/org/apache/fop/area/Trait.java
  63. 4
    2
      src/java/org/apache/fop/area/inline/AbstractTextArea.java
  64. 4
    0
      src/java/org/apache/fop/area/inline/InlineArea.java
  65. 1
    0
      src/java/org/apache/fop/area/inline/SpaceArea.java
  66. 1
    0
      src/java/org/apache/fop/area/inline/WordArea.java
  67. 12
    6
      src/java/org/apache/fop/cli/CommandLineOptions.java
  68. 3
    2
      src/java/org/apache/fop/cli/InputHandler.java
  69. 4
    1
      src/java/org/apache/fop/cli/Main.java
  70. 13
    2
      src/java/org/apache/fop/datatypes/FODimension.java
  71. 6
    5
      src/java/org/apache/fop/datatypes/Numeric.java
  72. 1
    1
      src/java/org/apache/fop/datatypes/PercentBaseContext.java
  73. 5
    2
      src/java/org/apache/fop/datatypes/URISpecification.java
  74. 4
    1
      src/java/org/apache/fop/events/EventExceptionManager.java
  75. 6
    2
      src/java/org/apache/fop/events/model/EventModelParser.java
  76. 5
    3
      src/java/org/apache/fop/fo/FONode.java
  77. 117
    100
      src/java/org/apache/fop/fo/FOPropertyMapping.java
  78. 3
    3
      src/java/org/apache/fop/fo/FOText.java
  79. 3
    3
      src/java/org/apache/fop/fo/FObj.java
  80. 4
    0
      src/java/org/apache/fop/fo/NullCharIterator.java
  81. 7
    0
      src/java/org/apache/fop/fo/PropertyListMaker.java
  82. 7
    4
      src/java/org/apache/fop/fo/StaticPropertyList.java
  83. 10
    0
      src/java/org/apache/fop/fo/ValidationException.java
  84. 3
    2
      src/java/org/apache/fop/fo/expr/BodyStartFunction.java
  85. 135
    24
      src/java/org/apache/fop/fo/expr/NumericOp.java
  86. 2
    0
      src/java/org/apache/fop/fo/expr/PropertyInfo.java
  87. 15
    11
      src/java/org/apache/fop/fo/expr/PropertyTokenizer.java
  88. 15
    1
      src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java
  89. 2
    1
      src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
  90. 5
    3
      src/java/org/apache/fop/fo/extensions/ExtensionObj.java
  91. 22
    5
      src/java/org/apache/fop/fo/extensions/ExternalDocument.java
  92. 2
    1
      src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java
  93. 1
    1
      src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java
  94. 3
    1
      src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java
  95. 2
    1
      src/java/org/apache/fop/fo/flow/Block.java
  96. 2
    1
      src/java/org/apache/fop/fo/flow/BlockContainer.java
  97. 1
    1
      src/java/org/apache/fop/fo/flow/Float.java
  98. 2
    2
      src/java/org/apache/fop/fo/flow/Footnote.java
  99. 2
    1
      src/java/org/apache/fop/fo/flow/Inline.java
  100. 0
    0
      src/java/org/apache/fop/fo/flow/Leader.java

+ 14
- 6
build.xml View File

@@ -494,7 +494,7 @@ list of possible build targets.
</path>
<!-- If we decide to use retroweaver for the actual weaving, the mkdir and
destdir= will have to be removed. Also, the weaving task would additionally
need to be defined even if no jdk 14 is available. -->
need to be defined even if no jdk 14 is available. -->
<mkdir dir="${build.dir}/temp"/>
<retroweaver srcdir="${build.classes.dir}" destdir="${build.dir}/temp"
classpath="${toString:verify-classpath}" lazy="false"
@@ -807,6 +807,7 @@ list of possible build targets.
<target name="junit-userconfig" depends="junit-compile" if="junit.present" description="Runs FOP's user config JUnit tests">
<echo message="Running user config tests"/>
<junit dir="${basedir}" haltonfailure="${junit.haltonfailure}" fork="${junit.fork}" errorproperty="fop.junit.error" failureproperty="fop.junit.failure">
<jvmarg value="-Xmx1024m"/>
<sysproperty key="basedir" value="${basedir}"/>
<sysproperty key="jawa.awt.headless" value="true"/>
<sysproperty key="fop.layoutengine.disabled" value="${layoutengine.disabled}"/>
@@ -1045,7 +1046,7 @@ NOTE:
<pathelement path="${src.sandbox.dir}"/>
<pathelement path="${build.gensrc.dir}"/>
</sourcepath>
<tag name="todo" scope="all" description="To do:"/>
<tag name="asf.todo" scope="all" description="To do:"/>
<tag name="event.severity" scope="all" description="Event severity level:"/>
<group title="Control and Startup">
<package name="org.apache.fop"/>
@@ -1135,13 +1136,20 @@ NOTE:
</condition>
<target name="checkstyle-avail" unless="checkstyle.avail">
<echo message="Checkstyle support NOT present. Please download it from http://checkstyle.sf.net/ and"/>
<echo message="..copy or link checkstyle-all-5.0.jar to ${lib-tools}"/>
<echo message="..copy or link checkstyle-all-5.1.jar to ${lib-tools}"/>
<echo message="..copy or link checkstyle-noframes.xsl to ${checkstyle.noframes.xslt}"/>
</target>
<target name="checkstyle" depends="init, checkstyle-avail" if="checkstyle.avail" description="Runs Checkstyle for a code quality report">
<target name="checkstyle" depends="package, checkstyle-avail" if="checkstyle.avail" description="Runs Checkstyle for a code quality report">
<taskdef name="checkstyle" classname="com.puppycrawl.tools.checkstyle.CheckStyleTask" classpathref="libs-tools-build-classpath"/>
<checkstyle config="checkstyle-5.0.xml" failonviolation="false">
<fileset dir="${src.java.dir}" includes="**/*.java"/>
<mkdir dir="${build.dir}"/>
<checkstyle config="checkstyle-5.1.xml" failonviolation="false">
<classpath>
<path refid="libs-build-classpath"/>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${build.sandbox-classes.dir}"/>
<pathelement location="${build.codegen-classes.dir}"/>
</classpath>
<fileset dir="${src.dir}" includes="**/*.java"/>
<formatter type="xml" toFile="${build.dir}/report_checkstyle.xml"/>
</checkstyle>
<xslt in="${build.dir}/report_checkstyle.xml" out="${build.dir}/report_checkstyle.html" style="${checkstyle.noframes.xslt}"/>

checkstyle-5.0.xml → checkstyle-5.1.xml View File

@@ -175,6 +175,7 @@
<property name="severity" value="warning"/>
<property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, EQUAL, GE, GT, LAND, LCURLY, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN"/>
</module>
<module name="FileContentsHolder"/>
</module>
<module name="RegexpHeader">
<property name="headerFile" value="${samedir}/checkstyle.header"/>
@@ -187,4 +188,17 @@
<module name="FileTabCharacter">
<property name="severity" value="error"/>
</module>
<module name="SuppressionFilter">
<property name="file" value="${samedir}/checkstyle-suppressions.xml"/>
</module>
<module name="SuppressionCommentFilter">
<property name="offCommentFormat" value="CSOFF\: ([\w\|]+)"/>
<property name="onCommentFormat" value="CSON\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
</module>
<module name="SuppressWithNearbyCommentFilter">
<property name="commentFormat" value="CSOK\: ([\w\|]+)"/>
<property name="checkFormat" value="$1"/>
<property name="influenceFormat" value="0"/>
</module>
</module>

+ 7
- 0
checkstyle-suppressions.xml View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
<suppress files="org/apache/fop/fo/FOPropertyMapping.java" checks="FileLengthCheck"/>
<suppress files="org/apache/fop/fonts/truetype/TTFFile.java" checks="FileLengthCheck"/>
<suppress files="org/apache/fop/Version.java" lines="40-50" checks="LineLengthCheck"/>
</suppressions>

+ 1
- 0
src/codegen/java/org/apache/fop/tools/EventProducerCollectorTask.java View File

@@ -117,6 +117,7 @@ public class EventProducerCollectorTask extends Task {

/**
* Updates the translation file with new entries for newly found event producer methods.
* @param modelFile the model file to use
* @throws IOException if an I/O error occurs
*/
protected void updateTranslationFile(File modelFile) throws IOException {

+ 28
- 27
src/codegen/unicode/data/LineBreakPairTable.txt View File

@@ -1,28 +1,29 @@
OP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT
OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^
CL _ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _
QU ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
GL % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
NS _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
EX _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
SY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
IS _ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
PR % ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % %
PO % ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
NU % ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _
AL % ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
ID _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
IN _ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
HY _ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
BA _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
BB % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
B2 _ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _
ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _
CM _ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
WJ % ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
H2 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
H3 _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
JL _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _
JV _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
JT _ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
OP CP CL QU GL NS EX SY IS PR PO NU AL ID IN HY BA BB B2 ZW CM WJ H2 H3 JL JV JT
OP ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ @ ^ ^ ^ ^ ^ ^
CP _ ^ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _
CL _ ^ ^ % % ^ ^ ^ ^ % % % % _ _ % % _ _ ^ # ^ _ _ _ _ _
QU ^ ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
GL % ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
NS _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
EX _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
SY _ ^ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
IS _ ^ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
PR % ^ ^ % % % ^ ^ ^ _ _ % % % _ % % _ _ ^ # ^ % % % % %
PO % ^ ^ % % % ^ ^ ^ _ _ % % _ _ % % _ _ ^ # ^ _ _ _ _ _
NU % ^ ^ % % % ^ ^ ^ % % % % _ % % % _ _ ^ # ^ _ _ _ _ _
AL % ^ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
ID _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
IN _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ % % % _ _ ^ # ^ _ _ _ _ _
HY _ ^ ^ % % % ^ ^ ^ _ _ % _ _ _ % % _ _ ^ # ^ _ _ _ _ _
BA _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ _ ^ # ^ _ _ _ _ _
BB % ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
B2 _ ^ ^ % % % ^ ^ ^ _ _ _ _ _ _ % % _ ^ ^ # ^ _ _ _ _ _
ZW _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ^ _ _ _ _ _ _ _
CM _ ^ ^ % % % ^ ^ ^ _ _ % % _ % % % _ _ ^ # ^ _ _ _ _ _
WJ % ^ ^ % % % ^ ^ ^ % % % % % % % % % % ^ # ^ % % % % %
H2 _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
H3 _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %
JL _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ % % % % _
JV _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ % %
JT _ ^ ^ % % % ^ ^ ^ _ % _ _ _ % % % _ _ ^ # ^ _ _ _ _ %


+ 4
- 4
src/codegen/unicode/java/org/apache/fop/hyphenation/UnicodeClasses.java View File

@@ -51,7 +51,8 @@ import org.apache.fop.util.License;
*/
public final class UnicodeClasses {
public static String UNICODE_DIR = "http://www.unicode.org/Public/UNIDATA/";
/** directory containing unicode properties files */
public static final String UNICODE_DIR = "http://www.unicode.org/Public/UNIDATA/";

/**
* Disallow constructor for this utility class
@@ -77,7 +78,7 @@ public final class UnicodeClasses {
* Generate classes.xml from Java's compiled-in Unicode Character Database
* @param hexcode whether to prefix each class with the hexcode (only for debugging purposes)
* @param outfilePath output file
* @throws IOException
* @throws IOException if an I/O exception occurs
*/
public static void fromJava(boolean hexcode, String outfilePath) throws IOException {
File f = new File(outfilePath);
@@ -160,7 +161,6 @@ public final class UnicodeClasses {
* @param outfilePath output file
* @throws IOException if the input files are not found
* @throws URISyntaxException
* @throws FOPException
*/
public static void fromUCD(boolean hexcode, String unidataPath, String outfilePath)
throws IOException, URISyntaxException {
@@ -286,7 +286,7 @@ public final class UnicodeClasses {
* @param hexcode whether to prefix each class with the hexcode (only for debugging purposes)
* @param lettersPath path to XeTeX's Unicode letters file unicode-letters-XeTeX.tex
* @param outfilePath output file
* @throws IOException
* @throws IOException in case of an I/O exception
*/
public static void fromTeX(boolean hexcode, String lettersPath, String outfilePath)
throws IOException {

+ 51
- 33
src/codegen/unicode/java/org/apache/fop/text/linebreak/GenerateLineBreakUtils.java View File

@@ -33,6 +33,8 @@ import java.util.Map;

import org.apache.fop.util.License;

// CSOFF: LineLengthCheck

/**
* <p>Utility for generating a Java class representing line break properties
* from the Unicode property files.</p>
@@ -46,7 +48,10 @@ import org.apache.fop.util.License;
* </ul>
*
*/
public class GenerateLineBreakUtils {
public final class GenerateLineBreakUtils {

private GenerateLineBreakUtils() {
}

private static final int MAX_LINE_LENGTH = 110;

@@ -57,12 +62,14 @@ public class GenerateLineBreakUtils {
private static final byte PROHIBITED_BREAK = 4; // ^ in table
private static final byte EXPLICIT_BREAK = 5; // ! in rules
private static final String BREAK_CLASS_TOKENS = "_%#@^!";
private static final String notInPairTable[] = { "AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX" };
private static final String[] NOT_IN_PAIR_TABLE = {
"AI", "BK", "CB", "CR", "LF", "NL", "SA", "SG", "SP", "XX"
};

private static final byte lineBreakProperties[] = new byte[0x10000];
private static final Map lineBreakPropertyValues = new HashMap();
private static final List lineBreakPropertyShortNames = new ArrayList();
private static final List lineBreakPropertyLongNames = new ArrayList();
private static byte[] lineBreakProperties = new byte[0x10000];
private static Map lineBreakPropertyValues = new HashMap();
private static List lineBreakPropertyShortNames = new ArrayList();
private static List lineBreakPropertyLongNames = new ArrayList();

/**
* Generate a class managing line break properties for Unicode characters and a sample
@@ -76,7 +83,7 @@ public class GenerateLineBreakUtils {
* @param outFileName Name of the output file.
* @throws Exception in case anything goes wrong.
*/
private static void convertLineBreakProperties(
private static void convertLineBreakProperties( // CSOK: MethodLength
String lineBreakFileName,
String propertyValueFileName,
String breakPairFileName,
@@ -86,21 +93,21 @@ public class GenerateLineBreakUtils {
readLineBreakProperties(lineBreakFileName, propertyValueFileName);
// read break pair table
int lineBreakPropertyValueCount = lineBreakPropertyValues.size();
int tableSize = lineBreakPropertyValueCount - notInPairTable.length;
Map notInPairTableMap = new HashMap(notInPairTable.length);
for (int i = 0; i < notInPairTable.length; i++) {
Object v = lineBreakPropertyValues.get(notInPairTable[i]);
int tableSize = lineBreakPropertyValueCount - NOT_IN_PAIR_TABLE.length;
Map notInPairTableMap = new HashMap(NOT_IN_PAIR_TABLE.length);
for (int i = 0; i < NOT_IN_PAIR_TABLE.length; i++) {
Object v = lineBreakPropertyValues.get(NOT_IN_PAIR_TABLE[i]);
if (v == null) {
throw new Exception("'not in pair table' property not found: " + notInPairTable[i]);
throw new Exception("'not in pair table' property not found: " + NOT_IN_PAIR_TABLE[i]);
}
notInPairTableMap.put(notInPairTable[i], v);
notInPairTableMap.put(NOT_IN_PAIR_TABLE[i], v);
}
byte pairTable[][] = new byte[tableSize][];
byte columnHeader[] = new byte[tableSize];
byte rowHeader[] = new byte[tableSize];
byte columnMap[] = new byte[lineBreakPropertyValueCount + 1];
byte[][] pairTable = new byte[tableSize][];
byte[] columnHeader = new byte[tableSize];
byte[] rowHeader = new byte[tableSize];
byte[] columnMap = new byte[lineBreakPropertyValueCount + 1];
Arrays.fill(columnMap, (byte)255);
byte rowMap[] = new byte[lineBreakPropertyValueCount + 1];
byte[] rowMap = new byte[lineBreakPropertyValueCount + 1];
Arrays.fill(rowMap, (byte)255);
BufferedReader b = new BufferedReader(new FileReader(breakPairFileName));
String line = b.readLine();
@@ -224,7 +231,7 @@ public class GenerateLineBreakUtils {
// generate class
int rowsize = 512;
int blocksize = lineBreakProperties.length / rowsize;
byte row[][] = new byte[rowsize][];
byte[][] row = new byte[rowsize][];
int idx = 0;
StringBuffer doStaticLinkCode = new StringBuffer();
PrintWriter out = new PrintWriter(new FileWriter(outFileName));
@@ -242,8 +249,15 @@ public class GenerateLineBreakUtils {
out.println(" * - commit BOTH changed files");
out.println(" */");
out.println();
out.println("// CSOFF: WhitespaceAfterCheck");
out.println("// CSOFF: LineLengthCheck");
out.println();
out.println("/** Line breaking utilities. */");
out.println("public final class LineBreakUtils {");
out.println();
out.println(" private LineBreakUtils() {");
out.println(" }");
out.println();
out.println(" /** Break class constant */");
out.println(" public static final byte DIRECT_BREAK = " + DIRECT_BREAK + ';');
out.println(" /** Break class constant */");
@@ -257,7 +271,7 @@ public class GenerateLineBreakUtils {
out.println(" /** Break class constant */");
out.println(" public static final byte EXPLICIT_BREAK = " + EXPLICIT_BREAK + ';');
out.println();
out.println(" private static final byte PAIR_TABLE[][] = {");
out.println(" private static final byte[][] PAIR_TABLE = {");
boolean printComma = false;
for (int i = 1; i <= lineBreakPropertyValueCount; i++) {
if (printComma) {
@@ -283,9 +297,9 @@ public class GenerateLineBreakUtils {
}
out.println("};");
out.println();
out.println(" private static byte lineBreakProperties[][] = new byte[" + rowsize + "][];");
out.println(" private static byte[][] lineBreakProperties = new byte[" + rowsize + "][];");
out.println();
out.println(" private static void init_0() {");
out.println(" private static void init0() {");
int rowsPrinted = 0;
int initSections = 0;
for (int i = 0; i < rowsize; i++) {
@@ -315,7 +329,7 @@ public class GenerateLineBreakUtils {
out.println(" }");
out.println();
initSections++;
out.println(" private static void init_" + initSections + "() {");
out.println(" private static void init" + initSections + "() {");
rowsPrinted = 0;
}
row[i] = new byte[blocksize];
@@ -339,7 +353,7 @@ public class GenerateLineBreakUtils {
out.println();
out.println(" static {");
for (int i = 0; i <= initSections; i++) {
out.println(" init_" + i + "();");
out.println(" init" + i + "();");
}
out.print(doStaticLinkCode);
out.println(" }");
@@ -354,7 +368,7 @@ public class GenerateLineBreakUtils {
out.println(';');
}
out.println();
final String shortNamePrefix = " private static String lineBreakPropertyShortNames[] = {";
final String shortNamePrefix = " private static String[] lineBreakPropertyShortNames = {";
out.print(shortNamePrefix);
int lineLength = shortNamePrefix.length();
printComma = false;
@@ -383,7 +397,7 @@ public class GenerateLineBreakUtils {
}
out.println("};");
out.println();
final String longNamePrefix = " private static String lineBreakPropertyLongNames[] = {";
final String longNamePrefix = " private static String[] lineBreakPropertyLongNames = {";
out.print(longNamePrefix);
lineLength = longNamePrefix.length();
printComma = false;
@@ -600,11 +614,11 @@ public class GenerateLineBreakUtils {
for (int i = 0; i < 16; i++) {
int rowsize = 1 << i;
int blocksize = lineBreakProperties.length / (rowsize);
byte row[][] = new byte[rowsize][];
byte[][] row = new byte[rowsize][];
int idx = 0;
int nrOfDistinctBlocks = 0;
for (int j = 0; j < rowsize; j++) {
byte block[] = new byte[blocksize];
byte[] block = new byte[blocksize];
for (int k = 0; k < blocksize; k++) {
block[k] = lineBreakProperties[idx];
idx++;
@@ -638,6 +652,10 @@ public class GenerateLineBreakUtils {
}
}

/**
* Main entry point for running GenerateLineBreakUtils
* @param args array of command line arg
*/
public static void main(String[] args) {
String lineBreakFileName = "http://www.unicode.org/Public/UNIDATA/LineBreak.txt";
String propertyValueFileName = "http://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt";
@@ -650,13 +668,13 @@ public class GenerateLineBreakUtils {
} else {
String opt = args[i];
if ("-l".equals(opt)) {
lineBreakFileName = args[i+1];
lineBreakFileName = args[i + 1];
} else if ("-p".equals(opt)) {
propertyValueFileName = args[i+1];
propertyValueFileName = args[i + 1];
} else if ("-b".equals(opt)) {
breakPairFileName = args[i+1];
} else if("-o".equals(opt)) {
outFileName = args[i+1];
breakPairFileName = args[i + 1];
} else if ("-o".equals(opt)) {
outFileName = args[i + 1];
} else {
ok = false;
}

+ 17
- 14
src/codegen/unicode/java/org/apache/fop/util/License.java View File

@@ -29,10 +29,13 @@ import java.io.Writer;
*/
public final class License {
private License() {
}

/**
* The Apache license text as a string array
*/
public static final String[] license
public static final String[] LICENSE
= {"Licensed to the Apache Software Foundation (ASF) under one or more",
"contributor license agreements. See the NOTICE file distributed with",
"this work for additional information regarding copyright ownership.",
@@ -52,21 +55,21 @@ public final class License {
/**
* The subversion Id keyword line
*/
public static final String id = "$Id$";
public static final String ID = "$Id$";
/**
* Calculate the maximum line length in the Apache license text
* for use in formatting
*/
private static int MAX_LENGTH;
private static int maxLength;
static {
int j = 0;
for (int i = 0; i < license.length; ++i) {
if (j < license[i].length()) {
j = license[i].length();
for (int i = 0; i < LICENSE.length; ++i) {
if (j < LICENSE[i].length()) {
j = LICENSE[i].length();
}
}
MAX_LENGTH = j;
maxLength = j;
}

/**
@@ -76,16 +79,16 @@ public final class License {
*/
public static void writeJavaLicenseId(Writer w) throws IOException {
w.write("/*\n");
for (int i = 0; i < license.length; ++i) {
if (license[i].equals("")) {
for (int i = 0; i < LICENSE.length; ++i) {
if (LICENSE[i].equals("")) {
w.write(" *\n");
} else {
w.write(" * " + license[i] + "\n");
w.write(" * " + LICENSE[i] + "\n");
}
}
w.write(" */\n");
w.write("\n");
w.write("/* " + id + " */\n");
w.write("/* " + ID + " */\n");
}

/**
@@ -94,11 +97,11 @@ public final class License {
* @throws IOException if the write operation fails
*/
public static void writeXMLLicenseId(Writer w) throws IOException {
for (int i = 0; i < license.length; ++i) {
w.write(String.format("<!-- %-" + MAX_LENGTH + "s -->\n", new Object[] {license[i]}));
for (int i = 0; i < LICENSE.length; ++i) {
w.write(String.format("<!-- %-" + maxLength + "s -->\n", new Object[] {LICENSE[i]}));
}
w.write("\n");
w.write("<!-- " + id + " -->\n");
w.write("<!-- " + ID + " -->\n");
}
/**

+ 4
- 1
src/java/org/apache/fop/ResourceEventProducer.java View File

@@ -39,7 +39,10 @@ public interface ResourceEventProducer extends EventProducer {
/**
* Provider class for the event producer.
*/
class Provider {
final class Provider {

private Provider() {
}

/**
* Returns an event producer.

+ 53
- 44
src/java/org/apache/fop/afp/AFPBorderPainter.java View File

@@ -40,7 +40,7 @@ public class AFPBorderPainter extends AbstractAFPPainter {
}

/** {@inheritDoc} */
public void paint(PaintingInfo paintInfo) {
public void paint(PaintingInfo paintInfo) { // CSOK: MethodLength
BorderPaintingInfo borderPaintInfo = (BorderPaintingInfo)paintInfo;
float w = borderPaintInfo.getX2() - borderPaintInfo.getX1();
float h = borderPaintInfo.getY2() - borderPaintInfo.getY1();
@@ -60,6 +60,7 @@ public class AFPBorderPainter extends AbstractAFPPainter {
float y2 = unitConv.pt2units(borderPaintInfo.getY2());

switch (paintingState.getRotation()) {
default:
case 0:
x1 += at.getTranslateX();
y1 += at.getTranslateY();
@@ -89,8 +90,8 @@ public class AFPBorderPainter extends AbstractAFPPainter {
AFPLineDataInfo lineDataInfo = new AFPLineDataInfo();
lineDataInfo.setColor(borderPaintInfo.getColor());
lineDataInfo.setRotation(paintingState.getRotation());
lineDataInfo.x1 = Math.round(x1);
lineDataInfo.y1 = Math.round(y1);
lineDataInfo.setX1 ( Math.round(x1) );
lineDataInfo.setY1 ( Math.round(y1) );
float thickness;
if (borderPaintInfo.isHorizontal()) {
thickness = y2 - y1;
@@ -105,83 +106,91 @@ public class AFPBorderPainter extends AbstractAFPPainter {
int thickness3 = (int)Math.floor(thickness / 3f);
lineDataInfo.setThickness(thickness3);
if (borderPaintInfo.isHorizontal()) {
lineDataInfo.x2 = Math.round(x2);
lineDataInfo.y2 = lineDataInfo.y1;
lineDataInfo.setX2 ( Math.round(x2) );
lineDataInfo.setY2 ( lineDataInfo.getY1() );
dataStream.createLine(lineDataInfo);
int distance = thickness3 * 2;
lineDataInfo = new AFPLineDataInfo(lineDataInfo);
lineDataInfo.y1 += distance;
lineDataInfo.y2 += distance;
lineDataInfo.setY1 ( lineDataInfo.getY1() + distance );
lineDataInfo.setY2 ( lineDataInfo.getY2() + distance );
dataStream.createLine(lineDataInfo);
} else {
lineDataInfo.x2 = lineDataInfo.x1;
lineDataInfo.y2 = Math.round(y2);
lineDataInfo.setX2 ( lineDataInfo.getX1() );
lineDataInfo.setY2 ( Math.round(y2) );
dataStream.createLine(lineDataInfo);
int distance = thickness3 * 2;
lineDataInfo = new AFPLineDataInfo(lineDataInfo);
lineDataInfo.x1 += distance;
lineDataInfo.x2 += distance;
lineDataInfo.setX1 ( lineDataInfo.getX1() + distance );
lineDataInfo.setX2 ( lineDataInfo.getX2() + distance );
dataStream.createLine(lineDataInfo);
}
break;
case Constants.EN_DASHED:
int thick = lineDataInfo.thickness * 3;
int thick = lineDataInfo.getThickness() * 3;
if (borderPaintInfo.isHorizontal()) {
lineDataInfo.x2 = lineDataInfo.x1 + thick;
lineDataInfo.y2 = lineDataInfo.y1;
lineDataInfo.setX2 ( lineDataInfo.getX1() + thick );
lineDataInfo.setY2 ( lineDataInfo.getY1() );
int ex2 = Math.round(x2);
while (lineDataInfo.x1 + thick < ex2) {
while (lineDataInfo.getX1() + thick < ex2) {
dataStream.createLine(lineDataInfo);
lineDataInfo.x1 += 2 * thick;
lineDataInfo.x2 = lineDataInfo.x1 + thick;
lineDataInfo.setX1 ( lineDataInfo.getX1() + 2 * thick );
lineDataInfo.setX2 ( lineDataInfo.getX1() + thick );
}
} else {
lineDataInfo.x2 = lineDataInfo.x1;
lineDataInfo.y2 = lineDataInfo.y1 + thick;
lineDataInfo.setX2 ( lineDataInfo.getX1() );
lineDataInfo.setY2 ( lineDataInfo.getY1() + thick );
int ey2 = Math.round(y2);
while (lineDataInfo.y1 + thick < ey2) {
while (lineDataInfo.getY1() + thick < ey2) {
dataStream.createLine(lineDataInfo);
lineDataInfo.y1 += 2 * thick;
lineDataInfo.y2 = lineDataInfo.y1 + thick;
lineDataInfo.setY1 ( lineDataInfo.getY1() + 2 * thick );
lineDataInfo.setY2 ( lineDataInfo.getY1() + thick );
}
}
break;
case Constants.EN_DOTTED:
if (borderPaintInfo.isHorizontal()) {
lineDataInfo.x2 = lineDataInfo.x1 + lineDataInfo.thickness;
lineDataInfo.y2 = lineDataInfo.y1;
lineDataInfo.setX2 ( lineDataInfo.getX1() + lineDataInfo.getThickness() );
lineDataInfo.setY2 ( lineDataInfo.getY1() );
int ex2 = Math.round(x2);
while (lineDataInfo.x1 + lineDataInfo.thickness < ex2) {
while (lineDataInfo.getX1() + lineDataInfo.getThickness() < ex2) {
dataStream.createLine(lineDataInfo);
lineDataInfo.x1 += 3 * lineDataInfo.thickness;
lineDataInfo.x2 = lineDataInfo.x1 + lineDataInfo.thickness;
lineDataInfo.setX1 ( lineDataInfo.getX1() + 3 * lineDataInfo.getThickness() );
lineDataInfo.setX2 ( lineDataInfo.getX1() + lineDataInfo.getThickness() );
}
} else {
lineDataInfo.x2 = lineDataInfo.x1;
lineDataInfo.y2 = lineDataInfo.y1 + lineDataInfo.thickness;
lineDataInfo.setX2 ( lineDataInfo.getX1() );
lineDataInfo.setY2 ( lineDataInfo.getY1() + lineDataInfo.getThickness() );
int ey2 = Math.round(y2);
while (lineDataInfo.y1 + lineDataInfo.thickness < ey2) {
while (lineDataInfo.getY1() + lineDataInfo.getThickness() < ey2) {
dataStream.createLine(lineDataInfo);
lineDataInfo.y1 += 3 * lineDataInfo.thickness;
lineDataInfo.y2 = lineDataInfo.y1 + lineDataInfo.thickness;
lineDataInfo.setY1 ( lineDataInfo.getY1() + 3 * lineDataInfo.getThickness() );
lineDataInfo.setY2 ( lineDataInfo.getY1() + lineDataInfo.getThickness() );
}
}
break;
case Constants.EN_GROOVE:
case Constants.EN_RIDGE:
//TODO
lineDataInfo.x2 = Math.round(x2);
int yNew;
lineDataInfo.setX2 ( Math.round(x2) );
float colFactor = (borderPaintInfo.getStyle() == Constants.EN_GROOVE ? 0.4f : -0.4f);
float h3 = (y2 - y1) / 3;
lineDataInfo.color = ColorUtil.lightenColor(borderPaintInfo.getColor(), -colFactor);
lineDataInfo.thickness = Math.round(h3);
lineDataInfo.y1 = lineDataInfo.y2 = Math.round(y1);
lineDataInfo.setColor
( ColorUtil.lightenColor(borderPaintInfo.getColor(), -colFactor) );
lineDataInfo.setThickness ( Math.round(h3) );
yNew = Math.round(y1);
lineDataInfo.setY1 ( yNew );
lineDataInfo.setY2 ( yNew );
dataStream.createLine(lineDataInfo);
lineDataInfo.color = borderPaintInfo.getColor();
lineDataInfo.y1 = lineDataInfo.y2 = Math.round(y1 + h3);
lineDataInfo.setColor ( borderPaintInfo.getColor() );
yNew = Math.round(y1 + h3);
lineDataInfo.setY1 ( yNew );
lineDataInfo.setY2 ( yNew );
dataStream.createLine(lineDataInfo);
lineDataInfo.color = ColorUtil.lightenColor(borderPaintInfo.getColor(), colFactor);
lineDataInfo.y1 = lineDataInfo.y2 = Math.round(y1 + h3 + h3);
lineDataInfo.setColor ( ColorUtil.lightenColor(borderPaintInfo.getColor(), colFactor) );
yNew = Math.round(y1 + h3 + h3);
lineDataInfo.setY1 ( yNew );
lineDataInfo.setY2 ( yNew );
dataStream.createLine(lineDataInfo);
break;
case Constants.EN_HIDDEN:
@@ -191,11 +200,11 @@ public class AFPBorderPainter extends AbstractAFPPainter {
case Constants.EN_SOLID:
default:
if (borderPaintInfo.isHorizontal()) {
lineDataInfo.x2 = Math.round(x2);
lineDataInfo.y2 = lineDataInfo.y1;
lineDataInfo.setX2 ( Math.round(x2) );
lineDataInfo.setY2 ( lineDataInfo.getY1() );
} else {
lineDataInfo.x2 = lineDataInfo.x1;
lineDataInfo.y2 = Math.round(y2);
lineDataInfo.setX2 ( lineDataInfo.getX1() );
lineDataInfo.setY2 ( Math.round(y2) );
}
dataStream.createLine(lineDataInfo);
}

+ 4
- 3
src/java/org/apache/fop/afp/AFPDataObjectInfo.java View File

@@ -29,7 +29,8 @@ import org.apache.fop.afp.modca.triplets.MappingOptionTriplet;
* A list of parameters associated with an AFP data objects
*/
public class AFPDataObjectInfo {
private static final Log log = LogFactory.getLog("org.apache.xmlgraphics.afp");
private static final Log log // CSOK: ConstantName
= LogFactory.getLog("org.apache.xmlgraphics.afp");

/** the object area info */
private AFPObjectAreaInfo objectAreaInfo;
@@ -197,9 +198,9 @@ public class AFPDataObjectInfo {
}

/**
* Sets the data width resolution
* Sets the data height resolution
*
* @param dataWidthRes the data width resolution
* @param dataHeightRes the data height resolution
*/
public void setDataHeightRes(int dataHeightRes) {
this.dataHeightRes = dataHeightRes;

+ 4
- 1
src/java/org/apache/fop/afp/AFPEventProducer.java View File

@@ -28,7 +28,10 @@ import org.apache.fop.events.EventProducer;
public interface AFPEventProducer extends EventProducer {

/** Provider class for the event producer. */
class Provider {
static final class Provider {

private Provider() {
}

/**
* Returns an event producer.

+ 1
- 1
src/java/org/apache/fop/afp/AFPGraphics2D.java View File

@@ -75,7 +75,7 @@ import org.apache.fop.svg.NativeImageHandler;
*/
public class AFPGraphics2D extends AbstractGraphics2D implements NativeImageHandler {

private static final Log log = LogFactory.getLog(AFPGraphics2D.class);
private static final Log log = LogFactory.getLog(AFPGraphics2D.class); // CSOK: ConstantName

private static final int X = 0;


+ 7
- 7
src/java/org/apache/fop/afp/AFPLineDataInfo.java View File

@@ -25,25 +25,25 @@ import java.awt.Color;
public class AFPLineDataInfo {

/** the x1 coordinate */
int x1;
private int x1;

/** the y1 coordinate */
int y1;
private int y1;

/** the x2 coordinate */
int x2;
private int x2;

/** the y2 coordinate */
int y2;
private int y2;

/** the thickness */
int thickness;
private int thickness;

/** the painting color */
Color color;
private Color color;

/** the rotation */
int rotation = 0;
private int rotation = 0;

/**
* Default constructor

+ 26
- 17
src/java/org/apache/fop/afp/AFPRectanglePainter.java View File

@@ -42,6 +42,7 @@ public class AFPRectanglePainter extends AbstractAFPPainter {
RectanglePaintingInfo rectanglePaintInfo = (RectanglePaintingInfo)paintInfo;
int pageWidth = dataStream.getCurrentPage().getWidth();
int pageHeight = dataStream.getCurrentPage().getHeight();
int yNew;

AFPUnitConverter unitConv = paintingState.getUnitConverter();
float width = unitConv.pt2units(rectanglePaintInfo.getWidth());
@@ -52,31 +53,39 @@ public class AFPRectanglePainter extends AbstractAFPPainter {
AffineTransform at = paintingState.getData().getTransform();

AFPLineDataInfo lineDataInfo = new AFPLineDataInfo();
lineDataInfo.color = paintingState.getColor();
lineDataInfo.rotation = paintingState.getRotation();
lineDataInfo.thickness = Math.round(height);
lineDataInfo.setColor ( paintingState.getColor() );
lineDataInfo.setRotation ( paintingState.getRotation() );
lineDataInfo.setThickness ( Math.round(height) );

switch (lineDataInfo.rotation) {
switch (lineDataInfo.getRotation()) {
default:
case 0:
lineDataInfo.x1 = Math.round((float)at.getTranslateX() + x);
lineDataInfo.y1 = lineDataInfo.y2 = Math.round((float)at.getTranslateY() + y);
lineDataInfo.x2 = Math.round((float)at.getTranslateX() + x + width);
lineDataInfo.setX1 ( Math.round((float)at.getTranslateX() + x) );
yNew = Math.round((float)at.getTranslateY() + y);
lineDataInfo.setY1 ( yNew );
lineDataInfo.setY2 ( yNew );
lineDataInfo.setX2 ( Math.round((float)at.getTranslateX() + x + width) );
break;
case 90:
lineDataInfo.x1 = Math.round((float)at.getTranslateY() + x);
lineDataInfo.y1 = lineDataInfo.y2
= pageWidth - Math.round((float)at.getTranslateX()) + Math.round(y);
lineDataInfo.x2 = Math.round(width + (float)at.getTranslateY() + x);
lineDataInfo.setX1 ( Math.round((float)at.getTranslateY() + x) );
yNew = pageWidth - Math.round((float)at.getTranslateX()) + Math.round(y);
lineDataInfo.setY1 ( yNew );
lineDataInfo.setY2 ( yNew );
lineDataInfo.setX2 ( Math.round(width + (float)at.getTranslateY() + x) );
break;
case 180:
lineDataInfo.x1 = pageWidth - Math.round((float)at.getTranslateX() - x);
lineDataInfo.y1 = lineDataInfo.y2 = pageHeight - Math.round((float)at.getTranslateY() - y);
lineDataInfo.x2 = pageWidth - Math.round((float)at.getTranslateX() - x - width);
lineDataInfo.setX1 ( pageWidth - Math.round((float)at.getTranslateX() - x) );
yNew = pageHeight - Math.round((float)at.getTranslateY() - y);
lineDataInfo.setY1 ( yNew );
lineDataInfo.setY2 ( yNew );
lineDataInfo.setX2 ( pageWidth - Math.round((float)at.getTranslateX() - x - width) );
break;
case 270:
lineDataInfo.x1 = pageHeight - Math.round((float)at.getTranslateY() - x);
lineDataInfo.y1 = lineDataInfo.y2 = Math.round((float)at.getTranslateX() + y);
lineDataInfo.x2 = pageHeight - Math.round((float)at.getTranslateY() - x - width);
lineDataInfo.setX1 ( pageHeight - Math.round((float)at.getTranslateY() - x) );
yNew = Math.round((float)at.getTranslateX() + y);
lineDataInfo.setY1 ( yNew );
lineDataInfo.setY2 ( yNew );
lineDataInfo.setX2 ( pageHeight - Math.round((float)at.getTranslateY() - x - width) );
break;
}
dataStream.createLine(lineDataInfo);

+ 1
- 1
src/java/org/apache/fop/afp/AFPStreamer.java View File

@@ -39,7 +39,7 @@ import org.apache.fop.afp.modca.StreamedResourceGroup;
*/
public class AFPStreamer implements Streamable {
/** Static logging instance */
private static final Log log = LogFactory.getLog(AFPStreamer.class);
private static final Log log = LogFactory.getLog(AFPStreamer.class); // CSOK: ConstantName

private static final String AFPDATASTREAM_TEMP_FILE_PREFIX = "AFPDataStream_";


+ 2
- 0
src/java/org/apache/fop/afp/AbstractAFPPainter.java View File

@@ -32,7 +32,9 @@ public abstract class AbstractAFPPainter {
/** Static logging instance */
protected static Log log = LogFactory.getLog("org.apache.xmlgraphics.afp");

/** data stream */
protected final DataStream dataStream;
/** painting state */
protected final AFPPaintingState paintingState;

/**

+ 5
- 3
src/java/org/apache/fop/afp/DataStream.java View File

@@ -65,7 +65,8 @@ import org.apache.fop.fonts.Font;
public class DataStream {

/** Static logging instance */
protected static final Log log = LogFactory.getLog("org.apache.xmlgraphics.afp");
protected static final Log log // CSOK: ConstantName
= LogFactory.getLog("org.apache.xmlgraphics.afp");

/** Boolean completion indicator */
private boolean complete = false;
@@ -359,8 +360,9 @@ public class DataStream {
* @param charSet is the AFP Character Set to use with the text
* @throws UnsupportedEncodingException thrown if character encoding is not supported
*/
public void createText(final AFPTextDataInfo textDataInfo, final int letterSpacing, final int wordSpacing,
final Font font, final CharacterSet charSet) throws UnsupportedEncodingException {
public void createText
( final AFPTextDataInfo textDataInfo, final int letterSpacing, final int wordSpacing,
final Font font, final CharacterSet charSet) throws UnsupportedEncodingException {
int rotation = paintingState.getRotation();
if (rotation != 0) {
textDataInfo.setRotation(rotation);

+ 5
- 2
src/java/org/apache/fop/afp/Factory.java View File

@@ -66,7 +66,7 @@ import org.apache.fop.afp.util.StringUtils;
public class Factory {

/** Static logging instance */
private static final Log log = LogFactory.getLog(Factory.class);
private static final Log log = LogFactory.getLog(Factory.class); // CSOK: ConstantName

private static final String OBJECT_ENVIRONMENT_GROUP_NAME_PREFIX = "OEG";

@@ -541,7 +541,10 @@ public class Factory {

/**
* Creates a new PTOCA {@link PresentationTextDescriptor}
*
* @param width presentation width
* @param height presentation height
* @param widthRes resolution of presentation width
* @param heightRes resolution of presentation height
* @return a new {@link PresentationTextDescriptor}
*/
public PresentationTextDescriptor createPresentationTextDataDescriptor(

+ 1
- 1
src/java/org/apache/fop/afp/Startable.java View File

@@ -27,7 +27,7 @@ public interface Startable {
/**
* Sets whether or not this object has started or not
*
* @param complete true if this object has started
* @param started true if this object has started
*/
void setStarted(boolean started);


+ 2
- 1
src/java/org/apache/fop/afp/fonts/CharacterSet.java View File

@@ -102,7 +102,8 @@ public class CharacterSet {
* @param encoding the encoding of the font
* @param name the character set name
* @param path the path to the installed afp fonts
* @deprecated Please use {@link #CharacterSet(String, String, String, URI)} instead.
* @deprecated Please use
* {@link #CharacterSet(String, String, String, ResourceAccessor)} instead.
*/
public CharacterSet(String codePage, String encoding, String name, String path) {
this(codePage, encoding, name,

+ 3
- 2
src/java/org/apache/fop/afp/fonts/CharacterSetBuilder.java View File

@@ -114,8 +114,9 @@ public class CharacterSetBuilder {
*/
private final SoftMapCache characterSetsCache = new SoftMapCache(true);


private CharacterSetBuilder() { }
/** Default constructor. */
protected CharacterSetBuilder() {
}

/**
* Factory method for the single-byte implementation of AFPFontReader.

+ 2
- 2
src/java/org/apache/fop/afp/fonts/CharacterSetOrientation.java View File

@@ -279,7 +279,7 @@ public class CharacterSetOrientation {
* Returns the space increment.
* @return the space increment
*/
public int getSpaceIncrement(){
public int getSpaceIncrement() {
return this.spaceIncrement;
}

@@ -295,7 +295,7 @@ public class CharacterSetOrientation {
* Returns the em space increment.
* @return the em space increment
*/
public int getEmSpaceIncrement(){
public int getEmSpaceIncrement() {
return this.emSpaceIncrement;
}


+ 1
- 1
src/java/org/apache/fop/afp/fonts/DoubleByteFont.java View File

@@ -36,7 +36,7 @@ public class DoubleByteFont extends AbstractOutlineFont {
private static final Set IDEOGRAPHIC = new java.util.HashSet();
static {
IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS);
//IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT); //Java 1.5
//IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS_SUPPLEMENT);//Java 1.5
IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS);
IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A);
//IDEOGRAPHIC.add(Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B); //Java 1.1

+ 5
- 1
src/java/org/apache/fop/afp/fonts/OutlineFont.java View File

@@ -24,7 +24,11 @@ package org.apache.fop.afp.fonts;
*/
public class OutlineFont extends AbstractOutlineFont {

/** {@inheritDoc} */
/**
* Construct outline font with specified name and character set.
* @param name font's name
* @param charSet font's character set
*/
public OutlineFont(String name, CharacterSet charSet) {
super(name, charSet);
}

+ 2
- 1
src/java/org/apache/fop/afp/fonts/RasterFont.java View File

@@ -37,7 +37,8 @@ import org.apache.commons.logging.LogFactory;
public class RasterFont extends AFPFont {

/** Static logging instance */
protected static final Log log = LogFactory.getLog("org.apache.fop.afp.fonts");
protected static final Log log // CSOK: ConstantName
= LogFactory.getLog("org.apache.fop.afp.fonts");

private final SortedMap/*<Integer,CharacterSet>*/ charSets
= new java.util.TreeMap/*<Integer,CharacterSet>*/();

+ 2
- 1
src/java/org/apache/fop/afp/goca/AbstractGraphicsCoord.java View File

@@ -32,6 +32,7 @@ public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder
/** array of x/y coordinates */
protected int[] coords = null;

/** if true, then uses relative drawing order */
protected boolean relative = false;

/**
@@ -51,7 +52,7 @@ public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder
* Constructor
*
* @param coords the x/y coordinates for this object
* @param relative
* @param relative true if relative drawing order
*/
public AbstractGraphicsCoord(int[] coords, boolean relative) {
this(coords);

+ 0
- 2
src/java/org/apache/fop/afp/goca/GraphicsCharacterString.java View File

@@ -52,8 +52,6 @@ public class GraphicsCharacterString extends AbstractGraphicsCoord {
* Constructor (relative positioning)
*
* @param str the character string
* @param x the x coordinate
* @param y the y coordinate
*/
public GraphicsCharacterString(String str) {
super(null);

+ 1
- 0
src/java/org/apache/fop/afp/goca/GraphicsFillet.java View File

@@ -29,6 +29,7 @@ public final class GraphicsFillet extends AbstractGraphicsCoord {
* Constructor
*
* @param coords the x/y coordinates for this object
* @param relative true if uses relative drawing order
*/
public GraphicsFillet(int[] coords, boolean relative) {
super(coords, relative);

+ 3
- 0
src/java/org/apache/fop/afp/goca/GraphicsSetMix.java View File

@@ -27,7 +27,10 @@ import java.io.OutputStream;
*/
public class GraphicsSetMix extends AbstractGraphicsDrawingOrder {

/** default mode */
public static final byte MODE_DEFAULT = 0x00;

/** overpaint mode */
public static final byte MODE_OVERPAINT = 0x02;

/** the mix mode value */

+ 1
- 1
src/java/org/apache/fop/afp/goca/GraphicsSetPatternSymbol.java View File

@@ -84,7 +84,7 @@ public class GraphicsSetPatternSymbol extends AbstractGraphicsDrawingOrder {
/**
* Main constructor
*
* @param symb the pattern symbol to use
* @param pattern the pattern symbol to use
*/
public GraphicsSetPatternSymbol(byte pattern) {
this.pattern = pattern;

+ 3
- 3
src/java/org/apache/fop/afp/ioca/IDEStructureParameter.java View File

@@ -85,9 +85,9 @@ public class IDEStructureParameter implements Streamable {
}

/**
* Sets
* @param numComponents
* @param bitsPerComponent
* Sets uniform bits per component.
* @param numComponents the number of components
* @param bitsPerComponent number of bits per component
*/
public void setUniformBitsPerComponent(int numComponents, int bitsPerComponent) {
if (bitsPerComponent < 0 || bitsPerComponent >= 256) {

+ 4
- 1
src/java/org/apache/fop/afp/ioca/ImageRasterPattern.java View File

@@ -26,7 +26,10 @@ package org.apache.fop.afp.ioca;
* shades of grey (betweeen 0 and 16) the lower the number being the
* darker the shade. The image data dimensions are 64 x 8.
*/
public class ImageRasterPattern {
public final class ImageRasterPattern {

private ImageRasterPattern() {
}

/**
* The Raster Pattern for Greyscale 16

+ 5
- 2
src/java/org/apache/fop/afp/modca/AbstractAFPObject.java View File

@@ -38,11 +38,13 @@ import org.apache.fop.afp.util.BinaryUtils;
public abstract class AbstractAFPObject implements Streamable {

/** Static logging instance */
protected static final Log log = LogFactory.getLog("org.apache.xmlgraphics.afp.modca");
protected static final Log log // CSOK: ConstantName
= LogFactory.getLog("org.apache.xmlgraphics.afp.modca");

/** the structured field class id */
protected static final byte SF_CLASS = (byte)0xD3;

/** the structure field header */
protected static final byte[] SF_HEADER = new byte[] {
0x5A, // Structured field identifier
0x00, // Length byte 1
@@ -187,7 +189,8 @@ public abstract class AbstractAFPObject implements Streamable {
protected String truncate(String str, int maxLength) {
if (str.length() > maxLength) {
str = str.substring(0, maxLength);
log.warn("truncated character string '" + str + "', longer than " + maxLength + " chars");
log.warn("truncated character string '"
+ str + "', longer than " + maxLength + " chars");
}
return str;
}

+ 5
- 0
src/java/org/apache/fop/afp/modca/AbstractEnvironmentGroup.java View File

@@ -88,6 +88,11 @@ public abstract class AbstractEnvironmentGroup extends AbstractNamedAFPObject {
return (MapPageOverlay)getLastElement(this.mapPageOverlays);
}

/**
* Get last element.
* @param list of elements
* @return last element or null if none
*/
protected Object getLastElement(List list) {
if (list != null && list.size() > 0) {
return list.get(list.size() - 1);

+ 2
- 2
src/java/org/apache/fop/afp/modca/AbstractPageObject.java View File

@@ -166,8 +166,7 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject implemen
* Helper method to create text on the current page, this method delegates
* to the presentation text object in order to construct the text.
*
* @param textDataInfo
* the afp text data
* @param producer the producer
* @throws UnsupportedEncodingException thrown if character encoding is not supported
*/
public void createText(PtocaProducer producer) throws UnsupportedEncodingException {
@@ -258,6 +257,7 @@ public abstract class AbstractPageObject extends AbstractNamedAFPObject implemen
* the x coordinate of the page segment.
* @param y
* the y coordinate of the page segment.
* @param hard true if hard page segment possible
*/
public void createIncludePageSegment(String name, int x, int y, boolean hard) {
IncludePageSegment ips = factory.createIncludePageSegment(name, x, y);

+ 4
- 0
src/java/org/apache/fop/afp/modca/ActiveEnvironmentGroup.java View File

@@ -205,6 +205,10 @@ public final class ActiveEnvironmentGroup extends AbstractEnvironmentGroup {
}
}

/**
* Add map page segment.
* @param name of segment to add
*/
public void addMapPageSegment(String name) {
try {
needMapPageSegment().addPageSegment(name);

+ 6
- 2
src/java/org/apache/fop/afp/modca/GraphicsObject.java View File

@@ -98,7 +98,7 @@ public class GraphicsObject extends AbstractDataObject {
getObjectEnvironmentGroup().setDataDescriptor(graphicsDataDescriptor);
}

/** {@inheritDoc} */
/** @param object the structured data */
public void addObject(StructuredData object) {
if (currentData == null) {
newData();
@@ -385,7 +385,11 @@ public class GraphicsObject extends AbstractDataObject {
}

/** the internal graphics state */
private static class GraphicsState {
private static final class GraphicsState {
private GraphicsState() {
}

/** the current color */
private Color color;


+ 3
- 0
src/java/org/apache/fop/afp/modca/ImageDataDescriptor.java View File

@@ -29,8 +29,11 @@ import org.apache.fop.afp.util.BinaryUtils;
*/
public class ImageDataDescriptor extends AbstractDescriptor {

/** function set fs10 */
public static final byte FUNCTION_SET_FS10 = 0x0A;
/** function set fs11 */
public static final byte FUNCTION_SET_FS11 = 0x0B;
/** function set fs45 */
public static final byte FUNCTION_SET_FS45 = 45;

private byte functionSet = FUNCTION_SET_FS11; // FCNSET = IOCA FS 11

+ 3
- 2
src/java/org/apache/fop/afp/modca/IncludeObject.java View File

@@ -116,8 +116,9 @@ public class IncludeObject extends AbstractNamedAFPObject {

/**
* Sets the x and y offset of the content area to the object area
* used in conjunction with the {@link MappingOptionTriplet.POSITION} and
* {@link MappingOptionTriplet.POSITION_AND_TRIM}.
* used in conjunction with the
* {@link MappingOptionTriplet#POSITION} and
* {@link MappingOptionTriplet#POSITION_AND_TRIM}.
*
* @param x the X-axis origin defined in the object
* @param y the Y-axis origin defined in the object

+ 4
- 1
src/java/org/apache/fop/afp/modca/MapCodedFont.java View File

@@ -264,7 +264,10 @@ public class MapCodedFont extends AbstractStructuredObject {
/**
* Private utility class used as a container for font attributes
*/
private class FontDefinition {
private static final class FontDefinition {

private FontDefinition() {
}

/**
* The code page of the font

+ 2
- 2
src/java/org/apache/fop/afp/modca/ObjectContainer.java View File

@@ -113,9 +113,9 @@ public class ObjectContainer extends AbstractDataObject {
}

/**
* Sets the inputstream for the the object container data
* Sets the data for the the object container
*
* @param inputStream the inputstream for the object container data
* @param data a byte array
*/
public void setData(byte[] data) {
this.data = data;

+ 1
- 0
src/java/org/apache/fop/afp/modca/PageGroup.java View File

@@ -100,6 +100,7 @@ public class PageGroup extends AbstractResourceEnvironmentGroupContainer {
return this.getName();
}

/** @return the TLE sequence number */
public int getTleSequence() {
return tleSequence;
}

+ 4
- 0
src/java/org/apache/fop/afp/modca/PreprocessPresentationObject.java View File

@@ -60,9 +60,13 @@ public class PreprocessPresentationObject extends AbstractTripletStructuredObjec
}
}

/** 0 degrees orientation */
public static final byte ORIENTATION_ZERO_DEGREES = 1;
/** 90 degrees orientation */
public static final byte ORIENTATION_90_DEGREES = 2;
/** 180 degrees orientation */
public static final byte ORIENTATION_180_DEGREES = 4;
/** 270 degrees orientation */
public static final byte ORIENTATION_270_DEGREES = 8;

/**

+ 5
- 0
src/java/org/apache/fop/afp/modca/triplets/CommentTriplet.java View File

@@ -31,6 +31,11 @@ public class CommentTriplet extends AbstractTriplet {

private final String commentString;

/**
* Construct a triplet.
* @param id the triplet identification number
* @param commentString a comment
*/
public CommentTriplet(byte id, String commentString) {
super(id);
this.commentString = commentString;

+ 2
- 1
src/java/org/apache/fop/afp/modca/triplets/ObjectClassificationTriplet.java View File

@@ -182,7 +182,8 @@ public class ObjectClassificationTriplet extends AbstractTriplet {
data[5] = 0x00; // reserved (must be zero)

// StrucFlgs - Information on the structure of the object container
byte[] structureFlagsBytes = getStructureFlagsAsBytes(dataInContainer, containerHasOEG, dataInOCD);
byte[] structureFlagsBytes
= getStructureFlagsAsBytes(dataInContainer, containerHasOEG, dataInOCD);
data[6] = structureFlagsBytes[0];
data[7] = structureFlagsBytes[1];


+ 60
- 1
src/java/org/apache/fop/afp/modca/triplets/Triplet.java View File

@@ -22,64 +22,123 @@ package org.apache.fop.afp.modca.triplets;
import org.apache.fop.afp.Streamable;
import org.apache.fop.afp.StructuredData;

/**
* Triplet interface.
*/
public interface Triplet extends Streamable, StructuredData {

/** maximum length */
int MAX_LENGTH = 254;

/** CODED_GRAPHIC_CHARACTER_SET_GLOBAL_IDENTIFIER identifier */
byte CODED_GRAPHIC_CHARACTER_SET_GLOBAL_IDENTIFIER = 0x01;

/** Triplet identifiers */
/** FULLY_QUALIFIED_NAME triplet identifier */
byte FULLY_QUALIFIED_NAME = 0x02;
/** MAPPING_OPTION triplet identifier */
byte MAPPING_OPTION = 0x04;
/** OBJECT_CLASSIFICATION triplet identifier */
byte OBJECT_CLASSIFICATION = 0x10;
/** MODCA_INTERCHANGE_SET triplet identifier */
byte MODCA_INTERCHANGE_SET = 0x18;
/** FONT_DESCRIPTOR_SPECIFICATION triplet identifier */
byte FONT_DESCRIPTOR_SPECIFICATION = 0x1F;
/** OBJECT_FUNCTION_SET_SPECIFICATION triplet identifier */
byte OBJECT_FUNCTION_SET_SPECIFICATION = 0x21;
/** EXTENDED_RESOURCE_LOCAL_IDENTIFIER triplet identifier */
byte EXTENDED_RESOURCE_LOCAL_IDENTIFIER = 0x22;
/** RESOURCE_LOCAL_IDENTIFIER triplet identifier */
byte RESOURCE_LOCAL_IDENTIFIER = 0x24;
/** RESOURCE_SECTION_NUMBER triplet identifier */
byte RESOURCE_SECTION_NUMBER = 0x25;
/** CHARACTER_ROTATION triplet identifier */
byte CHARACTER_ROTATION = 0x26;
/** OBJECT_BYTE_OFFSET triplet identifier */
byte OBJECT_BYTE_OFFSET = 0x2D;
/** ATTRIBUTE_VALUE triplet identifier */
byte ATTRIBUTE_VALUE = 0x36;
/** DESCRIPTOR_POSITION triplet identifier */
byte DESCRIPTOR_POSITION = 0x43;
/** MEDIA_EJECT_CONTROL triplet identifier */
byte MEDIA_EJECT_CONTROL = 0x45;
/** PAGE_OVERLAY_CONDITIONAL_PROCESSING triplet identifier */
byte PAGE_OVERLAY_CONDITIONAL_PROCESSING = 0x46;
/** RESOURCE_USAGE_ATTRIBUTE triplet identifier */
byte RESOURCE_USAGE_ATTRIBUTE = 0x47;
/** MEASUREMENT_UNITS triplet identifier */
byte MEASUREMENT_UNITS = 0x4B;
/** OBJECT_AREA_SIZE triplet identifier */
byte OBJECT_AREA_SIZE = 0x4C;
/** AREA_DEFINITION triplet identifier */
byte AREA_DEFINITION = 0x4D;
/** COLOR_SPECIFICATION triplet identifier */
byte COLOR_SPECIFICATION = 0x4E;
/** ENCODING_SCHEME_ID triplet identifier */
byte ENCODING_SCHEME_ID = 0x50;
/** MEDIUM_MAP_PAGE_NUMBER triplet identifier */
byte MEDIUM_MAP_PAGE_NUMBER = 0x56;
/** OBJECT_BYTE_EXTENT triplet identifier */
byte OBJECT_BYTE_EXTENT = 0x57;
/** OBJECT_STRUCTURED_FIELD_OFFSET triplet identifier */
byte OBJECT_STRUCTURED_FIELD_OFFSET = 0x58;
/** OBJECT_STRUCTURED_FIELD_EXTENT triplet identifier */
byte OBJECT_STRUCTURED_FIELD_EXTENT = 0x59;
/** OBJECT_OFFSET triplet identifier */
byte OBJECT_OFFSET = 0x5A;
/** FONT_HORIZONTAL_SCALE_FACTOR triplet identifier */
byte FONT_HORIZONTAL_SCALE_FACTOR = 0x5D;
/** OBJECT_COUNT triplet identifier */
byte OBJECT_COUNT = 0x5E;
/** OBJECT_DATE_AND_TIMESTAMP triplet identifier */
byte OBJECT_DATE_AND_TIMESTAMP = 0x62;
/** COMMENT triplet identifier */
byte COMMENT = 0x65;
/** MEDIUM_ORIENTATION triplet identifier */
byte MEDIUM_ORIENTATION = 0x68;
/** RESOURCE_OBJECT_INCLUDE triplet identifier */
byte RESOURCE_OBJECT_INCLUDE = 0x6C;
/** PRESENTATION_SPACE_RESET_MIXING triplet identifier */
byte PRESENTATION_SPACE_RESET_MIXING = 0x70;
/** PRESENTATION_SPACE_MIXING_RULE triplet identifier */
byte PRESENTATION_SPACE_MIXING_RULE = 0x71;
/** UNIVERSAL_DATE_AND_TIMESTAMP triplet identifier */
byte UNIVERSAL_DATE_AND_TIMESTAMP = 0x72;
/** TONER_SAVER triplet identifier */
byte TONER_SAVER = 0x74;
/** COLOR_FIDELITY triplet identifier */
byte COLOR_FIDELITY = 0x75;
/** FONT_FIDELITY triplet identifier */
byte FONT_FIDELITY = 0x78;
/** ATTRIBUTE_QUALIFIER triplet identifier */
byte ATTRIBUTE_QUALIFIER = (byte)0x80;
/** PAGE_POSITION_INFORMATION triplet identifier */
byte PAGE_POSITION_INFORMATION = (byte)0x81;
/** PARAMETER_VALUE triplet identifier */
byte PARAMETER_VALUE = (byte)0x82;
/** PRESENTATION_CONTROL triplet identifier */
byte PRESENTATION_CONTROL = (byte)0x83;
/** FONT_RESOLUTION_AND_METRIC_TECHNOLOGY triplet identifier */
byte FONT_RESOLUTION_AND_METRIC_TECHNOLOGY = (byte)0x84;
/** FINISHING_OPERATION triplet identifier */
byte FINISHING_OPERATION = (byte)0x85;
/** TEXT_FIDELITY triplet identifier */
byte TEXT_FIDELITY = (byte)0x86;
/** MEDIA_FIDELITY triplet identifier */
byte MEDIA_FIDELITY = (byte)0x87;
/** FINISHING_FIDELITY triplet identifier */
byte FINISHING_FIDELITY = (byte)0x88;
/** DATA_OBJECT_FONT_DESCRIPTOR triplet identifier */
byte DATA_OBJECT_FONT_DESCRIPTOR = (byte)0x8B;
/** LOCALE_SELECTOR triplet identifier */
byte LOCALE_SELECTOR = (byte)0x8C;
/** UP3I_FINISHING_OPERATION triplet identifier */
byte UP3I_FINISHING_OPERATION = (byte)0x8E;
/** COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR triplet identifier */
byte COLOR_MANAGEMENT_RESOURCE_DESCRIPTOR = (byte)0x91;
/** RENDERING_INTENT triplet identifier */
byte RENDERING_INTENT = (byte)0x95;
/** CMR_TAG_FIDELITY triplet identifier */
byte CMR_TAG_FIDELITY = (byte)0x96;
/** DEVICE_APPEARANCE triplet identifier */
byte DEVICE_APPEARANCE = (byte)0x97;
}

+ 2
- 1
src/java/org/apache/fop/afp/ptoca/LineDataInfoProducer.java View File

@@ -32,7 +32,8 @@ import org.apache.fop.afp.AFPLineDataInfo;
public class LineDataInfoProducer implements PtocaProducer, PtocaConstants {

/** Static logging instance */
private static final Log log = LogFactory.getLog(LineDataInfoProducer.class);
private static final Log log // CSOK: ConstantName
= LogFactory.getLog(LineDataInfoProducer.class);

private AFPLineDataInfo lineDataInfo;


+ 4
- 5
src/java/org/apache/fop/afp/svg/AFPBridgeContext.java View File

@@ -60,22 +60,21 @@ public class AFPBridgeContext extends AbstractFOPBridgeContext {
/**
* Constructs a new bridge context.
* @param userAgent the user agent
* @param loader the Document Loader to use for referenced documents.
* @param documentLoader the Document Loader to use for referenced documents.
* @param fontInfo the font list for the text painter, may be null
* in which case text is painted as shapes
* @param linkTransform AffineTransform to properly place links,
* may be null
* @param imageManager an image manager
* @param imageSessionContext an image session context
* @param linkTransform AffineTransform to properly place links,
* may be null
* @param an AFPGraphics 2D implementation
* @param g2d an AFPGraphics 2D implementation
*/
public AFPBridgeContext(UserAgent userAgent, DocumentLoader documentLoader,
FontInfo fontInfo, ImageManager imageManager,
ImageSessionContext imageSessionContext,
AffineTransform linkTransform, AFPGraphics2D g2d) {
super(userAgent, documentLoader, fontInfo, imageManager, imageSessionContext, linkTransform);
super(userAgent, documentLoader, fontInfo, imageManager,
imageSessionContext, linkTransform);
this.g2d = g2d;
}


+ 2
- 1
src/java/org/apache/fop/afp/svg/AFPGraphicsConfiguration.java View File

@@ -109,7 +109,8 @@ public class AFPGraphicsConfiguration extends GraphicsConfiguration {
}
}

private static final Log log = LogFactory.getLog(AFPGraphicsConfiguration.class);
private static final Log log // CSOK: ConstantName
= LogFactory.getLog(AFPGraphicsConfiguration.class);

private AffineTransform defaultTransform = null;
private AffineTransform normalizingTransform = null;

+ 3
- 10
src/java/org/apache/fop/afp/svg/AFPTextHandler.java View File

@@ -21,7 +21,6 @@ package org.apache.fop.afp.svg;

import java.awt.Color;
import java.awt.Graphics2D;
import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -34,13 +33,13 @@ import org.apache.fop.afp.fonts.AFPPageFonts;
import org.apache.fop.afp.modca.GraphicsObject;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.svg.FOPTextHandler;
import org.apache.fop.svg.FOPTextHandlerAdapter;

/**
* Specialized TextHandler implementation that the AFPGraphics2D class delegates to to paint text
* using AFP GOCA text operations.
*/
public class AFPTextHandler implements FOPTextHandler {
public class AFPTextHandler extends FOPTextHandlerAdapter {

/** logging instance */
private static Log log = LogFactory.getLog(AFPTextHandler.class);
@@ -87,19 +86,13 @@ public class AFPTextHandler implements FOPTextHandler {
return afpFontAttributes.getFontReference();
}

/** {@inheritDoc} */
public void drawString(String text, float x, float y) throws IOException {
// TODO Remove me after removing the deprecated method in TextHandler.
throw new UnsupportedOperationException("Deprecated method!");
}

/**
* Add a text string to the current data object of the AFP datastream.
* The text is painted using text operations.
*
* {@inheritDoc}
*/
public void drawString(Graphics2D g, String str, float x, float y) throws IOException {
public void drawString(Graphics2D g, String str, float x, float y) {
if (log.isDebugEnabled()) {
log.debug("drawString() str=" + str + ", x=" + x + ", y=" + y);
}

+ 1
- 1
src/java/org/apache/fop/afp/svg/AFPTextPainter.java View File

@@ -26,7 +26,7 @@ import org.apache.fop.svg.AbstractFOPTextPainter;
import org.apache.fop.svg.FOPTextHandler;

/**
* Renders the attributed character iterator of a {@link TextNode}.
* Renders the attributed character iterator of some text.
* This class draws the text directly into the AFPGraphics2D so that
* the text is not drawn using shapes.
* If the text is simple enough to draw then it sets the font and calls

+ 3
- 0
src/java/org/apache/fop/afp/util/BinaryUtils.java View File

@@ -27,6 +27,9 @@ import java.io.ByteArrayOutputStream;
*/
public final class BinaryUtils {

private BinaryUtils() {
}

/**
* Convert an int into the corresponding byte array by encoding each
* two hexadecimal digits as a char. This will return a byte array

+ 4
- 1
src/java/org/apache/fop/afp/util/CubicBezierApproximator.java View File

@@ -29,7 +29,10 @@ import java.awt.geom.Point2D.Double;
* The various techniques are described here:
* http://www.timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm
*/
public class CubicBezierApproximator {
public final class CubicBezierApproximator {

private CubicBezierApproximator() {
}

/**
* This method will take in an array containing the x and y coordinates of the four control

+ 4
- 1
src/java/org/apache/fop/afp/util/StringUtils.java View File

@@ -23,7 +23,10 @@ package org.apache.fop.afp.util;
* Library of utility methods useful in dealing with strings.
*
*/
public class StringUtils {
public final class StringUtils {

private StringUtils() {
}

/**
* Padds the string to the left with the given character for

+ 4
- 1
src/java/org/apache/fop/area/AreaEventProducer.java View File

@@ -30,7 +30,10 @@ public interface AreaEventProducer extends EventProducer {
/**
* Provider class for the event producer.
*/
class Provider {
static final class Provider {

private Provider() {
}

/**
* Returns an event producer.

+ 7
- 2
src/java/org/apache/fop/area/AreaTreeParser.java View File

@@ -228,8 +228,13 @@ public class AreaTreeParser {
if (areaStack.size() > 0) {
int pos = areaStack.size() - 1;
Object obj = null;
while (pos >= 0 && !(clazz.isInstance(obj = areaStack.get(pos)))) {
pos--;
while ( pos >= 0 ) {
obj = areaStack.get(pos);
if ( clazz.isInstance ( obj ) ) {
break;
} else {
pos--;
}
}
if (pos >= 0) {
return (Area)obj;

+ 1
- 0
src/java/org/apache/fop/area/Block.java View File

@@ -58,6 +58,7 @@ public class Block extends BlockParent {
private int stacking = TB;
private int positioning = STACK;

/** if true, allow BPD update */
protected transient boolean allowBPDUpdate = true;

// a block with may contain the dominant styling info in

+ 1
- 1
src/java/org/apache/fop/area/DestinationData.java View File

@@ -98,7 +98,7 @@ public class DestinationData extends AbstractOffDocumentItem implements Resolvab
* object that corresponds to the IDRef
*
* {@inheritDoc} List)
* @todo check to make sure it works if multiple bookmark-items
* @asf.todo check to make sure it works if multiple bookmark-items
* have the same idref
*/
public void resolveIDRef(String id, List pages) {

+ 2
- 1
src/java/org/apache/fop/area/IDTracker.java View File

@@ -34,7 +34,8 @@ import org.apache.commons.logging.LogFactory;
*/
public class IDTracker {

private static final Log log = LogFactory.getLog(IDTracker.class);
private static final Log log // CSOK: ConstantName
= LogFactory.getLog(IDTracker.class);

// HashMap of ID's whose area is located on one or more consecutive
// PageViewports. Each ID has an arraylist of PageViewports that

+ 1
- 1
src/java/org/apache/fop/area/LineArea.java View File

@@ -37,7 +37,7 @@ public class LineArea extends Area {
* that can be used in order to re-compute adjustement and / or indents when a
* page-number or a page-number-citation is resolved
*/
private class LineAdjustingInfo implements Serializable {
private final class LineAdjustingInfo implements Serializable {
private int lineAlignment;
private int difference;
private int availableStretch;

+ 4
- 1
src/java/org/apache/fop/area/Trait.java View File

@@ -34,7 +34,10 @@ import org.apache.fop.util.ColorUtil;
* Area traits used for rendering.
* This class represents an area trait that specifies a value for rendering.
*/
public class Trait implements Serializable {
public final class Trait implements Serializable {

private Trait() {
}

/**
* Id reference line, not resolved.

+ 4
- 2
src/java/org/apache/fop/area/inline/AbstractTextArea.java View File

@@ -140,12 +140,14 @@ public abstract class AbstractTextArea extends InlineParent {
if (textWordSpaceAdjust < 0) {
// from a negative adjustment to a positive one
balancingFactor
= ((double) textAdjustingInfo.availableStretch / textAdjustingInfo.availableShrink)
= ((double) textAdjustingInfo.availableStretch
/ textAdjustingInfo.availableShrink)
* ((double) lineShrink / lineStretch);
} else {
// from a positive adjustment to a negative one
balancingFactor
= ((double) textAdjustingInfo.availableShrink / textAdjustingInfo.availableStretch)
= ((double) textAdjustingInfo.availableShrink
/ textAdjustingInfo.availableStretch)
* ((double) lineStretch / lineShrink);
}
}

+ 4
- 0
src/java/org/apache/fop/area/inline/InlineArea.java View File

@@ -218,6 +218,10 @@ public class InlineArea extends Area {
return false;
}

/**
* Apply IPD variation.
* @param ipdVariation the variation
*/
public void handleIPDVariation(int ipdVariation) {
increaseIPD(ipdVariation);
notifyIPDVariation(ipdVariation);

+ 1
- 0
src/java/org/apache/fop/area/inline/SpaceArea.java View File

@@ -16,6 +16,7 @@
*/

/* $Id$ */

package org.apache.fop.area.inline;

/**

+ 1
- 0
src/java/org/apache/fop/area/inline/WordArea.java View File

@@ -16,6 +16,7 @@
*/

/* $Id$ */

package org.apache.fop.area.inline;

/**

+ 12
- 6
src/java/org/apache/fop/cli/CommandLineOptions.java View File

@@ -961,10 +961,12 @@ public class CommandLineOptions {
"FO output mode is only available if you use -xml and -xsl");
} else if (outputmode.equals(MimeConstants.MIME_FOP_AREA_TREE)) {
throw new FOPException(
"Area Tree Output is not available if Intermediate Format is used as input!");
"Area Tree Output is not available if Intermediate Format"
+ " is used as input!");
} else if (outputmode.equals(MimeConstants.MIME_FOP_IF)) {
throw new FOPException(
"Intermediate Output is not available if Intermediate Format is used as input!");
"Intermediate Output is not available if Intermediate Format"
+ " is used as input!");
}
if (iffile != null && !iffile.exists()) {
throw new FileNotFoundException("Error: intermediate format file "
@@ -1151,7 +1153,8 @@ public class CommandLineOptions {
+ " -r relaxed/less strict validation (where available)\n"
+ " -dpi xxx target resolution in dots per inch (dpi) where xxx is a number\n"
+ " -s for area tree XML, down to block areas only\n"
+ " -v run in verbose mode (currently simply print FOP version and continue)\n\n"
+ " -v run in verbose mode (currently simply print FOP version"
+ " and continue)\n\n"
+ " -o [password] PDF file will be encrypted with option owner password\n"
+ " -u [password] PDF file will be encrypted with option user password\n"
+ " -noprint PDF file will be encrypted without printing permission\n"
@@ -1161,8 +1164,10 @@ public class CommandLineOptions {
+ " -a enables accessibility features (Tagged PDF etc., default off)\n"
+ " -pdfprofile prof PDF file will be generated with the specified profile\n"
+ " (Examples for prof: PDF/A-1b or PDF/X-3:2003)\n\n"
+ " -conserve Enable memory-conservation policy (trades memory-consumption for disk I/O)\n"
+ " (Note: currently only influences whether the area tree is serialized.)\n\n"
+ " -conserve Enable memory-conservation policy (trades memory-consumption"
+ " for disk I/O)\n"
+ " (Note: currently only influences whether the area tree is"
+ " serialized.)\n\n"
+ " [INPUT] \n"
+ " infile xsl:fo input file (the same as the next) \n"
+ " (use '-' for infile to pipe input from stdin)\n"
@@ -1192,7 +1197,8 @@ public class CommandLineOptions {
+ " -at [mime] out representation of area tree as XML (outfile req'd) \n"
+ " specify optional mime output to allow the AT to be converted\n"
+ " to final format later\n"
+ " -if [mime] out representation of document in intermediate format XML (outfile req'd)\n"
+ " -if [mime] out representation of document in intermediate format XML"
+ " (outfile req'd)\n"
+ " specify optional mime output to allow the IF to be converted\n"
+ " to final format later\n"
+ " -print input file will be rendered and sent to the printer \n"

+ 3
- 2
src/java/org/apache/fop/cli/InputHandler.java View File

@@ -196,13 +196,14 @@ public class InputHandler implements ErrorListener, Renderable {
* Creates a catalog resolver and uses it for XML parsing and XSLT URI resolution.
* Tries the Apache Commons Resolver, and if unsuccessful,
* tries the same built into Java 6.
* @param userAgent the user agent instance
*/
public void createCatalogResolver(FOUserAgent userAgent) {
String[] classNames = new String[] {
"org.apache.xml.resolver.tools.CatalogResolver",
"com.sun.org.apache.xml.internal.resolver.tools.CatalogResolver"};
ResourceEventProducer eventProducer =
ResourceEventProducer.Provider.get(userAgent.getEventBroadcaster());
ResourceEventProducer eventProducer
= ResourceEventProducer.Provider.get(userAgent.getEventBroadcaster());
Class resolverClass = null;
for (int i = 0; i < classNames.length && resolverClass == null; ++i) {
try {

+ 4
- 1
src/java/org/apache/fop/cli/Main.java View File

@@ -35,7 +35,10 @@ import org.apache.fop.apps.MimeConstants;
/**
* Main command-line class for Apache FOP.
*/
public class Main {
public final class Main {

private Main() {
}

/**
* @return the list of URLs to all libraries.

+ 13
- 2
src/java/org/apache/fop/datatypes/FODimension.java View File

@@ -27,9 +27,9 @@ package org.apache.fop.datatypes;
public class FODimension {

/** distance (in millipoints) on the inline-progression-direction */
public int ipd;
public int ipd; // CSOK: VisibilityModifier
/** distance (in millipoints) on the block-progression-direction */
public int bpd;
public int bpd; // CSOK: VisibilityModifier

/**
* Constructor
@@ -41,6 +41,17 @@ public class FODimension {
this.bpd = bpd;
}

/** @return ipd */
public int getIPD() {
return ipd;
}

/** @return bpd */
public int getBPD() {
return bpd;
}

/** {@inheritDoc} */
public String toString() {
StringBuffer sb = new StringBuffer(super.toString());
sb.append(" {ipd=").append(Integer.toString(ipd));

+ 6
- 5
src/java/org/apache/fop/datatypes/Numeric.java View File

@@ -37,7 +37,7 @@ public interface Numeric {
/**
* Return the value of this Numeric
* @return the computed value.
* @throws PropertyException
* @throws PropertyException if a propert exception occurs
*/
double getNumericValue() throws PropertyException;

@@ -45,7 +45,7 @@ public interface Numeric {
* Return the value of this Numeric
* @param context The context for the length calculation (for percentage based lengths)
* @return the computed value.
* @throws PropertyException
* @throws PropertyException if a propert exception occurs
*/
double getNumericValue(PercentBaseContext context) throws PropertyException;

@@ -68,14 +68,14 @@ public interface Numeric {
* Returns the value of this numeric as an int.
* @return the value as an integer.
*/
public int getValue();
int getValue();

/**
* Returns the value of this numeric as an int.
* @param context the context for the length calculation (for percentage based lengths)
* @return the value as an integer.
*/
public int getValue(PercentBaseContext context);
int getValue(PercentBaseContext context);

/**
* Return the resolved value. This method will becalled during evaluation
@@ -89,6 +89,7 @@ public interface Numeric {

/**
* Return the enum value that is stored in this numeric.
* @return the enum value
*/
public int getEnum();
int getEnum();
}

+ 1
- 1
src/java/org/apache/fop/datatypes/PercentBaseContext.java View File

@@ -36,6 +36,6 @@ public interface PercentBaseContext {
* @param fobj The FO object against which the percentage should be evaluated
* @return The base length value of the given kind
*/
public int getBaseLength(int lengthBase, FObj fobj);
int getBaseLength(int lengthBase, FObj fobj);

}

+ 5
- 2
src/java/org/apache/fop/datatypes/URISpecification.java View File

@@ -25,7 +25,10 @@ import java.io.UnsupportedEncodingException;
/**
* This class contains method to deal with the <uri-specification> datatype from XSL-FO.
*/
public class URISpecification {
public final class URISpecification {

private URISpecification() {
}

/**
* Get the URL string from a wrapped URL.
@@ -94,7 +97,7 @@ public class URISpecification {
return false;
}

private final static char[] HEX_DIGITS = {
private static final char[] HEX_DIGITS = {
'0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
};

+ 4
- 1
src/java/org/apache/fop/events/EventExceptionManager.java View File

@@ -27,7 +27,10 @@ import org.apache.xmlgraphics.util.Service;
/**
* This class is responsible for converting events into exceptions.
*/
public class EventExceptionManager {
public final class EventExceptionManager {

private EventExceptionManager() {
}

private static final Map EXCEPTION_FACTORIES = new java.util.HashMap();


+ 6
- 2
src/java/org/apache/fop/events/model/EventModelParser.java View File

@@ -40,10 +40,14 @@ import org.apache.fop.util.DefaultErrorListener;
/**
* This is a parser for the event model XML.
*/
public class EventModelParser {
public final class EventModelParser {

private EventModelParser() {
}

/** Logger instance */
protected static Log log = LogFactory.getLog(EventModelParser.class);
private static final Log log // CSOK: ConstantName
= LogFactory.getLog(EventModelParser.class);

private static SAXTransformerFactory tFactory
= (SAXTransformerFactory)SAXTransformerFactory.newInstance();

+ 5
- 3
src/java/org/apache/fop/fo/FONode.java View File

@@ -633,8 +633,9 @@ public abstract class FONode implements Cloneable {
* this method only in exceptional conditions because this method may perform quite extensive
* information gathering inside the FO tree.
* @return a String containing context information
* @deprecated Not localized! Should rename getContextInfoAlt() to getContextInfo() when done!
*/
// [GA] remove deprecation - no alternative specified
// @deprecated Not localized! Should rename getContextInfoAlt() to getContextInfo() when done!
public String getContextInfo() {
StringBuffer sb = new StringBuffer();
if (getLocalName() != null) {
@@ -797,8 +798,9 @@ public abstract class FONode implements Cloneable {

/**
* This method is overridden by extension elements and allows the extension element to return
* a {@link ContentHandlerFactory}. This factory can create ContentHandler implementations that handle
* foreign XML content by either building up a specific DOM, a Java object or something else.
* a {@link ContentHandlerFactory}. This factory can create ContentHandler implementations that
* handle foreign XML content by either building up a specific DOM, a Java object or something
* else.
*
* @return the <code>ContentHandlerFactory</code> or <code>null</code> if not applicable
*/

+ 117
- 100
src/java/org/apache/fop/fo/FOPropertyMapping.java View File

@@ -72,16 +72,20 @@ import org.apache.fop.fo.properties.XMLLangShorthandParser;
* This class creates and returns an array of Property.Maker instances
* indexed by the PR_* propId from Constants.java.
*
* @todo Check multi-threading safety of the statics below
* @asf.todo Check multi-threading safety of the statics below
*/
public final class FOPropertyMapping implements Constants {
private static Map s_htPropNames = new HashMap();
private static Map s_htSubPropNames = new HashMap();
private static Map s_htPropIds = new HashMap();

private static PropertyMaker[] s_generics = null;
private FOPropertyMapping() {
}

private static Map propNames = new HashMap(); // CSOK: VisibilityModifier
private static Map subPropNames = new HashMap(); // CSOK: VisibilityModifier
private static Map propIds = new HashMap(); // CSOK: VisibilityModifier

private static PropertyMaker[] generics = null; // CSOK: VisibilityModifier

// The rest is only used during the building of the s_generics array.
// The rest is only used during the building of the generics array.
private Property[] enums = null;

private PropertyMaker genericColor = null;
@@ -154,7 +158,7 @@ public final class FOPropertyMapping implements Constants {
genericPadding.setInherited(false);
genericPadding.setDefault("0pt");
genericPadding.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
genericPadding.addShorthand(s_generics[PR_PADDING]);
genericPadding.addShorthand(generics[PR_PADDING]);

// GenericCondBorderWidth
genericCondBorderWidth = new CondLengthProperty.Maker(0);
@@ -235,15 +239,15 @@ public final class FOPropertyMapping implements Constants {

/**
* Add a property maker to the generics array.
* Also creates the name <-> id mapping in s_htPropNames and s_htPropIds.
* Also creates the name <-> id mapping in propNames and propIds.
*
* @param name the name of the property maker.
* @param maker the maker.
*/
private static void addPropertyMaker(String name, PropertyMaker maker) {
s_generics[maker.getPropId()] = maker;
s_htPropNames.put(name, new Integer(maker.getPropId()));
s_htPropIds.put(new Integer(maker.getPropId()), name);
generics[maker.getPropId()] = maker;
propNames.put(name, new Integer(maker.getPropId()));
propIds.put(new Integer(maker.getPropId()), name);
}

/**
@@ -252,8 +256,8 @@ public final class FOPropertyMapping implements Constants {
* @param id Id for the subproperty from CP_* in Constants.java.
*/
private static void addSubpropMakerName(String name, int id) {
s_htSubPropNames.put(name, new Integer(id));
s_htPropIds.put(new Integer(id), name);
subPropNames.put(name, new Integer(id));
propIds.put(new Integer(id), name);
}

/**
@@ -278,9 +282,9 @@ public final class FOPropertyMapping implements Constants {
*/
public static PropertyMaker[] getGenericMappings() {

if (s_generics == null) {
if (generics == null) {
/* this method was never called before */
s_generics = new PropertyMaker[PROPERTY_COUNT + 1];
generics = new PropertyMaker[PROPERTY_COUNT + 1];
FOPropertyMapping gp = new FOPropertyMapping();

/* Create the shorthand first. They are
@@ -328,7 +332,7 @@ public final class FOPropertyMapping implements Constants {
addSubpropMakerName("precedence", CP_PRECEDENCE);
}

return s_generics;
return generics;
}

/**
@@ -338,7 +342,7 @@ public final class FOPropertyMapping implements Constants {
*/
public static int getPropertyId(String name) {
if (name != null) {
Integer i = (Integer) s_htPropNames.get(name);
Integer i = (Integer) propNames.get(name);
if (i != null) {
return i.intValue();
}
@@ -353,7 +357,7 @@ public final class FOPropertyMapping implements Constants {
*/
public static int getSubPropertyId(String name) {
if (name != null) {
Integer i = (Integer) s_htSubPropNames.get(name);
Integer i = (Integer) subPropNames.get(name);
if (i != null) {
return i.intValue();
}
@@ -369,10 +373,10 @@ public final class FOPropertyMapping implements Constants {
public static String getPropertyName(int id) {
if (((id & Constants.COMPOUND_MASK) == 0)
|| ((id & Constants.PROPERTY_MASK) == 0)) {
return (String) s_htPropIds.get(new Integer(id));
return (String) propIds.get(new Integer(id));
} else {
return s_htPropIds.get(new Integer(id & Constants.PROPERTY_MASK))
+ "." + s_htPropIds.get(new Integer(id & Constants.COMPOUND_MASK));
return propIds.get(new Integer(id & Constants.PROPERTY_MASK))
+ "." + propIds.get(new Integer(id & Constants.COMPOUND_MASK));
}
}

@@ -403,7 +407,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("fixed", getEnumProperty(EN_FIXED, "FIXED"));
m.addEnum("absolute", getEnumProperty(EN_ABSOLUTE, "ABSOLUTE"));
m.setDefault("auto");
m.addShorthand(s_generics[PR_POSITION]);
m.addShorthand(generics[PR_POSITION]);
addPropertyMaker("absolute-position", m);

// top
@@ -551,7 +555,7 @@ public final class FOPropertyMapping implements Constants {
addPropertyMaker("volume", m);
}

private void createBorderPaddingBackgroundProperties() {
private void createBorderPaddingBackgroundProperties() { // CSOK: MethodLength
PropertyMaker m;
BorderWidthPropertyMaker bwm;
CorrespondingPropertyMaker corr;
@@ -606,7 +610,7 @@ public final class FOPropertyMapping implements Constants {
m.addKeyword("center", "50%");
m.addKeyword("right", "100%");
m.setPercentBase(LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL);
m.addShorthand(s_generics[PR_BACKGROUND_POSITION]);
m.addShorthand(generics[PR_BACKGROUND_POSITION]);
addPropertyMaker("background-position-horizontal", m);

// background-position-vertical
@@ -617,7 +621,7 @@ public final class FOPropertyMapping implements Constants {
m.addKeyword("center", "50%");
m.addKeyword("bottom", "100%");
m.setPercentBase(LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL);
m.addShorthand(s_generics[PR_BACKGROUND_POSITION]);
m.addShorthand(generics[PR_BACKGROUND_POSITION]);
addPropertyMaker("background-position-vertical", m);

// border-before-color
@@ -745,9 +749,9 @@ public final class FOPropertyMapping implements Constants {
m.useGeneric(genericColor);
m.setInherited(false);
m.setDefault("black");
m.addShorthand(s_generics[PR_BORDER_TOP]);
m.addShorthand(s_generics[PR_BORDER_COLOR]);
m.addShorthand(s_generics[PR_BORDER]);
m.addShorthand(generics[PR_BORDER_TOP]);
m.addShorthand(generics[PR_BORDER_COLOR]);
m.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(m);
corr.setCorresponding(PR_BORDER_BEFORE_COLOR, PR_BORDER_BEFORE_COLOR,
PR_BORDER_START_COLOR);
@@ -756,9 +760,9 @@ public final class FOPropertyMapping implements Constants {
// border-top-style
m = new EnumProperty.Maker(PR_BORDER_TOP_STYLE);
m.useGeneric(genericBorderStyle);
m.addShorthand(s_generics[PR_BORDER_TOP]);
m.addShorthand(s_generics[PR_BORDER_STYLE]);
m.addShorthand(s_generics[PR_BORDER]);
m.addShorthand(generics[PR_BORDER_TOP]);
m.addShorthand(generics[PR_BORDER_STYLE]);
m.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(m);
corr.setCorresponding(PR_BORDER_BEFORE_STYLE, PR_BORDER_BEFORE_STYLE,
PR_BORDER_START_STYLE);
@@ -768,9 +772,9 @@ public final class FOPropertyMapping implements Constants {
bwm = new BorderWidthPropertyMaker(PR_BORDER_TOP_WIDTH);
bwm.useGeneric(genericBorderWidth);
bwm.setBorderStyleId(PR_BORDER_TOP_STYLE);
bwm.addShorthand(s_generics[PR_BORDER_TOP]);
bwm.addShorthand(s_generics[PR_BORDER_WIDTH]);
bwm.addShorthand(s_generics[PR_BORDER]);
bwm.addShorthand(generics[PR_BORDER_TOP]);
bwm.addShorthand(generics[PR_BORDER_WIDTH]);
bwm.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(bwm);
corr.setCorresponding(PR_BORDER_BEFORE_WIDTH, PR_BORDER_BEFORE_WIDTH,
PR_BORDER_START_WIDTH);
@@ -781,9 +785,9 @@ public final class FOPropertyMapping implements Constants {
m.useGeneric(genericColor);
m.setInherited(false);
m.setDefault("black");
m.addShorthand(s_generics[PR_BORDER_BOTTOM]);
m.addShorthand(s_generics[PR_BORDER_COLOR]);
m.addShorthand(s_generics[PR_BORDER]);
m.addShorthand(generics[PR_BORDER_BOTTOM]);
m.addShorthand(generics[PR_BORDER_COLOR]);
m.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(m);
corr.setCorresponding(PR_BORDER_AFTER_COLOR, PR_BORDER_AFTER_COLOR,
PR_BORDER_END_COLOR);
@@ -792,9 +796,9 @@ public final class FOPropertyMapping implements Constants {
// border-bottom-style
m = new EnumProperty.Maker(PR_BORDER_BOTTOM_STYLE);
m.useGeneric(genericBorderStyle);
m.addShorthand(s_generics[PR_BORDER_BOTTOM]);
m.addShorthand(s_generics[PR_BORDER_STYLE]);
m.addShorthand(s_generics[PR_BORDER]);
m.addShorthand(generics[PR_BORDER_BOTTOM]);
m.addShorthand(generics[PR_BORDER_STYLE]);
m.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(m);
corr.setCorresponding(PR_BORDER_AFTER_STYLE, PR_BORDER_AFTER_STYLE,
PR_BORDER_END_STYLE);
@@ -804,9 +808,9 @@ public final class FOPropertyMapping implements Constants {
bwm = new BorderWidthPropertyMaker(PR_BORDER_BOTTOM_WIDTH);
bwm.useGeneric(genericBorderWidth);
bwm.setBorderStyleId(PR_BORDER_BOTTOM_STYLE);
bwm.addShorthand(s_generics[PR_BORDER_BOTTOM]);
bwm.addShorthand(s_generics[PR_BORDER_WIDTH]);
bwm.addShorthand(s_generics[PR_BORDER]);
bwm.addShorthand(generics[PR_BORDER_BOTTOM]);
bwm.addShorthand(generics[PR_BORDER_WIDTH]);
bwm.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(bwm);
corr.setCorresponding(PR_BORDER_AFTER_WIDTH, PR_BORDER_AFTER_WIDTH,
PR_BORDER_END_WIDTH);
@@ -817,9 +821,9 @@ public final class FOPropertyMapping implements Constants {
m.useGeneric(genericColor);
m.setInherited(false);
m.setDefault("black");
m.addShorthand(s_generics[PR_BORDER_LEFT]);
m.addShorthand(s_generics[PR_BORDER_COLOR]);
m.addShorthand(s_generics[PR_BORDER]);
m.addShorthand(generics[PR_BORDER_LEFT]);
m.addShorthand(generics[PR_BORDER_COLOR]);
m.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(m);
corr.setCorresponding(PR_BORDER_START_COLOR, PR_BORDER_END_COLOR,
PR_BORDER_AFTER_COLOR);
@@ -828,9 +832,9 @@ public final class FOPropertyMapping implements Constants {
// border-left-style
m = new EnumProperty.Maker(PR_BORDER_LEFT_STYLE);
m.useGeneric(genericBorderStyle);
m.addShorthand(s_generics[PR_BORDER_LEFT]);
m.addShorthand(s_generics[PR_BORDER_STYLE]);
m.addShorthand(s_generics[PR_BORDER]);
m.addShorthand(generics[PR_BORDER_LEFT]);
m.addShorthand(generics[PR_BORDER_STYLE]);
m.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(m);
corr.setCorresponding(PR_BORDER_START_STYLE, PR_BORDER_END_STYLE,
PR_BORDER_AFTER_STYLE);
@@ -840,9 +844,9 @@ public final class FOPropertyMapping implements Constants {
bwm = new BorderWidthPropertyMaker(PR_BORDER_LEFT_WIDTH);
bwm.useGeneric(genericBorderWidth);
bwm.setBorderStyleId(PR_BORDER_LEFT_STYLE);
bwm.addShorthand(s_generics[PR_BORDER_LEFT]);
bwm.addShorthand(s_generics[PR_BORDER_WIDTH]);
bwm.addShorthand(s_generics[PR_BORDER]);
bwm.addShorthand(generics[PR_BORDER_LEFT]);
bwm.addShorthand(generics[PR_BORDER_WIDTH]);
bwm.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(bwm);
corr.setCorresponding(PR_BORDER_START_WIDTH, PR_BORDER_END_WIDTH,
PR_BORDER_AFTER_WIDTH);
@@ -853,9 +857,9 @@ public final class FOPropertyMapping implements Constants {
m.useGeneric(genericColor);
m.setInherited(false);
m.setDefault("black");
m.addShorthand(s_generics[PR_BORDER_RIGHT]);
m.addShorthand(s_generics[PR_BORDER_COLOR]);
m.addShorthand(s_generics[PR_BORDER]);
m.addShorthand(generics[PR_BORDER_RIGHT]);
m.addShorthand(generics[PR_BORDER_COLOR]);
m.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(m);
corr.setCorresponding(PR_BORDER_END_COLOR, PR_BORDER_START_COLOR,
PR_BORDER_BEFORE_COLOR);
@@ -864,9 +868,9 @@ public final class FOPropertyMapping implements Constants {
// border-right-style
m = new EnumProperty.Maker(PR_BORDER_RIGHT_STYLE);
m.useGeneric(genericBorderStyle);
m.addShorthand(s_generics[PR_BORDER_RIGHT]);
m.addShorthand(s_generics[PR_BORDER_STYLE]);
m.addShorthand(s_generics[PR_BORDER]);
m.addShorthand(generics[PR_BORDER_RIGHT]);
m.addShorthand(generics[PR_BORDER_STYLE]);
m.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(m);
corr.setCorresponding(PR_BORDER_END_STYLE, PR_BORDER_START_STYLE,
PR_BORDER_BEFORE_STYLE);
@@ -876,9 +880,9 @@ public final class FOPropertyMapping implements Constants {
bwm = new BorderWidthPropertyMaker(PR_BORDER_RIGHT_WIDTH);
bwm.useGeneric(genericBorderWidth);
bwm.setBorderStyleId(PR_BORDER_RIGHT_STYLE);
bwm.addShorthand(s_generics[PR_BORDER_RIGHT]);
bwm.addShorthand(s_generics[PR_BORDER_WIDTH]);
bwm.addShorthand(s_generics[PR_BORDER]);
bwm.addShorthand(generics[PR_BORDER_RIGHT]);
bwm.addShorthand(generics[PR_BORDER_WIDTH]);
bwm.addShorthand(generics[PR_BORDER]);
corr = new CorrespondingPropertyMaker(bwm);
corr.setCorresponding(PR_BORDER_END_WIDTH, PR_BORDER_START_WIDTH,
PR_BORDER_BEFORE_WIDTH);
@@ -964,7 +968,7 @@ public final class FOPropertyMapping implements Constants {
m = new FontFamilyProperty.Maker(PR_FONT_FAMILY);
m.setInherited(true);
m.setDefault("sans-serif,Symbol,ZapfDingbats");
m.addShorthand(s_generics[PR_FONT]);
m.addShorthand(generics[PR_FONT]);
addPropertyMaker("font-family", m);

// font-selection-strategy
@@ -990,7 +994,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("larger", getEnumProperty(EN_LARGER, "LARGER"));
m.addEnum("smaller", getEnumProperty(EN_SMALLER, "SMALLER"));
m.setPercentBase(LengthBase.INH_FONTSIZE);
m.addShorthand(s_generics[PR_FONT]);
m.addShorthand(generics[PR_FONT]);
addPropertyMaker("font-size", m);

// font-stretch
@@ -1024,7 +1028,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("oblique", getEnumProperty(EN_OBLIQUE, "OBLIQUE"));
m.addEnum("backslant", getEnumProperty(EN_BACKSLANT, "BACKSLANT"));
m.setDefault("normal");
m.addShorthand(s_generics[PR_FONT]);
m.addShorthand(generics[PR_FONT]);
addPropertyMaker("font-style", m);

// font-variant
@@ -1033,7 +1037,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("normal", getEnumProperty(EN_NORMAL, "NORMAL"));
m.addEnum("small-caps", getEnumProperty(EN_SMALL_CAPS, "SMALL_CAPS"));
m.setDefault("normal");
m.addShorthand(s_generics[PR_FONT]);
m.addShorthand(generics[PR_FONT]);
addPropertyMaker("font-variant", m);

// font-weight
@@ -1053,7 +1057,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("800", getEnumProperty(EN_800, "800"));
m.addEnum("900", getEnumProperty(EN_900, "900"));
m.setDefault("400");
m.addShorthand(s_generics[PR_FONT]);
m.addShorthand(generics[PR_FONT]);
addPropertyMaker("font-weight", m);
}

@@ -1064,14 +1068,14 @@ public final class FOPropertyMapping implements Constants {
m = new StringProperty.Maker(PR_COUNTRY);
m.setInherited(true);
m.setDefault("none");
m.addShorthand(s_generics[PR_XML_LANG]);
m.addShorthand(generics[PR_XML_LANG]);
addPropertyMaker("country", m);

// language
m = new StringProperty.Maker(PR_LANGUAGE);
m.setInherited(true);
m.setDefault("none");
m.addShorthand(s_generics[PR_XML_LANG]);
m.addShorthand(generics[PR_XML_LANG]);
addPropertyMaker("language", m);

// script
@@ -1114,7 +1118,7 @@ public final class FOPropertyMapping implements Constants {
m = new LengthProperty.Maker(PR_MARGIN_TOP);
m.setInherited(false);
m.setDefault("0pt");
m.addShorthand(s_generics[PR_MARGIN]);
m.addShorthand(generics[PR_MARGIN]);
m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin-top", m);

@@ -1122,7 +1126,7 @@ public final class FOPropertyMapping implements Constants {
m = new LengthProperty.Maker(PR_MARGIN_BOTTOM);
m.setInherited(false);
m.setDefault("0pt");
m.addShorthand(s_generics[PR_MARGIN]);
m.addShorthand(generics[PR_MARGIN]);
m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin-bottom", m);

@@ -1130,7 +1134,7 @@ public final class FOPropertyMapping implements Constants {
m = new LengthProperty.Maker(PR_MARGIN_LEFT);
m.setInherited(false);
m.setDefault("0pt");
m.addShorthand(s_generics[PR_MARGIN]);
m.addShorthand(generics[PR_MARGIN]);
m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin-left", m);

@@ -1138,7 +1142,7 @@ public final class FOPropertyMapping implements Constants {
m = new LengthProperty.Maker(PR_MARGIN_RIGHT);
m.setInherited(false);
m.setDefault("0pt");
m.addShorthand(s_generics[PR_MARGIN]);
m.addShorthand(generics[PR_MARGIN]);
m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin-right", m);

@@ -1218,7 +1222,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("static", getEnumProperty(EN_STATIC, "STATIC"));
m.addEnum("relative", getEnumProperty(EN_RELATIVE, "RELATIVE"));
m.setDefault("static");
m.addShorthand(s_generics[PR_POSITION]);
m.addShorthand(generics[PR_POSITION]);
addPropertyMaker("relative-position", m);
}

@@ -1242,7 +1246,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("mathematical", getEnumProperty(EN_MATHEMATICAL, "MATHEMATICAL"));
m.setDefault("auto");
m.setPercentBase(LengthBase.ALIGNMENT_ADJUST);
m.addShorthand(s_generics[PR_VERTICAL_ALIGN]);
m.addShorthand(generics[PR_VERTICAL_ALIGN]);
addPropertyMaker("alignment-adjust", m);

// alignment-baseline
@@ -1261,7 +1265,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("hanging", getEnumProperty(EN_HANGING, "HANGING"));
m.addEnum("mathematical", getEnumProperty(EN_MATHEMATICAL, "MATHEMATICAL"));
m.setDefault("auto");
m.addShorthand(s_generics[PR_VERTICAL_ALIGN]);
m.addShorthand(generics[PR_VERTICAL_ALIGN]);
addPropertyMaker("alignment-baseline", m);

// baseline-shift
@@ -1271,7 +1275,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("sub", getEnumProperty(EN_SUB, "SUB"));
m.addEnum("super", getEnumProperty(EN_SUPER, "SUPER"));
m.setDefault("baseline");
m.addShorthand(s_generics[PR_VERTICAL_ALIGN]);
m.addShorthand(generics[PR_VERTICAL_ALIGN]);
m.setPercentBase(LengthBase.CUSTOM_BASE);
addPropertyMaker("baseline-shift", m);

@@ -1303,7 +1307,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("text-after-edge", getEnumProperty(EN_TEXT_AFTER_EDGE, "TEXT_AFTER_EDGE"));
m.addEnum("text-before-edge", getEnumProperty(EN_TEXT_BEFORE_EDGE, "TEXT_BEFORE_EDGE"));
m.setDefault("auto");
m.addShorthand(s_generics[PR_VERTICAL_ALIGN]);
m.addShorthand(generics[PR_VERTICAL_ALIGN]);
addPropertyMaker("dominant-baseline", m);

// relative-align
@@ -1315,7 +1319,7 @@ public final class FOPropertyMapping implements Constants {
addPropertyMaker("relative-align", m);
}

private void createAreaDimensionProperties() {
private void createAreaDimensionProperties() { // CSOK: MethodLength
PropertyMaker m;
LengthProperty.Maker l;
DimensionPropertyMaker pdim;
@@ -1464,8 +1468,10 @@ public final class FOPropertyMapping implements Constants {
m = new EnumProperty.Maker(PR_SCALING_METHOD);
m.setInherited(false);
m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
m.addEnum("integer-pixels", getEnumProperty(EN_INTEGER_PIXELS, "INTEGER_PIXELS"));
m.addEnum("resample-any-method", getEnumProperty(EN_RESAMPLE_ANY_METHOD, "RESAMPLE_ANY_METHOD"));
m.addEnum("integer-pixels",
getEnumProperty(EN_INTEGER_PIXELS, "INTEGER_PIXELS"));
m.addEnum("resample-any-method",
getEnumProperty(EN_RESAMPLE_ANY_METHOD, "RESAMPLE_ANY_METHOD"));
m.setDefault("auto");
addPropertyMaker("scaling-method", m);

@@ -1484,7 +1490,7 @@ public final class FOPropertyMapping implements Constants {
addPropertyMaker("fox:block-progression-unit", l);
}

private void createBlockAndLineProperties() {
private void createBlockAndLineProperties() { // CSOK: MethodLength
PropertyMaker m;

// hyphenation-keep
@@ -1517,7 +1523,7 @@ public final class FOPropertyMapping implements Constants {
m.addKeyword("normal", "1.2");
m.setPercentBase(LengthBase.FONTSIZE);
m.setDefault("normal", true);
m.addShorthand(s_generics[PR_FONT]);
m.addShorthand(generics[PR_FONT]);
addPropertyMaker("line-height", m);

// line-height-shift-adjustment
@@ -1543,9 +1549,11 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("ignore", getEnumProperty(EN_IGNORE, "IGNORE"));
m.addEnum("preserve", getEnumProperty(EN_PRESERVE, "PRESERVE"));
m.addEnum("treat-as-space", getEnumProperty(EN_TREAT_AS_SPACE, "TREAT_AS_SPACE"));
m.addEnum("treat-as-zero-width-space", getEnumProperty(EN_TREAT_AS_ZERO_WIDTH_SPACE, "TREAT_AS_ZERO_WIDTH_SPACE"));
m.addEnum("treat-as-zero-width-space",
getEnumProperty(EN_TREAT_AS_ZERO_WIDTH_SPACE,
"TREAT_AS_ZERO_WIDTH_SPACE"));
m.setDefault("treat-as-space");
m.addShorthand(s_generics[PR_WHITE_SPACE]);
m.addShorthand(generics[PR_WHITE_SPACE]);
addPropertyMaker("linefeed-treatment", m);

// white-space-treatment
@@ -1553,11 +1561,17 @@ public final class FOPropertyMapping implements Constants {
m.setInherited(true);
m.addEnum("ignore", getEnumProperty(EN_IGNORE, "IGNORE"));
m.addEnum("preserve", getEnumProperty(EN_PRESERVE, "PRESERVE"));
m.addEnum("ignore-if-before-linefeed", getEnumProperty(EN_IGNORE_IF_BEFORE_LINEFEED, "IGNORE_IF_BEFORE_LINEFEED"));
m.addEnum("ignore-if-after-linefeed", getEnumProperty(EN_IGNORE_IF_AFTER_LINEFEED, "IGNORE_IF_AFTER_LINEFEED"));
m.addEnum("ignore-if-surrounding-linefeed", getEnumProperty(EN_IGNORE_IF_SURROUNDING_LINEFEED, "IGNORE_IF_SURROUNDING_LINEFEED"));
m.addEnum("ignore-if-before-linefeed",
getEnumProperty(EN_IGNORE_IF_BEFORE_LINEFEED,
"IGNORE_IF_BEFORE_LINEFEED"));
m.addEnum("ignore-if-after-linefeed",
getEnumProperty(EN_IGNORE_IF_AFTER_LINEFEED,
"IGNORE_IF_AFTER_LINEFEED"));
m.addEnum("ignore-if-surrounding-linefeed",
getEnumProperty(EN_IGNORE_IF_SURROUNDING_LINEFEED,
"IGNORE_IF_SURROUNDING_LINEFEED"));
m.setDefault("ignore-if-surrounding-linefeed");
m.addShorthand(s_generics[PR_WHITE_SPACE]);
m.addShorthand(generics[PR_WHITE_SPACE]);
addPropertyMaker("white-space-treatment", m);

// text-align TODO: make it a StringProperty with enums.
@@ -1637,7 +1651,7 @@ public final class FOPropertyMapping implements Constants {
m.useGeneric(genericBoolean);
m.setInherited(true);
m.setDefault("true");
m.addShorthand(s_generics[PR_WHITE_SPACE]);
m.addShorthand(generics[PR_WHITE_SPACE]);
addPropertyMaker("white-space-collapse", m);

// wrap-option
@@ -1646,7 +1660,7 @@ public final class FOPropertyMapping implements Constants {
m.addEnum("wrap", getEnumProperty(EN_WRAP, "WRAP"));
m.addEnum("no-wrap", getEnumProperty(EN_NO_WRAP, "NO_WRAP"));
m.setDefault("wrap");
m.addShorthand(s_generics[PR_WHITE_SPACE]);
m.addShorthand(generics[PR_WHITE_SPACE]);
addPropertyMaker("wrap-option", m);
}

@@ -1750,9 +1764,11 @@ public final class FOPropertyMapping implements Constants {
m.setInherited(false);
m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
m.addEnum("perceptual", getEnumProperty(EN_PERCEPTUAL, "PERCEPTUAL"));
m.addEnum("relative-colorimetric", getEnumProperty(EN_RELATIVE_COLOMETRIC, "RELATIVE_COLOMETRIC"));
m.addEnum("relative-colorimetric", getEnumProperty(EN_RELATIVE_COLOMETRIC,
"RELATIVE_COLOMETRIC"));
m.addEnum("saturation", getEnumProperty(EN_SATURATION, "SATURATION"));
m.addEnum("absolute-colorimetric", getEnumProperty(EN_ABSOLUTE_COLORMETRIC, "ABSOLUTE_COLORMETRIC"));
m.addEnum("absolute-colorimetric", getEnumProperty(EN_ABSOLUTE_COLORMETRIC,
"ABSOLUTE_COLORMETRIC"));
m.setDefault("auto");
addPropertyMaker("rendering-intent", m);
}
@@ -1804,13 +1820,13 @@ public final class FOPropertyMapping implements Constants {
// break-after
m = new EnumProperty.Maker(PR_BREAK_AFTER);
m.useGeneric(genericBreak);
m.addShorthand(s_generics[PR_PAGE_BREAK_AFTER]);
m.addShorthand(generics[PR_PAGE_BREAK_AFTER]);
addPropertyMaker("break-after", m);

// break-before
m = new EnumProperty.Maker(PR_BREAK_BEFORE);
m.useGeneric(genericBreak);
m.addShorthand(s_generics[PR_PAGE_BREAK_BEFORE]);
m.addShorthand(generics[PR_PAGE_BREAK_BEFORE]);
addPropertyMaker("break-before", m);

// keep-together
@@ -1818,7 +1834,7 @@ public final class FOPropertyMapping implements Constants {
m.useGeneric(genericKeep);
m.setInherited(true);
m.setDefault("auto");
m.addShorthand(s_generics[PR_PAGE_BREAK_INSIDE]);
m.addShorthand(generics[PR_PAGE_BREAK_INSIDE]);
addPropertyMaker("keep-together", m);

// keep-with-next
@@ -1826,7 +1842,7 @@ public final class FOPropertyMapping implements Constants {
m.useGeneric(genericKeep);
m.setInherited(false);
m.setDefault("auto");
m.addShorthand(s_generics[PR_PAGE_BREAK_AFTER]);
m.addShorthand(generics[PR_PAGE_BREAK_AFTER]);
addPropertyMaker("keep-with-next", m);

// keep-with-previous
@@ -1834,7 +1850,7 @@ public final class FOPropertyMapping implements Constants {
m.useGeneric(genericKeep);
m.setInherited(false);
m.setDefault("auto");
m.addShorthand(s_generics[PR_PAGE_BREAK_BEFORE]);
m.addShorthand(generics[PR_PAGE_BREAK_BEFORE]);
addPropertyMaker("keep-with-previous", m);

// orphans
@@ -2240,7 +2256,8 @@ public final class FOPropertyMapping implements Constants {
m.setInherited(false);
m.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
m.addEnum("paginate", getEnumProperty(EN_PAGINATE, "PAGINATE"));
m.addEnum("bounded-in-one-dimension", getEnumProperty(EN_BOUNDED_IN_ONE_DIMENSION, "BOUNDED_IN_ONE_DIMENSION"));
m.addEnum("bounded-in-one-dimension", getEnumProperty(EN_BOUNDED_IN_ONE_DIMENSION,
"BOUNDED_IN_ONE_DIMENSION"));
m.addEnum("unbounded", getEnumProperty(EN_UNBOUNDED, "UNBOUNDED"));
m.setDefault("auto");
addPropertyMaker("media-usage", m);
@@ -2330,7 +2347,7 @@ public final class FOPropertyMapping implements Constants {
// border-separation
m = new LengthPairProperty.Maker(PR_BORDER_SEPARATION);
m.setInherited(true);
m.addShorthand(s_generics[PR_BORDER_SPACING]);
m.addShorthand(generics[PR_BORDER_SPACING]);

sub = new LengthProperty.Maker(CP_BLOCK_PROGRESSION_DIRECTION);
sub.setDefault("0pt");
@@ -2577,7 +2594,7 @@ public final class FOPropertyMapping implements Constants {
addPropertyMaker("z-index", m);
}

private void createShorthandProperties() {
private void createShorthandProperties() { // CSOK: MethodLength
PropertyMaker m;

// background

+ 3
- 3
src/java/org/apache/fop/fo/FOText.java View File

@@ -489,10 +489,10 @@ public class FOText extends FONode implements CharSequence {

private class TextCharIterator extends CharIterator {

int currentPosition = 0;
private int currentPosition = 0;

boolean canRemove = false;
boolean canReplace = false;
private boolean canRemove = false;
private boolean canReplace = false;

/** {@inheritDoc} */
public boolean hasNext() {

+ 3
- 3
src/java/org/apache/fop/fo/FObj.java View File

@@ -44,7 +44,7 @@ import org.apache.fop.fo.properties.PropertyMaker;
public abstract class FObj extends FONode implements Constants {

/** the list of property makers */
private static final PropertyMaker[] propertyListTable
private static final PropertyMaker[] propertyListTable // CSOK: ConstantName
= FOPropertyMapping.getGenericMappings();

/**
@@ -255,7 +255,7 @@ public abstract class FObj extends FONode implements Constants {
/**
* Check if this formatting object generates reference areas.
* @return true if generates reference areas
* @todo see if needed
* @asf.todo see if needed
*/
public boolean generatesReferenceAreas() {
return false;
@@ -610,7 +610,7 @@ public abstract class FObj extends FONode implements Constants {
return (super.toString() + "[@id=" + this.id + "]");
}

/** Basic {@link FONodeIterator} implementation */
/** Basic {@link FONode.FONodeIterator} implementation */
public class FObjIterator implements FONodeIterator {

private static final int F_NONE_ALLOWED = 0;

+ 4
- 0
src/java/org/apache/fop/fo/NullCharIterator.java View File

@@ -28,6 +28,10 @@ public class NullCharIterator extends CharIterator {

private static CharIterator instance;

/**
* Obtain the singleton instance of the null character iterator.
* @return the char iterator
*/
public static CharIterator getInstance() {
if (instance == null) {
instance = new NullCharIterator();

+ 7
- 0
src/java/org/apache/fop/fo/PropertyListMaker.java View File

@@ -23,6 +23,13 @@ package org.apache.fop.fo;
* A PropertyListMaker is a factory that creates PropertyLists.
*/
public interface PropertyListMaker {

/**
* Make a property list.
* @param fobj the FO from which the new property list is associated
* @param parentPropertyList the parent property list
* @return the new property list
*/
PropertyList make(FObj fobj, PropertyList parentPropertyList);

}

+ 7
- 4
src/java/org/apache/fop/fo/StaticPropertyList.java View File

@@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/* $Id$ */

package org.apache.fop.fo;

import org.apache.fop.fo.expr.PropertyException;
@@ -62,14 +65,14 @@ public class StaticPropertyList extends PropertyList {
/**
* Override PropertyList.get() and provides fast caching of previously
* retrieved property values.
* @param propId The property ID
* {@inheritDoc}
*/
public Property get(int propId, boolean bTryInherit, boolean bTryDefault)
throws PropertyException
{
throws PropertyException {
Property p = values[propId];
if (p == null) {
p = values[propId] = super.get(propId, bTryInherit, bTryDefault);
p = super.get(propId, bTryInherit, bTryDefault);
values[propId] = p;
}
return p;
}

+ 10
- 0
src/java/org/apache/fop/fo/ValidationException.java View File

@@ -26,10 +26,20 @@ import org.xml.sax.Locator;
* Exception thrown during FO tree validation.
*/
public class ValidationException extends FOPException {

/**
* Construct a validation exception instance.
* @param message a message
*/
public ValidationException(String message) {
super(message);
}

/**
* Construct a validation exception instance.
* @param message a message
* @param locator a locator
*/
public ValidationException(String message, Locator locator) {
super(message, locator);
}

+ 3
- 2
src/java/org/apache/fop/fo/expr/BodyStartFunction.java View File

@@ -47,8 +47,9 @@ public class BodyStartFunction extends FunctionBase {
*/
public Property eval(Property[] args,
PropertyInfo pInfo) throws PropertyException {
Numeric distance =
pInfo.getPropertyList().get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric();
Numeric distance
= pInfo.getPropertyList()
.get(Constants.PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS).getNumeric();

PropertyList pList = pInfo.getPropertyList();
while (pList != null && !(pList.getFObj() instanceof ListItem)) {

+ 135
- 24
src/java/org/apache/fop/fo/expr/NumericOp.java View File

@@ -30,7 +30,11 @@ import org.apache.fop.datatypes.Numeric;
* The evaluation of the operation can then occur when getNumericValue() is
* called.
*/
public class NumericOp {
public final class NumericOp {

private NumericOp() {
}

/**
* Add the two operands and return a new Numeric representing the result.
* @param op1 The first operand.
@@ -39,7 +43,8 @@ public class NumericOp {
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric addition(Numeric op1, Numeric op2) throws PropertyException {
public static Numeric addition(Numeric op1, Numeric op2)
throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
return addition2(op1, op2, null);
} else {
@@ -47,11 +52,23 @@ public class NumericOp {
}
}

public static Numeric addition2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
/**
* Add the two operands with a percentage context
* and return a new Numeric representing the result.
* @param op1 The first operand.
* @param op2 The second operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric addition2(Numeric op1, Numeric op2, PercentBaseContext context)
throws PropertyException {
if (op1.getDimension() != op2.getDimension()) {
throw new PropertyException("Can't subtract Numerics of different dimensions");
}
return numeric(op1.getNumericValue(context) + op2.getNumericValue(context), op1.getDimension());
return numeric(op1.getNumericValue(context)
+ op2.getNumericValue(context), op1.getDimension());
}

/**
@@ -63,7 +80,8 @@ public class NumericOp {
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric subtraction(Numeric op1, Numeric op2) throws PropertyException {
public static Numeric subtraction(Numeric op1, Numeric op2)
throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
return subtraction2(op1, op2, null);
} else {
@@ -71,11 +89,23 @@ public class NumericOp {
}
}

public static Numeric subtraction2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
/**
* Subtract the two operands with a percentage context
* and return a new Numeric representing the result.
* @param op1 The first operand.
* @param op2 The second operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric subtraction2(Numeric op1, Numeric op2, PercentBaseContext context)
throws PropertyException {
if (op1.getDimension() != op2.getDimension()) {
throw new PropertyException("Can't subtract Numerics of different dimensions");
}
return numeric(op1.getNumericValue(context) - op2.getNumericValue(context), op1.getDimension());
return numeric(op1.getNumericValue(context)
- op2.getNumericValue(context), op1.getDimension());
}

/**
@@ -87,7 +117,8 @@ public class NumericOp {
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric multiply(Numeric op1, Numeric op2) throws PropertyException {
public static Numeric multiply(Numeric op1, Numeric op2)
throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
return multiply2(op1, op2, null);
} else {
@@ -95,7 +126,18 @@ public class NumericOp {
}
}

public static Numeric multiply2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
/**
* Multiply the two operands with a percentage context
* and return a new Numeric representing the result.
* @param op1 The first operand.
* @param op2 The second operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric multiply2(Numeric op1, Numeric op2, PercentBaseContext context)
throws PropertyException {
return numeric(op1.getNumericValue(context) * op2.getNumericValue(context),
op1.getDimension() + op2.getDimension());
}
@@ -118,7 +160,18 @@ public class NumericOp {
}
}

public static Numeric divide2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
/**
* Divide the two operands with a percentage context
* and return a new Numeric representing the result.
* @param op1 The first operand.
* @param op2 The second operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric divide2(Numeric op1, Numeric op2, PercentBaseContext context)
throws PropertyException {
return numeric(op1.getNumericValue(context) / op2.getNumericValue(context),
op1.getDimension() - op2.getDimension());
}
@@ -128,8 +181,10 @@ public class NumericOp {
* @param op1 The first operand.
* @param op2 The second operand.
* @return A new Numeric object representing the absolute value.
* @throws PropertyException if a property exception occurs
*/
public static Numeric modulo(Numeric op1, Numeric op2) throws PropertyException {
public static Numeric modulo(Numeric op1, Numeric op2)
throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
return modulo2(op1, op2, null);
} else {
@@ -137,16 +192,29 @@ public class NumericOp {
}
}

public static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
return numeric(op1.getNumericValue(context) % op2.getNumericValue(context), op1.getDimension());
/**
* Return the remainder of a division of the two operand Numeric.
* @param op1 The first operand.
* @param op2 The second operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context)
throws PropertyException {
return numeric(op1.getNumericValue(context)
% op2.getNumericValue(context), op1.getDimension());
}

/**
* Return the absolute value of a Numeric.
* @param op the operand.
* @return a new Numeric object representing the absolute value of the operand.
* @throws PropertyException if a property exception occurs
*/
public static Numeric abs(Numeric op) throws PropertyException {
public static Numeric abs(Numeric op)
throws PropertyException {
if (op.isAbsolute()) {
return abs2(op, null);
} else {
@@ -154,7 +222,16 @@ public class NumericOp {
}
}

public static Numeric abs2(Numeric op, PercentBaseContext context) throws PropertyException {
/**
* Return the absolute value of a Numeric.
* @param op the operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric abs2(Numeric op, PercentBaseContext context)
throws PropertyException {
return numeric(Math.abs(op.getNumericValue(context)), op.getDimension());
}

@@ -162,8 +239,10 @@ public class NumericOp {
* Return the negation of a Numeric.
* @param op the operand.
* @return a new Numeric object representing the negation of the operand.
* @throws PropertyException if a property exception occurs
*/
public static Numeric negate(Numeric op) throws PropertyException {
public static Numeric negate(Numeric op)
throws PropertyException {
if (op.isAbsolute()) {
return negate2(op, null);
} else {
@@ -171,8 +250,18 @@ public class NumericOp {
}
}

public static Numeric negate2(Numeric op, PercentBaseContext context) throws PropertyException {
return numeric(- op.getNumericValue(context), op.getDimension());

/**
* Return the negation of a Numeric.
* @param op the operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric negate2(Numeric op, PercentBaseContext context)
throws PropertyException {
return numeric(-op.getNumericValue(context), op.getDimension());
}

/**
@@ -182,7 +271,8 @@ public class NumericOp {
* @return a Numeric which is the maximum of the two operands.
* @throws PropertyException if the dimensions or value types of the operands are different.
*/
public static Numeric max(Numeric op1, Numeric op2) throws PropertyException {
public static Numeric max(Numeric op1, Numeric op2)
throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
return max2(op1, op2, null);
} else {
@@ -190,7 +280,17 @@ public class NumericOp {
}
}

public static Numeric max2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
/**
* Return the larger of the two Numerics.
* @param op1 The first operand.
* @param op2 The second operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric max2(Numeric op1, Numeric op2, PercentBaseContext context)
throws PropertyException {
if (op1.getDimension() != op2.getDimension()) {
throw new PropertyException("Arguments to max() must have same dimensions");
}
@@ -204,7 +304,8 @@ public class NumericOp {
* @return a Numeric which is the minimum of the two operands.
* @throws PropertyException if the dimensions or value types of the operands are different.
*/
public static Numeric min(Numeric op1, Numeric op2) throws PropertyException {
public static Numeric min(Numeric op1, Numeric op2)
throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
return min2(op1, op2, null);
} else {
@@ -212,7 +313,17 @@ public class NumericOp {
}
}

public static Numeric min2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
/**
* Return the smaller of the two Numerics.
* @param op1 The first operand.
* @param op2 The second operand.
* @param context a percent base context
* @return A Numeric representing the result.
* @throws PropertyException If the dimension of the operand is different
* from the dimension of this Numeric.
*/
public static Numeric min2(Numeric op1, Numeric op2, PercentBaseContext context)
throws PropertyException {
if (op1.getDimension() != op2.getDimension()) {
throw new PropertyException("Arguments to min() must have same dimensions");
}
@@ -221,8 +332,8 @@ public class NumericOp {

/**
* Create a new absolute numeric with the specified value and dimension.
* @param value
* @param dimension
* @param value of numeric
* @param dimension of numeric
* @return a new absolute numeric.
*/
private static Numeric numeric(double value, int dimension) {

+ 2
- 0
src/java/org/apache/fop/fo/expr/PropertyInfo.java View File

@@ -58,6 +58,7 @@ public class PropertyInfo {
* a percent specification.
* Propagates to the Maker.
* @return The PercentBase object or null if percentLengthOK()=false.
* @throws PropertyException if a property exception occurs
*/
public PercentBase getPercentBase() throws PropertyException {
PercentBase pcbase = getFunctionPercentBase();
@@ -66,6 +67,7 @@ public class PropertyInfo {

/**
* @return the current font-size value as base units (milli-points).
* @throws PropertyException if a property exception occurs
*/
public Length currentFontSize() throws PropertyException {
return plist.get(Constants.PR_FONT_SIZE).getLength();

+ 15
- 11
src/java/org/apache/fop/fo/expr/PropertyTokenizer.java View File

@@ -83,7 +83,7 @@ class PropertyTokenizer {
boolean currentMaybeOperator = recognizeOperator;
boolean bSawDecimal;
recognizeOperator = true;
for (; ;) {
while ( true ) {
if (exprIndex >= exprLength) {
currentToken = TOK_EOF;
return;
@@ -273,8 +273,11 @@ class PropertyTokenizer {
}

private void scanRestOfName() {
while (++exprIndex < exprLength
&& isNameChar(expr.charAt(exprIndex))) { }
while ( ++exprIndex < exprLength ) {
if ( !isNameChar ( expr.charAt ( exprIndex ) ) ) {
break;
}
}
}

/**
@@ -320,8 +323,8 @@ class PropertyTokenizer {
}


private static final String NAME_START_CHARS =
"_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static final String NAME_START_CHARS
= "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static final String NAME_CHARS = ".-0123456789";
private static final String DIGITS = "0123456789";
private static final String HEX_CHARS = DIGITS + "abcdefABCDEF";
@@ -331,7 +334,7 @@ class PropertyTokenizer {
* decimal digit (0-9).
* @param c The character to check
*/
private static final boolean isDigit(char c) {
private static boolean isDigit(char c) {
return DIGITS.indexOf(c) >= 0;
}

@@ -340,7 +343,7 @@ class PropertyTokenizer {
* hexadecimal digit (0-9, A-F, a-f).
* @param c The character to check
*/
private static final boolean isHexDigit(char c) {
private static boolean isHexDigit(char c) {
return HEX_CHARS.indexOf(c) >= 0;
}

@@ -349,15 +352,16 @@ class PropertyTokenizer {
* as defined by XSL (space, newline, CR, tab).
* @param c The character to check
*/
private static final boolean isSpace(char c) {
private static boolean isSpace(char c) {
switch (c) {
case ' ':
case '\r':
case '\n':
case '\t':
return true;
default:
return false;
}
return false;
}

/**
@@ -365,7 +369,7 @@ class PropertyTokenizer {
* start character, ie. can start a NAME as defined by XSL.
* @param c The character to check
*/
private static final boolean isNameStartChar(char c) {
private static boolean isNameStartChar(char c) {
return NAME_START_CHARS.indexOf(c) >= 0 || c >= 0x80;
}

@@ -374,7 +378,7 @@ class PropertyTokenizer {
* character, ie. can occur in a NAME as defined by XSL.
* @param c The character to check
*/
private static final boolean isNameChar(char c) {
private static boolean isNameChar(char c) {
return NAME_START_CHARS.indexOf(c) >= 0 || NAME_CHARS.indexOf(c) >= 0
|| c >= 0x80;
}

+ 15
- 1
src/java/org/apache/fop/fo/expr/RelativeNumericProperty.java View File

@@ -33,14 +33,23 @@ import org.apache.fop.fo.properties.TableColLength;
* or getValue() is called.
*/
public class RelativeNumericProperty extends Property implements Length {
/** ADDITION */
public static final int ADDITION = 1;
/** SUBTRACTION */
public static final int SUBTRACTION = 2;
/** MULTIPLY */
public static final int MULTIPLY = 3;
/** DIVIDE */
public static final int DIVIDE = 4;
/** MODULO */
public static final int MODULO = 5;
/** NEGATE */
public static final int NEGATE = 6;
/** ABS */
public static final int ABS = 7;
/** MAX */
public static final int MAX = 8;
/** MIN */
public static final int MIN = 9;

// Used in the toString() method, indexed by operation id.
@@ -145,6 +154,7 @@ public class RelativeNumericProperty extends Property implements Length {

/**
* Return the dimension of the expression
* @return numeric value as dimension
*/
public int getDimension() {
return dimension;
@@ -153,6 +163,7 @@ public class RelativeNumericProperty extends Property implements Length {
/**
* Return false since an expression is only created when there is relative
* numerics involved.
* @return true if expression is absolute
*/
public boolean isAbsolute() {
return false;
@@ -160,6 +171,7 @@ public class RelativeNumericProperty extends Property implements Length {

/**
* Cast this numeric as a Length.
* @return numeric value as length
*/
public Length getLength() {
if (dimension == 1) {
@@ -169,6 +181,7 @@ public class RelativeNumericProperty extends Property implements Length {
return null;
}

/** @return numeric value */
public Numeric getNumeric() {
return this;
}
@@ -272,7 +285,8 @@ public class RelativeNumericProperty extends Property implements Length {
return "min(" + op1 + ", " + op2 + ")";
case ABS:
return "abs(" + op1 + ")";
default:
return "unknown operation " + operation;
}
return "unknown operation " + operation;
}
}

+ 2
- 1
src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java View File

@@ -37,7 +37,8 @@ public class ExtensionElementMapping extends ElementMapping {
/** The FOP extension namespace URI */
public static final String URI = "http://xmlgraphics.apache.org/fop/extensions";

private static final Set propertyAttributes = new java.util.HashSet();
private static final Set propertyAttributes // CSOK: ConstantName
= new java.util.HashSet();

static {
//These are FOP's standard extension properties (fox:*)

+ 5
- 3
src/java/org/apache/fop/fo/extensions/ExtensionObj.java View File

@@ -47,13 +47,15 @@ public abstract class ExtensionObj extends FObj {
*/
public void processNode(String elementName, Locator locator,
Attributes attlist, PropertyList pList)
throws FOPException
{
// Empty
throws FOPException {
}

/**
* Create a default property list for this element.
* @param parent the parent property list
* @param foEventHandler an event handler
* @return property list
* @throws FOPException in case of exception
*/
protected PropertyList createPropertyList(PropertyList parent,
FOEventHandler foEventHandler) throws FOPException {

+ 22
- 5
src/java/org/apache/fop/fo/extensions/ExternalDocument.java View File

@@ -82,13 +82,18 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr
}
}

/**
* @throws FOPException in case of processing exception
* @see org.apache.fop.fo.FONode#startOfNode()
*/
protected void startOfNode() throws FOPException {
super.startOfNode();
getFOEventHandler().startExternalDocument(this);
}

/**
* @see org.apache.fop.fo.FONode#endOfNode
* @throws FOPException in case of processing exception
* @see org.apache.fop.fo.FONode#endOfNode()
*/
protected void endOfNode() throws FOPException {
getFOEventHandler().endExternalDocument(this);
@@ -96,8 +101,11 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr
}

/**
* @param loc a locator
* @param nsURI a namespace uri or null
* @param localName a local name
* @throws ValidationException if invalid child
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
XSL/FOP: empty
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
@@ -162,17 +170,26 @@ public class ExternalDocument extends AbstractPageSequence implements GraphicsPr
return textAlign;
}

/** @see org.apache.fop.fo.FONode#getNamespaceURI() */
/**
* @return namespace uri
* @see org.apache.fop.fo.FONode#getNamespaceURI()
*/
public String getNamespaceURI() {
return ExtensionElementMapping.URI;
}

/** @see org.apache.fop.fo.FONode#getNormalNamespacePrefix() */
/**
* @return namespace prefix
* @see org.apache.fop.fo.FONode#getNormalNamespacePrefix()
*/
public String getNormalNamespacePrefix() {
return "fox";
}

/** @see org.apache.fop.fo.FONode#getLocalName() */
/**
* @return local name
* @see org.apache.fop.fo.FONode#getLocalName()
*/
public String getLocalName() {
return "external-document";
}

+ 2
- 1
src/java/org/apache/fop/fo/extensions/svg/BatikExtensionElementMapping.java View File

@@ -53,7 +53,7 @@ public class BatikExtensionElementMapping extends ElementMapping {
* Batik classes that apparently need it (error messages, perhaps)
* @return an XML parser classname
*/
private final String getAParserClassName() {
private String getAParserClassName() {
try {
//TODO Remove when Batik uses JAXP instead of SAX directly.
SAXParserFactory factory = SAXParserFactory.newInstance();
@@ -63,6 +63,7 @@ public class BatikExtensionElementMapping extends ElementMapping {
}
}

/** initialize mapping */
protected void initialize() {
if (foObjs == null && batikAvail) {
// this sets the parser that will be used

+ 1
- 1
src/java/org/apache/fop/fo/extensions/svg/SVGDOMContentHandlerFactory.java View File

@@ -105,7 +105,7 @@ public class SVGDOMContentHandlerFactory implements ContentHandlerFactory {
Class clazz = Class.forName(
"org.apache.batik.dom.svg12.SVG12DOMImplementation");
return (DOMImplementation)clazz.getMethod(
"getDOMImplementation", null).invoke(null, null);
"getDOMImplementation", (Class[])null).invoke(null, (Object[])null);
} catch (Exception e) {
return SVGDOMImplementation.getDOMImplementation();
}

+ 3
- 1
src/java/org/apache/fop/fo/flow/AbstractPageNumberCitation.java View File

@@ -109,7 +109,9 @@ public abstract class AbstractPageNumberCitation extends FObj
}

/** {@inheritDoc} */
public void processNode(String elementName, Locator locator, Attributes attlist, PropertyList pList) throws FOPException {
public void processNode
(String elementName, Locator locator, Attributes attlist, PropertyList pList)
throws FOPException {
super.processNode(elementName, locator, attlist, pList);
if (!inMarker() && (refId == null || "".equals(refId))) {
missingPropertyError("ref-id");

+ 2
- 1
src/java/org/apache/fop/fo/flow/Block.java View File

@@ -330,7 +330,8 @@ public class Block extends FObjMixed implements BreakPropertySet, StructurePoint

/**
* @return the "fox:disable-column-balancing" property, one of
* {@link Constants#EN_TRUE}, {@link Constants#EN_FALSE}
* {@link org.apache.fop.fo.Constants#EN_TRUE},
* {@link org.apache.fop.fo.Constants#EN_FALSE}
*/
public int getDisableColumnBalancing() {
return disableColumnBalancing;

+ 2
- 1
src/java/org/apache/fop/fo/flow/BlockContainer.java View File

@@ -219,7 +219,8 @@ public class BlockContainer extends FObj implements BreakPropertySet {

/**
* @return the "fox:disable-column-balancing" property, one of
* {@link Constants#EN_TRUE}, {@link Constants#EN_FALSE}
* {@link org.apache.fop.fo.Constants#EN_TRUE},
* {@link org.apache.fop.fo.Constants#EN_FALSE}
*/
public int getDisableColumnBalancing() {
return disableColumnBalancing;

+ 1
- 1
src/java/org/apache/fop/fo/flow/Float.java View File

@@ -38,7 +38,7 @@ public class Float extends FObj {
// private int clear;
// End of property values

static boolean notImplementedWarningGiven = false;
private static boolean notImplementedWarningGiven = false;

/**
* Base constructor

+ 2
- 2
src/java/org/apache/fop/fo/flow/Footnote.java View File

@@ -76,9 +76,9 @@ public class Footnote extends FObj {
/**
* {@inheritDoc}
* <br>XSL Content Model: (inline,footnote-body)
* @todo implement additional constraint: A fo:footnote is not permitted
* @asf.todo implement additional constraint: A fo:footnote is not permitted
* to have a fo:float, fo:footnote, or fo:marker as a descendant.
* @todo implement additional constraint: A fo:footnote is not
* @asf.todo implement additional constraint: A fo:footnote is not
* permitted to have as a descendant a fo:block-container that
* generates an absolutely positioned area.
*/

+ 2
- 1
src/java/org/apache/fop/fo/flow/Inline.java View File

@@ -120,7 +120,8 @@ public class Inline extends InlineLevel implements StructurePointerPropertySet {
} else if (!isBlockOrInlineItem(nsURI, localName)) {
invalidChildError(loc, nsURI, localName);
} else if (!canHaveBlockLevelChildren && isBlockItem(nsURI, localName)) {
invalidChildError(loc, getParent().getName(), nsURI, getName(), "rule.inlineContent");
invalidChildError(loc, getParent().getName(), nsURI, getName(),
"rule.inlineContent");
} else {
blockOrInlineItemFound = true;
}

+ 0
- 0
src/java/org/apache/fop/fo/flow/Leader.java View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save