diff options
author | Glen Mazza <gmazza@apache.org> | 2005-01-06 00:56:26 +0000 |
---|---|---|
committer | Glen Mazza <gmazza@apache.org> | 2005-01-06 00:56:26 +0000 |
commit | 32781f1091b3227044dd80b43743999c81157ac5 (patch) | |
tree | b4cdb696ced423b07f9bcda27bdef2004ab12043 | |
parent | c5f1859de3bc9f0b06322e63caed66b498d2bfe5 (diff) | |
download | xmlgraphics-fop-32781f1091b3227044dd80b43743999c81157ac5.tar.gz xmlgraphics-fop-32781f1091b3227044dd80b43743999c81157ac5.zip |
1.) fox:label converted to 1.1 fo:bookmark-title.
2.) FObj, FObjMixed, InlineLevel made abstract.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198227 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | examples/fo/advanced/cid-fonts.fo | 33 | ||||
-rw-r--r-- | examples/fo/basic/pdfoutline.fo | 232 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/Constants.java | 3 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FOElementMapping.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FOTreeBuilder.java | 5 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FObj.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/FObjMixed.java | 2 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/PropertySets.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java | 7 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/extensions/Label.java | 70 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/flow/InlineLevel.java | 4 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java | 40 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java | 92 | ||||
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java | 2 |
14 files changed, 270 insertions, 236 deletions
diff --git a/examples/fo/advanced/cid-fonts.fo b/examples/fo/advanced/cid-fonts.fo index 556aa8a2d..526ebea06 100644 --- a/examples/fo/advanced/cid-fonts.fo +++ b/examples/fo/advanced/cid-fonts.fo @@ -2,8 +2,7 @@ <!DOCTYPE fo:root [ <!ENTITY nbsp " "> ]> -<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" - xmlns:fox="http://xml.apache.org/fop/extensions"> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> <fo:layout-master-set> <fo:simple-page-master master-name="A4" page-width="21cm" @@ -18,61 +17,61 @@ <fo:bookmark-tree> <fo:bookmark internal-destination="sec0"> - <fox:label>Adding Fonts to FOP</fox:label> + <fo:bookmark-title>Adding Fonts to FOP</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec1"> - <fox:label>Adding additional Type 1 fonts</fox:label> + <fo:bookmark-title>Adding additional Type 1 fonts</fo:bookmark-title> <fo:bookmark internal-destination="sec1-1"> - <fox:label>Generating a font metrics file</fox:label> + <fo:bookmark-title>Generating a font metrics file</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec1-2"> - <fox:label>Register the fonts within FOP</fox:label> + <fo:bookmark-title>Register the fonts within FOP</fo:bookmark-title> </fo:bookmark> </fo:bookmark> <fo:bookmark internal-destination="sec2"> - <fox:label>Adding additional TrueType fonts</fox:label> + <fo:bookmark-title>Adding additional TrueType fonts</fo:bookmark-title> <fo:bookmark internal-destination="sec2-1"> - <fox:label>Generating a font metrics file</fox:label> + <fo:bookmark-title>Generating a font metrics file</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec2-2"> - <fox:label>TrueType collections</fox:label> + <fo:bookmark-title>TrueType collections</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec2-3"> - <fox:label>Register the fonts within FOP</fox:label> + <fo:bookmark-title>Register the fonts within FOP</fo:bookmark-title> </fo:bookmark> </fo:bookmark> <fo:bookmark internal-destination="sec3"> - <fox:label>Embedding fonts in the PDF</fox:label> + <fo:bookmark-title>Embedding fonts in the PDF</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec4"> - <fox:label>Example embedding MSGothic</fox:label> + <fo:bookmark-title>Example embedding MSGothic</fo:bookmark-title> <fo:bookmark internal-destination="sec4-1"> - <fox:label>Setup CLASSPATH</fox:label> + <fo:bookmark-title>Setup CLASSPATH</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec4-2"> - <fox:label>Create the metrics file</fox:label> + <fo:bookmark-title>Create the metrics file</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec4-3"> - <fox:label>Edit msgothic.xml</fox:label> + <fo:bookmark-title>Edit msgothic.xml</fo:bookmark-title> </fo:bookmark> <fo:bookmark internal-destination="sec4-4"> - <fox:label>Register the font with FOP</fox:label> + <fo:bookmark-title>Register the font with FOP</fo:bookmark-title> </fo:bookmark> </fo:bookmark> <fo:bookmark internal-destination="sec5"> - <fox:label>Japanese Examples</fox:label> + <fo:bookmark-title>Japanese Examples</fo:bookmark-title> </fo:bookmark> </fo:bookmark-tree> diff --git a/examples/fo/basic/pdfoutline.fo b/examples/fo/basic/pdfoutline.fo index ce1aa3597..e09020b2f 100644 --- a/examples/fo/basic/pdfoutline.fo +++ b/examples/fo/basic/pdfoutline.fo @@ -11,141 +11,121 @@ This files shows next to the trivial usage of fo:block and fo:inline examples of - fo:page-number-citation (computes dynamically the page number in section 'content') --> -<!-- note the extensions namespace (fox) --> - -<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" - xmlns:fox="http://xml.apache.org/fop/extensions"> - <fo:layout-master-set> - - <!-- layout for the first page --> - <fo:simple-page-master master-name="first" - page-height="29.7cm" - page-width="21cm" - margin-top="1cm" - margin-bottom="2cm" - margin-left="2.5cm" - margin-right="2.5cm"> - <fo:region-body margin-top="3cm"/> - <fo:region-before extent="3cm"/> - <fo:region-after extent="1.5cm"/> - </fo:simple-page-master> - - <!-- layout for the other pages --> - <fo:simple-page-master master-name="rest" - page-height="29.7cm" - page-width="21cm" - margin-top="1cm" - margin-bottom="2cm" - margin-left="2.5cm" - margin-right="2.5cm"> - <fo:region-body margin-top="2.5cm"/> - <fo:region-before extent="2.5cm"/> - <fo:region-after extent="1.5cm"/> - </fo:simple-page-master> - - <fo:page-sequence-master master-name="basicPSM" > - <fo:repeatable-page-master-alternatives> - <fo:conditional-page-master-reference master-reference="first" - page-position="first" /> - <fo:conditional-page-master-reference master-reference="rest" - page-position="rest" /> - <!-- recommended fallback procedure --> - <fo:conditional-page-master-reference master-reference="rest" /> - </fo:repeatable-page-master-alternatives> - </fo:page-sequence-master> - - </fo:layout-master-set> - <!-- end: defines page layout --> - - -<!-- bookmark section --> - <fo:bookmark-tree> - <fo:bookmark internal-destination="sec1"> - <fox:label>What is FOP?</fox:label> - </fo:bookmark> +<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"> + + <fo:layout-master-set> + <!-- layout for the first page --> + <fo:simple-page-master master-name="first" + page-height="29.7cm" + page-width="21cm" + margin-top="1cm" + margin-bottom="2cm" + margin-left="2.5cm" + margin-right="2.5cm"> + <fo:region-body margin-top="3cm"/> + <fo:region-before extent="3cm"/> + <fo:region-after extent="1.5cm"/> + </fo:simple-page-master> - <fo:bookmark internal-destination="sec2"> - <fox:label>Downloading FOP</fox:label> - </fo:bookmark> + <!-- layout for the other pages --> + <fo:simple-page-master master-name="rest" + page-height="29.7cm" + page-width="21cm" + margin-top="1cm" + margin-bottom="2cm" + margin-left="2.5cm" + margin-right="2.5cm"> + <fo:region-body margin-top="2.5cm"/> + <fo:region-before extent="2.5cm"/> + <fo:region-after extent="1.5cm"/> + </fo:simple-page-master> - <fo:bookmark internal-destination="sec3"> - <fox:label>Running FOP</fox:label> + <fo:page-sequence-master master-name="basicPSM" > + <fo:repeatable-page-master-alternatives> + <fo:conditional-page-master-reference master-reference="first" + page-position="first" /> + <fo:conditional-page-master-reference master-reference="rest" + page-position="rest" /> + <!-- recommended fallback procedure --> + <fo:conditional-page-master-reference master-reference="rest" /> + </fo:repeatable-page-master-alternatives> + </fo:page-sequence-master> + </fo:layout-master-set> - <fo:bookmark internal-destination="sec3-1"> - <fox:label>Prerequisites</fox:label> - - <fo:bookmark internal-destination="sec3-1-1"> - <fox:label>Java 1.1</fox:label> - </fo:bookmark> - - <fo:bookmark internal-destination="sec3-1-2"> - <fox:label>XML Parser</fox:label> - </fo:bookmark> - - <fo:bookmark internal-destination="sec3-1-3"> - <fox:label>XSLT Processor</fox:label> - </fo:bookmark> + <!-- bookmark section --> + <fo:bookmark-tree> + <fo:bookmark internal-destination="sec1"> + <fo:bookmark-title>What is FOP?</fo:bookmark-title> </fo:bookmark> - - <fo:bookmark internal-destination="sec3-2"> - <fox:label>Starting FOP</fox:label> + <fo:bookmark internal-destination="sec2"> + <fo:bookmark-title>Downloading FOP</fo:bookmark-title> </fo:bookmark> - - </fo:bookmark> - - <fo:bookmark internal-destination="sec4"> - <fox:label>Embedding FOP</fox:label> - </fo:bookmark> - - <fo:bookmark internal-destination="sec5"> - <fox:label>What's Implemented?</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec6"> - <fox:label>Limitations</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec7"> - <fox:label>Bugs</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec8"> - <fox:label>Compiling FOP</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec9"> - <fox:label>Getting Involved</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec10"> - <fox:label>FOP Relevant Specifications</fox:label> - </fo:bookmark> - <fo:bookmark internal-destination="sec11"> - <fox:label>License</fox:label> - </fo:bookmark> - </fo:bookmark-tree> - - <!-- actual layout --> - <fo:page-sequence master-reference="basicPSM"> - - -<fo:static-content flow-name="xsl-region-before"> -<fo:block text-align="end" font-size="10pt" font-family="serif" line-height="14pt" color="red" > -This is not the latest Fop documentation, but just an fo example. FOP - p. <fo:page-number/> -</fo:block> -</fo:static-content> - - -<fo:flow flow-name="xsl-region-body"> - -<fo:block id="secA" font-size="18pt" font-family="sans-serif" line-height="24pt" space-after.optimum="15pt" background-color="blue" color="white" text-align="center" padding-top="3pt">FOP: An Open-Source XSL Formatter and Renderer</fo:block> + <fo:bookmark internal-destination="sec3"> + <fo:bookmark-title>Running FOP</fo:bookmark-title> + <fo:bookmark internal-destination="sec3-1"> + <fo:bookmark-title>Prerequisites</fo:bookmark-title> + <fo:bookmark internal-destination="sec3-1-1"> + <fo:bookmark-title>Java 1.1</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec3-1-2"> + <fo:bookmark-title>XML Parser</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec3-1-3"> + <fo:bookmark-title>XSLT Processor</fo:bookmark-title> + </fo:bookmark> + </fo:bookmark> + <fo:bookmark internal-destination="sec3-2"> + <fo:bookmark-title>Starting FOP</fo:bookmark-title> + </fo:bookmark> + </fo:bookmark> + <fo:bookmark internal-destination="sec4"> + <fo:bookmark-title>Embedding FOP</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec5"> + <fo:bookmark-title>What's Implemented?</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec6"> + <fo:bookmark-title>Limitations</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec7"> + <fo:bookmark-title>Bugs</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec8"> + <fo:bookmark-title>Compiling FOP</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec9"> + <fo:bookmark-title>Getting Involved</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec10"> + <fo:bookmark-title>FOP Relevant Specifications</fo:bookmark-title> + </fo:bookmark> + <fo:bookmark internal-destination="sec11"> + <fo:bookmark-title>License</fo:bookmark-title> + </fo:bookmark> + </fo:bookmark-tree> + <!-- actual layout --> + <fo:page-sequence master-reference="basicPSM"> + <fo:static-content flow-name="xsl-region-before"> + <fo:block text-align="end" font-size="10pt" font-family="serif" line-height="14pt" color="red" > + This is not the latest Fop documentation, but just an fo example. FOP - p. <fo:page-number/> + </fo:block> + </fo:static-content> -<fo:block id="sec1" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >A) - What is FOP?</fo:block> - <fo:block space-after.optimum="3pt" font-family="serif">FOP is the world's first print formatter driven by XSL formatting - objects. It is a Java 1.1 application that reads a formatting object - tree and then turns it into a PDF document. The formatting object - tree, can be in the form of an XML document (output by an XSLT engine - like XT or Xalan) or can be passed in memory as a DOM Document or (in - the case of XT) SAX events. + <fo:flow flow-name="xsl-region-body"> + + <fo:block id="secA" font-size="18pt" font-family="sans-serif" line-height="24pt" space-after.optimum="15pt" background-color="blue" color="white" text-align="center" padding-top="3pt">FOP: An Open-Source XSL Formatter and Renderer</fo:block> + + <fo:block id="sec1" font-size="18pt" font-family="serif" line-height="20pt" space-before.optimum="20pt" space-after.optimum="14pt" >A) + What is FOP?</fo:block> + <fo:block space-after.optimum="3pt" font-family="serif">FOP is the world's first print formatter driven by XSL formatting + objects. It is a Java 1.1 application that reads a formatting object + tree and then turns it into a PDF document. The formatting object + tree, can be in the form of an XML document (output by an XSLT engine + like XT or Xalan) or can be passed in memory as a DOM Document or (in + the case of XT) SAX events. </fo:block> <fo:block space-after.optimum="3pt" font-family="serif">FOP is part of Apache's XML project. The homepage of FOP is diff --git a/src/java/org/apache/fop/fo/Constants.java b/src/java/org/apache/fop/fo/Constants.java index 192ad5560..3103ca9d8 100644 --- a/src/java/org/apache/fop/fo/Constants.java +++ b/src/java/org/apache/fop/fo/Constants.java @@ -115,7 +115,8 @@ public interface Constants { int FO_WRAPPER = 56; int FO_BOOKMARK_TREE = 57; int FO_BOOKMARK = 58; - int FRM_OBJ_COUNT = 58; + int FO_BOOKMARK_TITLE = 59; + int FRM_OBJ_COUNT = 59; // Masks int COMPOUND_SHIFT = 9; diff --git a/src/java/org/apache/fop/fo/FOElementMapping.java b/src/java/org/apache/fop/fo/FOElementMapping.java index 1fa266778..d19d784a6 100644 --- a/src/java/org/apache/fop/fo/FOElementMapping.java +++ b/src/java/org/apache/fop/fo/FOElementMapping.java @@ -47,6 +47,7 @@ public class FOElementMapping extends ElementMapping { foObjs.put("color-profile", new ColorProfileMaker()); foObjs.put("bookmark-tree", new BookmarkTreeMaker()); foObjs.put("bookmark", new BookmarkMaker()); + foObjs.put("bookmark-title", new BookmarkTitleMaker()); foObjs.put("page-sequence", new PageSequenceMaker()); foObjs.put("layout-master-set", new LayoutMasterSetMaker()); foObjs.put("page-sequence-master", @@ -159,6 +160,12 @@ public class FOElementMapping extends ElementMapping { } } + static class BookmarkTitleMaker extends ElementMapping.Maker { + public FONode make(FONode parent) { + return new org.apache.fop.fo.pagination.bookmarks.BookmarkTitle(parent); + } + } + static class PageSequenceMaker extends ElementMapping.Maker { public FONode make(FONode parent) { return new org.apache.fop.fo.pagination.PageSequence(parent); diff --git a/src/java/org/apache/fop/fo/FOTreeBuilder.java b/src/java/org/apache/fop/fo/FOTreeBuilder.java index 5c9909f64..8d66a5f44 100644 --- a/src/java/org/apache/fop/fo/FOTreeBuilder.java +++ b/src/java/org/apache/fop/fo/FOTreeBuilder.java @@ -246,8 +246,9 @@ public class FOTreeBuilder extends DefaultHandler { "Error: First element must be fo:root formatting object")); } } else { // check that incoming node is valid for currentFObj - if (namespaceURI.equals(FOElementMapping.URI) || - namespaceURI.equals(ExtensionElementMapping.URI)) { + if (namespaceURI.equals(FOElementMapping.URI)) { + // currently no fox: elements to validate + // || namespaceURI.equals(ExtensionElementMapping.URI) */) { try { currentFObj.validateChildNode(locator, namespaceURI, localName); } catch (ValidationException e) { diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index b4c7edce2..3281a4c27 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -35,7 +35,7 @@ import org.xml.sax.Locator; /** * Base class for representation of formatting objects and their processing. */ -public class FObj extends FONode implements Constants { +public abstract class FObj extends FONode implements Constants { public static PropertyMaker[] propertyListTable = null; /** The immediate child nodes of this node. */ diff --git a/src/java/org/apache/fop/fo/FObjMixed.java b/src/java/org/apache/fop/fo/FObjMixed.java index 37f8724af..b7e0a7f29 100644 --- a/src/java/org/apache/fop/fo/FObjMixed.java +++ b/src/java/org/apache/fop/fo/FObjMixed.java @@ -29,7 +29,7 @@ import org.apache.fop.apps.FOPException; * (i.e., those that can contain both child FO's and text nodes/PCDATA). * It should not be instantiated directly. */ -public class FObjMixed extends FObj { +public abstract class FObjMixed extends FObj { /** * @param parent FONode that is the parent of this object */ diff --git a/src/java/org/apache/fop/fo/PropertySets.java b/src/java/org/apache/fop/fo/PropertySets.java index 418d23bac..9b4e7d3b9 100644 --- a/src/java/org/apache/fop/fo/PropertySets.java +++ b/src/java/org/apache/fop/fo/PropertySets.java @@ -205,13 +205,18 @@ public class PropertySets { elem.addContent(Constants.FO_BOOKMARK); elem = elements[Constants.FO_BOOKMARK]; -// elem.addContent(Constants.FO_BOOKMARK_TITLE); + elem.addContent(Constants.FO_BOOKMARK_TITLE); elem.addContent(Constants.FO_BOOKMARK); elem.addProperties(CommonAccessibilityProperties); elem.addProperty(Constants.PR_EXTERNAL_DESTINATION); elem.addProperty(Constants.PR_INTERNAL_DESTINATION); elem.addProperty(Constants.PR_STARTING_STATE); + elem = elements[Constants.FO_BOOKMARK_TITLE]; + elem.addProperties(CommonAccessibilityProperties); + elem.addProperty(Constants.PR_FONT_STYLE); + elem.addProperty(Constants.PR_FONT_WEIGHT); + elem = elements[Constants.FO_PAGE_SEQUENCE]; elem.addProperty(Constants.PR_COUNTRY); elem.addProperty(Constants.PR_FORMAT); diff --git a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java index 3e0067d12..950738e85 100644 --- a/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java @@ -44,13 +44,6 @@ public class ExtensionElementMapping extends ElementMapping { protected void initialize() { if (foObjs == null) { foObjs = new HashMap(); - foObjs.put("label", new L()); - } - } - - static class L extends ElementMapping.Maker { - public FONode make(FONode parent) { - return new Label(parent); } } } diff --git a/src/java/org/apache/fop/fo/extensions/Label.java b/src/java/org/apache/fop/fo/extensions/Label.java deleted file mode 100644 index cfba909b6..000000000 --- a/src/java/org/apache/fop/fo/extensions/Label.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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$ */ - -package org.apache.fop.fo.extensions; - -import org.xml.sax.Locator; - -import org.apache.fop.fo.FONode; -import org.apache.fop.fo.PropertyList; - -/** - * Labal for PDF bookmark extension. - * This element contains the label for the bookmark object. - */ -public class Label extends ExtensionObj { - private String label = ""; - - /** - * Create a new label object. - * - * @param parent the fo node parent - */ - public Label(FONode parent) { - super(parent); - } - - /** - * Add the characters to this label. - * The text data inside the label xml element is used for the label string. - * - * @param data the character data - * @param start the start position in the data array - * @param end the end position in the character array - * @param locator location in fo source file. - */ - protected void addCharacters(char data[], int start, int end, - PropertyList pList, - Locator locator) { - label += new String(data, start, end - start); - } - - /** - * Get the string for this label. - * - * @return the label string - */ - public String toString() { - return label; - } - - public String getName() { - return "(http://xml.apache.org/fop/extensions) label"; - } - -} diff --git a/src/java/org/apache/fop/fo/flow/InlineLevel.java b/src/java/org/apache/fop/fo/flow/InlineLevel.java index ab468f6ad..6cdb92b40 100644 --- a/src/java/org/apache/fop/fo/flow/InlineLevel.java +++ b/src/java/org/apache/fop/fo/flow/InlineLevel.java @@ -35,9 +35,9 @@ import org.apache.fop.layoutmgr.InlineLayoutManager; /** * Class modelling the commonalities of several inline-level - * formatting objects. It should not be instantiated directly. + * formatting objects. */ -public class InlineLevel extends FObjMixed { +public abstract class InlineLevel extends FObjMixed { protected CommonBorderPaddingBackground commonBorderPaddingBackground; protected CommonAccessibility commonAccessibility; protected CommonMarginInline commonMarginInline; diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java index 4ba55d317..dce00e128 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java +++ b/src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java @@ -19,15 +19,13 @@ package org.apache.fop.fo.pagination.bookmarks; import java.util.ArrayList; - import org.xml.sax.Attributes; import org.xml.sax.Locator; - import org.apache.fop.apps.FOPException; import org.apache.fop.fo.FObj; import org.apache.fop.fo.FONode; import org.apache.fop.fo.PropertyList; -import org.apache.fop.fo.extensions.Label; +import org.apache.fop.fo.ValidationException; /** @@ -36,7 +34,7 @@ import org.apache.fop.fo.extensions.Label; * XSL 1.1 WD evolves. */ public class Bookmark extends FObj { - private Label bookmarkTitle; + private BookmarkTitle bookmarkTitle; private ArrayList childBookmarks = new ArrayList(); private String internalDestination; @@ -76,11 +74,39 @@ public class Bookmark extends FObj { } /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + XSL/FOP: (bookmark-title, bookmark*) + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws ValidationException { + if (nsURI == FO_URI && localName.equals("bookmark-title")) { + if (bookmarkTitle != null) { + tooManyNodesError(loc, "fo:bookmark-title"); + } + } else if (nsURI == FO_URI && localName.equals("bookmark")) { + if (bookmarkTitle == null) { + nodesOutOfOrderError(loc, "fo:bookmark-title", "fo:bookmark"); + } + } else { + invalidChildError(loc, nsURI, localName); + } + } + + /** + * @see org.apache.fop.fo.FONode#endOfNode + */ + protected void endOfNode() throws FOPException { + if (bookmarkTitle == null) { + missingChildElementError("(bookmark-title, bookmark*)"); + } + } + + /** * @see org.apache.fop.fo.FONode#addChildNode(FONode) */ protected void addChildNode(FONode obj) { - if (obj instanceof Label) { - bookmarkTitle = (Label)obj; + if (obj instanceof BookmarkTitle) { + bookmarkTitle = (BookmarkTitle)obj; } else if (obj instanceof Bookmark) { childBookmarks.add(obj); } @@ -92,7 +118,7 @@ public class Bookmark extends FObj { * @return the bookmark title string or an empty string if not found */ public String getBookmarkTitle() { - return bookmarkTitle == null ? "" : bookmarkTitle.toString(); + return bookmarkTitle == null ? "" : bookmarkTitle.getTitle(); } public String getInternalDestination() { diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java new file mode 100644 index 000000000..d458408cc --- /dev/null +++ b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java @@ -0,0 +1,92 @@ +/* + * 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 $ */ + +package org.apache.fop.fo.pagination.bookmarks; + +import org.xml.sax.Locator; + +import org.apache.fop.fo.FObj; +import org.apache.fop.fo.FONode; +import org.apache.fop.fo.PropertyList; +import org.apache.fop.fo.ValidationException; + +/** + * The fo:bookmark-title formatting object, first introduced in the + * XSL 1.1 WD. Prototype version only, subject to change as XSL 1.1 WD + * evolves. + */ +public class BookmarkTitle extends FObj { + private String title = ""; + + /** + * Create a new BookmarkTitle object. + * + * @param parent the fo node parent + */ + public BookmarkTitle(FONode parent) { + super(parent); + } + + /** + * Add the characters to this BookmarkTitle. + * The text data inside the BookmarkTitle xml element + * is used for the BookmarkTitle string. + * + * @param data the character data + * @param start the start position in the data array + * @param end the end position in the character array + * @param locator location in fo source file. + */ + protected void addCharacters(char data[], int start, int end, + PropertyList pList, + Locator locator) { + title += new String(data, start, end - start); + } + + /** + * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) + XSL/FOP: empty + */ + protected void validateChildNode(Locator loc, String nsURI, String localName) + throws ValidationException { + invalidChildError(loc, nsURI, localName); + } + + /** + * Get the title for this BookmarkTitle. + * + * @return the bookmark title + */ + public String getTitle() { + return title; + } + + /** + * @see org.apache.fop.fo.FObj#getName() + */ + public String getName() { + return "fo:bookmark-title"; + } + + /** + * @see org.apache.fop.fo.FObj#getNameId() + */ + public int getNameId() { + return FO_BOOKMARK_TITLE; + } +} diff --git a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java index b5af4efcf..d13cdd966 100644 --- a/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java +++ b/src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java @@ -67,7 +67,7 @@ public class BookmarkTree extends FObj { /** * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String) - XSL/FOP: (conditional-page-master-reference+) + XSL/FOP: (bookmark+) */ protected void validateChildNode(Locator loc, String nsURI, String localName) throws ValidationException { |