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.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * $Id$
  3. * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
  4. * For details on use and redistribution please refer to the
  5. * LICENSE file included with these sources.
  6. */
  7. package org.apache.fop.fo;
  8. import org.apache.fop.layout.FontState;
  9. import org.apache.fop.layout.FontInfo;
  10. import org.apache.fop.apps.FOPException;
  11. import org.apache.fop.apps.StructureHandler;
  12. import org.apache.fop.datatypes.ColorType;
  13. import org.apache.fop.layoutmgr.InlineStackingBPLayoutManager;
  14. import org.apache.fop.layoutmgr.LMiter;
  15. import java.util.List;
  16. /**
  17. * base class for representation of mixed content formatting objects
  18. * and their processing
  19. */
  20. public class FObjMixed extends FObj {
  21. TextInfo textInfo = null;
  22. protected FontInfo fontInfo = null;
  23. public FObjMixed(FONode parent) {
  24. super(parent);
  25. }
  26. public void setStructHandler(StructureHandler st) {
  27. super.setStructHandler(st);
  28. fontInfo = st.getFontInfo();
  29. }
  30. public void addLayoutManager(List lms) {
  31. lms.add(new InlineStackingBPLayoutManager(this,
  32. new LMiter(children.listIterator())));
  33. // set start and end properties for this element, id, etc.
  34. // int numChildren = this.children.size();
  35. // for (int i = 0; i < numChildren; i++) {
  36. // Object o = children.get(i);
  37. // if (o instanceof FObj) {
  38. // FObj fo = (FObj) o;
  39. // fo.addLayoutManager(lms);
  40. // }
  41. // }
  42. }
  43. protected void addCharacters(char data[], int start, int length) {
  44. if(textInfo == null) {
  45. // Really only need one of these, but need to get fontInfo
  46. // stored in propMgr for later use.
  47. propMgr.setFontInfo(fontInfo);
  48. textInfo = propMgr.getTextLayoutProps(fontInfo);
  49. }
  50. FOText ft = new FOText(data, start, length, textInfo);
  51. ft.setUserAgent(userAgent);
  52. ft.setStructHandler(structHandler);
  53. addChild(ft);
  54. }
  55. public void setup() {
  56. if (this.properties != null) {
  57. setupID();
  58. }
  59. }
  60. public CharIterator charIterator() {
  61. return new RecursiveCharIterator(this);
  62. }
  63. }