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:
Serializable
,StructureTreeElement
,CompressedObject
,PDFWritable
- Direct Known Subclasses:
PageSequenceStructElem
,PDFStructElem.Placeholder
,TableStructElem
public class PDFStructElem
extends StructureHierarchyMember
implements StructureTreeElement, CompressedObject, Serializable
Class representing a PDF Structure Element.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class representing a placeholder for a PDF Structure Element. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<PDFDictionary>
Elements to be added to the kids array.protected PDFStructElem
private static final long
private StructureType
Fields inherited from class org.apache.fop.pdf.PDFDictionary
entries, order
-
Constructor Summary
ConstructorsModifierConstructorDescriptionCreates PDFStructElem with no entries.private
PDFStructElem
(PDFObject parent) PDFStructElem
(PDFObject parent, StructureType structureType) Creates a new structure element. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a kid to this structure element.void
addKidInSpecificOrder
(int position, PDFStructElem kid) private void
protected boolean
Attaches all valid kids to the kids array.getKids()
Returns the language of this structure element.Returns the parent of this structure element.Returns the structure type of this structure element.private boolean
int
output
(OutputStream stream) Write the PDF represention of this objectprivate void
setLanguage
(String language) Sets the language of this structure element.void
setLanguage
(Locale language) Sets the language of this structure element.void
setMCIDKid
(int mcid) Sets the given mcid as the kid of this structure element.void
Sets the page reference of this structure element.void
Sets the direct parent object.void
setTableAttributeColSpan
(int colSpan) private void
setTableAttributeRowColumnSpan
(String typeSpan, int span) void
setTableAttributeRowSpan
(int rowSpan) protected void
writeDictionary
(OutputStream out, 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, toPDF, toPDFString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.fop.pdf.CompressedObject
getObjectNumber
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
structureType
-
parentElement
-
kids
Elements to be added to the kids array. -
attributes
-
-
Constructor Details
-
PDFStructElem
public PDFStructElem()Creates PDFStructElem with no entries. -
PDFStructElem
Creates a new structure element.- Parameters:
parent
- parent of this elementstructureType
- the structure type of this element
-
PDFStructElem
-
-
Method Details
-
getParentStructElem
Returns the parent of this structure element.- Returns:
- the parent,
null
if the parent is not a structure element (i.e., is the structure tree root)
-
setParent
Sets the direct parent object. -
addKid
Adds a kid to this structure element.- Specified by:
addKid
in classStructureHierarchyMember
- Parameters:
kid
- element to be added
-
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
Sets the page reference of this structure element.- Parameters:
page
- value for the Pg entry
-
getStructureType
Returns the structure type of this structure element.- Returns:
- the value of the S entry
-
setLanguage
Sets the language of this structure element.- Parameters:
language
- the language (as defined in the section about "Natural Language Specification")
-
setLanguage
Sets the language of this structure element.- Parameters:
language
- a value for the Lang entry
-
getLanguage
Returns the language of this structure element.- Returns:
- the value of the Lang entry (
null
if no language was specified)
-
writeDictionary
Description copied from class:PDFDictionary
Writes the contents of the dictionary to a StringBuffer.- Overrides:
writeDictionary
in classPDFDictionary
- Parameters:
out
- the OutputStream (for binary content)textBuffer
- the text buffer for text output- Throws:
IOException
- if an I/O error occurs
-
attachAttributes
private void attachAttributes() -
addKidInSpecificOrder
-
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
-
getKids
-
output
Description copied from class:PDFDictionary
Write the PDF represention of this object- Specified by:
output
in interfaceCompressedObject
- Overrides:
output
in classPDFDictionary
- Parameters:
stream
- the stream to write the PDF to- Returns:
- the number of bytes written
- Throws:
IOException
- if there is an error writing to the stream
-
isBSLE
-