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.

Footnote.java 2.4KB

New feature: "Intermediate format" (IF). The IF is basically the XML dialect written by the area tree renderer (XMLRenderer). A new parser for this format allows reparsing a serialized and possibly modified area tree and rendering it to the final target format. More details on the Wiki at http://wiki.apache.org/xmlgraphics-fop/AreaTreeIntermediateXml. No advanced features have been implemented, yet, only the basic functionality. The whole change should be fully backwards-compatible WRT the outer FOP API except maybe for FOTreeBuilder.addElementMapping(), and the area tree XML which got small changes. The area tree has been cleaned up. The serializability has been restored. The CachedRenderPagesModel works again and can, in certain situations, decrease the maximum amount of memory held at one point in time. Some adjustments were necessary in the area tree to help the work of the AreaTreeParser. The AreaTreeParser is new and is responsible for parsing area tree XML files and adding pages to a RenderPagesModel instance. It is SAX-based and should be pretty efficient. XMLUnit (http://xmlunit.sourceforge.net, BSD license) is a new dependency for the test code. It is used to verify the correctness of the intermediate format code. It doesn't have to be installed for the build to run through, though. ElementMapping got a new method getDOMImplementation() which provides the DOMImplementation used to handle a subdocument of a particular namespace. For example, SVG uses Batik's SVG DOM. The AreaTreeParser needs that to properly recreate foreign objects because it can't use the mechanism of the FO tree. The default implementation returns null. The ElementMapping instances are no longer maintained by the FOTreeBuilder, but by the newly created ElementMappingRegistry class. It is expected that the instance of this class is moved from the FOTreeBuilder and the AreaTreeParser's Handler class to the "environment class" once it is created to cut down on the startup time for each processed document. The XMLRenderer has been slightly modified to improve the serialization/deserialization qualities of the area tree XML format. The XMLRenderer can now mimic another renderer (see mimicRenderer(Renderer)) in order to use its font setup. That way it is made certain that the reparsed area tree will render to the final target format exactly as expected. Fixed a bug in the XMLHandlerRegistry which did not always return the right XMLHandler for every situation. Added a DefaultErrorListener to the util package. I've had problems with Xalan-J swallowing exceptions with its default ErrorListener, so I added a simple one for convenience and use in AreaTreeParser. Example code for working with the AreaTreeParser can be found in examples/embedding. Documentation will follow. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@369753 13f79535-47bb-0310-9956-ffa450edef68
18 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. // may combine with before float into a conditional area
  20. /**
  21. * The footnote-reference-area optionally generated by an fo:region-body.
  22. * This areas holds footnote areas and an optional separator area.
  23. * See fo:region-body definition in the XSL Rec for more information.
  24. */
  25. public class Footnote extends BlockParent {
  26. private static final long serialVersionUID = -7907428219886367161L;
  27. private Block separator = null;
  28. // footnote has an optional separator
  29. // and a list of sub block areas that can be added/removed
  30. // this is the relative position of the footnote inside
  31. // the body region
  32. private int top;
  33. /**
  34. * Set the separator area for this footnote.
  35. *
  36. * @param sep the separator area
  37. */
  38. public void setSeparator(Block sep) {
  39. separator = sep;
  40. }
  41. /**
  42. * Get the separator area for this footnote area.
  43. *
  44. * @return the separator area
  45. */
  46. public Block getSeparator() {
  47. return separator;
  48. }
  49. /**
  50. * Set the relative position of the footnote inside the body region.
  51. *
  52. * @param top the relative position.
  53. */
  54. public void setTop(int top) {
  55. this.top = top;
  56. }
  57. /**
  58. * Get the relative position of the footnote inside the body region.
  59. *
  60. * @return the relative position.
  61. */
  62. public int getTop() {
  63. return top;
  64. }
  65. /**
  66. * Add a block area as child to the footnote area
  67. *
  68. * @param child the block area.
  69. */
  70. public void addBlock(Block child) {
  71. addChildArea(child);
  72. this.setBPD(this.getBPD() + child.getBPD());
  73. }
  74. }