You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by gm...@apache.org on 2005/01/02 21:42:51 UTC
cvs commit: xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks BookmarkTree.java
gmazza 2005/01/02 12:42:51
Modified: examples/fo/advanced cid-fonts.fo
examples/fo/basic pdfoutline.fo
src/java/org/apache/fop/area AreaTreeHandler.java
BookmarkData.java
src/java/org/apache/fop/fo Constants.java
FOElementMapping.java FObj.java PropertySets.java
src/java/org/apache/fop/fo/extensions
ExtensionElementMapping.java
src/java/org/apache/fop/fo/pagination Root.java
Added: src/java/org/apache/fop/fo/pagination/bookmarks
BookmarkTree.java
Removed: src/java/org/apache/fop/fo/extensions Bookmarks.java
Log:
Switched from fox:bookmarks to fo:bookmark-tree (of XSL 1.1 2WD). Two more
bookmark-related FO's (fox:outline and fox:label) need conversion and will
be done next.
Revision Changes Path
1.4 +2 -2 xml-fop/examples/fo/advanced/cid-fonts.fo
Index: cid-fonts.fo
===================================================================
RCS file: /home/cvs/xml-fop/examples/fo/advanced/cid-fonts.fo,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- cid-fonts.fo 22 Feb 2004 13:37:06 -0000 1.3
+++ cid-fonts.fo 2 Jan 2005 20:42:50 -0000 1.4
@@ -16,7 +16,7 @@
</fo:simple-page-master>
</fo:layout-master-set>
-
+<fo:bookmark-tree>
<fox:outline internal-destination="sec0">
<fox:label>Adding Fonts to FOP</fox:label>
</fox:outline>
@@ -74,7 +74,7 @@
<fox:outline internal-destination="sec5">
<fox:label>Japanese Examples</fox:label>
</fox:outline>
-
+</fo:bookmark-tree>
<fo:page-sequence master-reference="A4">
1.5 +62 -65 xml-fop/examples/fo/basic/pdfoutline.fo
Index: pdfoutline.fo
===================================================================
RCS file: /home/cvs/xml-fop/examples/fo/basic/pdfoutline.fo,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- pdfoutline.fo 13 Dec 2004 22:59:02 -0000 1.4
+++ pdfoutline.fo 2 Jan 2005 20:42:50 -0000 1.5
@@ -58,71 +58,68 @@
<!-- end: defines page layout -->
-<!-- beginning of the PDF outline extensions -->
- <fox:bookmarks>
-
- <fox:outline internal-destination="sec1">
- <fox:label>What is FOP?</fox:label>
- </fox:outline>
-
- <fox:outline internal-destination="sec2">
- <fox:label>Downloading FOP</fox:label>
- </fox:outline>
-
- <fox:outline internal-destination="sec3">
- <fox:label>Running FOP</fox:label>
-
- <fox:outline internal-destination="sec3-1">
- <fox:label>Prerequisites</fox:label>
-
- <fox:outline internal-destination="sec3-1-1">
- <fox:label>Java 1.1</fox:label>
- </fox:outline>
-
- <fox:outline internal-destination="sec3-1-2">
- <fox:label>XML Parser</fox:label>
- </fox:outline>
-
- <fox:outline internal-destination="sec3-1-3">
- <fox:label>XSLT Processor</fox:label>
- </fox:outline>
-
- </fox:outline>
-
- <fox:outline internal-destination="sec3-2">
- <fox:label>Starting FOP</fox:label>
- </fox:outline>
-
- </fox:outline>
-
- <fox:outline internal-destination="sec4">
- <fox:label>Embedding FOP</fox:label>
- </fox:outline>
-
- <fox:outline internal-destination="sec5">
- <fox:label>What's Implemented?</fox:label>
- </fox:outline>
- <fox:outline internal-destination="sec6">
- <fox:label>Limitations</fox:label>
- </fox:outline>
- <fox:outline internal-destination="sec7">
- <fox:label>Bugs</fox:label>
- </fox:outline>
- <fox:outline internal-destination="sec8">
- <fox:label>Compiling FOP</fox:label>
- </fox:outline>
- <fox:outline internal-destination="sec9">
- <fox:label>Getting Involved</fox:label>
- </fox:outline>
- <fox:outline internal-destination="sec10">
- <fox:label>FOP Relevant Specifications</fox:label>
- </fox:outline>
- <fox:outline internal-destination="sec11">
- <fox:label>License</fox:label>
- </fox:outline>
- </fox:bookmarks>
-
-
+<!-- bookmark section -->
+ <fo:bookmark-tree>
+ <fox:outline internal-destination="sec1">
+ <fox:label>What is FOP?</fox:label>
+ </fox:outline>
+
+ <fox:outline internal-destination="sec2">
+ <fox:label>Downloading FOP</fox:label>
+ </fox:outline>
+
+ <fox:outline internal-destination="sec3">
+ <fox:label>Running FOP</fox:label>
+
+ <fox:outline internal-destination="sec3-1">
+ <fox:label>Prerequisites</fox:label>
+
+ <fox:outline internal-destination="sec3-1-1">
+ <fox:label>Java 1.1</fox:label>
+ </fox:outline>
+
+ <fox:outline internal-destination="sec3-1-2">
+ <fox:label>XML Parser</fox:label>
+ </fox:outline>
+
+ <fox:outline internal-destination="sec3-1-3">
+ <fox:label>XSLT Processor</fox:label>
+ </fox:outline>
+
+ </fox:outline>
+
+ <fox:outline internal-destination="sec3-2">
+ <fox:label>Starting FOP</fox:label>
+ </fox:outline>
+
+ </fox:outline>
+
+ <fox:outline internal-destination="sec4">
+ <fox:label>Embedding FOP</fox:label>
+ </fox:outline>
+
+ <fox:outline internal-destination="sec5">
+ <fox:label>What's Implemented?</fox:label>
+ </fox:outline>
+ <fox:outline internal-destination="sec6">
+ <fox:label>Limitations</fox:label>
+ </fox:outline>
+ <fox:outline internal-destination="sec7">
+ <fox:label>Bugs</fox:label>
+ </fox:outline>
+ <fox:outline internal-destination="sec8">
+ <fox:label>Compiling FOP</fox:label>
+ </fox:outline>
+ <fox:outline internal-destination="sec9">
+ <fox:label>Getting Involved</fox:label>
+ </fox:outline>
+ <fox:outline internal-destination="sec10">
+ <fox:label>FOP Relevant Specifications</fox:label>
+ </fox:outline>
+ <fox:outline internal-destination="sec11">
+ <fox:label>License</fox:label>
+ </fox:outline>
+ </fo:bookmark-tree>
<!-- actual layout -->
<fo:page-sequence master-reference="basicPSM">
1.30 +5 -5 xml-fop/src/java/org/apache/fop/area/AreaTreeHandler.java
Index: AreaTreeHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTreeHandler.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- AreaTreeHandler.java 27 Dec 2004 10:13:05 -0000 1.29
+++ AreaTreeHandler.java 2 Jan 2005 20:42:50 -0000 1.30
@@ -36,9 +36,9 @@
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.FOEventHandler;
-import org.apache.fop.fo.extensions.Bookmarks;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.Root;
+import org.apache.fop.fo.pagination.bookmarks.BookmarkTree;
import org.apache.fop.layoutmgr.PageSequenceLayoutManager;
import org.apache.fop.layoutmgr.LayoutManagerMaker;
import org.apache.fop.layoutmgr.LayoutManagerMapping;
@@ -251,9 +251,9 @@
public void endDocument() throws SAXException {
// process fo:bookmark-tree
- Bookmarks bookmarks = rootFObj.getBookmarks();
- if (bookmarks != null) {
- BookmarkData data = new BookmarkData(bookmarks);
+ BookmarkTree bookmarkTree = rootFObj.getBookmarkTree();
+ if (bookmarkTree != null) {
+ BookmarkData data = new BookmarkData(bookmarkTree);
addOffDocumentItem(data);
}
1.9 +5 -5 xml-fop/src/java/org/apache/fop/area/BookmarkData.java
Index: BookmarkData.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/BookmarkData.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- BookmarkData.java 17 Dec 2004 00:19:11 -0000 1.8
+++ BookmarkData.java 2 Jan 2005 20:42:50 -0000 1.9
@@ -22,7 +22,7 @@
import java.util.List;
import java.util.HashMap;
-import org.apache.fop.fo.extensions.Bookmarks;
+import org.apache.fop.fo.pagination.bookmarks.BookmarkTree;
import org.apache.fop.fo.extensions.Outline;
/**
@@ -52,12 +52,12 @@
*
* @param bookmarks fo:bookmark-tree for this document
*/
- public BookmarkData(Bookmarks bookmarks) {
+ public BookmarkData(BookmarkTree bookmarkTree) {
idRef = null;
whenToProcess = END_OF_DOC;
- for (int count = 0; count < bookmarks.getOutlines().size(); count++) {
- Outline out = (Outline)(bookmarks.getOutlines()).get(count);
+ for (int count = 0; count < bookmarkTree.getBookmarks().size(); count++) {
+ Outline out = (Outline)(bookmarkTree.getBookmarks()).get(count);
addSubData(createBookmarkData(out));
}
}
1.21 +3 -2 xml-fop/src/java/org/apache/fop/fo/Constants.java
Index: Constants.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/Constants.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- Constants.java 25 Dec 2004 15:29:18 -0000 1.20
+++ Constants.java 2 Jan 2005 20:42:50 -0000 1.21
@@ -113,7 +113,8 @@
int FO_TABLE_ROW = 54;
int FO_TITLE = 55;
int FO_WRAPPER = 56;
- int FRM_OBJ_COUNT = 56;
+ int FO_BOOKMARK_TREE = 57;
+ int FRM_OBJ_COUNT = 57;
// Masks
int COMPOUND_SHIFT = 9;
1.9 +7 -0 xml-fop/src/java/org/apache/fop/fo/FOElementMapping.java
Index: FOElementMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOElementMapping.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- FOElementMapping.java 15 Jun 2004 00:30:43 -0000 1.8
+++ FOElementMapping.java 2 Jan 2005 20:42:50 -0000 1.9
@@ -45,6 +45,7 @@
foObjs.put("root", new RootMaker());
foObjs.put("declarations", new DeclarationsMaker());
foObjs.put("color-profile", new ColorProfileMaker());
+ foObjs.put("bookmark-tree", new BookmarkTreeMaker());
foObjs.put("page-sequence", new PageSequenceMaker());
foObjs.put("layout-master-set", new LayoutMasterSetMaker());
foObjs.put("page-sequence-master",
@@ -142,6 +143,12 @@
static class ColorProfileMaker extends ElementMapping.Maker {
public FONode make(FONode parent) {
return new org.apache.fop.fo.pagination.ColorProfile(parent);
+ }
+ }
+
+ static class BookmarkTreeMaker extends ElementMapping.Maker {
+ public FONode make(FONode parent) {
+ return new org.apache.fop.fo.pagination.bookmarks.BookmarkTree(parent);
}
}
1.88 +2 -2 xml-fop/src/java/org/apache/fop/fo/FObj.java
Index: FObj.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- FObj.java 21 Dec 2004 11:28:05 -0000 1.87
+++ FObj.java 2 Jan 2005 20:42:50 -0000 1.88
@@ -117,12 +117,12 @@
/**
* Bind property values from the property list to the FO node.
- * Must be overriden in all FObj subclasses.
+ * Must be overridden in all FObj subclasses that have properties
+ * applying to it.
* @param pList the PropertyList where the properties can be found.
* @throws FOPException
*/
public void bind(PropertyList pList) throws FOPException {
-// throw new ValidationException("Unconverted element " + this, locator);
}
/**
1.13 +13 -10 xml-fop/src/java/org/apache/fop/fo/PropertySets.java
Index: PropertySets.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/PropertySets.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- PropertySets.java 25 Dec 2004 15:29:18 -0000 1.12
+++ PropertySets.java 2 Jan 2005 20:42:50 -0000 1.13
@@ -201,6 +201,9 @@
elem.addProperty(Constants.PR_COLOR_PROFILE_NAME);
elem.addProperty(Constants.PR_RENDERING_INTENT);
+ elem = elements[Constants.FO_BOOKMARK_TREE];
+// elem.addContent(Constants.FO_BOOKMARK);
+
elem = elements[Constants.FO_PAGE_SEQUENCE];
elem.addProperty(Constants.PR_COUNTRY);
elem.addProperty(Constants.PR_FORMAT);
@@ -1117,7 +1120,7 @@
BitSet relevant = new BitSet();
BitSet valid = new BitSet();
int elementId;
- ArrayList children;
+ ArrayList childFOs;
Element(int elementId) {
this.elementId = elementId;
@@ -1143,14 +1146,14 @@
* Add a single fo element as a content child.
*/
public void addContent(int elementId) {
- if (children == null) {
- children = new ArrayList();
+ if (childFOs == null) {
+ childFOs = new ArrayList();
}
- children.add(elements[elementId]);
+ childFOs.add(elements[elementId]);
}
/**
- * Add a set of fo elements as content children.
+ * Add a set of fo elements as content childFOs.
*/
public void addContent(BitSet elements) {
for (int i = 0; i < elements.size(); i++) {
@@ -1161,16 +1164,16 @@
}
/**
- * Merge the properties from the children into the set of valid
+ * Merge the properties from the child FO's into the set of valid
* properties. Return true if at least one property could be added.
*/
public boolean merge() {
- if (children == null) {
+ if (childFOs == null) {
return false;
}
boolean dirty = false;
- for (int i = 0; i < children.size(); i++) {
- Element child = (Element) children.get(i);
+ for (int i = 0; i < childFOs.size(); i++) {
+ Element child = (Element) childFOs.get(i);
BitSet childValid = child.valid;
int n = childValid.length();
for (int j = 0; j < n; j++) {
1.5 +1 -8 xml-fop/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
Index: ExtensionElementMapping.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ExtensionElementMapping.java 15 Jun 2004 00:30:43 -0000 1.4
+++ ExtensionElementMapping.java 2 Jan 2005 20:42:50 -0000 1.5
@@ -44,15 +44,8 @@
protected void initialize() {
if (foObjs == null) {
foObjs = new HashMap();
- foObjs.put("bookmarks", new B());
foObjs.put("outline", new O());
foObjs.put("label", new L());
- }
- }
-
- static class B extends ElementMapping.Maker {
- public FONode make(FONode parent) {
- return new Bookmarks(parent);
}
}
1.37 +21 -23 xml-fop/src/java/org/apache/fop/fo/pagination/Root.java
Index: Root.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Root.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- Root.java 14 Nov 2004 20:20:43 -0000 1.36
+++ Root.java 2 Jan 2005 20:42:50 -0000 1.37
@@ -29,7 +29,7 @@
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.apache.fop.fo.extensions.Bookmarks;
+import org.apache.fop.fo.pagination.bookmarks.BookmarkTree;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
/**
@@ -42,7 +42,7 @@
private LayoutMasterSet layoutMasterSet;
private Declarations declarations;
- private Bookmarks bookmarks = null;
+ private BookmarkTree bookmarkTree = null;
private List pageSequences;
// temporary until above list populated
@@ -82,7 +82,7 @@
protected void endOfNode() throws FOPException {
if (!pageSequenceFound || layoutMasterSet == null) {
missingChildElementError("(layout-master-set, declarations?, " +
- "fox:bookmarks?, page-sequence+)");
+ "bookmark-tree?, page-sequence+)");
}
}
@@ -103,11 +103,19 @@
nodesOutOfOrderError(loc, "fo:layout-master-set", "fo:declarations");
} else if (declarations != null) {
tooManyNodesError(loc, "fo:declarations");
- } else if (bookmarks != null) {
- nodesOutOfOrderError(loc, "fo:declarations", "fox:bookmarks");
+ } else if (bookmarkTree != null) {
+ nodesOutOfOrderError(loc, "fo:declarations", "fo:bookmark-tree");
} else if (pageSequenceFound) {
nodesOutOfOrderError(loc, "fo:declarations", "fo:page-sequence");
}
+ } else if (localName.equals("bookmark-tree")) {
+ if (layoutMasterSet == null) {
+ nodesOutOfOrderError(loc, "fo:layout-master-set", "fo:bookmark-tree");
+ } else if (bookmarkTree != null) {
+ tooManyNodesError(loc, "fo:bookmark-tree");
+ } else if (pageSequenceFound) {
+ nodesOutOfOrderError(loc, "fo:bookmark-tree", "fo:page-sequence");
+ }
} else if (localName.equals("page-sequence")) {
if (layoutMasterSet == null) {
nodesOutOfOrderError(loc, "fo:layout-master-set", "fo:page-sequence");
@@ -117,16 +125,6 @@
} else {
invalidChildError(loc, nsURI, localName);
}
- } else if (nsURI.equals(ExtensionElementMapping.URI)) {
- if (!localName.equals("bookmarks")) {
- invalidChildError(loc, nsURI, localName);
- } else if (layoutMasterSet == null) {
- nodesOutOfOrderError(loc, "fo:layout-master-set", "fox:bookmarks");
- } else if (bookmarks != null) {
- tooManyNodesError(loc, "fox:bookmarks");
- } else if (pageSequenceFound) {
- nodesOutOfOrderError(loc, "fox:bookmarks", "fo:page-sequence");
- }
} else {
invalidChildError(loc, nsURI, localName);
}
@@ -226,19 +224,19 @@
}
/**
- * Set the Bookmarks object for this FO
- * @param bookmarks the Bookmarks object
+ * Set the BookmarkTree object for this FO
+ * @param bookmarkTree the BookmarkTree object
*/
- public void setBookmarks(Bookmarks bookmarks) {
- this.bookmarks = bookmarks;
+ public void setBookmarkTree(BookmarkTree bookmarkTree) {
+ this.bookmarkTree = bookmarkTree;
}
/**
- * Public accessor for the Bookmarks for this FO
- * @return the Bookmarks object
+ * Public accessor for the BookmarkTree object for this FO
+ * @return the BookmarkTree object
*/
- public Bookmarks getBookmarks() {
- return bookmarks;
+ public BookmarkTree getBookmarkTree() {
+ return bookmarkTree;
}
/**
1.1 xml-fop/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java
Index: BookmarkTree.java
===================================================================
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed 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: BookmarkTree.java,v 1.1 2005/01/02 20:42:51 gmazza Exp $ */
package org.apache.fop.fo.pagination.bookmarks;
// Java
import java.util.ArrayList;
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.fo.extensions.Outline;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.pagination.Root;
import org.apache.fop.fo.properties.Property;
/**
* The fo:bookmark-tree formatting object, first introduced in the
* XSL 1.1 WD. Prototype version only, subject to change as XSL 1.1 WD
* evolves.
*/
public class BookmarkTree extends FObj {
private ArrayList bookmarks = new ArrayList();
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
public BookmarkTree(FONode parent) {
super(parent);
}
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
protected void addChildNode(FONode obj) {
if (obj instanceof Outline) {
bookmarks.add(obj);
}
}
/**
* @see org.apache.fop.fo.FONode#endOfNode
*/
protected void endOfNode() throws FOPException {
if (bookmarks == null) {
missingChildElementError("(fox:outline+)");
}
((Root) parent).setBookmarkTree(this);
}
/**
* @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
XSL/FOP: (conditional-page-master-reference+)
*/
protected void validateChildNode(Locator loc, String nsURI, String localName)
throws ValidationException {
if (!(nsURI == ExtensionElementMapping.URI &&
localName.equals("outline"))) {
invalidChildError(loc, nsURI, localName);
}
}
public ArrayList getBookmarks() {
return bookmarks;
}
public String getName() {
return "fo:bookmark-tree";
}
/**
* @see org.apache.fop.fo.FObj#getNameId()
*/
public int getNameId() {
return FO_BOOKMARK_TREE;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-cvs-help@xml.apache.org