You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PDFAElementBridge.java 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. /* $Id$ */
  18. package org.apache.fop.svg;
  19. import java.awt.geom.AffineTransform;
  20. import org.w3c.dom.Element;
  21. import org.w3c.dom.svg.SVGAElement;
  22. import org.apache.batik.bridge.AbstractGraphicsNodeBridge;
  23. import org.apache.batik.bridge.BridgeContext;
  24. import org.apache.batik.gvt.GraphicsNode;
  25. /**
  26. * <p>Bridge class for the &lt;a> element.</p>
  27. *
  28. * <p>This work was authored by Keiron Liddle (keiron@aftexsw.com).</p>
  29. */
  30. public class PDFAElementBridge extends AbstractGraphicsNodeBridge {
  31. private AffineTransform transform;
  32. /**
  33. * Constructs a new bridge for the &lt;a> element.
  34. */
  35. public PDFAElementBridge() {
  36. }
  37. /**
  38. * Set the current transform of this element.
  39. * @param tf the transform
  40. */
  41. public void setCurrentTransform(AffineTransform tf) {
  42. transform = tf;
  43. }
  44. /** @return the transformation matrix for links */
  45. public AffineTransform getCurrentTransform() {
  46. return this.transform;
  47. }
  48. /**
  49. * Returns 'a'.
  50. * @return the name of this node
  51. */
  52. public String getLocalName() {
  53. return SVG_A_TAG;
  54. }
  55. /**
  56. * Creates a {@link org.apache.batik.gvt.CompositeGraphicsNode}.
  57. * @return a new PDFANode
  58. */
  59. protected GraphicsNode instantiateGraphicsNode() {
  60. return new PDFANode();
  61. }
  62. /**
  63. * Builds using the specified BridgeContext and element, the
  64. * specified graphics node.
  65. *
  66. * @param ctx the bridge context to use
  67. * @param e the element that describes the graphics node to build
  68. * @return node the new graphics node
  69. */
  70. public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
  71. PDFANode aNode = (PDFANode)super.createGraphicsNode(ctx, e);
  72. aNode.setDestination(((SVGAElement)e).getHref().getBaseVal());
  73. aNode.setTransform(transform);
  74. return aNode;
  75. }
  76. /**
  77. * Returns true as the &lt;a> element is a container.
  78. * @return true if the a element is a container
  79. */
  80. public boolean isComposite() {
  81. return true;
  82. }
  83. }