aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
diff options
context:
space:
mode:
authorVincent Hennebert <vhennebert@apache.org>2012-09-26 11:31:40 +0000
committerVincent Hennebert <vhennebert@apache.org>2012-09-26 11:31:40 +0000
commita1af0b2481adf1d4bdb1279972a9d4e51e381f6a (patch)
tree00f0840c0593e48cc1c49878a6e2a1a78e20a9e9 /src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
parent182bbad662b45ecc15e2cc3d3de6cde7bdc77bea (diff)
downloadxmlgraphics-fop-a1af0b2481adf1d4bdb1279972a9d4e51e381f6a.tar.gz
xmlgraphics-fop-a1af0b2481adf1d4bdb1279972a9d4e51e381f6a.zip
Bugzilla #53902: Added possibility to define 'header' table columns (the same way as fo:table-header allows to define header rows).
When accessibility is enabled, this allows to set the appropriate Scope attribute on the corresponding TH cells. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1390412 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java')
-rw-r--r--src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java b/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
index 0d4a6b7fb..031224ffb 100644
--- a/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
+++ b/src/java/org/apache/fop/render/pdf/PDFStructureTreeBuilder.java
@@ -30,6 +30,7 @@ import org.apache.fop.accessibility.StructureTreeElement;
import org.apache.fop.accessibility.StructureTreeEventHandler;
import org.apache.fop.events.EventBroadcaster;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.fo.extensions.InternalElementMapping;
import org.apache.fop.fo.pagination.Flow;
import org.apache.fop.pdf.PDFFactory;
import org.apache.fop.pdf.PDFParentTree;
@@ -138,7 +139,7 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler {
PDFStructElem structElem = createStructureElement(parent, structureType);
setAttributes(structElem, attributes);
addKidToParent(structElem, parent, attributes);
- registerStructureElement(structElem, pdfFactory);
+ registerStructureElement(structElem, pdfFactory, attributes);
return structElem;
}
@@ -155,7 +156,8 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler {
parent.addKid(kid);
}
- protected void registerStructureElement(PDFStructElem structureElement, PDFFactory pdfFactory) {
+ protected void registerStructureElement(PDFStructElem structureElement, PDFFactory pdfFactory,
+ Attributes attributes) {
pdfFactory.getDocument().registerStructureElement(structureElement);
}
@@ -240,22 +242,15 @@ class PDFStructureTreeBuilder implements StructureTreeEventHandler {
}
@Override
- protected PDFStructElem createStructureElement(StructureHierarchyMember parent,
- StructureType structureType) {
- PDFStructElem grandParent = ((PDFStructElem) parent).getParentStructElem();
- //TODO What to do with cells from table-footer? Currently they are mapped on TD.
- if (grandParent.getStructureType() == StandardStructureTypes.Table.THEAD) {
- structureType = StandardStructureTypes.Table.TH;
- } else {
- structureType = StandardStructureTypes.Table.TD;
- }
- return super.createStructureElement(parent, structureType);
- }
-
- @Override
- protected void registerStructureElement(PDFStructElem structureElement, PDFFactory pdfFactory) {
+ protected void registerStructureElement(PDFStructElem structureElement, PDFFactory pdfFactory,
+ Attributes attributes) {
if (structureElement.getStructureType() == Table.TH) {
- pdfFactory.getDocument().registerStructureElement(structureElement, Scope.COLUMN);
+ String scopeAttribute = attributes.getValue(InternalElementMapping.URI,
+ InternalElementMapping.SCOPE);
+ Scope scope = (scopeAttribute == null)
+ ? Scope.COLUMN
+ : Scope.valueOf(scopeAttribute.toUpperCase(Locale.ENGLISH));
+ pdfFactory.getDocument().registerStructureElement(structureElement, scope);
} else {
pdfFactory.getDocument().registerStructureElement(structureElement);
}