git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP-2393_gradient-rendering@1611658 13f79535-47bb-0310-9956-ffa450edef68tags/fop-2_0
<!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... --> | <!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... --> | ||||
<!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... --> | <!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... --> | ||||
<!-- <module name="ExplicitInitialization"/> produces 795 new errors --> | |||||
<module name="ExplicitInitialization"/> | |||||
<!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... --> | <!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... --> | ||||
<!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... --> | <!-- ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... --> |
<Method name="hasValueOfElementName"/> | <Method name="hasValueOfElementName"/> | ||||
<Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/> | <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/> | ||||
</Match> | </Match> | ||||
<Match> | |||||
<Class name="org.apache.fop.pdf.PDFCFFStream"/> | |||||
<Or> | |||||
<Bug pattern="EI_EXPOSE_REP"/> | |||||
<Bug pattern="EI_EXPOSE_REP2"/> | |||||
</Or> | |||||
</Match> | |||||
</FindBugsFilter> | </FindBugsFilter> |
private static final int Y3 = 5; | private static final int Y3 = 5; | ||||
/** graphics object */ | /** graphics object */ | ||||
private GraphicsObject graphicsObj = null; | |||||
private GraphicsObject graphicsObj; | |||||
/** Fallback text handler */ | /** Fallback text handler */ | ||||
protected TextHandler fallbackTextHandler = new StrokingTextHandler(); | protected TextHandler fallbackTextHandler = new StrokingTextHandler(); | ||||
/** Custom text handler */ | /** Custom text handler */ | ||||
protected TextHandler customTextHandler = null; | |||||
protected TextHandler customTextHandler; | |||||
/** AFP resource manager */ | /** AFP resource manager */ | ||||
private AFPResourceManager resourceManager = null; | |||||
private AFPResourceManager resourceManager; | |||||
/** AFP resource info */ | /** AFP resource info */ | ||||
private AFPResourceInfo resourceInfo = null; | |||||
private AFPResourceInfo resourceInfo; | |||||
/** Current AFP state */ | /** Current AFP state */ | ||||
private AFPPaintingState paintingState = null; | |||||
private AFPPaintingState paintingState; | |||||
/** AFP graphics configuration */ | /** AFP graphics configuration */ | ||||
private final GraphicsConfigurationWithTransparency graphicsConfig = new GraphicsConfigurationWithTransparency(); | private final GraphicsConfigurationWithTransparency graphicsConfig = new GraphicsConfigurationWithTransparency(); |
private Color color; | private Color color; | ||||
/** the rotation */ | /** the rotation */ | ||||
private int rotation = 0; | |||||
private int rotation; | |||||
/** | /** | ||||
* Default constructor | * Default constructor |
private static Log log = LogFactory.getLog("org.apache.xmlgraphics.afp"); | private static Log log = LogFactory.getLog("org.apache.xmlgraphics.afp"); | ||||
/** the portrait rotation */ | /** the portrait rotation */ | ||||
private int portraitRotation = 0; | |||||
private int portraitRotation; | |||||
/** the landscape rotation */ | /** the landscape rotation */ | ||||
private int landscapeRotation = 270; | private int landscapeRotation = 270; | ||||
/** color image support */ | /** color image support */ | ||||
private boolean colorImages = false; | |||||
private boolean colorImages; | |||||
/** dithering quality setting (0.0f..1.0f) */ | /** dithering quality setting (0.0f..1.0f) */ | ||||
private float ditheringQuality; | private float ditheringQuality; | ||||
* true if certain image formats may be embedded unchanged in their native | * true if certain image formats may be embedded unchanged in their native | ||||
* format. | * format. | ||||
*/ | */ | ||||
private boolean nativeImagesSupported = false; | |||||
private boolean nativeImagesSupported; | |||||
private boolean canEmbedJpeg = false; | |||||
private boolean canEmbedJpeg; | |||||
/** | /** | ||||
* true if CMYK images (requires IOCA FS45 suppport on the target platform) | * true if CMYK images (requires IOCA FS45 suppport on the target platform) | ||||
/** determines whether GOCA is enabled or disabled */ | /** determines whether GOCA is enabled or disabled */ | ||||
private boolean gocaEnabled = true; | private boolean gocaEnabled = true; | ||||
/** determines whether to stroke text in GOCA mode or to use text operators where possible */ | /** determines whether to stroke text in GOCA mode or to use text operators where possible */ | ||||
private boolean strokeGocaText = false; | |||||
private boolean strokeGocaText; | |||||
/** use page segment with F11 and F45 images*/ | /** use page segment with F11 and F45 images*/ | ||||
*/ | */ | ||||
private class AFPPagePaintingState implements Cloneable { | private class AFPPagePaintingState implements Cloneable { | ||||
/** page width */ | /** page width */ | ||||
private int width = 0; | |||||
private int width; | |||||
/** page height */ | /** page height */ | ||||
private int height = 0; | |||||
private int height; | |||||
/** page fonts */ | /** page fonts */ | ||||
private AFPPageFonts fonts = new AFPPageFonts(); | private AFPPageFonts fonts = new AFPPageFonts(); | ||||
/** page font count */ | /** page font count */ | ||||
private int fontCount = 0; | |||||
private int fontCount; | |||||
/** page orientation */ | /** page orientation */ | ||||
private int orientation = 0; | |||||
private int orientation; | |||||
/** | /** | ||||
* Returns the page width | * Returns the page width | ||||
private static final long serialVersionUID = -1789481244175275686L; | private static final long serialVersionUID = -1789481244175275686L; | ||||
/** The current fill status */ | /** The current fill status */ | ||||
private boolean filled = false; | |||||
private boolean filled; | |||||
private String imageUri = null; | |||||
private String imageUri; | |||||
/** {@inheritDoc} */ | /** {@inheritDoc} */ | ||||
@Override | @Override |
= new AFPResourceLevel(ResourceType.PRINT_FILE); | = new AFPResourceLevel(ResourceType.PRINT_FILE); | ||||
/** the URI of this resource */ | /** the URI of this resource */ | ||||
private String uri = null; | |||||
private String uri; | |||||
/** | /** | ||||
* the image dimension in page coordinates (non-null only when page segments are | * the image dimension in page coordinates (non-null only when page segments are | ||||
* generated because the cannot be scaled for painting). | * generated because the cannot be scaled for painting). | ||||
*/ | */ | ||||
private Dimension imageDimension = null; | |||||
private Dimension imageDimension; | |||||
/** the reference name of this resource */ | /** the reference name of this resource */ | ||||
private String name = null; | |||||
private String name; | |||||
/** the resource level of this resource */ | /** the resource level of this resource */ | ||||
private AFPResourceLevel level = DEFAULT_LEVEL; | private AFPResourceLevel level = DEFAULT_LEVEL; | ||||
/** true when the resource level was changed */ | /** true when the resource level was changed */ | ||||
private boolean levelChanged = false; | |||||
private boolean levelChanged; | |||||
/** | /** | ||||
* Sets the data object URI. | * Sets the data object URI. |
} | } | ||||
} | } | ||||
private URI extUri = null; | |||||
private URI extUri; | |||||
private final ResourceType resourceType; | private final ResourceType resourceType; | ||||
/** | /** |
private final AFPDataObjectFactory dataObjectFactory; | private final AFPDataObjectFactory dataObjectFactory; | ||||
/** Maintain a reference count of instream objects for referencing purposes */ | /** Maintain a reference count of instream objects for referencing purposes */ | ||||
private int instreamObjectCount = 0; | |||||
private int instreamObjectCount; | |||||
/** Mapping of resourceInfo to AbstractCachedObject */ | /** Mapping of resourceInfo to AbstractCachedObject */ | ||||
private final Map<AFPResourceInfo, AbstractCachedObject> includeObjectCache | private final Map<AFPResourceInfo, AbstractCachedObject> includeObjectCache |
protected static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp"); | protected static final Log LOG = LogFactory.getLog("org.apache.xmlgraphics.afp"); | ||||
/** Boolean completion indicator */ | /** Boolean completion indicator */ | ||||
private boolean complete = false; | |||||
private boolean complete; | |||||
/** The AFP document object */ | /** The AFP document object */ | ||||
private Document document = null; | |||||
private Document document; | |||||
/** The current page group object */ | /** The current page group object */ | ||||
private PageGroup currentPageGroup = null; | |||||
private PageGroup currentPageGroup; | |||||
/** The current page object */ | /** The current page object */ | ||||
private PageObject currentPageObject = null; | |||||
private PageObject currentPageObject; | |||||
/** The current overlay object */ | /** The current overlay object */ | ||||
private Overlay currentOverlay = null; | |||||
private Overlay currentOverlay; | |||||
/** The current page */ | /** The current page */ | ||||
private AbstractPageObject currentPage = null; | |||||
private AbstractPageObject currentPage; | |||||
/** The MO:DCA interchange set in use (default to MO:DCA-P IS/2 set) */ | /** The MO:DCA interchange set in use (default to MO:DCA-P IS/2 set) */ | ||||
private InterchangeSet interchangeSet | private InterchangeSet interchangeSet |
/** the page group count */ | /** the page group count */ | ||||
private int pageGroupCount = 0; | |||||
private int pageGroupCount; | |||||
/** the page count */ | /** the page count */ | ||||
private int pageCount = 0; | |||||
private int pageCount; | |||||
/** the image count */ | /** the image count */ | ||||
private int imageCount = 0; | |||||
private int imageCount; | |||||
/** the im image count */ | /** the im image count */ | ||||
private int imImageCount = 0; | |||||
private int imImageCount; | |||||
/** the image segment count */ | /** the image segment count */ | ||||
private int imageSegmentCount = 0; | |||||
private int imageSegmentCount; | |||||
/** the graphic count */ | /** the graphic count */ | ||||
private int graphicCount = 0; | |||||
private int graphicCount; | |||||
/** the object container count */ | /** the object container count */ | ||||
private int objectContainerCount = 0; | |||||
private int objectContainerCount; | |||||
/** the resource count */ | /** the resource count */ | ||||
private int resourceCount = 0; | |||||
private int resourceCount; | |||||
/** the resource group count */ | /** the resource group count */ | ||||
private int resourceGroupCount = 0; | |||||
private int resourceGroupCount; | |||||
/** the overlay count */ | /** the overlay count */ | ||||
private int overlayCount = 0; | |||||
private int overlayCount; | |||||
/** the presentation text object count */ | /** the presentation text object count */ | ||||
private int textObjectCount = 0; | |||||
private int textObjectCount; | |||||
/** the active environment group count */ | /** the active environment group count */ | ||||
private int activeEnvironmentGroupCount = 0; | |||||
private int activeEnvironmentGroupCount; | |||||
/** the document count */ | /** the document count */ | ||||
private int documentCount = 0; | |||||
private int documentCount; | |||||
/** the object environment group count */ | /** the object environment group count */ | ||||
private int objectEnvironmentGroupCount = 0; | |||||
private int objectEnvironmentGroupCount; | |||||
/** | /** | ||||
* Main constructor | * Main constructor |
public abstract class AbstractOutlineFont extends AFPFont { | public abstract class AbstractOutlineFont extends AFPFont { | ||||
/** The character set for this font */ | /** The character set for this font */ | ||||
protected CharacterSet charSet = null; | |||||
protected CharacterSet charSet; | |||||
private final AFPEventProducer eventProducer; | private final AFPEventProducer eventProducer; | ||||
private int dpi; | private int dpi; | ||||
private int unitsPerEm; | private int unitsPerEm; | ||||
private boolean isRelative = false; | |||||
private boolean isRelative; | |||||
public int getDpi() { | public int getDpi() { | ||||
return dpi; | return dpi; |
public class FopCharacterSet extends CharacterSet { | public class FopCharacterSet extends CharacterSet { | ||||
/** The character set for this font */ | /** The character set for this font */ | ||||
private Typeface charSet = null; | |||||
private Typeface charSet; | |||||
/** | /** | ||||
* Constructor for the CharacterSetMetric object, the character set is used | * Constructor for the CharacterSetMetric object, the character set is used |
private final SortedMap<Integer, CharacterSet> charSets = new TreeMap<Integer, CharacterSet>(); | private final SortedMap<Integer, CharacterSet> charSets = new TreeMap<Integer, CharacterSet>(); | ||||
private Map<Integer, CharacterSet> substitutionCharSets; | private Map<Integer, CharacterSet> substitutionCharSets; | ||||
private CharacterSet charSet = null; | |||||
private CharacterSet charSet; | |||||
/** | /** | ||||
* Constructor for the raster font requires the name, weight and style | * Constructor for the raster font requires the name, weight and style |
public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder { | public abstract class AbstractGraphicsCoord extends AbstractGraphicsDrawingOrder { | ||||
/** array of x/y coordinates */ | /** array of x/y coordinates */ | ||||
protected int[] coords = null; | |||||
protected int[] coords; | |||||
/** if true, then uses relative drawing order */ | /** if true, then uses relative drawing order */ | ||||
protected boolean relative = false; | |||||
protected boolean relative; | |||||
/** | /** | ||||
* Constructor | * Constructor |
= new java.util.ArrayList/*<StructuredDataObject>*/(); | = new java.util.ArrayList/*<StructuredDataObject>*/(); | ||||
/** object is complete */ | /** object is complete */ | ||||
private boolean complete = false; | |||||
private boolean complete; | |||||
/** object has started */ | /** object has started */ | ||||
private boolean started = false; | |||||
private boolean started; | |||||
/** | /** | ||||
* Default constructor | * Default constructor |
private static final int NO_BOUNDARY = 0; | private static final int NO_BOUNDARY = 0; | ||||
/** draw boundary lines around this area */ | /** draw boundary lines around this area */ | ||||
private boolean drawBoundary = false; | |||||
private boolean drawBoundary; | |||||
/** | /** | ||||
* Sets whether boundary lines are drawn | * Sets whether boundary lines are drawn |
//+16 to avoid unnecessary, practically empty GraphicsData instances. | //+16 to avoid unnecessary, practically empty GraphicsData instances. | ||||
/** the graphics segment */ | /** the graphics segment */ | ||||
private GraphicsChainedSegment currentSegment = null; | |||||
private GraphicsChainedSegment currentSegment; | |||||
private boolean segmentedData; | private boolean segmentedData; | ||||
public static final byte COLOR_MODEL_YCBCR = (byte)0x12; | public static final byte COLOR_MODEL_YCBCR = (byte)0x12; | ||||
/** additive/subtractive setting for ASFLAG */ | /** additive/subtractive setting for ASFLAG */ | ||||
private boolean subtractive = false; | |||||
private boolean subtractive; | |||||
/** setting for GRAYCODE flag */ | /** setting for GRAYCODE flag */ | ||||
private boolean grayCoding = false; | |||||
private boolean grayCoding; | |||||
/** the image color model */ | /** the image color model */ | ||||
private byte colorModel = COLOR_MODEL_RGB; | private byte colorModel = COLOR_MODEL_RGB; |
public class ImageCellPosition extends AbstractAFPObject { | public class ImageCellPosition extends AbstractAFPObject { | ||||
/** offset of image cell in X direction */ | /** offset of image cell in X direction */ | ||||
private int xOffset = 0; | |||||
private int xOffset; | |||||
/** offset of image cell in Y direction */ | /** offset of image cell in Y direction */ | ||||
private int yOffset = 0; | |||||
private int yOffset; | |||||
/** size of image cell in X direction */ | /** size of image cell in X direction */ | ||||
private final byte[] xSize = new byte[] {(byte)0xFF, (byte)0xFF}; | private final byte[] xSize = new byte[] {(byte)0xFF, (byte)0xFF}; |
public static final byte COMPID_JPEG = (byte)0x83; | public static final byte COMPID_JPEG = (byte)0x83; | ||||
/** the image size parameter */ | /** the image size parameter */ | ||||
private ImageSizeParameter imageSizeParameter = null; | |||||
private ImageSizeParameter imageSizeParameter; | |||||
/** the IDE Structure parameter */ | /** the IDE Structure parameter */ | ||||
private IDEStructureParameter ideStructureParameter = null; | |||||
private IDEStructureParameter ideStructureParameter; | |||||
/** the image encoding */ | /** the image encoding */ | ||||
private byte encoding = (byte)0x03; | private byte encoding = (byte)0x03; |
public class ImageOutputControl extends AbstractAFPObject { | public class ImageOutputControl extends AbstractAFPObject { | ||||
/** the orientation of the image */ | /** the orientation of the image */ | ||||
private int orientation = 0; | |||||
private int orientation; | |||||
/** | /** | ||||
* Specifies the offset, along the X-axis, of the IM image object area | * Specifies the offset, along the X-axis, of the IM image object area | ||||
* origin to the origin of the including page | * origin to the origin of the including page | ||||
*/ | */ | ||||
private int xCoord = 0; | |||||
private int xCoord; | |||||
/** | /** | ||||
* Specifies the offset, along the Y-axis, of the IM image object area | * Specifies the offset, along the Y-axis, of the IM image object area | ||||
* origin to the origin of the including page | * origin to the origin of the including page | ||||
*/ | */ | ||||
private int yCoord = 0; | |||||
private int yCoord; | |||||
/** map an image point to a single presentation device */ | /** map an image point to a single presentation device */ | ||||
private boolean singlePoint = true; | private boolean singlePoint = true; |
/** | /** | ||||
* The ImageContent for the image segment | * The ImageContent for the image segment | ||||
*/ | */ | ||||
private ImageContent imageContent = null; | |||||
private ImageContent imageContent; | |||||
private final Factory factory; | private final Factory factory; | ||||
*/ | */ | ||||
public class ImageSizeParameter extends AbstractAFPObject { | public class ImageSizeParameter extends AbstractAFPObject { | ||||
private int hSize = 0; | |||||
private int vSize = 0; | |||||
private int hRes = 0; | |||||
private int vRes = 0; | |||||
private int hSize; | |||||
private int vSize; | |||||
private int hRes; | |||||
private int vRes; | |||||
/** | /** | ||||
* Constructor for a ImageSizeParameter for the specified | * Constructor for a ImageSizeParameter for the specified |
implements Startable, Completable { | implements Startable, Completable { | ||||
/** the object environment group */ | /** the object environment group */ | ||||
protected ObjectEnvironmentGroup objectEnvironmentGroup = null; | |||||
protected ObjectEnvironmentGroup objectEnvironmentGroup; | |||||
/** the object factory */ | /** the object factory */ | ||||
protected final Factory factory; | protected final Factory factory; |
public abstract class AbstractDescriptor extends AbstractTripletStructuredObject { | public abstract class AbstractDescriptor extends AbstractTripletStructuredObject { | ||||
/** width of this descriptor */ | /** width of this descriptor */ | ||||
protected int width = 0; | |||||
protected int width; | |||||
/** height of this descriptor */ | /** height of this descriptor */ | ||||
protected int height = 0; | |||||
protected int height; | |||||
/** width resolution of this descriptor */ | /** width resolution of this descriptor */ | ||||
protected int widthRes = 0; | |||||
protected int widthRes; | |||||
/** height resolution of this descriptor */ | /** height resolution of this descriptor */ | ||||
protected int heightRes = 0; | |||||
protected int heightRes; | |||||
/** | /** | ||||
* Default constructor | * Default constructor |
protected final List mapDataResources = null; | protected final List mapDataResources = null; | ||||
/** the collection of MapPageOverlay objects */ | /** the collection of MapPageOverlay objects */ | ||||
protected List mapPageOverlays = null; | |||||
protected List mapPageOverlays; | |||||
/** | /** | ||||
* Main constructor | * Main constructor |
/** | /** | ||||
* The actual name of the object | * The actual name of the object | ||||
*/ | */ | ||||
protected String name = null; | |||||
protected String name; | |||||
/** | /** | ||||
* Default constructor | * Default constructor |
public abstract class AbstractPageObject extends AbstractNamedAFPObject implements Completable { | public abstract class AbstractPageObject extends AbstractNamedAFPObject implements Completable { | ||||
/** The active environment group for the page */ | /** The active environment group for the page */ | ||||
protected ActiveEnvironmentGroup activeEnvironmentGroup = null; | |||||
protected ActiveEnvironmentGroup activeEnvironmentGroup; | |||||
/** The current presentation text object */ | /** The current presentation text object */ | ||||
private PresentationTextObject currentPresentationTextObject = null; | |||||
private PresentationTextObject currentPresentationTextObject; | |||||
/** The list of objects within this resource container */ | /** The list of objects within this resource container */ | ||||
protected List/*<AbstractStructuredObject>*/ objects = new java.util.ArrayList(); | protected List/*<AbstractStructuredObject>*/ objects = new java.util.ArrayList(); | ||||
private int height; | private int height; | ||||
/** The page rotation */ | /** The page rotation */ | ||||
protected int rotation = 0; | |||||
protected int rotation; | |||||
/** The page state */ | /** The page state */ | ||||
protected boolean complete = false; | |||||
protected boolean complete; | |||||
/** The width resolution */ | /** The width resolution */ | ||||
private int widthRes; | private int widthRes; |
/** | /** | ||||
* The resource environment group used to store complex resources | * The resource environment group used to store complex resources | ||||
*/ | */ | ||||
protected ResourceEnvironmentGroup resourceEnvironmentGroup = null; | |||||
protected ResourceEnvironmentGroup resourceEnvironmentGroup; | |||||
/** | /** | ||||
* Main constructor | * Main constructor |
implements Streamable { | implements Streamable { | ||||
/** The container started state */ | /** The container started state */ | ||||
protected boolean started = false; | |||||
protected boolean started; | |||||
/** the resource group object */ | /** the resource group object */ | ||||
protected ResourceGroup resourceGroup = null; | |||||
protected ResourceGroup resourceGroup; | |||||
/** | /** | ||||
* Default constructor | * Default constructor |
= new java.util.ArrayList/*<MapCodedFonts>*/(); | = new java.util.ArrayList/*<MapCodedFonts>*/(); | ||||
/** the collection of MapPageSegments objects */ | /** the collection of MapPageSegments objects */ | ||||
private List mapPageSegments = null; | |||||
private List mapPageSegments; | |||||
/** the Object Area Descriptor for the active environment group */ | /** the Object Area Descriptor for the active environment group */ | ||||
private ObjectAreaDescriptor objectAreaDescriptor = null; | |||||
private ObjectAreaDescriptor objectAreaDescriptor; | |||||
/** the Object Area Position for the active environment group */ | /** the Object Area Position for the active environment group */ | ||||
private ObjectAreaPosition objectAreaPosition = null; | |||||
private ObjectAreaPosition objectAreaPosition; | |||||
/** the PresentationTextDescriptor for the active environment group */ | /** the PresentationTextDescriptor for the active environment group */ | ||||
private PresentationTextDescriptor presentationTextDataDescriptor = null; | |||||
private PresentationTextDescriptor presentationTextDataDescriptor; | |||||
/** the PageDescriptor for the active environment group */ | /** the PageDescriptor for the active environment group */ | ||||
private PageDescriptor pageDescriptor = null; | |||||
private PageDescriptor pageDescriptor; | |||||
/** the resource manager */ | /** the resource manager */ | ||||
private final Factory factory; | private final Factory factory; |
public class GraphicsObject extends AbstractDataObject { | public class GraphicsObject extends AbstractDataObject { | ||||
/** the graphics data */ | /** the graphics data */ | ||||
private GraphicsData currentData = null; | |||||
private GraphicsData currentData; | |||||
/** list of objects contained within this container */ | /** list of objects contained within this container */ | ||||
protected List<GraphicsData> objects | protected List<GraphicsData> objects | ||||
/** color converter */ | /** color converter */ | ||||
private ColorConverter colorConverter = null; | |||||
private ColorConverter colorConverter; | |||||
/** | /** | ||||
* Default constructor | * Default constructor |
/** | /** | ||||
* The image output control | * The image output control | ||||
*/ | */ | ||||
private ImageOutputControl imageOutputControl = null; | |||||
private ImageOutputControl imageOutputControl; | |||||
/** | /** | ||||
* The image input descriptor | * The image input descriptor | ||||
*/ | */ | ||||
private ImageInputDescriptor imageInputDescriptor = null; | |||||
private ImageInputDescriptor imageInputDescriptor; | |||||
/** | /** | ||||
* The image cell position | * The image cell position | ||||
*/ | */ | ||||
private ImageCellPosition imageCellPosition = null; | |||||
private ImageCellPosition imageCellPosition; | |||||
/** | /** | ||||
* The image rastor data | * The image rastor data | ||||
*/ | */ | ||||
private ImageRasterData imageRasterData = null; | |||||
private ImageRasterData imageRasterData; | |||||
/** | /** | ||||
* Constructor for the image object with the specified name, | * Constructor for the image object with the specified name, |
private static final int MAX_DATA_LEN = 8192; | private static final int MAX_DATA_LEN = 8192; | ||||
/** the image segment */ | /** the image segment */ | ||||
private ImageSegment imageSegment = null; | |||||
private ImageSegment imageSegment; | |||||
/** | /** | ||||
* Constructor for the image object with the specified name, | * Constructor for the image object with the specified name, |
private byte objectType = TYPE_OTHER; | private byte objectType = TYPE_OTHER; | ||||
/** the X-axis origin of the object area */ | /** the X-axis origin of the object area */ | ||||
private int xoaOset = 0; | |||||
private int xoaOset; | |||||
/** the Y-axis origin of the object area */ | /** the Y-axis origin of the object area */ | ||||
private int yoaOset = 0; | |||||
private int yoaOset; | |||||
/** the orientation of the referenced object */ | /** the orientation of the referenced object */ | ||||
private AxisOrientation oaOrent = AxisOrientation.RIGHT_HANDED_0; | private AxisOrientation oaOrent = AxisOrientation.RIGHT_HANDED_0; |
/** | /** | ||||
* The x coordinate | * The x coordinate | ||||
*/ | */ | ||||
private int x = 0; | |||||
private int x; | |||||
/** | /** | ||||
* The y coordinate | * The y coordinate | ||||
*/ | */ | ||||
private int y = 0; | |||||
private int y; | |||||
/** | /** | ||||
* The orientation | * The orientation | ||||
*/ | */ | ||||
private int orientation = 0; | |||||
private int orientation; | |||||
/** | /** | ||||
* Constructor for the Include Page Overlay | * Constructor for the Include Page Overlay |
/** | /** | ||||
* The scale (only specified for outline fonts) | * The scale (only specified for outline fonts) | ||||
*/ | */ | ||||
private int scale = 0; | |||||
private int scale; | |||||
} | } | ||||
} | } |
/** | /** | ||||
* The collection of overlays (maximum of 254 stored as byte[]) | * The collection of overlays (maximum of 254 stored as byte[]) | ||||
*/ | */ | ||||
private List overLays = null; | |||||
private List overLays; | |||||
/** | /** | ||||
* Constructor for the Map Page Overlay | * Constructor for the Map Page Overlay |
/** | /** | ||||
* The collection of page segments (maximum of 127 stored as String) | * The collection of page segments (maximum of 127 stored as String) | ||||
*/ | */ | ||||
private Set pageSegments = null; | |||||
private Set pageSegments; | |||||
/** | /** | ||||
* Constructor for the Map Page Overlay | * Constructor for the Map Page Overlay |
*/ | */ | ||||
public class PageSegment extends AbstractNamedAFPObject { | public class PageSegment extends AbstractNamedAFPObject { | ||||
private List/*<AbstractAFPObject>*/ objects = null; | |||||
private List/*<AbstractAFPObject>*/ objects; | |||||
/** | /** | ||||
* Main constructor | * Main constructor |
private static final byte TYPE_IMAGE = (byte)0xFB; | private static final byte TYPE_IMAGE = (byte)0xFB; | ||||
private byte objType = TYPE_OTHER; | private byte objType = TYPE_OTHER; | ||||
private byte objOrent = 0; // object always processed at 0 degree orientation | |||||
private byte objOrent; // object always processed at 0 degree orientation | |||||
private int objXOffset = -1; | private int objXOffset = -1; | ||||
private int objYOffset = -1; | private int objYOffset = -1; | ||||
/** | /** | ||||
* The current presentation text data | * The current presentation text data | ||||
*/ | */ | ||||
private PresentationTextData currentPresentationTextData = null; | |||||
private PresentationTextData currentPresentationTextData; | |||||
/** | /** | ||||
* The presentation text data list | * The presentation text data list | ||||
*/ | */ | ||||
private List/*<PresentationTextData>*/ presentationTextDataList = null; | |||||
private List/*<PresentationTextData>*/ presentationTextDataList; | |||||
private PtocaBuilder builder = new DefaultBuilder(); | private PtocaBuilder builder = new DefaultBuilder(); | ||||
= Collections.synchronizedMap(new HashMap<String, ObjectType>()); | = Collections.synchronizedMap(new HashMap<String, ObjectType>()); | ||||
/** singleton instance */ | /** singleton instance */ | ||||
private static Registry instance = null; | |||||
private static Registry instance; | |||||
/** | /** | ||||
* Returns a single instance of a MO:DCA Registry | * Returns a single instance of a MO:DCA Registry |
private static final String DEFAULT_NAME = "REG00001"; | private static final String DEFAULT_NAME = "REG00001"; | ||||
/** the pre-process presentation objects contained in this resource environment group */ | /** the pre-process presentation objects contained in this resource environment group */ | ||||
private List/*<PreprocessPresentationObject>*/ preProcessPresentationObjects = null; | |||||
private List/*<PreprocessPresentationObject>*/ preProcessPresentationObjects; | |||||
/** the resource environment group state */ | /** the resource environment group state */ | ||||
private boolean complete = false; | |||||
private boolean complete; | |||||
/** | /** | ||||
* Default constructor | * Default constructor |
/** the outputstream to write to */ | /** the outputstream to write to */ | ||||
private final OutputStream os; | private final OutputStream os; | ||||
private boolean started = false; | |||||
private boolean started; | |||||
private boolean complete = false; | |||||
private boolean complete; | |||||
/** | /** | ||||
* Main constructor | * Main constructor |
private int currentFont = Integer.MIN_VALUE; | private int currentFont = Integer.MIN_VALUE; | ||||
/** the current orientation */ | /** the current orientation */ | ||||
private int currentOrientation = 0; | |||||
private int currentOrientation; | |||||
/** the current color */ | /** the current color */ | ||||
private Color currentColor = Color.BLACK; | private Color currentColor = Color.BLACK; | ||||
/** the current variable space increment */ | /** the current variable space increment */ | ||||
private int currentVariableSpaceCharacterIncrement = 0; | |||||
private int currentVariableSpaceCharacterIncrement; | |||||
/** the current inter character adjustment */ | /** the current inter character adjustment */ | ||||
private int currentInterCharacterAdjustment = 0; | |||||
private int currentInterCharacterAdjustment; | |||||
/** | /** |
private static Log log = LogFactory.getLog(AFPTextHandler.class); | private static Log log = LogFactory.getLog(AFPTextHandler.class); | ||||
/** Overriding FontState */ | /** Overriding FontState */ | ||||
protected Font overrideFont = null; | |||||
protected Font overrideFont; | |||||
/** Font information */ | /** Font information */ | ||||
private final FontInfo fontInfo; | private final FontInfo fontInfo; |
/** | /** | ||||
* The input stream to read | * The input stream to read | ||||
*/ | */ | ||||
private InputStream inputStream = null; | |||||
private InputStream inputStream; | |||||
/** | /** | ||||
* The constructor for the StructuredFieldReader | * The constructor for the StructuredFieldReader |
private float targetResolution = FopFactoryConfig.DEFAULT_TARGET_RESOLUTION; | private float targetResolution = FopFactoryConfig.DEFAULT_TARGET_RESOLUTION; | ||||
private Map rendererOptions = new java.util.HashMap(); | private Map rendererOptions = new java.util.HashMap(); | ||||
private File outputFile = null; | |||||
private IFDocumentHandler documentHandlerOverride = null; | |||||
private Renderer rendererOverride = null; | |||||
private FOEventHandler foEventHandlerOverride = null; | |||||
private File outputFile; | |||||
private IFDocumentHandler documentHandlerOverride; | |||||
private Renderer rendererOverride; | |||||
private FOEventHandler foEventHandlerOverride; | |||||
private boolean locatorEnabled = true; // true by default (for error messages). | private boolean locatorEnabled = true; // true by default (for error messages). | ||||
private boolean conserveMemoryPolicy = false; | |||||
private boolean conserveMemoryPolicy; | |||||
private EventBroadcaster eventBroadcaster = new FOPEventBroadcaster(); | private EventBroadcaster eventBroadcaster = new FOPEventBroadcaster(); | ||||
private StructureTreeEventHandler structureTreeEventHandler | private StructureTreeEventHandler structureTreeEventHandler | ||||
= DummyStructureTreeEventHandler.INSTANCE; | = DummyStructureTreeEventHandler.INSTANCE; | ||||
/** Creator: Metadata element for the user that created the | /** Creator: Metadata element for the user that created the | ||||
* document. (Some renderers can store this in the document.) | * document. (Some renderers can store this in the document.) | ||||
*/ | */ | ||||
protected String creator = null; | |||||
protected String creator; | |||||
/** Creation Date: Override of the date the document was created. | /** Creation Date: Override of the date the document was created. | ||||
* (Some renderers can store this in the document.) | * (Some renderers can store this in the document.) | ||||
*/ | */ | ||||
protected Date creationDate = null; | |||||
protected Date creationDate; | |||||
/** Author of the content of the document. */ | /** Author of the content of the document. */ | ||||
protected String author = null; | |||||
protected String author; | |||||
/** Title of the document. */ | /** Title of the document. */ | ||||
protected String title = null; | |||||
protected String title; | |||||
/** Subject of the document. */ | /** Subject of the document. */ | ||||
protected String subject = null; | |||||
protected String subject; | |||||
/** Set of keywords applicable to this document. */ | /** Set of keywords applicable to this document. */ | ||||
protected String keywords = null; | |||||
protected String keywords; | |||||
private final ImageSessionContext imageSessionContext; | private final ImageSessionContext imageSessionContext; | ||||
public class Fop { | public class Fop { | ||||
// desired output format: MIME type such as "application/pdf", "application/postscript" etc. | // desired output format: MIME type such as "application/pdf", "application/postscript" etc. | ||||
private String outputFormat = null; | |||||
private String outputFormat; | |||||
// output stream to send results to | // output stream to send results to | ||||
private OutputStream stream = null; | |||||
private OutputStream stream; | |||||
// FOUserAgent object to set processing options | // FOUserAgent object to set processing options | ||||
private final FOUserAgent foUserAgent; | private final FOUserAgent foUserAgent; | ||||
// FOTreeBuilder object to maintain reference for access to results | // FOTreeBuilder object to maintain reference for access to results | ||||
private FOTreeBuilder foTreeBuilder = null; | |||||
private FOTreeBuilder foTreeBuilder; | |||||
/** | /** | ||||
* Constructor for use with already-created FOUserAgents. It uses MIME types to select the | * Constructor for use with already-created FOUserAgents. It uses MIME types to select the |
/** | /** | ||||
* Map of configured names of hyphenation pattern file names: ll_CC => name | * Map of configured names of hyphenation pattern file names: ll_CC => name | ||||
*/ | */ | ||||
private Map/*<String,String>*/ hyphPatNames = null; | |||||
private Map/*<String,String>*/ hyphPatNames; | |||||
/** | /** | ||||
* FOP has the ability, for some FO's, to continue processing even if the | * FOP has the ability, for some FO's, to continue processing even if the |
*/ | */ | ||||
public class FormattingResults { | public class FormattingResults { | ||||
private int pageCount = 0; | |||||
private List pageSequences = null; | |||||
private int pageCount; | |||||
private List pageSequences; | |||||
/** | /** | ||||
* Constructor for the FormattingResults object | * Constructor for the FormattingResults object |
private static Log log = LogFactory.getLog(AreaTreeHandler.class); | private static Log log = LogFactory.getLog(AreaTreeHandler.class); | ||||
// Recorder of debug statistics | // Recorder of debug statistics | ||||
private Statistics statistics = null; | |||||
private Statistics statistics; | |||||
// The LayoutManager maker | // The LayoutManager maker | ||||
private LayoutManagerMaker lmMaker; | private LayoutManagerMaker lmMaker; | ||||
private TopLevelLayoutManager prevPageSeqLM; | private TopLevelLayoutManager prevPageSeqLM; | ||||
private int idGen = 0; | |||||
private int idGen; | |||||
/** | /** | ||||
* Constructor. | * Constructor. |
* the life of the area tree model. | * the life of the area tree model. | ||||
*/ | */ | ||||
public class AreaTreeModel { | public class AreaTreeModel { | ||||
private List<PageSequence> pageSequenceList = null; | |||||
private int currentPageIndex = 0; | |||||
private List<PageSequence> pageSequenceList; | |||||
private int currentPageIndex; | |||||
/** the current page sequence */ | /** the current page sequence */ | ||||
protected PageSequence currentPageSequence; | protected PageSequence currentPageSequence; |
public abstract class AreaTreeObject implements Cloneable { | public abstract class AreaTreeObject implements Cloneable { | ||||
/** Foreign attributes */ | /** Foreign attributes */ | ||||
protected Map<QName, String> foreignAttributes = null; | |||||
protected Map<QName, String> foreignAttributes; | |||||
/** Extension attachments */ | /** Extension attachments */ | ||||
protected List<ExtensionAttachment> extensionAttachments = null; | |||||
protected List<ExtensionAttachment> extensionAttachments; | |||||
/** {@inheritDoc} */ | /** {@inheritDoc} */ | ||||
public Object clone() throws CloneNotSupportedException { | public Object clone() throws CloneNotSupportedException { |
// this is an optional block area that will be rendered | // this is an optional block area that will be rendered | ||||
// as the separator only if there are float areas | // as the separator only if there are float areas | ||||
private Block separator = null; | |||||
private Block separator; | |||||
/** | /** | ||||
* Set the separator area for this before float. | * Set the separator area for this before float. |
* Used for relative (serves as left-offset trait) and absolute positioning | * Used for relative (serves as left-offset trait) and absolute positioning | ||||
* (serves as left-position trait). | * (serves as left-position trait). | ||||
*/ | */ | ||||
protected int xOffset = 0; | |||||
protected int xOffset; | |||||
/** | /** | ||||
* The y offset position of this block parent. | * The y offset position of this block parent. | ||||
* Used for relative (serves as top-offset trait) and absolute positioning | * Used for relative (serves as top-offset trait) and absolute positioning | ||||
* (serves as top-position trait). | * (serves as top-position trait). | ||||
*/ | */ | ||||
protected int yOffset = 0; | |||||
protected int yOffset; | |||||
/** | /** | ||||
* The children of this block parent area. | * The children of this block parent area. | ||||
*/ | */ | ||||
protected List<Area> children = null; | |||||
protected List<Area> children; | |||||
/** {@inheritDoc} */ | /** {@inheritDoc} */ | ||||
@Override | @Override |
private static final long serialVersionUID = -7840580922580735157L; | private static final long serialVersionUID = -7840580922580735157L; | ||||
// clipping for this viewport | // clipping for this viewport | ||||
private boolean clip = false; | |||||
private boolean clip; | |||||
// transform if rotated or absolute | // transform if rotated or absolute | ||||
private CTM viewportCTM; | private CTM viewportCTM; | ||||
private List<BookmarkData> subData = new java.util.ArrayList<BookmarkData>(); | private List<BookmarkData> subData = new java.util.ArrayList<BookmarkData>(); | ||||
// bookmark-title for this fo:bookmark | // bookmark-title for this fo:bookmark | ||||
private String bookmarkTitle = null; | |||||
private String bookmarkTitle; | |||||
// indicator of whether to initially display/hide child bookmarks of this object | // indicator of whether to initially display/hide child bookmarks of this object | ||||
private boolean showChildren = true; | private boolean showChildren = true; | ||||
private String idRef; | private String idRef; | ||||
// PageViewport that the idRef item refers to | // PageViewport that the idRef item refers to | ||||
private PageViewport pageRef = null; | |||||
private PageViewport pageRef; | |||||
// unresolved idrefs by this bookmark and child bookmarks below it | // unresolved idrefs by this bookmark and child bookmarks below it | ||||
private Map<String, List<Resolvable>> unresolvedIDRefs | private Map<String, List<Resolvable>> unresolvedIDRefs |
private String[] idRefs; | private String[] idRefs; | ||||
// PageViewport that the idRef item refers to | // PageViewport that the idRef item refers to | ||||
private PageViewport pageRef = null; | |||||
private PageViewport pageRef; | |||||
/** | /** | ||||
* Create a new pdf destination data object. | * Create a new pdf destination data object. |
private static final long serialVersionUID = -7907428219886367161L; | private static final long serialVersionUID = -7907428219886367161L; | ||||
private Block separator = null; | |||||
private Block separator; | |||||
// footnote has an optional separator | // footnote has an optional separator | ||||
// and a list of sub block areas that can be added/removed | // and a list of sub block areas that can be added/removed |
} | } | ||||
} | } | ||||
private LineAdjustingInfo adjustingInfo = null; | |||||
private LineAdjustingInfo adjustingInfo; | |||||
// this class can contain the dominant char styling info | // this class can contain the dominant char styling info | ||||
// this means that many renderers can optimise a bit | // this means that many renderers can optimise a bit |
private static final long serialVersionUID = -7102134165192960718L; | private static final long serialVersionUID = -7102134165192960718L; | ||||
private boolean resolved = false; | |||||
private boolean resolved; | |||||
private String idRef; | private String idRef; | ||||
private Area area; | private Area area; | ||||
private transient List<Resolvable> dependents = null; | |||||
private transient List<Resolvable> dependents; | |||||
/** | /** | ||||
* Create a new link resolver. | * Create a new link resolver. |
private static final long serialVersionUID = 6272157047421543866L; | private static final long serialVersionUID = 6272157047421543866L; | ||||
// contains before, start, body, end and after regions | // contains before, start, body, end and after regions | ||||
private RegionViewport regionBefore = null; | |||||
private RegionViewport regionStart = null; | |||||
private RegionViewport regionBody = null; | |||||
private RegionViewport regionEnd = null; | |||||
private RegionViewport regionAfter = null; | |||||
private RegionViewport regionBefore; | |||||
private RegionViewport regionStart; | |||||
private RegionViewport regionBody; | |||||
private RegionViewport regionEnd; | |||||
private RegionViewport regionAfter; | |||||
// temporary map of unresolved objects used when serializing the page | // temporary map of unresolved objects used when serializing the page | ||||
private Map<String, List<Resolvable>> unresolved = null; | |||||
private Map<String, List<Resolvable>> unresolved; | |||||
/** Set to true to make this page behave as if it were not empty. */ | /** Set to true to make this page behave as if it were not empty. */ | ||||
private boolean fakeNonEmpty = false; | |||||
private boolean fakeNonEmpty; | |||||
/** | /** | ||||
* Empty constructor | * Empty constructor |
private String pageKey; | private String pageKey; | ||||
private int pageNumber = -1; | private int pageNumber = -1; | ||||
private String pageNumberString = null; | |||||
private String pageNumberString; | |||||
private int pageIndex = -1; //-1 = undetermined | private int pageIndex = -1; //-1 = undetermined | ||||
private boolean blank; | private boolean blank; | ||||
private Map<String, List<Resolvable>> unresolvedIDRefs | private Map<String, List<Resolvable>> unresolvedIDRefs | ||||
= new java.util.HashMap<String, List<Resolvable>>(); | = new java.util.HashMap<String, List<Resolvable>>(); | ||||
private Map<String, List<PageViewport>> pendingResolved = null; | |||||
private Map<String, List<PageViewport>> pendingResolved; | |||||
private Markers pageMarkers; | private Markers pageMarkers; | ||||
// this rectangle is relative to the page | // this rectangle is relative to the page | ||||
private RegionReference regionReference; | private RegionReference regionReference; | ||||
private Rectangle2D viewArea; | private Rectangle2D viewArea; | ||||
private boolean clip = false; | |||||
private boolean clip; | |||||
/** | /** | ||||
* Create a new region-viewport-area | * Create a new region-viewport-area |
private static final long serialVersionUID = 8452078676273242870L; | private static final long serialVersionUID = 8452078676273242870L; | ||||
/** The background color if any. */ | /** The background color if any. */ | ||||
private Color color = null; | |||||
private Color color; | |||||
/** The background image url if any. */ | /** The background image url if any. */ | ||||
private String url = null; | |||||
private String url; | |||||
/** The background image if any. */ | /** The background image if any. */ | ||||
private ImageInfo imageInfo = null; | |||||
private ImageInfo imageInfo; | |||||
/** Background repeat enum for images. */ | /** Background repeat enum for images. */ | ||||
private int repeat; | private int repeat; |
* and the default width of a space according to the font | * and the default width of a space according to the font | ||||
* (this is equivalent to the property word-spacing.optimum) | * (this is equivalent to the property word-spacing.optimum) | ||||
*/ | */ | ||||
protected int spaceDifference = 0; | |||||
protected int spaceDifference; | |||||
/** | /** | ||||
* Constructor | * Constructor | ||||
} | } | ||||
} | } | ||||
private int textWordSpaceAdjust = 0; | |||||
private int textLetterSpaceAdjust = 0; | |||||
private TextAdjustingInfo textAdjustingInfo = null; | |||||
private int baselineOffset = 0; | |||||
private int textWordSpaceAdjust; | |||||
private int textLetterSpaceAdjust; | |||||
private TextAdjustingInfo textAdjustingInfo; | |||||
private int baselineOffset; | |||||
/** | /** | ||||
* Default constructor | * Default constructor |
/** | /** | ||||
* offset position from before edge of parent area | * offset position from before edge of parent area | ||||
*/ | */ | ||||
protected int blockProgressionOffset = 0; | |||||
protected int blockProgressionOffset; | |||||
/** | /** | ||||
* parent area | * parent area | ||||
* it is needed in order to recompute adjust ratio and indents | * it is needed in order to recompute adjust ratio and indents | ||||
* when a page-number or a page-number-citation is resolved | * when a page-number or a page-number-citation is resolved | ||||
*/ | */ | ||||
private Area parentArea = null; | |||||
private Area parentArea; | |||||
/** | /** | ||||
* ipd variation of child areas: if this area has not already | * ipd variation of child areas: if this area has not already | ||||
* been added and cannot notify its parent area, store the variation | * been added and cannot notify its parent area, store the variation | ||||
* and wait for the parent area to be set | * and wait for the parent area to be set | ||||
*/ | */ | ||||
private int storedIPDVariation = 0; | |||||
private int storedIPDVariation; | |||||
/** | /** | ||||
* The adjustment information object | * The adjustment information object | ||||
*/ | */ | ||||
protected InlineAdjustingInfo adjustingInfo = null; | |||||
protected InlineAdjustingInfo adjustingInfo; | |||||
/** | /** | ||||
* Default constructor for inline area. | * Default constructor for inline area. |
/** | /** | ||||
* The list of inline areas added to this inline parent. | * The list of inline areas added to this inline parent. | ||||
*/ | */ | ||||
protected Block child = null; | |||||
protected Block child; | |||||
/** | /** | ||||
* Create a new inline block parent to add areas to. | * Create a new inline block parent to add areas to. |
// contents could be container, foreign object or image | // contents could be container, foreign object or image | ||||
private Area content; | private Area content; | ||||
// clipping for the viewport | // clipping for the viewport | ||||
private boolean clip = false; | |||||
private boolean clip; | |||||
// position of the child area relative to this area | // position of the child area relative to this area | ||||
private Rectangle2D contentPosition; | private Rectangle2D contentPosition; | ||||
private static final long serialVersionUID = -1758090835371647980L; | private static final long serialVersionUID = -1758090835371647980L; | ||||
private boolean resolved = false; | |||||
private boolean resolved; | |||||
private String pageIDRef; | private String pageIDRef; | ||||
private String text; | private String text; | ||||
private boolean pageType; | private boolean pageType; |
/* for area tree XML output, only down to block area level */ | /* for area tree XML output, only down to block area level */ | ||||
private Boolean suppressLowLevelAreas = Boolean.FALSE; | private Boolean suppressLowLevelAreas = Boolean.FALSE; | ||||
/* user configuration file */ | /* user configuration file */ | ||||
private File userConfigFile = null; | |||||
private File userConfigFile; | |||||
/* input fo file */ | /* input fo file */ | ||||
private File fofile = null; | |||||
private File fofile; | |||||
/* xsltfile (xslt transformation as input) */ | /* xsltfile (xslt transformation as input) */ | ||||
private File xsltfile = null; | |||||
private File xsltfile; | |||||
/* xml file (xslt transformation as input) */ | /* xml file (xslt transformation as input) */ | ||||
private File xmlfile = null; | |||||
private File xmlfile; | |||||
/* area tree input file */ | /* area tree input file */ | ||||
private File areatreefile = null; | |||||
private File areatreefile; | |||||
/* intermediate format input file */ | /* intermediate format input file */ | ||||
private File iffile = null; | |||||
private File iffile; | |||||
/* area tree input file */ | /* area tree input file */ | ||||
private File imagefile = null; | |||||
private File imagefile; | |||||
/* output file */ | /* output file */ | ||||
private File outfile = null; | |||||
private File outfile; | |||||
/* input mode */ | /* input mode */ | ||||
private int inputmode = NOT_SET; | private int inputmode = NOT_SET; | ||||
/* output mode */ | /* output mode */ | ||||
private String outputmode = null; | |||||
private String outputmode; | |||||
/* true if System.in (stdin) should be used for the input file */ | /* true if System.in (stdin) should be used for the input file */ | ||||
private boolean useStdIn = false; | |||||
private boolean useStdIn; | |||||
/* true if System.out (stdout) should be used for the output file */ | /* true if System.out (stdout) should be used for the output file */ | ||||
private boolean useStdOut = false; | |||||
private boolean useStdOut; | |||||
/* true if a catalog resolver should be used for entity and uri resolution */ | /* true if a catalog resolver should be used for entity and uri resolution */ | ||||
private boolean useCatalogResolver = false; | |||||
private boolean useCatalogResolver; | |||||
/* rendering options (for the user agent) */ | /* rendering options (for the user agent) */ | ||||
private Map renderingOptions = new java.util.HashMap(); | private Map renderingOptions = new java.util.HashMap(); | ||||
/* target resolution (for the user agent) */ | /* target resolution (for the user agent) */ | ||||
private boolean strictValidation = true; | private boolean strictValidation = true; | ||||
/* control memory-conservation policy */ | /* control memory-conservation policy */ | ||||
private boolean conserveMemoryPolicy = false; | |||||
private boolean conserveMemoryPolicy; | |||||
/* true if a complex script features are enabled */ | /* true if a complex script features are enabled */ | ||||
private boolean useComplexScriptFeatures = true; | private boolean useComplexScriptFeatures = true; | ||||
/* set to true if -dpi used in command line */ | /* set to true if -dpi used in command line */ | ||||
private boolean overrideTargetResolution = false; | |||||
private boolean overrideTargetResolution; | |||||
private FopFactory factory; | private FopFactory factory; | ||||
private FOUserAgent foUserAgent; | private FOUserAgent foUserAgent; | ||||
private Log log; | private Log log; | ||||
private Vector xsltParams = null; | |||||
private Vector xsltParams; | |||||
private String mimicRenderer = null; | |||||
private String mimicRenderer; | |||||
private boolean flushCache = false; | |||||
private boolean flushCache; | |||||
private URI baseURI = new File(".").getAbsoluteFile().toURI(); | private URI baseURI = new File(".").getAbsoluteFile().toURI(); | ||||
protected File sourcefile; | protected File sourcefile; | ||||
private File stylesheet; // for XML/XSLT usage | private File stylesheet; // for XML/XSLT usage | ||||
private Vector xsltParams; // for XML/XSLT usage | private Vector xsltParams; // for XML/XSLT usage | ||||
private EntityResolver entityResolver = null; | |||||
private URIResolver uriResolver = null; | |||||
private EntityResolver entityResolver; | |||||
private URIResolver uriResolver; | |||||
/** the logger */ | /** the logger */ | ||||
protected Log log = LogFactory.getLog(InputHandler.class); | protected Log log = LogFactory.getLog(InputHandler.class); |
/** range mapping table base class */ | /** range mapping table base class */ | ||||
protected abstract static class RangeMappingTable extends GlyphMappingTable { | protected abstract static class RangeMappingTable extends GlyphMappingTable { | ||||
private int[] sa = null; // array of range (inclusive) starts | |||||
private int[] ea = null; // array of range (inclusive) ends | |||||
private int[] ma = null; // array of range mapped values | |||||
private int[] sa; // array of range (inclusive) starts | |||||
private int[] ea; // array of range (inclusive) ends | |||||
private int[] ma; // array of range mapped values | |||||
private int miMax = -1; | private int miMax = -1; | ||||
/** | /** | ||||
* Construct range mapping table. | * Construct range mapping table. |
} | } | ||||
} | } | ||||
private static Map<Integer, String> scriptTagsMap = null; | |||||
private static Map<String, Integer> scriptCodeMap = null; | |||||
private static Map<Integer, String> scriptTagsMap; | |||||
private static Map<String, Integer> scriptCodeMap; | |||||
private static void putScriptTag(Map tm, Map cm, int code, String tag) { | private static void putScriptTag(Map tm, Map cm, int code, String tag) { | ||||
assert tag != null; | assert tag != null; |
/** constant for a user-settable keep-with value (??) */ | /** constant for a user-settable keep-with value (??) */ | ||||
public static final String KEEP_WITH_VALUE = "KEEP_WITH_VALUE"; | public static final String KEEP_WITH_VALUE = "KEEP_WITH_VALUE"; | ||||
private String type = KEEP_WITH_AUTO; | private String type = KEEP_WITH_AUTO; | ||||
private int value = 0; | |||||
private int value; | |||||
/** | /** | ||||
* Constructor | * Constructor |
return 100000; | return 100000; | ||||
} | } | ||||
private static PercentBaseContext pseudoContextForValidation = null; | |||||
private static PercentBaseContext pseudoContextForValidation; | |||||
/** @return a base context for validation purposes. See class description. */ | /** @return a base context for validation purposes. See class description. */ | ||||
public static PercentBaseContext getPseudoContext() { | public static PercentBaseContext getPseudoContext() { |
public static final String DEFAULT = "<default>"; | public static final String DEFAULT = "<default>"; | ||||
/** The HashMap table of formatting objects defined by the ElementMapping */ | /** The HashMap table of formatting objects defined by the ElementMapping */ | ||||
protected HashMap<String, Maker> foObjs = null; | |||||
protected HashMap<String, Maker> foObjs; | |||||
//Please don't change that to java.util.Map as that can break extensions. | //Please don't change that to java.util.Map as that can break extensions. | ||||
/** The namespace for the ElementMapping */ | /** The namespace for the ElementMapping */ | ||||
protected String namespaceURI = null; | |||||
protected String namespaceURI; | |||||
/** | /** | ||||
* Returns a HashMap of maker objects for this element mapping | * Returns a HashMap of maker objects for this element mapping |
private static Map<String, Integer> subPropNames = new HashMap<String, Integer>(); | private static Map<String, Integer> subPropNames = new HashMap<String, Integer>(); | ||||
private static Map<Integer, String> propIds = new HashMap<Integer, String>(); | private static Map<Integer, String> propIds = new HashMap<Integer, String>(); | ||||
private static PropertyMaker[] generics = null; | |||||
private static PropertyMaker[] generics; | |||||
// The rest is only used during the building of the generics array. | // The rest is only used during the building of the generics array. | ||||
private Property[] enums = null; | |||||
private PropertyMaker genericColor = null; | |||||
private PropertyMaker genericBoolean = null; | |||||
private PropertyMaker genericKeep = null; | |||||
private PropertyMaker genericCondLength = null; | |||||
private PropertyMaker genericCondPadding = null; | |||||
private PropertyMaker genericPadding = null; | |||||
private PropertyMaker genericCondBorderWidth = null; | |||||
private PropertyMaker genericBorderWidth = null; | |||||
private PropertyMaker genericBorderStyle = null; | |||||
private PropertyMaker genericCondCornerRadius = null; | |||||
private PropertyMaker genericBreak = null; | |||||
private PropertyMaker genericSpace = null; | |||||
private Property[] enums; | |||||
private PropertyMaker genericColor; | |||||
private PropertyMaker genericBoolean; | |||||
private PropertyMaker genericKeep; | |||||
private PropertyMaker genericCondLength; | |||||
private PropertyMaker genericCondPadding; | |||||
private PropertyMaker genericPadding; | |||||
private PropertyMaker genericCondBorderWidth; | |||||
private PropertyMaker genericBorderWidth; | |||||
private PropertyMaker genericBorderStyle; | |||||
private PropertyMaker genericCondCornerRadius; | |||||
private PropertyMaker genericBreak; | |||||
private PropertyMaker genericSpace; | |||||
/** | /** | ||||
* Create the generic property maker templates. These templates | * Create the generic property maker templates. These templates |
* Points to the previous FOText object created within the current | * Points to the previous FOText object created within the current | ||||
* block. If this is "null", this is the first such object. | * block. If this is "null", this is the first such object. | ||||
*/ | */ | ||||
private FOText prevFOTextThisBlock = null; | |||||
private FOText prevFOTextThisBlock; | |||||
/** | /** | ||||
* Points to the next FOText object created within the current | * Points to the next FOText object created within the current | ||||
* block. If this is "null", this is the last such object. | * block. If this is "null", this is the last such object. | ||||
*/ | */ | ||||
private FOText nextFOTextThisBlock = null; | |||||
private FOText nextFOTextThisBlock; | |||||
/** | /** | ||||
* Points to the ancestor Block object. This is used to keep track of | * Points to the ancestor Block object. This is used to keep track of | ||||
* which FOText nodes are descendants of the same block. | * which FOText nodes are descendants of the same block. | ||||
*/ | */ | ||||
private Block ancestorBlock = null; | |||||
private Block ancestorBlock; | |||||
/** Holds the text decoration values. May be null */ | /** Holds the text decoration values. May be null */ | ||||
private CommonTextDecoration textDecoration; | private CommonTextDecoration textDecoration; | ||||
private class TextCharIterator extends CharIterator { | private class TextCharIterator extends CharIterator { | ||||
private int currentPosition = 0; | |||||
private int currentPosition; | |||||
private boolean canRemove = false; | |||||
private boolean canReplace = false; | |||||
private boolean canRemove; | |||||
private boolean canReplace; | |||||
public TextCharIterator() { | public TextCharIterator() { | ||||
} | } |
protected ElementMappingRegistry elementMappingRegistry; | protected ElementMappingRegistry elementMappingRegistry; | ||||
/** The root of the formatting object tree */ | /** The root of the formatting object tree */ | ||||
protected Root rootFObj = null; | |||||
protected Root rootFObj; | |||||
/** Main DefaultHandler that handles the FO namespace. */ | /** Main DefaultHandler that handles the FO namespace. */ | ||||
protected MainFOHandler mainFOHandler; | protected MainFOHandler mainFOHandler; | ||||
/** The user agent for this processing run. */ | /** The user agent for this processing run. */ | ||||
private FOUserAgent userAgent; | private FOUserAgent userAgent; | ||||
private boolean used = false; | |||||
private boolean used; | |||||
private boolean empty = true; | private boolean empty = true; | ||||
private int depth; | private int depth; | ||||
private class MainFOHandler extends DefaultHandler { | private class MainFOHandler extends DefaultHandler { | ||||
/** Current formatting object being handled */ | /** Current formatting object being handled */ | ||||
protected FONode currentFObj = null; | |||||
protected FONode currentFObj; | |||||
/** Current propertyList for the node being handled */ | /** Current propertyList for the node being handled */ | ||||
protected PropertyList currentPropertyList; | protected PropertyList currentPropertyList; | ||||
/** Current marker nesting-depth */ | /** Current marker nesting-depth */ | ||||
private int nestedMarkerDepth = 0; | |||||
private int nestedMarkerDepth; | |||||
/** {@inheritDoc} */ | /** {@inheritDoc} */ | ||||
public void startElement(String namespaceURI, String localName, String rawName, | public void startElement(String namespaceURI, String localName, String rawName, |
/** | /** | ||||
* Indicates whether processing descendants of a marker | * Indicates whether processing descendants of a marker | ||||
*/ | */ | ||||
private boolean inMarker = false; | |||||
private boolean inMarker; | |||||
/** | /** | ||||
* Returns the set of ID references. | * Returns the set of ID references. |
protected FONode lastChild; | protected FONode lastChild; | ||||
/** The list of extension attachments, null if none */ | /** The list of extension attachments, null if none */ | ||||
private List<ExtensionAttachment> extensionAttachments = null; | |||||
private List<ExtensionAttachment> extensionAttachments; | |||||
/** The map of foreign attributes, null if none */ | /** The map of foreign attributes, null if none */ | ||||
private Map<QName, String> foreignAttributes = null; | |||||
private Map<QName, String> foreignAttributes; | |||||
/** Used to indicate if this FO is either an Out Of Line FO (see rec) | /** Used to indicate if this FO is either an Out Of Line FO (see rec) | ||||
* or a descendant of one. Used during FO validation. | * or a descendant of one. Used during FO validation. | ||||
*/ | */ | ||||
private boolean isOutOfLineFODescendant = false; | |||||
private boolean isOutOfLineFODescendant; | |||||
/** Markers added to this element. */ | /** Markers added to this element. */ | ||||
private Map<String, Marker> markers; | private Map<String, Marker> markers; |
public abstract class FObjMixed extends FObj { | public abstract class FObjMixed extends FObj { | ||||
/** Represents accumulated, pending FO text. See {@link #flushText()}. */ | /** Represents accumulated, pending FO text. See {@link #flushText()}. */ | ||||
private FOText ft = null; | |||||
private FOText ft; | |||||
/** Used for white-space handling; start CharIterator at node ... */ | /** Used for white-space handling; start CharIterator at node ... */ | ||||
protected FONode currentTextNode; | protected FONode currentTextNode; | ||||
/** Used in creating pointers between subsequent {@link FOText} nodes | /** Used in creating pointers between subsequent {@link FOText} nodes | ||||
* in the same {@link org.apache.fop.fo.flow.Block} | * in the same {@link org.apache.fop.fo.flow.Block} | ||||
* (for handling text-transform) */ | * (for handling text-transform) */ | ||||
protected FOText lastFOTextProcessed = null; | |||||
protected FOText lastFOTextProcessed; | |||||
/** | /** | ||||
* Base constructor | * Base constructor |
private static boolean[] inheritableProperty; | private static boolean[] inheritableProperty; | ||||
/** reference to the parent FO's propertyList **/ | /** reference to the parent FO's propertyList **/ | ||||
protected PropertyList parentPropertyList = null; | |||||
private FObj fobj = null; | |||||
protected PropertyList parentPropertyList; | |||||
private FObj fobj; | |||||
private static Log log = LogFactory.getLog(PropertyList.class); | private static Log log = LogFactory.getLog(PropertyList.class); | ||||
/** parent node for whose child nodes this iterator iterates */ | /** parent node for whose child nodes this iterator iterates */ | ||||
private FONode fobj; | private FONode fobj; | ||||
/** iterator for the child nodes */ | /** iterator for the child nodes */ | ||||
private Iterator childIter = null; | |||||
private Iterator childIter; | |||||
/** current child object that is being managed by childIter*/ | /** current child object that is being managed by childIter*/ | ||||
private FONode curChild; | private FONode curChild; | ||||
/** CharIterator for curChild's characters */ | /** CharIterator for curChild's characters */ | ||||
private CharIterator curCharIter = null; | |||||
private CharIterator curCharIter; | |||||
/** | /** | ||||
* Constructor which creates an iterator for all child nodes | * Constructor which creates an iterator for all child nodes |
public abstract class XMLObj extends FONode implements ObjectBuiltListener { | public abstract class XMLObj extends FONode implements ObjectBuiltListener { | ||||
// temp reference for attributes | // temp reference for attributes | ||||
private Attributes attr = null; | |||||
private Attributes attr; | |||||
/** DOM element representing this node */ | /** DOM element representing this node */ | ||||
protected Element element; | protected Element element; |
public class XMLWhiteSpaceHandler { | public class XMLWhiteSpaceHandler { | ||||
/** True if we are in a run of white space */ | /** True if we are in a run of white space */ | ||||
private boolean inWhiteSpace = false; | |||||
private boolean inWhiteSpace; | |||||
/** True if the last char was a linefeed */ | /** True if the last char was a linefeed */ | ||||
private boolean afterLinefeed = true; | private boolean afterLinefeed = true; | ||||
/** Counter, increased every time a non-white-space is encountered */ | /** Counter, increased every time a non-white-space is encountered */ | ||||
* the following child is a block-level FO) | * the following child is a block-level FO) | ||||
*/ | */ | ||||
private class EOLchecker { | private class EOLchecker { | ||||
private boolean nextIsEOL = false; | |||||
private boolean nextIsEOL; | |||||
private RecursiveCharIterator charIter; | private RecursiveCharIterator charIter; | ||||
EOLchecker(CharIterator charIter) { | EOLchecker(CharIterator charIter) { |
static final int TOK_INTEGER = TOK_FLOAT + 1; | static final int TOK_INTEGER = TOK_FLOAT + 1; | ||||
protected int currentToken = TOK_EOF; | protected int currentToken = TOK_EOF; | ||||
protected String currentTokenValue = null; | |||||
protected int currentUnitLength = 0; | |||||
protected String currentTokenValue; | |||||
protected int currentUnitLength; | |||||
private int currentTokenStartIndex = 0; | |||||
private int currentTokenStartIndex; | |||||
private /* final */ String expr; | private /* final */ String expr; | ||||
private int exprIndex = 0; | |||||
private int exprIndex; | |||||
private int exprLength; | private int exprLength; | ||||
/** | /** |
/** | /** | ||||
* The second operand. | * The second operand. | ||||
*/ | */ | ||||
private Numeric op2 = null; | |||||
private Numeric op2; | |||||
/** | /** | ||||
* The dimension of the result. | * The dimension of the result. | ||||
*/ | */ |
// End of property values | // End of property values | ||||
/** used for FO validation */ | /** used for FO validation */ | ||||
private boolean blockItemFound = false; | |||||
private boolean blockItemFound; | |||||
/** | /** | ||||
* Base constructor | * Base constructor |
// End of property values | // End of property values | ||||
// used only for FO validation | // used only for FO validation | ||||
private boolean blockOrInlineItemFound = false; | |||||
private boolean blockOrInlineItemFound; | |||||
/** | /** | ||||
* Construct a BasicLink instance with the given {@link FONode} | * Construct a BasicLink instance with the given {@link FONode} |
CommonAccessibilityHolder { | CommonAccessibilityHolder { | ||||
// used for FO validation | // used for FO validation | ||||
private boolean blockOrInlineItemFound = false; | |||||
private boolean initialPropertySetFound = false; | |||||
private boolean blockOrInlineItemFound; | |||||
private boolean initialPropertySetFound; | |||||
// The value of FO traits (refined properties) that apply to fo:block. | // The value of FO traits (refined properties) that apply to fo:block. | ||||
private CommonAccessibility commonAccessibility; | private CommonAccessibility commonAccessibility; |
// End of FO trait values | // End of FO trait values | ||||
/** used for FO validation */ | /** used for FO validation */ | ||||
private boolean blockItemFound = false; | |||||
private boolean blockItemFound; | |||||
/** | /** | ||||
* Creates a new BlockContainer instance as a child of | * Creates a new BlockContainer instance as a child of |
// private int clear; | // private int clear; | ||||
// End of property values | // End of property values | ||||
private static boolean notImplementedWarningGiven = false; | |||||
private static boolean notImplementedWarningGiven; | |||||
/** | /** | ||||
* Base constructor | * Base constructor |
private CommonAccessibility commonAccessibility; | private CommonAccessibility commonAccessibility; | ||||
private Inline footnoteCitation = null; | |||||
private Inline footnoteCitation; | |||||
private FootnoteBody footnoteBody; | private FootnoteBody footnoteBody; | ||||
/** | /** |
// private int wrapOption; | // private int wrapOption; | ||||
// End of property values | // End of property values | ||||
// used for FO validation | // used for FO validation | ||||
private boolean blockOrInlineItemFound = false; | |||||
private boolean blockOrInlineItemFound; | |||||
private boolean canHaveBlockLevelChildren = true; | private boolean canHaveBlockLevelChildren = true; | ||||
/** | /** |