1 */
108
109
110
111
112
113 package org.apache.poi.hssf.record;
114
115
116
117
118
119
120
121 import org.apache.poi.util.*;
122
123
124
125 /**
126
127 * Record for the bottom margin.
128
129 * NOTE: This source was automatically generated.
130
131 * @author Shawn Laubach (slaubach at apache dot org)
132
133 */
134
135 public class BottomMarginRecord
136
137 extends Record implements Margin
138
139 {
140
141 public final static short sid = 0x29;
142
143 private double field_1_margin;
144
145
146
147
148
149 public BottomMarginRecord()
150
151 {
152
153
154
155 }
156
157
158
159 /**
160
161 * Constructs a BottomMargin record and sets its fields appropriately.
162
163 *
164
165 * @param id id must be 0x29 or an exception
166
167 * will be throw upon validation
168
169 * @param size size the size of the data area of the record
170
171 * @param data data of the record (should not contain sid/len)
172
173 */
174
175
176
177 public BottomMarginRecord(short id, short size, byte [] data)
178
179 {
180
181 super(id, size, data);
182
183 }
184
185
186
187 /**
188
189 * Constructs a BottomMargin record and sets its fields appropriately.
190
191 *
192
193 * @param id id must be 0x29 or an exception
194
195 * will be throw upon validation
196
197 * @param size size the size of the data area of the record
198
199 * @param data data of the record (should not contain sid/len)
200
201 * @param offset of the record's data
202
203 */
204
205
206
207 public BottomMarginRecord(short id, short size, byte [] data, int offset)
208
209 {
210
211 super(id, size, data, offset);
212
213 }
214
215
216
217 /**
218
219 * Checks the sid matches the expected side for this record
220
221 *
222
223 * @param id the expected sid.
224
225 */
226
227 protected void validateSid(short id)
228
229 {
230
231 if (id != sid)
232
233 {
234
235 throw new RecordFormatException("Not a BottomMargin record");
236
237 }
238
239 }
240
241
242
243 protected void fillFields(byte [] data, short size, int offset)
244
245 {
246
247 field_1_margin = LittleEndian.getDouble(data, 0x0 + offset);
248
249
250
251 }
252
253
254
255 public String toString()
256
257 {
258
259 StringBuffer buffer = new StringBuffer();
260
261
262
263 buffer.append("[BottomMargin]\n");
264
265
266
267 buffer.append(" .margin = ")
268
269 .append(" (").append(getMargin()).append(" )\n");
270
271
272
273 buffer.append("[/BottomMargin]\n");
274
275 return buffer.toString();
276
277 }
278
279
280
281 public int serialize(int offset, byte[] data)
282
283 {
284
285 LittleEndian.putShort(data, 0 + offset, sid);
286
287 LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
288
289
290
291 LittleEndian.putDouble(data, 4 + offset, field_1_margin);
292
293
294
295 return getRecordSize();
296
297 }
298
299
300
301 /**
302
303 * Size of record (exluding 4 byte header)
304
305 */
306
307 public int getRecordSize()
308
309 {
310
311 return 4 + 8;
312
313 }
314
315
316
317 public short getSid()
318
319 {
320
321 return this.sid;
322
323 }
324
325
326
327
328
329 /**
330
331 * Get the margin field for the BottomMargin record.
332
333 */
334
335 public double getMargin()
336
337 {
338
339 return field_1_margin;
340
341 }
342
343
344
345 /**
346
347 * Set the margin field for the BottomMargin record.
348
349 */
350
351 public void setMargin(double field_1_margin)
352
353 {
354
355 this.field_1_margin = field_1_margin;
356
357 }
358
359
360
361
362
363 } // END OF CLASS
364
365
366
367
368
369
370
371
372
373 ???????????????BottomMarginRecord?????????????Record???????????????????????????????Margin????????????????????????????????????sid?????????????????????????field_1_margin????????????BottomMarginRecord?????????????????BottomMarginRecord???????????????id???????????????????size?????????????????????????data?????????????????BottomMarginRecord???????????????id???????????????????size?????????????????????????data???????????????????????????????offset?????????????????????????validateSid?????????????id???????????????????sid????????????????????fillFields?????????field_1_margin???????????????????????????????????????????LittleEndian????????????????????????????????????????????????????????getDouble??????????????????????????????????????????????????????????????????data??????????????????????????????????????????????????????????????????????????????offset???????????????????toString?????????buffer?????????buffer??????????????????????????????????getMargin?????????buffer????????????????buffer????????????????serialize?????????LittleEndian??????????????????????putShort???????????????????????????????data?????????????????????????????????????????offset?????????????????????????????????????????????????sid?????????LittleEndian??????????????????????putShort???????????????????????????????data?????????????????????????????????????????offset?????????????????????????????????????????????????????????getRecordSize?????????LittleEndian??????????????????????putDouble????????????????????????????????data??????????????????????????????????????????offset??????????????????????????????????????????????????field_1_margin????????????????getRecordSize?????????????????????getRecordSize??????????????????getSid????????????????????????getMargin????????????????field_1_margin??????????????????????setMargin???????????????????????????????field_1_margin????