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.

FObjMixed.java 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright 1999-2004 The Apache Software Foundation.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /* $Id$ */
  17. package org.apache.fop.fo;
  18. import org.xml.sax.Locator;
  19. /**
  20. * Base class for representation of mixed content formatting objects
  21. * and their processing
  22. */
  23. public class FObjMixed extends FObj {
  24. /** TextInfo for this object */
  25. protected TextInfo textInfo = null;
  26. /**
  27. * @param parent FONode that is the parent of this object
  28. */
  29. public FObjMixed(FONode parent) {
  30. super(parent);
  31. }
  32. /**
  33. * @param data array of characters containing text to be added
  34. * @param start starting array element to add
  35. * @param length number of characters to add
  36. * @param locator location in fo source file.
  37. */
  38. protected void addCharacters(char data[], int start, int length,
  39. Locator locator) {
  40. if (textInfo == null) {
  41. // Really only need one of these, but need to get fontInfo
  42. // stored in propMgr for later use.
  43. propMgr.setFontInfo(getFOTreeControl());
  44. textInfo = propMgr.getTextLayoutProps(getFOTreeControl());
  45. }
  46. FOText ft = new FOText(data, start, length, textInfo, this);
  47. ft.setLocation(locator);
  48. ft.setName("text");
  49. /* characters() processing empty for FOTreeHandler, not empty for RTF & MIFHandlers */
  50. getFOTreeControl().getFOInputHandler().characters(ft.ca, 0, ft.length);
  51. addChild(ft);
  52. }
  53. private void setup() {
  54. if (this.propertyList != null) {
  55. setupID();
  56. }
  57. }
  58. /**
  59. * @return iterator for this object
  60. */
  61. public CharIterator charIterator() {
  62. return new RecursiveCharIterator(this);
  63. }
  64. /**
  65. * This is a hook for an FOTreeVisitor subclass to be able to access
  66. * this object.
  67. * @param fotv the FOTreeVisitor subclass that can access this object.
  68. * @see org.apache.fop.fo.FOTreeVisitor
  69. */
  70. public void acceptVisitor(FOTreeVisitor fotv) {
  71. fotv.serveFObjMixed(this);
  72. }
  73. }