1 /********************************************************************* 2 * 3 * Copyright (C) 2002 Andrew Khan 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 ***************************************************************************/ 19 20 package jxl.biff.drawing; 21 22 import java.io.IOException; 23 24 import jxl.write.biff.File; 25 26 /** 27 * Interface for the various object types that can be added to a drawing 28 * group 29 */ 30 public interface DrawingGroupObject 31 { 32 /** 33 * Sets the object id. Invoked by the drawing group when the object is 34 * added to id 35 * 36 * @param objid the object id 37 * @param bip the blip id 38 * @param sid the shape id 39 */ 40 void setObjectId(int objid, int bip, int sid); 41 42 /** 43 * Accessor for the object id 44 * 45 * @return the object id 46 */ 47 int getObjectId(); 48 49 /** 50 * Accessor for the blip id 51 * 52 * @return the blip id 53 */ 54 int getBlipId(); 55 56 /** 57 * Accessor for the shape id 58 * 59 * @return the shape id 60 */ 61 public int getShapeId(); 62 63 64 /** 65 * Gets the drawing record which was read in 66 * 67 * @return the drawing record 68 */ 69 MsoDrawingRecord getMsoDrawingRecord(); 70 71 /** 72 * Creates the main Sp container for the drawing 73 * 74 * @return the SP container 75 */ 76 public EscherContainer getSpContainer(); 77 78 /** 79 * Sets the drawing group for this drawing. Called by the drawing group 80 * when this drawing is added to it 81 * 82 * @param dg the drawing group 83 */ 84 void setDrawingGroup(DrawingGroup dg); 85 86 /** 87 * Accessor for the drawing group 88 * 89 * @return the drawing group 90 */ 91 DrawingGroup getDrawingGroup(); 92 93 /** 94 * Gets the origin of this drawing 95 * 96 * @return where this drawing came from 97 */ 98 Origin getOrigin(); 99 100 /** 101 * Accessor for the reference count on this drawing 102 * 103 * @return the reference count 104 */ 105 int getReferenceCount(); 106 107 /** 108 * Sets the new reference count on the drawing 109 * 110 * @param r the new reference count 111 */ 112 void setReferenceCount(int r); 113 114 /** 115 * Accessor for the column of this drawing 116 * 117 * @return the column 118 */ 119 public double getX(); 120 121 /** 122 * Sets the column position of this drawing 123 * 124 * @param x the column 125 */ 126 public void setX(double x); 127 128 /** 129 * Accessor for the row of this drawing 130 * 131 * @return the row 132 */ 133 public double getY(); 134 135 /** 136 * Accessor for the row of the drawing 137 * 138 * @param y the row 139 */ 140 public void setY(double y); 141 142 /** 143 * Accessor for the width of this drawing 144 * 145 * @return the number of columns spanned by this image 146 */ 147 public double getWidth(); 148 149 /** 150 * Accessor for the width 151 * 152 * @param w the number of columns to span 153 */ 154 public void setWidth(double w); 155 156 /** 157 * Accessor for the height of this drawing 158 * 159 * @return the number of rows spanned by this image 160 */ 161 public double getHeight(); 162 163 /** 164 * Accessor for the height of this drawing 165 * 166 * @param h the number of rows spanned by this image 167 */ 168 public void setHeight(double h); 169 170 171 /** 172 * Accessor for the type 173 * 174 * @return the type 175 */ 176 ShapeType getType(); 177 178 /** 179 * Accessor for the image data 180 * 181 * @return the image data 182 */ 183 public byte[] getImageData(); 184 185 /** 186 * Accessor for the image data 187 * 188 * @return the image data 189 */ 190 public byte[] getImageBytes() throws IOException; 191 192 /** 193 * Accessor for the image file path. Normally this is the absolute path 194 * of a file on the directory system, but if this drawing was constructed 195 * using an byte[] then the blip id is returned 196 * 197 * @return the image file path, or the blip id 198 */ 199 String getImageFilePath(); 200 201 /** 202 * Writes any other records associated with this drawing group object 203 */ 204 public void writeAdditionalRecords(File outputFile) throws IOException; 205 206 /** 207 * Writes any records that need to be written after all the drawing group 208 * objects have been written 209 */ 210 public void writeTailRecords(File outputFile) throws IOException; 211 212 /** 213 * Accessor for the first drawing on the sheet. This is used when 214 * copying unmodified sheets to indicate that this drawing contains 215 * the first time Escher gubbins 216 * 217 * @return TRUE if this MSORecord is the first drawing on the sheet 218 */ 219 public boolean isFirst(); 220 221 /** 222 * Queries whether this object is a form object. Form objects have their 223 * drawings records spread over TXO and CONTINUE records and 224 * require special handling 225 * 226 * @return TRUE if this is a form object, FALSE otherwise 227 */ 228 public boolean isFormObject(); 229 230 } 231 232 233