Package org.apache.fop.pdf
Class PDFStructElem
- java.lang.Object
-
- org.apache.fop.pdf.PDFObject
-
- org.apache.fop.pdf.PDFDictionary
-
- org.apache.fop.pdf.StructureHierarchyMember
-
- org.apache.fop.pdf.PDFStructElem
-
- All Implemented Interfaces:
java.io.Serializable,StructureTreeElement,CompressedObject,PDFWritable
- Direct Known Subclasses:
PageSequenceStructElem,PDFStructElem.Placeholder,TableStructElem
public class PDFStructElem extends StructureHierarchyMember implements StructureTreeElement, java.io.Serializable
Class representing a PDF Structure Element.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPDFStructElem.PlaceholderClass representing a placeholder for a PDF Structure Element.
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<PDFDictionary>attributesprivate static java.util.List<StructureType>BLSEprotected java.util.List<PDFObject>kidsElements to be added to the kids array.private PDFObjectparentprotected PDFStructElemparentElementprivate static longserialVersionUIDprivate StructureTypestructureType-
Fields inherited from class org.apache.fop.pdf.PDFDictionary
entries, order
-
-
Constructor Summary
Constructors Modifier Constructor Description PDFStructElem()Creates PDFStructElem with no entries.privatePDFStructElem(PDFObject parent)PDFStructElem(PDFObject parent, StructureType structureType)Creates a new structure element.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddKid(PDFObject kid)Adds a kid to this structure element.voidaddKidInSpecificOrder(int position, PDFStructElem kid)private voidassignObjectNumber()private voidattachAttributes()protected booleanattachKids()Attaches all valid kids to the kids array.java.util.List<PDFObject>getKids()java.lang.StringgetLanguage()Returns the language of this structure element.PDFStructElemgetParentStructElem()Returns the parent of this structure element.StructureTypegetStructureType()Returns the structure type of this structure element.private booleanisBSLE(PDFStructElem kid)intoutput(java.io.OutputStream stream)Write the PDF represention of this objectprivate voidsetLanguage(java.lang.String language)Sets the language of this structure element.voidsetLanguage(java.util.Locale language)Sets the language of this structure element.voidsetMCIDKid(int mcid)Sets the given mcid as the kid of this structure element.voidsetPage(PDFPage page)Sets the page reference of this structure element.voidsetParent(PDFObject parent)Sets the direct parent object.voidsetTableAttributeColSpan(int colSpan)private voidsetTableAttributeRowColumnSpan(java.lang.String typeSpan, int span)voidsetTableAttributeRowSpan(int rowSpan)protected voidwriteDictionary(java.io.OutputStream out, java.lang.StringBuilder textBuffer)Writes the contents of the dictionary to a StringBuffer.-
Methods inherited from class org.apache.fop.pdf.PDFDictionary
containsKey, get, getChildren, getChildren, keySet, put, put, remove
-
Methods inherited from class org.apache.fop.pdf.PDFObject
contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setDocument, setObjectNumber, setObjectNumber, setObjectNumber, supportsObjectStream, toPDF, toPDFString
-
-
-
-
Field Detail
-
BLSE
private static final java.util.List<StructureType> BLSE
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
structureType
private StructureType structureType
-
parentElement
protected PDFStructElem parentElement
-
kids
protected java.util.List<PDFObject> kids
Elements to be added to the kids array.
-
attributes
private java.util.List<PDFDictionary> attributes
-
parent
private PDFObject parent
-
-
Constructor Detail
-
PDFStructElem
public PDFStructElem()
Creates PDFStructElem with no entries.
-
PDFStructElem
public PDFStructElem(PDFObject parent, StructureType structureType)
Creates a new structure element.- Parameters:
parent- parent of this elementstructureType- the structure type of this element
-
PDFStructElem
private PDFStructElem(PDFObject parent)
-
-
Method Detail
-
getParentStructElem
public PDFStructElem getParentStructElem()
Returns the parent of this structure element.- Returns:
- the parent,
nullif the parent is not a structure element (i.e., is the structure tree root)
-
setParent
public void setParent(PDFObject parent)
Sets the direct parent object.
-
addKid
public void addKid(PDFObject kid)
Adds a kid to this structure element.- Specified by:
addKidin classStructureHierarchyMember- Parameters:
kid- element to be added
-
assignObjectNumber
private void assignObjectNumber()
-
setMCIDKid
public void setMCIDKid(int mcid)
Sets the given mcid as the kid of this structure element. This element will then add itself to its parent structure element if it has not already, and so will the parent, and so on.- Parameters:
mcid- mcid of the marked-content sequence corresponding to this structure element's kid
-
setPage
public void setPage(PDFPage page)
Sets the page reference of this structure element.- Parameters:
page- value for the Pg entry
-
getStructureType
public StructureType getStructureType()
Returns the structure type of this structure element.- Returns:
- the value of the S entry
-
setLanguage
private void setLanguage(java.lang.String language)
Sets the language of this structure element.- Parameters:
language- the language (as defined in the section about "Natural Language Specification")
-
setLanguage
public void setLanguage(java.util.Locale language)
Sets the language of this structure element.- Parameters:
language- a value for the Lang entry
-
getLanguage
public java.lang.String getLanguage()
Returns the language of this structure element.- Returns:
- the value of the Lang entry (
nullif no language was specified)
-
writeDictionary
protected void writeDictionary(java.io.OutputStream out, java.lang.StringBuilder textBuffer) throws java.io.IOExceptionDescription copied from class:PDFDictionaryWrites the contents of the dictionary to a StringBuffer.- Overrides:
writeDictionaryin classPDFDictionary- Parameters:
out- the OutputStream (for binary content)textBuffer- the text buffer for text output- Throws:
java.io.IOException- if an I/O error occurs
-
attachAttributes
private void attachAttributes()
-
addKidInSpecificOrder
public void addKidInSpecificOrder(int position, PDFStructElem kid)
-
attachKids
protected boolean attachKids()
Attaches all valid kids to the kids array.- Returns:
- true iff 1+ kids were added to the kids array
-
setTableAttributeColSpan
public void setTableAttributeColSpan(int colSpan)
-
setTableAttributeRowSpan
public void setTableAttributeRowSpan(int rowSpan)
-
setTableAttributeRowColumnSpan
private void setTableAttributeRowColumnSpan(java.lang.String typeSpan, int span)
-
getKids
public java.util.List<PDFObject> getKids()
-
output
public int output(java.io.OutputStream stream) throws java.io.IOExceptionDescription copied from class:PDFDictionaryWrite the PDF represention of this object- Specified by:
outputin interfaceCompressedObject- Overrides:
outputin classPDFDictionary- Parameters:
stream- the stream to write the PDF to- Returns:
- the number of bytes written
- Throws:
java.io.IOException- if there is an error writing to the stream
-
isBSLE
private boolean isBSLE(PDFStructElem kid)
-
-