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.

FOTreeBuilderContext.java 2.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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.fo;
  19. import java.util.HashSet;
  20. import java.util.Set;
  21. /**
  22. * Context class providing information needed while building the FO tree.
  23. */
  24. public class FOTreeBuilderContext {
  25. /**
  26. * The current set of id's in the FO tree.
  27. * This is used so we know if the FO tree contains duplicates.
  28. */
  29. private Set idReferences = new HashSet();
  30. /**
  31. * The property list maker.
  32. */
  33. protected PropertyListMaker propertyListMaker;
  34. /**
  35. * The XMLWhitespaceHandler for this tree
  36. */
  37. protected XMLWhiteSpaceHandler whiteSpaceHandler = new XMLWhiteSpaceHandler();
  38. /**
  39. * Indicates whether processing descendants of a marker
  40. */
  41. private boolean inMarker;
  42. /**
  43. * Returns the set of ID references.
  44. * @return the ID references
  45. */
  46. public Set getIDReferences() {
  47. return idReferences;
  48. }
  49. /**
  50. * Return the propertyListMaker.
  51. *
  52. * @return the currently active {@link PropertyListMaker}
  53. */
  54. public PropertyListMaker getPropertyListMaker() {
  55. return propertyListMaker;
  56. }
  57. /**
  58. * Set a new propertyListMaker.
  59. *
  60. * @param propertyListMaker the new {@link PropertyListMaker} to use
  61. */
  62. public void setPropertyListMaker(PropertyListMaker propertyListMaker) {
  63. this.propertyListMaker = propertyListMaker;
  64. }
  65. /**
  66. * Return the XMLWhiteSpaceHandler
  67. * @return the whiteSpaceHandler
  68. */
  69. public XMLWhiteSpaceHandler getXMLWhiteSpaceHandler() {
  70. return whiteSpaceHandler;
  71. }
  72. /**
  73. * Switch to or from marker context
  74. * (used by FOTreeBuilder when processing
  75. * a marker)
  76. *
  77. * @param inMarker true if a marker is being processed;
  78. * false otherwise
  79. *
  80. */
  81. protected void switchMarkerContext(boolean inMarker) {
  82. this.inMarker = inMarker;
  83. }
  84. /**
  85. * Check whether in marker context
  86. *
  87. * @return true if a marker is being processed
  88. */
  89. protected boolean inMarker() {
  90. return this.inMarker;
  91. }
  92. }