diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2007-04-03 08:23:11 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2007-04-03 08:23:11 +0000 |
commit | 405e9d2b9bba697c4ab4f3c61de0e14ba718860d (patch) | |
tree | 27e9f4acae3181bc8f0a1e7ac38153d6820a2d8c /src | |
parent | 877d2fbdccdde9c8ed4873009095fb053fcb52b2 (diff) | |
download | xmlgraphics-fop-405e9d2b9bba697c4ab4f3c61de0e14ba718860d.tar.gz xmlgraphics-fop-405e9d2b9bba697c4ab4f3c61de0e14ba718860d.zip |
No change; just add svn:keywords and svn:Id properties on new files
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@525081 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
7 files changed, 651 insertions, 651 deletions
diff --git a/src/java/org/apache/fop/area/DestinationData.java b/src/java/org/apache/fop/area/DestinationData.java index 5d36969b9..7e59210e0 100644 --- a/src/java/org/apache/fop/area/DestinationData.java +++ b/src/java/org/apache/fop/area/DestinationData.java @@ -1,131 +1,131 @@ -/*
- * 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";
- }
-
-}
-
+/* + * 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"; + } + +} + diff --git a/src/java/org/apache/fop/fo/extensions/destination/Destination.java b/src/java/org/apache/fop/fo/extensions/destination/Destination.java index 01ce44196..81c432601 100644 --- a/src/java/org/apache/fop/fo/extensions/destination/Destination.java +++ b/src/java/org/apache/fop/fo/extensions/destination/Destination.java @@ -1,98 +1,98 @@ -/*
- * 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";
- }
-
-}
-
+/* + * 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"; + } + +} + diff --git a/src/java/org/apache/fop/fo/extensions/destination/DestinationElementMapping.java b/src/java/org/apache/fop/fo/extensions/destination/DestinationElementMapping.java index 33a953689..d0f398617 100644 --- a/src/java/org/apache/fop/fo/extensions/destination/DestinationElementMapping.java +++ b/src/java/org/apache/fop/fo/extensions/destination/DestinationElementMapping.java @@ -1,89 +1,89 @@ -/*
- * 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());
- }
-
-}
+/* + * 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()); + } + +} diff --git a/src/java/org/apache/fop/fo/extensions/destination/package.html b/src/java/org/apache/fop/fo/extensions/destination/package.html index ff2bdbc88..59cbb493d 100644 --- a/src/java/org/apache/fop/fo/extensions/destination/package.html +++ b/src/java/org/apache/fop/fo/extensions/destination/package.html @@ -1,23 +1,23 @@ -<!--
- 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>
+<!-- + 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> diff --git a/src/java/org/apache/fop/pdf/PDFDestination.java b/src/java/org/apache/fop/pdf/PDFDestination.java index e68428a19..97923e935 100644 --- a/src/java/org/apache/fop/pdf/PDFDestination.java +++ b/src/java/org/apache/fop/pdf/PDFDestination.java @@ -1,138 +1,138 @@ -/*
- * 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: PDFLink.java 426576 2006-07-28 15:44:37Z jeremias $ */
-
-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;
- }
-}
-
+/* + * 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; + } +} + diff --git a/src/java/org/apache/fop/pdf/PDFDests.java b/src/java/org/apache/fop/pdf/PDFDests.java index 3989b397a..96172c8e2 100644 --- a/src/java/org/apache/fop/pdf/PDFDests.java +++ b/src/java/org/apache/fop/pdf/PDFDests.java @@ -1,79 +1,79 @@ -/*
- * 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: PDFLink.java 426576 2006-07-28 15:44:37Z jeremias $ */
-
-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;
- }
-}
-
+/* + * 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; + } +} + diff --git a/src/java/org/apache/fop/pdf/PDFLimits.java b/src/java/org/apache/fop/pdf/PDFLimits.java index 2687ff1cc..97c097463 100644 --- a/src/java/org/apache/fop/pdf/PDFLimits.java +++ b/src/java/org/apache/fop/pdf/PDFLimits.java @@ -1,93 +1,93 @@ -/*
- * 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: PDFLink.java 426576 2006-07-28 15:44:37Z jeremias $ */
-
-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;
- }
-}
-
+/* + * 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; + } +} + |