-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one or more\r
- * contributor license agreements. See the NOTICE file distributed with\r
- * this work for additional information regarding copyright ownership.\r
- * The ASF licenses this file to You under the Apache License, Version 2.0\r
- * (the "License"); you may not use this file except in compliance with\r
- * the License. You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id$ */\r
-\r
-package org.apache.fop.area;\r
-\r
-import java.util.List;\r
-\r
-import org.apache.fop.fo.extensions.destination.Destination;\r
-import org.apache.fop.area.PageViewport;\r
-/**\r
- * An instance of this class is named destination from fox:destination\r
- */\r
-public class DestinationData extends AbstractOffDocumentItem implements Resolvable {\r
-\r
- // PDFReference (object reference) for this destination\r
- private String goToReference;\r
-\r
- // ID Reference for this bookmark\r
- private String idRef;\r
-\r
- // String Array to satisfy getIDRefs method\r
- private String[] idRefs;\r
-\r
- // PageViewport that the idRef item refers to\r
- private PageViewport pageRef = null;\r
-\r
- /**\r
- * Create a new pdf destination data object.\r
- * This is used by the destination to create a data object\r
- * with a idref. During processing, this idref will be\r
- * subsequently resolved to a particular PageViewport.\r
- *\r
- * @param destination the fo:bookmark object\r
- */\r
- public DestinationData(Destination destination) {\r
- idRef = destination.getInternalDestination();\r
- idRefs = new String[] {idRef};\r
- }\r
-\r
- /**\r
- * Get the idref for this destination\r
- *\r
- * @return the idref for the destination\r
- */\r
- public String getIDRef() {\r
- return idRef;\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.area.Resolvable#getIDRefs()\r
- */\r
- public String[] getIDRefs() {\r
- return idRefs;\r
- }\r
-\r
- /**\r
- * Get the PageViewport object that this destination refers to\r
- *\r
- * @return the PageViewport that this destination points to\r
- */\r
- public PageViewport getPageViewport() {\r
- return pageRef;\r
- }\r
-\r
- /**\r
- * Set the GoToReference for this destination\r
- *\r
- * @param goToReference the GoToReference to associate with this destination\r
- */\r
- public void setGoToReference(String goToReference) {\r
- this.goToReference = goToReference;\r
- }\r
-\r
- /**\r
- * Get the GoToReference for this destination\r
- *\r
- * @return the GoToReference associated with this destination\r
- */\r
- public String getGoToReference() {\r
- return goToReference;\r
- }\r
-\r
- /**\r
- * Check if this resolvable object has been resolved.\r
- * For now, just return true.\r
- * To do: Find a way to determine whether the destination has been resolved.\r
- *\r
- * @return true if this object has been resolved\r
- */\r
- public boolean isResolved() {\r
- return true;\r
- }\r
-\r
- /**\r
- * Resolves the idref of this object by getting the PageViewport\r
- * object that corresponds to the IDRef\r
- *\r
- * @see org.apache.fop.area.Resolvable#resolveIDRef(String, List)\r
- * @todo check to make sure it works if multiple bookmark-items\r
- * have the same idref\r
- */\r
- public void resolveIDRef(String id, List pages) {\r
- pageRef = (PageViewport) pages.get(0);\r
- // TODO get rect area of id on page\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.area.OffDocumentItem#getName()\r
- */\r
- public String getName() {\r
- return "Destination";\r
- }\r
-\r
-}\r
-\r
+/*
+ * 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.area;
+
+import java.util.List;
+
+import org.apache.fop.fo.extensions.destination.Destination;
+import org.apache.fop.area.PageViewport;
+/**
+ * An instance of this class is named destination from fox:destination
+ */
+public class DestinationData extends AbstractOffDocumentItem implements Resolvable {
+
+ // PDFReference (object reference) for this destination
+ private String goToReference;
+
+ // ID Reference for this bookmark
+ private String idRef;
+
+ // String Array to satisfy getIDRefs method
+ private String[] idRefs;
+
+ // PageViewport that the idRef item refers to
+ private PageViewport pageRef = null;
+
+ /**
+ * Create a new pdf destination data object.
+ * This is used by the destination to create a data object
+ * with a idref. During processing, this idref will be
+ * subsequently resolved to a particular PageViewport.
+ *
+ * @param destination the fo:bookmark object
+ */
+ public DestinationData(Destination destination) {
+ idRef = destination.getInternalDestination();
+ idRefs = new String[] {idRef};
+ }
+
+ /**
+ * Get the idref for this destination
+ *
+ * @return the idref for the destination
+ */
+ public String getIDRef() {
+ return idRef;
+ }
+
+ /**
+ * @see org.apache.fop.area.Resolvable#getIDRefs()
+ */
+ public String[] getIDRefs() {
+ return idRefs;
+ }
+
+ /**
+ * Get the PageViewport object that this destination refers to
+ *
+ * @return the PageViewport that this destination points to
+ */
+ public PageViewport getPageViewport() {
+ return pageRef;
+ }
+
+ /**
+ * Set the GoToReference for this destination
+ *
+ * @param goToReference the GoToReference to associate with this destination
+ */
+ public void setGoToReference(String goToReference) {
+ this.goToReference = goToReference;
+ }
+
+ /**
+ * Get the GoToReference for this destination
+ *
+ * @return the GoToReference associated with this destination
+ */
+ public String getGoToReference() {
+ return goToReference;
+ }
+
+ /**
+ * Check if this resolvable object has been resolved.
+ * For now, just return true.
+ * To do: Find a way to determine whether the destination has been resolved.
+ *
+ * @return true if this object has been resolved
+ */
+ public boolean isResolved() {
+ return true;
+ }
+
+ /**
+ * Resolves the idref of this object by getting the PageViewport
+ * object that corresponds to the IDRef
+ *
+ * @see org.apache.fop.area.Resolvable#resolveIDRef(String, List)
+ * @todo check to make sure it works if multiple bookmark-items
+ * have the same idref
+ */
+ public void resolveIDRef(String id, List pages) {
+ pageRef = (PageViewport) pages.get(0);
+ // TODO get rect area of id on page
+ }
+
+ /**
+ * @see org.apache.fop.area.OffDocumentItem#getName()
+ */
+ public String getName() {
+ return "Destination";
+ }
+
+}
+
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one or more\r
- * contributor license agreements. See the NOTICE file distributed with\r
- * this work for additional information regarding copyright ownership.\r
- * The ASF licenses this file to You under the Apache License, Version 2.0\r
- * (the "License"); you may not use this file except in compliance with\r
- * the License. You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id$ */\r
-\r
-package org.apache.fop.fo.extensions.destination;\r
-\r
-import org.apache.fop.fo.ValidationException;\r
-import org.apache.fop.apps.FOPException;\r
-import org.apache.fop.fo.PropertyList;\r
-import org.apache.fop.fo.FOEventHandler;\r
-import org.apache.fop.fo.FONode;\r
-import org.apache.fop.fo.FObj;\r
-import org.apache.fop.fo.pagination.Root;\r
-import org.apache.fop.fo.extensions.ExtensionElementMapping;\r
-\r
-import org.xml.sax.Attributes;\r
-import org.xml.sax.Locator;\r
-\r
-/**\r
- * Class for named destinations in PDF.\r
- */\r
-public class Destination extends FObj {\r
-\r
- String internalDestination;\r
- Root root;\r
-\r
- /**\r
- * Constructs a Destination object (called by Maker).\r
- *\r
- * @param parent the parent formatting object\r
- */\r
- public Destination(FONode parent) {\r
- super(parent);\r
- root = parent.getRoot();\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.fo.FObj#bind(PropertyList)\r
- */\r
- public void bind(PropertyList pList) throws FOPException {\r
- internalDestination = pList.get(PR_INTERNAL_DESTINATION).getString();\r
- if (internalDestination.length() == 0) {\r
- attributeError("Missing attribute: internal-destination must be specified.");\r
- }\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.fo.FONode#endOfNode\r
- */\r
- protected void endOfNode() throws FOPException {\r
- root.addDestination(this);\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)\r
- XSL/FOP: empty\r
- */\r
- protected void validateChildNode(Locator loc, String nsURI, String localName)\r
- throws ValidationException {\r
- invalidChildError(loc, nsURI, localName);\r
- }\r
-\r
- public String getInternalDestination() {\r
- return internalDestination;\r
- }\r
-\r
- /** @see org.apache.fop.fo.FONode#getNamespaceURI() */\r
- public String getNamespaceURI() {\r
- return ExtensionElementMapping.URI;\r
- }\r
-\r
- /** @see org.apache.fop.fo.FONode#getNormalNamespacePrefix() */\r
- public String getNormalNamespacePrefix() {\r
- return "fox";\r
- }\r
-\r
- /** @see org.apache.fop.fo.FONode#getLocalName() */\r
- public String getLocalName() {\r
- return "destination";\r
- }\r
-\r
-}\r
-\r
+/*
+ * 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.fo.extensions.destination;
+
+import org.apache.fop.fo.ValidationException;
+import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.FOEventHandler;
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.pagination.Root;
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
+/**
+ * Class for named destinations in PDF.
+ */
+public class Destination extends FObj {
+
+ String internalDestination;
+ Root root;
+
+ /**
+ * Constructs a Destination object (called by Maker).
+ *
+ * @param parent the parent formatting object
+ */
+ public Destination(FONode parent) {
+ super(parent);
+ root = parent.getRoot();
+ }
+
+ /**
+ * @see org.apache.fop.fo.FObj#bind(PropertyList)
+ */
+ public void bind(PropertyList pList) throws FOPException {
+ internalDestination = pList.get(PR_INTERNAL_DESTINATION).getString();
+ if (internalDestination.length() == 0) {
+ attributeError("Missing attribute: internal-destination must be specified.");
+ }
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#endOfNode
+ */
+ protected void endOfNode() throws FOPException {
+ root.addDestination(this);
+ }
+
+ /**
+ * @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);
+ }
+
+ public String getInternalDestination() {
+ return internalDestination;
+ }
+
+ /** @see org.apache.fop.fo.FONode#getNamespaceURI() */
+ public String getNamespaceURI() {
+ return ExtensionElementMapping.URI;
+ }
+
+ /** @see org.apache.fop.fo.FONode#getNormalNamespacePrefix() */
+ public String getNormalNamespacePrefix() {
+ return "fox";
+ }
+
+ /** @see org.apache.fop.fo.FONode#getLocalName() */
+ public String getLocalName() {
+ return "destination";
+ }
+
+}
+
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one or more\r
- * contributor license agreements. See the NOTICE file distributed with\r
- * this work for additional information regarding copyright ownership.\r
- * The ASF licenses this file to You under the Apache License, Version 2.0\r
- * (the "License"); you may not use this file except in compliance with\r
- * the License. You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id$ */\r
-\r
-package org.apache.fop.fo.extensions.destination;\r
-\r
-import java.util.HashMap;\r
-import java.util.Set;\r
-\r
-import org.apache.fop.fo.FONode;\r
-import org.apache.fop.fo.ElementMapping;\r
-import org.apache.fop.fo.extensions.ExtensionElementMapping;\r
-import org.apache.fop.util.QName;\r
-\r
-import org.apache.fop.fo.extensions.destination.Destination;\r
-\r
-/**\r
- * Set up the destination element mapping.\r
- */\r
-public class DestinationElementMapping extends ElementMapping {\r
- \r
- /**\r
- * The FOP extension namespace URI\r
- */\r
- public static final String URI = ExtensionElementMapping.URI;\r
-\r
- private static final Set propertyAttributes = new java.util.HashSet();\r
- \r
- static {\r
- //The extension property (fox:*) for named destinations\r
- propertyAttributes.add("internal-destination");\r
- }\r
-\r
- /**\r
- * Constructor.\r
- */\r
- public DestinationElementMapping() {\r
- namespaceURI = URI;\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.fo.ElementMapping#initialize()\r
- */\r
- protected void initialize() {\r
- if (foObjs == null) {\r
- foObjs = new HashMap();\r
- foObjs.put("destination", new DestinationMaker());\r
- }\r
- }\r
-\r
- static class DestinationMaker extends ElementMapping.Maker {\r
- public FONode make(FONode parent) {\r
- return new Destination(parent);\r
- }\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.fo.ElementMapping#getStandardPrefix()\r
- */\r
- public String getStandardPrefix() {\r
- return "fox";\r
- }\r
- \r
- /**\r
- * @see org.apache.fop.fo.ElementMapping#isAttributeProperty(org.apache.fop.util.QName)\r
- */\r
- public boolean isAttributeProperty(QName attributeName) {\r
- if (!URI.equals(attributeName.getNamespaceURI())) {\r
- throw new IllegalArgumentException("The namespace URIs don't match");\r
- }\r
- return propertyAttributes.contains(attributeName.getLocalName());\r
- }\r
- \r
-}\r
+/*
+ * 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.fo.extensions.destination;
+
+import java.util.HashMap;
+import java.util.Set;
+
+import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.ElementMapping;
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
+import org.apache.fop.util.QName;
+
+import org.apache.fop.fo.extensions.destination.Destination;
+
+/**
+ * Set up the destination element mapping.
+ */
+public class DestinationElementMapping extends ElementMapping {
+
+ /**
+ * The FOP extension namespace URI
+ */
+ public static final String URI = ExtensionElementMapping.URI;
+
+ private static final Set propertyAttributes = new java.util.HashSet();
+
+ static {
+ //The extension property (fox:*) for named destinations
+ propertyAttributes.add("internal-destination");
+ }
+
+ /**
+ * Constructor.
+ */
+ public DestinationElementMapping() {
+ namespaceURI = URI;
+ }
+
+ /**
+ * @see org.apache.fop.fo.ElementMapping#initialize()
+ */
+ protected void initialize() {
+ if (foObjs == null) {
+ foObjs = new HashMap();
+ foObjs.put("destination", new DestinationMaker());
+ }
+ }
+
+ static class DestinationMaker extends ElementMapping.Maker {
+ public FONode make(FONode parent) {
+ return new Destination(parent);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.fo.ElementMapping#getStandardPrefix()
+ */
+ public String getStandardPrefix() {
+ return "fox";
+ }
+
+ /**
+ * @see org.apache.fop.fo.ElementMapping#isAttributeProperty(org.apache.fop.util.QName)
+ */
+ public boolean isAttributeProperty(QName attributeName) {
+ if (!URI.equals(attributeName.getNamespaceURI())) {
+ throw new IllegalArgumentException("The namespace URIs don't match");
+ }
+ return propertyAttributes.contains(attributeName.getLocalName());
+ }
+
+}
-<!--\r
- Licensed to the Apache Software Foundation (ASF) under one or more\r
- contributor license agreements. See the NOTICE file distributed with\r
- this work for additional information regarding copyright ownership.\r
- The ASF licenses this file to You under the Apache License, Version 2.0\r
- (the "License"); you may not use this file except in compliance with\r
- the License. You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
--->\r
-<!-- $Id$ -->\r
-<HTML>\r
-<TITLE>org.apache.fop.destination Package</TITLE>\r
-<BODY>\r
-<P>Classes to support named destinations (only relevant for PDF output)</P>\r
-</BODY>\r
-</HTML>\r
+<!--
+ 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$ -->
+<HTML>
+<TITLE>org.apache.fop.destination Package</TITLE>
+<BODY>
+<P>Classes to support named destinations (only relevant for PDF output)</P>
+</BODY>
+</HTML>
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one or more\r
- * contributor license agreements. See the NOTICE file distributed with\r
- * this work for additional information regarding copyright ownership.\r
- * The ASF licenses this file to You under the Apache License, Version 2.0\r
- * (the "License"); you may not use this file except in compliance with\r
- * the License. You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id: PDFLink.java 426576 2006-07-28 15:44:37Z jeremias $ */\r
-\r
-package org.apache.fop.pdf;\r
-\r
-import org.apache.fop.area.DestinationData;\r
-import org.apache.fop.area.PageViewport;\r
-\r
-/**\r
- * class representing a named destination\r
- */\r
-public class PDFDestination extends PDFObject {\r
-\r
- /**\r
- * PDFReference (object reference) for this destination\r
- */\r
- private String goToReference;\r
-\r
- /**\r
- * ID Reference for this destination\r
- */\r
- private String idRef;\r
-\r
- /**\r
- * PageViewport to which the idRef item refers\r
- */\r
- private PageViewport pageViewport = null;\r
-\r
- /**\r
- * create a named destination\r
- */\r
- public PDFDestination(DestinationData destinationData) {\r
- /* generic creation of PDF object */\r
- super();\r
- this.goToReference = destinationData.getGoToReference();\r
- this.idRef = destinationData.getIDRef();\r
- this.pageViewport = destinationData.getPageViewport();\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.pdf.PDFObject#toPDFString()\r
- */\r
- public String toPDFString() {\r
- String s = getObjectID()\r
- + "<<"\r
- + "/Limits [(" + idRef + ") (" + idRef + ")]\n"\r
- + "/Names [(" + idRef + ") " + goToReference + "]"\r
- + "\n>>\nendobj\n";\r
- return s;\r
- }\r
-\r
- /*\r
- * example:\r
- *\r
- * 249 0 obj\r
- * <<\r
- * /Limits [(drivervariables) (drivervariables)]\r
- * /Names [(drivervariables) 73 0 R]\r
- * >>\r
- * endobj\r
- */\r
-\r
- /**\r
- * Sets the GoToReference in the associated DestinationData object.\r
- *\r
- * @param goToReference the reference to set in the associated DestinationData object.\r
- */\r
- public void setGoToReference(String goToReference) {\r
- this.goToReference = goToReference;\r
- }\r
-\r
- /**\r
- * Returns the GoToReference from the associated DestinationData object.\r
- *\r
- * @return the GoToReference from the associated DestinationData object.\r
- */\r
- public String getGoToReference() {\r
- return this.goToReference;\r
- }\r
-\r
- /**\r
- * Get the PageViewport object that this destination refers to\r
- *\r
- * @return the PageViewport that this destination points to\r
- */\r
- public PageViewport getPageViewport() {\r
- return this.pageViewport;\r
- }\r
-\r
- /**\r
- * Returns the RefID from the associated DestinationData object.\r
- *\r
- * @return the RefID from the associated DestinationData object.\r
- */\r
- public String getIDRef() {\r
- return this.idRef;\r
- }\r
-\r
- /**\r
- * Check if this equals another object.\r
- *\r
- * @param obj the object to compare\r
- * @return true if this equals other object\r
- */\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
-\r
- if (obj == null || !(obj instanceof PDFDestination)) {\r
- return false;\r
- }\r
-\r
- PDFDestination dest = (PDFDestination)obj;\r
- if (dest.getIDRef() == this.getIDRef()) {\r
- return true;\r
- }\r
- \r
- return true;\r
- }\r
-}\r
-\r
+/*
+ * 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.pdf;
+
+import org.apache.fop.area.DestinationData;
+import org.apache.fop.area.PageViewport;
+
+/**
+ * class representing a named destination
+ */
+public class PDFDestination extends PDFObject {
+
+ /**
+ * PDFReference (object reference) for this destination
+ */
+ private String goToReference;
+
+ /**
+ * ID Reference for this destination
+ */
+ private String idRef;
+
+ /**
+ * PageViewport to which the idRef item refers
+ */
+ private PageViewport pageViewport = null;
+
+ /**
+ * create a named destination
+ */
+ public PDFDestination(DestinationData destinationData) {
+ /* generic creation of PDF object */
+ super();
+ this.goToReference = destinationData.getGoToReference();
+ this.idRef = destinationData.getIDRef();
+ this.pageViewport = destinationData.getPageViewport();
+ }
+
+ /**
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
+ */
+ public String toPDFString() {
+ String s = getObjectID()
+ + "<<"
+ + "/Limits [(" + idRef + ") (" + idRef + ")]\n"
+ + "/Names [(" + idRef + ") " + goToReference + "]"
+ + "\n>>\nendobj\n";
+ return s;
+ }
+
+ /*
+ * example:
+ *
+ * 249 0 obj
+ * <<
+ * /Limits [(drivervariables) (drivervariables)]
+ * /Names [(drivervariables) 73 0 R]
+ * >>
+ * endobj
+ */
+
+ /**
+ * Sets the GoToReference in the associated DestinationData object.
+ *
+ * @param goToReference the reference to set in the associated DestinationData object.
+ */
+ public void setGoToReference(String goToReference) {
+ this.goToReference = goToReference;
+ }
+
+ /**
+ * Returns the GoToReference from the associated DestinationData object.
+ *
+ * @return the GoToReference from the associated DestinationData object.
+ */
+ public String getGoToReference() {
+ return this.goToReference;
+ }
+
+ /**
+ * Get the PageViewport object that this destination refers to
+ *
+ * @return the PageViewport that this destination points to
+ */
+ public PageViewport getPageViewport() {
+ return this.pageViewport;
+ }
+
+ /**
+ * Returns the RefID from the associated DestinationData object.
+ *
+ * @return the RefID from the associated DestinationData object.
+ */
+ public String getIDRef() {
+ return this.idRef;
+ }
+
+ /**
+ * Check if this equals another object.
+ *
+ * @param obj the object to compare
+ * @return true if this equals other object
+ */
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null || !(obj instanceof PDFDestination)) {
+ return false;
+ }
+
+ PDFDestination dest = (PDFDestination)obj;
+ if (dest.getIDRef() == this.getIDRef()) {
+ return true;
+ }
+
+ return true;
+ }
+}
+
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one or more\r
- * contributor license agreements. See the NOTICE file distributed with\r
- * this work for additional information regarding copyright ownership.\r
- * The ASF licenses this file to You under the Apache License, Version 2.0\r
- * (the "License"); you may not use this file except in compliance with\r
- * the License. You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id: PDFLink.java 426576 2006-07-28 15:44:37Z jeremias $ */\r
-\r
-package org.apache.fop.pdf;\r
-\r
-import org.apache.fop.area.DestinationData;\r
-\r
-/**\r
- * class representing an /Dests object (part of a name dictionary)\r
- */\r
-public class PDFDests extends PDFObject {\r
-\r
- private String limitsRef;\r
-\r
- /**\r
- * create a named destination\r
- */\r
- public PDFDests(String limitsRef) {\r
- /* generic creation of PDF object */\r
- super();\r
- this.limitsRef = limitsRef;\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.pdf.PDFObject#toPDFString()\r
- */\r
- public String toPDFString() {\r
- String s = getObjectID()\r
- + "<<\n"\r
- + "/Dests " + limitsRef\r
- + "\n>>\nendobj\n";\r
- return s;\r
- }\r
-\r
- /*\r
- * example:\r
- *\r
- * 262 0 obj\r
- * <<\r
- * /Dests 260 0 R\r
- * >>\r
- * endobj\r
- */\r
-\r
- /**\r
- * Check if this equals another object.\r
- *\r
- * @param obj the object to compare\r
- * @return true if this equals other object\r
- */\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
-\r
- if (obj == null || !(obj instanceof PDFDests)) {\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-}\r
-\r
+/*
+ * 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.pdf;
+
+import org.apache.fop.area.DestinationData;
+
+/**
+ * class representing an /Dests object (part of a name dictionary)
+ */
+public class PDFDests extends PDFObject {
+
+ private String limitsRef;
+
+ /**
+ * create a named destination
+ */
+ public PDFDests(String limitsRef) {
+ /* generic creation of PDF object */
+ super();
+ this.limitsRef = limitsRef;
+ }
+
+ /**
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
+ */
+ public String toPDFString() {
+ String s = getObjectID()
+ + "<<\n"
+ + "/Dests " + limitsRef
+ + "\n>>\nendobj\n";
+ return s;
+ }
+
+ /*
+ * example:
+ *
+ * 262 0 obj
+ * <<
+ * /Dests 260 0 R
+ * >>
+ * endobj
+ */
+
+ /**
+ * Check if this equals another object.
+ *
+ * @param obj the object to compare
+ * @return true if this equals other object
+ */
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null || !(obj instanceof PDFDests)) {
+ return false;
+ }
+
+ return true;
+ }
+}
+
-/*\r
- * Licensed to the Apache Software Foundation (ASF) under one or more\r
- * contributor license agreements. See the NOTICE file distributed with\r
- * this work for additional information regarding copyright ownership.\r
- * The ASF licenses this file to You under the Apache License, Version 2.0\r
- * (the "License"); you may not use this file except in compliance with\r
- * the License. You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id: PDFLink.java 426576 2006-07-28 15:44:37Z jeremias $ */\r
-\r
-package org.apache.fop.pdf;\r
-\r
-import java.util.ArrayList;\r
-\r
-import org.apache.fop.pdf.PDFDestination;\r
-\r
-/**\r
- * class representing a Limits object (part of the names dictionary for named destinations)\r
- */\r
-public class PDFLimits extends PDFObject {\r
-\r
- private ArrayList destinationList;\r
-\r
- /**\r
- * create a named destination\r
- */\r
- public PDFLimits(ArrayList destinationList) {\r
- /* generic creation of PDF object */\r
- super();\r
- this.destinationList = destinationList;\r
- }\r
-\r
- /**\r
- * @see org.apache.fop.pdf.PDFObject#toPDFString()\r
- */\r
- public String toPDFString() {\r
- String[] idRefs = new String[destinationList.size()];\r
- String kidsString = "";\r
- for (int i = 0; i < destinationList.size(); i++) {\r
- PDFDestination dest = (PDFDestination)destinationList.get(i);\r
- idRefs[i] = dest.getIDRef();\r
- kidsString += dest.referencePDF();\r
- if (!(i == destinationList.size() - 1)) {\r
- kidsString += " ";\r
- }\r
- }\r
- String s = getObjectID()\r
- + "<<\n"\r
- + "/Limits [(" + idRefs[0] + ") (" + idRefs[destinationList.size() - 1] + ")]\n"\r
- + "/Kids [" + kidsString + "]"\r
- + "\n>>\nendobj\n";\r
- return s;\r
- }\r
-\r
- /*\r
- * example:\r
- *\r
- * 260 0 obj\r
- * <<\r
- * /Limits [(Annotate) (thumbnails)]\r
- * /Kids [248 0 R 253 0 R 254 0 R 259 0 R]\r
- * >>\r
- * endobj\r
- */\r
-\r
- /**\r
- * Check if this equals another object.\r
- *\r
- * @param obj the object to compare\r
- * @return true if this equals other object\r
- */\r
- public boolean equals(Object obj) {\r
- if (this == obj) {\r
- return true;\r
- }\r
-\r
- if (obj == null || !(obj instanceof PDFLimits)) {\r
- return false;\r
- }\r
-\r
- return true;\r
- }\r
-}\r
-\r
+/*
+ * 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.pdf;
+
+import java.util.ArrayList;
+
+import org.apache.fop.pdf.PDFDestination;
+
+/**
+ * class representing a Limits object (part of the names dictionary for named destinations)
+ */
+public class PDFLimits extends PDFObject {
+
+ private ArrayList destinationList;
+
+ /**
+ * create a named destination
+ */
+ public PDFLimits(ArrayList destinationList) {
+ /* generic creation of PDF object */
+ super();
+ this.destinationList = destinationList;
+ }
+
+ /**
+ * @see org.apache.fop.pdf.PDFObject#toPDFString()
+ */
+ public String toPDFString() {
+ String[] idRefs = new String[destinationList.size()];
+ String kidsString = "";
+ for (int i = 0; i < destinationList.size(); i++) {
+ PDFDestination dest = (PDFDestination)destinationList.get(i);
+ idRefs[i] = dest.getIDRef();
+ kidsString += dest.referencePDF();
+ if (!(i == destinationList.size() - 1)) {
+ kidsString += " ";
+ }
+ }
+ String s = getObjectID()
+ + "<<\n"
+ + "/Limits [(" + idRefs[0] + ") (" + idRefs[destinationList.size() - 1] + ")]\n"
+ + "/Kids [" + kidsString + "]"
+ + "\n>>\nendobj\n";
+ return s;
+ }
+
+ /*
+ * example:
+ *
+ * 260 0 obj
+ * <<
+ * /Limits [(Annotate) (thumbnails)]
+ * /Kids [248 0 R 253 0 R 254 0 R 259 0 R]
+ * >>
+ * endobj
+ */
+
+ /**
+ * Check if this equals another object.
+ *
+ * @param obj the object to compare
+ * @return true if this equals other object
+ */
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+
+ if (obj == null || !(obj instanceof PDFLimits)) {
+ return false;
+ }
+
+ return true;
+ }
+}
+