1 17 18 19 20 package org.apache.fop.area.inline; 21 22 import org.apache.fop.area.Area; 23 24 import java.io.IOException ; 25 import java.awt.geom.Rectangle2D ; 26 import java.util.HashMap ; 27 28 34 public class Viewport extends InlineArea { 35 private Area content; 37 private boolean clip = false; 39 private Rectangle2D contentPosition; 41 42 47 public Viewport(Area child) { 48 content = child; 49 } 50 51 56 public void setClip(boolean c) { 57 clip = c; 58 } 59 60 65 public boolean getClip() { 66 return clip; 67 } 68 69 74 public void setContentPosition(Rectangle2D cp) { 75 contentPosition = cp; 76 } 77 78 83 public Rectangle2D getContentPosition() { 84 return contentPosition; 85 } 86 87 91 public void setContent(Area content) { 92 this.content = content; 93 } 94 95 100 public Area getContent() { 101 return content; 102 } 103 104 private void writeObject(java.io.ObjectOutputStream out) 105 throws IOException { 106 out.writeBoolean(contentPosition != null); 107 if (contentPosition != null) { 108 out.writeFloat((float) contentPosition.getX()); 109 out.writeFloat((float) contentPosition.getY()); 110 out.writeFloat((float) contentPosition.getWidth()); 111 out.writeFloat((float) contentPosition.getHeight()); 112 } 113 out.writeBoolean(clip); 114 out.writeObject(props); 115 out.writeObject(content); 116 } 117 118 private void readObject(java.io.ObjectInputStream in) 119 throws IOException , ClassNotFoundException { 120 if (in.readBoolean()) { 121 contentPosition = new Rectangle2D.Float (in.readFloat(), 122 in.readFloat(), 123 in.readFloat(), 124 in.readFloat()); 125 } 126 clip = in.readBoolean(); 127 props = (HashMap ) in.readObject(); 128 content = (Area) in.readObject(); 129 } 130 131 } 132 | Popular Tags |