import org.apache.fop.util.LanguageTags;
import org.apache.fop.util.XMLUtil;
-class PDFStructureTreeBuilder implements StructureTreeEventHandler {
+public class PDFStructureTreeBuilder implements StructureTreeEventHandler {
private static final String ROLE = "role";
new AttributesImpl(), pdfFactory, eventBroadcaster);
}
- private static PDFStructElem createStructureElement(String name, StructureHierarchyMember parent,
+ public static PDFStructElem createStructureElement(String name, StructureHierarchyMember parent,
Attributes attributes, PDFFactory pdfFactory, EventBroadcaster eventBroadcaster) {
StructureElementBuilder builder = BUILDERS.get(name);
if (builder == null) {
import org.apache.fop.pdf.PDFStructElem;
import org.apache.fop.pdf.StructureType;
-class PageSequenceStructElem extends PDFStructElem {
+public class PageSequenceStructElem extends PDFStructElem {
private List<PDFStructElem> regionBefores = new ArrayList<PDFStructElem>();
private List<PDFStructElem> regionEnds = new ArrayList<PDFStructElem>();
+ private List<PDFStructElem> footnoteSeparator = new ArrayList<PDFStructElem>();
+
PageSequenceStructElem(PDFObject parent, StructureType structureType) {
super(parent, structureType);
}
regionStarts.add(content);
} else if (flowName.equals("xsl-region-end")) {
regionEnds.add(content);
+ } else if (flowName.equals("xsl-footnote-separator")) {
+ footnoteSeparator.add(content);
} else {
addKid(content);
}
addRegions(k, regionStarts);
addRegions(k, kids);
addRegions(k, regionEnds);
+ addRegions(k, footnoteSeparator);
addRegions(k, regionAfters);
put("K", k);
return true;
--- /dev/null
+/*
+ * 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.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.accessibility.pdf;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import org.junit.Test;
+
+import org.xml.sax.helpers.AttributesImpl;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.fop.pdf.PDFArray;
+import org.apache.fop.pdf.PDFDocument;
+import org.apache.fop.pdf.PDFFactory;
+import org.apache.fop.pdf.PDFParentTree;
+import org.apache.fop.pdf.PDFStructElem;
+import org.apache.fop.pdf.PDFStructTreeRoot;
+import org.apache.fop.render.pdf.PDFStructureTreeBuilder;
+
+public class FootnoteSeparatorTestCase {
+
+ @Test
+ public void testFootNoteSeparatorText() throws IOException {
+ PDFParentTree tree = new PDFParentTree();
+ AttributesImpl attributes = new AttributesImpl();
+ attributes.addAttribute("", "role", "role", "CDATA", null);
+ PDFDocument doc = new PDFDocument("");
+ PDFStructTreeRoot strucRoot = doc.makeStructTreeRoot(tree);
+ PDFFactory factory = new PDFFactory(doc);
+ PDFStructElem part = PDFStructureTreeBuilder.createStructureElement("page-sequence", strucRoot, attributes,
+ factory, null);
+ AttributesImpl att = new AttributesImpl();
+ att.addAttribute("", "flow-name", "flow-name", "CDATA", "xsl-footnote-separator");
+ PDFStructElem staticSection = PDFStructureTreeBuilder.createStructureElement("static-content", part, att,
+ factory, null);
+ PDFStructElem block = PDFStructureTreeBuilder.createStructureElement("block", part, new AttributesImpl(),
+ factory, null);
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ part.output(bos);
+ PDFArray array = (PDFArray)part.get("K");
+ PDFStructElem elem1 = (PDFStructElem)array.get(0);
+ String test = elem1.getStructureType().getName().getName();
+ String expected = "P";
+ assertEquals(test, expected);
+ PDFStructElem elem2 = (PDFStructElem)array.get(1);
+ test = elem2.getStructureType().getName().getName();
+ expected = "Sect";
+ assertEquals(test, expected);
+ }
+}