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.

ExternalGraphic.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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.flow;
  8. // FOP
  9. import org.apache.fop.fo.*;
  10. import org.apache.fop.fo.properties.*;
  11. import org.apache.fop.layout.*;
  12. import org.apache.fop.apps.FOPException;
  13. import org.apache.fop.image.*;
  14. import org.apache.fop.area.inline.InlineArea;
  15. import org.apache.fop.layoutmgr.LayoutManager;
  16. import org.apache.fop.layoutmgr.LeafNodeLayoutManager;
  17. import org.apache.fop.area.inline.Image;
  18. import org.apache.fop.area.inline.Viewport;
  19. // Java
  20. import java.net.URL;
  21. import java.net.MalformedURLException;
  22. public class ExternalGraphic extends FObj {
  23. String url;
  24. int breakAfter;
  25. int breakBefore;
  26. int align;
  27. int startIndent;
  28. int endIndent;
  29. int spaceBefore;
  30. int spaceAfter;
  31. String src;
  32. int height;
  33. int width;
  34. String id;
  35. ImageArea imageArea;
  36. public ExternalGraphic(FONode parent) {
  37. super(parent);
  38. }
  39. public LayoutManager getLayoutManager() {
  40. LeafNodeLayoutManager lm = new LeafNodeLayoutManager(this);
  41. lm.setCurrentArea(getInlineArea());
  42. return lm;
  43. }
  44. protected InlineArea getInlineArea() {
  45. url = ImageFactory.getURL(url);
  46. // if we need to load this image to get its size
  47. // FopImage fopimage = ImageFactory.getImage(url, userAgent);
  48. // if(fopimage == null) {
  49. // error
  50. // }
  51. // if(!fopimage.load(FopImage.DIMENSIONS)) {
  52. // error
  53. // }
  54. Image imArea = new Image(url);
  55. Viewport vp = new Viewport(imArea);
  56. return vp;
  57. }
  58. public void setup() throws FOPException {
  59. // Common Accessibility Properties
  60. AccessibilityProps mAccProps = propMgr.getAccessibilityProps();
  61. // Common Aural Properties
  62. AuralProps mAurProps = propMgr.getAuralProps();
  63. // Common Border, Padding, and Background Properties
  64. BorderAndPadding bap = propMgr.getBorderAndPadding();
  65. BackgroundProps bProps = propMgr.getBackgroundProps();
  66. // Common Margin Properties-Inline
  67. MarginInlineProps mProps = propMgr.getMarginInlineProps();
  68. // Common Relative Position Properties
  69. RelativePositionProps mRelProps = propMgr.getRelativePositionProps();
  70. // this.properties.get("alignment-adjust");
  71. // this.properties.get("alignment-baseline");
  72. // this.properties.get("baseline-shift");
  73. // this.properties.get("block-progression-dimension");
  74. // this.properties.get("content-height");
  75. // this.properties.get("content-type");
  76. // this.properties.get("content-width");
  77. // this.properties.get("display-align");
  78. // this.properties.get("dominant-baseline");
  79. // this.properties.get("height");
  80. // this.properties.get("id");
  81. // this.properties.get("inline-progression-dimension");
  82. // this.properties.get("keep-with-next");
  83. // this.properties.get("keep-with-previous");
  84. // this.properties.get("line-height");
  85. // this.properties.get("line-height-shift-adjustment");
  86. // this.properties.get("overflow");
  87. // this.properties.get("scaling");
  88. // this.properties.get("scaling-method");
  89. // this.properties.get("src");
  90. // this.properties.get("text-align");
  91. // this.properties.get("width");
  92. }
  93. }