Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

DestinationData.java 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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.area;
  19. import java.util.List;
  20. import org.apache.fop.fo.extensions.destination.Destination;
  21. /**
  22. * An instance of this class is named destination from fox:destination
  23. */
  24. public class DestinationData extends AbstractOffDocumentItem implements Resolvable {
  25. // ID Reference for this bookmark
  26. private String idRef;
  27. // String Array to satisfy getIDRefs method
  28. private String[] idRefs;
  29. // PageViewport that the idRef item refers to
  30. private PageViewport pageRef = null;
  31. /**
  32. * Create a new pdf destination data object.
  33. * This is used by the destination to create a data object
  34. * with a idref. During processing, this idref will be
  35. * subsequently resolved to a particular PageViewport.
  36. *
  37. * @param destination the fo:bookmark object
  38. */
  39. public DestinationData(Destination destination) {
  40. this(destination.getInternalDestination());
  41. }
  42. /**
  43. * Create a new named destination.
  44. * @param idRef the id reference of the destination
  45. */
  46. public DestinationData(String idRef) {
  47. this.idRef = idRef;
  48. this.idRefs = new String[] {idRef};
  49. }
  50. /**
  51. * Get the idref for this destination
  52. *
  53. * @return the idref for the destination
  54. */
  55. public String getIDRef() {
  56. return idRef;
  57. }
  58. /**
  59. * {@inheritDoc}
  60. */
  61. public String[] getIDRefs() {
  62. return idRefs;
  63. }
  64. /**
  65. * Get the PageViewport object that this destination refers to
  66. *
  67. * @return the PageViewport that this destination points to
  68. */
  69. public PageViewport getPageViewport() {
  70. return pageRef;
  71. }
  72. /**
  73. * Check if this resolvable object has been resolved.
  74. * For now, just return true.
  75. * To do: Find a way to determine whether the destination has been resolved.
  76. *
  77. * @return true if this object has been resolved
  78. */
  79. public boolean isResolved() {
  80. return true;
  81. }
  82. /**
  83. * Resolves the idref of this object by getting the PageViewport
  84. * object that corresponds to the IDRef
  85. *
  86. * {@inheritDoc} List)
  87. * @todo check to make sure it works if multiple bookmark-items
  88. * have the same idref
  89. */
  90. public void resolveIDRef(String id, List pages) {
  91. pageRef = (PageViewport) pages.get(0);
  92. // TODO get rect area of id on page
  93. }
  94. /** {@inheritDoc} */
  95. public String getName() {
  96. return "Destination";
  97. }
  98. }