KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > biff > drawing > MsoDrawingRecord


1 /*********************************************************************
2 *
3 * Copyright (C) 2001 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 common.Logger;
23 import jxl.biff.WritableRecordData;
24 import jxl.biff.Type;
25 import jxl.read.biff.Record;
26
27 /**
28  * A record which merely holds the MSODRAWING data. Used when copying files
29  * which contain images
30  */

31 public class MsoDrawingRecord extends WritableRecordData
32 {
33   /**
34    * The logger
35    */

36   private static Logger logger = Logger.getLogger(MsoDrawingRecord.class);
37
38   /**
39    * Flag to indicate whether this is the first drawing on the sheet
40    * - needed for copying
41    */

42   private boolean first;
43   /**
44    * The raw drawing data which was read in
45    */

46   private byte[] data;
47
48   /**
49    * Constructs this object from the raw data
50    *
51    * @param t the raw data
52    */

53   public MsoDrawingRecord(Record t)
54   {
55     super(t);
56     data = getRecord().getData();
57     first = false;
58   }
59
60   /**
61    * Constructor
62    *
63    * @param d the drawing data
64    */

65   public MsoDrawingRecord(byte[] d)
66   {
67     super(Type.MSODRAWING);
68     data = d;
69     first = false;
70   }
71
72   /**
73    * Expose the protected function
74    *
75    * @return the raw record data
76    */

77   public byte[] getData()
78   {
79     return data;
80   }
81
82   /**
83    * Expose the protected function to the SheetImpl in this package
84    *
85    * @return the raw record data
86    */

87   public Record getRecord()
88   {
89     return super.getRecord();
90   }
91
92   /**
93    * Sets the flag to indicate that this is the first drawing on the sheet
94    */

95   public void setFirst()
96   {
97     first = true;
98   }
99
100   /**
101    * Accessor for the first drawing on the sheet. This is used when
102    * copying unmodified sheets to indicate that this drawing contains
103    * the first time Escher gubbins
104    *
105    * @return TRUE if this MSORecord is the first drawing on the sheet
106    */

107   public boolean isFirst()
108   {
109     return first;
110   }
111 }
112
113
114
115
116
Popular Tags