]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
1.) fox:label converted to 1.1 fo:bookmark-title.
authorGlen Mazza <gmazza@apache.org>
Thu, 6 Jan 2005 00:56:26 +0000 (00:56 +0000)
committerGlen Mazza <gmazza@apache.org>
Thu, 6 Jan 2005 00:56:26 +0000 (00:56 +0000)
2.) FObj, FObjMixed, InlineLevel made abstract.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198227 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
examples/fo/advanced/cid-fonts.fo
examples/fo/basic/pdfoutline.fo
src/java/org/apache/fop/fo/Constants.java
src/java/org/apache/fop/fo/FOElementMapping.java
src/java/org/apache/fop/fo/FOTreeBuilder.java
src/java/org/apache/fop/fo/FObj.java
src/java/org/apache/fop/fo/FObjMixed.java
src/java/org/apache/fop/fo/PropertySets.java
src/java/org/apache/fop/fo/extensions/ExtensionElementMapping.java
src/java/org/apache/fop/fo/extensions/Label.java [deleted file]
src/java/org/apache/fop/fo/flow/InlineLevel.java
src/java/org/apache/fop/fo/pagination/bookmarks/Bookmark.java
src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTitle.java [new file with mode: 0644]
src/java/org/apache/fop/fo/pagination/bookmarks/BookmarkTree.java

index 556aa8a2d1d4e2521c5698038127c39a7492973f..526ebea0665c383d411d0ba6398079a6c8cef711 100644 (file)
@@ -2,8 +2,7 @@
 <!DOCTYPE fo:root [
 <!ENTITY nbsp "&#160;">
 ]>
-<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" 
 
 <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>
 
index ce1aa35973bd6666c8fee2ef36eeb4c7d348f419..e09020b2fb84cb368380aed5b5ce330aaaf3cf8b 100644 (file)
@@ -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
index 192ad5560e70b4b926b4cd06e352bcbb0712b754..3103ca9d8824806c75220ea7f389c5a443ead652 100644 (file)
@@ -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;
index 1fa266778a79fd657d60a88798b0e5eb2955cd23..d19d784a655b6350ec1a0eb69646dc2e7ba366a2 100644 (file)
@@ -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);
index 5c9909f649060b211ff0ea4a60957d4883da886b..8d66a5f44777016f51bd1dd45299a230955a0cea 100644 (file)
@@ -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) {
index b4c7edce2ad626dd078eb0513e147c6bedf847d4..3281a4c276e6d8f25e0294e7a444012da4b9d9bc 100644 (file)
@@ -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. */
index 37f8724af23f85bf6a149fbf6847024d53660a57..b7e0a7f29cdcc08236b3225d5b3feb6a474ef160 100644 (file)
@@ -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
      */
index 418d23bacb034e7e1400aff2e5acb1f2f8506f32..9b4e7d3b9188ed9b249c6592523cf73c1cc24067 100644 (file)
@@ -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);
index 3e0067d126ad0a48f81389a73fd17d09f4ac3678..950738e8596368cd244b4c6b9af1cf7acef6c317 100644 (file)
@@ -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 (file)
index cfba909..0000000
+++ /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";
-    }
-
-}
index ab468f6ad51ea7c72b2f3e1db9012456f1db7c35..6cdb92b4041a97fcb564fb4ed3259b80b18e10ea 100644 (file)
@@ -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;
index 4ba55d317270dce4f57e3f2c48bca1d36d8f469f..dce00e128540248ca7561e8842a5a4c2281bc1fa 100644 (file)
 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;
@@ -75,12 +73,40 @@ 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 (file)
index 0000000..d458408
--- /dev/null
@@ -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;
+    }
+}
index b5af4efcf0874bd25bce6f1b3eb3f0d5c0b9dc4e..d13cdd9667cc1acef20a61509738042ed679a787 100644 (file)
@@ -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 {