KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > record > ExtendedFormatRecord


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19 package org.apache.poi.hssf.record;
20
21 import org.apache.poi.util.BitField;
22 import org.apache.poi.util.LittleEndian;
23
24 /**
25  * Title: Extended Format Record
26  * Description: Probably one of the more complex records. There are two breeds:
27  * Style and Cell.
28  *<P>
29  * It should be noted that fields in the extended format record are
30  * somewhat arbitrary. Almost all of the fields are bit-level, but
31  * we name them as best as possible by functional group. In some
32  * places this is better than others.
33  *<P>
34  *
35  * REFERENCE: PG 426 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
36  * @author Andrew C. Oliver (acoliver at apache dot org)
37  * @version 2.0-pre
38  */

39
40 public class ExtendedFormatRecord
41     extends Record
42 {
43     public final static short sid = 0xE0;
44
45     // null constant
46
public final static short NULL = (short)0xfff0;
47
48     // xf type
49
public final static short XF_STYLE = 1;
50     public final static short XF_CELL = 0;
51
52     // borders
53
public final static short NONE = 0x0;
54     public final static short THIN = 0x1;
55     public final static short MEDIUM = 0x2;
56     public final static short DASHED = 0x3;
57     public final static short DOTTED = 0x4;
58     public final static short THICK = 0x5;
59     public final static short DOUBLE = 0x6;
60     public final static short HAIR = 0x7;
61     public final static short MEDIUM_DASHED = 0x8;
62     public final static short DASH_DOT = 0x9;
63     public final static short MEDIUM_DASH_DOT = 0xA;
64     public final static short DASH_DOT_DOT = 0xB;
65     public final static short MEDIUM_DASH_DOT_DOT = 0xC;
66     public final static short SLANTED_DASH_DOT = 0xD;
67
68     // alignment
69
public final static short GENERAL = 0x0;
70     public final static short LEFT = 0x1;
71     public final static short CENTER = 0x2;
72     public final static short RIGHT = 0x3;
73     public final static short FILL = 0x4;
74     public final static short JUSTIFY = 0x5;
75     public final static short CENTER_SELECTION = 0x6;
76
77     // vertical alignment
78
public final static short VERTICAL_TOP = 0x0;
79     public final static short VERTICAL_CENTER = 0x1;
80     public final static short VERTICAL_BOTTOM = 0x2;
81     public final static short VERTICAL_JUSTIFY = 0x3;
82
83     // fill
84
public final static short NO_FILL = 0 ;
85     public final static short SOLID_FILL = 1 ;
86     public final static short FINE_DOTS = 2 ;
87     public final static short ALT_BARS = 3 ;
88     public final static short SPARSE_DOTS = 4 ;
89     public final static short THICK_HORZ_BANDS = 5 ;
90     public final static short THICK_VERT_BANDS = 6 ;
91     public final static short THICK_BACKWARD_DIAG = 7 ;
92     public final static short THICK_FORWARD_DIAG = 8 ;
93     public final static short BIG_SPOTS = 9 ;
94     public final static short BRICKS = 10 ;
95     public final static short THIN_HORZ_BANDS = 11 ;
96     public final static short THIN_VERT_BANDS = 12 ;
97     public final static short THIN_BACKWARD_DIAG = 13 ;
98     public final static short THIN_FORWARD_DIAG = 14 ;
99     public final static short SQUARES = 15 ;
100     public final static short DIAMONDS = 16 ;
101
102     // fields in BOTH style and Cell XF records
103
private short field_1_font_index; // not bit-mapped
104
private short field_2_format_index; // not bit-mapped
105

106     // field_3_cell_options bit map
107
static final private BitField _locked = new BitField(0x0001);
108     static final private BitField _hidden = new BitField(0x0002);
109     static final private BitField _xf_type = new BitField(0x0004);
110     static final private BitField _123_prefix = new BitField(0x0008);
111     static final private BitField _parent_index = new BitField(0xFFF0);
112     private short field_3_cell_options;
113
114     // field_4_alignment_options bit map
115
static final private BitField _alignment = new BitField(0x0007);
116     static final private BitField _wrap_text = new BitField(0x0008);
117     static final private BitField _vertical_alignment = new BitField(0x0070);
118     static final private BitField _justify_last = new BitField(0x0080);
119     static final private BitField _rotation = new BitField(0xFF00);
120     private short field_4_alignment_options;
121
122     // field_5_indention_options
123
static final private BitField _indent =
124         new BitField(0x000F);
125     static final private BitField _shrink_to_fit =
126         new BitField(0x0010);
127     static final private BitField _merge_cells =
128         new BitField(0x0020);
129     static final private BitField _reading_order =
130         new BitField(0x00C0);
131
132     // apparently bits 8 and 9 are unused
133
static final private BitField _indent_not_parent_format =
134         new BitField(0x0400);
135     static final private BitField _indent_not_parent_font =
136         new BitField(0x0800);
137     static final private BitField _indent_not_parent_alignment =
138         new BitField(0x1000);
139     static final private BitField _indent_not_parent_border =
140         new BitField(0x2000);
141     static final private BitField _indent_not_parent_pattern =
142         new BitField(0x4000);
143     static final private BitField _indent_not_parent_cell_options =
144         new BitField(0x8000);
145     private short field_5_indention_options;
146
147     // field_6_border_options bit map
148
static final private BitField _border_left = new BitField(0x000F);
149     static final private BitField _border_right = new BitField(0x00F0);
150     static final private BitField _border_top = new BitField(0x0F00);
151     static final private BitField _border_bottom = new BitField(0xF000);
152     private short field_6_border_options;
153
154     // all three of the following attributes are palette options
155
// field_7_palette_options bit map
156
static final private BitField _left_border_palette_idx =
157         new BitField(0x007F);
158     static final private BitField _right_border_palette_idx =
159         new BitField(0x3F80);
160     static final private BitField _diag =
161         new BitField(0xC000);
162     private short field_7_palette_options;
163
164     // field_8_adtl_palette_options bit map
165
static final private BitField _top_border_palette_idx =
166         new BitField(0x0000007F);
167     static final private BitField _bottom_border_palette_idx =
168         new BitField(0x00003F80);
169     static final private BitField _adtl_diag =
170         new BitField(0x001fc000);
171     static final private BitField _adtl_diag_line_style =
172         new BitField(0x01e00000);
173
174     // apparently bit 25 is unused
175
static final private BitField _adtl_fill_pattern =
176         new BitField(0xfc000000);
177     private int field_8_adtl_palette_options; // additional to avoid 2
178

179     // field_9_fill_palette_options bit map
180
static final private BitField _fill_foreground = new BitField(0x007F);
181     static final private BitField _fill_background = new BitField(0x3f80);
182
183     // apparently bits 15 and 14 are unused
184
private short field_9_fill_palette_options;
185
186     /**
187      * Constructor ExtendedFormatRecord
188      *
189      *
190      */

191
192     public ExtendedFormatRecord()
193     {
194     }
195
196     /**
197      * Constructs an ExtendedFormat record and sets its fields appropriately.
198      *
199      * @param id id must be 0xE0 or an exception will be throw upon validation
200      * @param size the size of the data area of the record
201      * @param data data of the record (should not contain sid/len)
202      */

203
204     public ExtendedFormatRecord(short id, short size, byte [] data)
205     {
206         super(id, size, data);
207     }
208
209     /**
210      * Constructs an ExtendedFormat record and sets its fields appropriately.
211      *
212      * @param id id must be 0xE0 or an exception will be throw upon validation
213      * @param size the size of the data area of the record
214      * @param data data of the record (should not contain sid/len)
215      * @param offset of the record's data
216      */

217     public ExtendedFormatRecord(short id, short size, byte [] data,
218                                 int offset)
219     {
220         super(id, size, data, offset);
221     }
222
223     protected void validateSid(short id)
224     {
225         if (id != sid)
226         {
227             throw new RecordFormatException("NOT A EXTENDED FORMAT RECORD");
228         }
229     }
230
231     protected void fillFields(byte [] data, short size, int offset)
232     {
233         field_1_font_index = LittleEndian.getShort(data,
234                 0 + offset);
235         field_2_format_index = LittleEndian.getShort(data,
236                 2 + offset);
237         field_3_cell_options = LittleEndian.getShort(data,
238                 4 + offset);
239         field_4_alignment_options = LittleEndian.getShort(data,
240                 6 + offset);
241         field_5_indention_options = LittleEndian.getShort(data,
242                 8 + offset);
243         field_6_border_options = LittleEndian.getShort(data,
244                 10 + offset);
245         field_7_palette_options = LittleEndian.getShort(data,
246                 12 + offset);
247         field_8_adtl_palette_options = LittleEndian.getInt(data, 14 + offset);
248         field_9_fill_palette_options = LittleEndian.getShort(data,
249                 18 + offset);
250     }
251
252     /**
253      * set the index to the FONT record (which font to use 0 based)
254      *
255      *
256      * @param index to the font
257      * @see org.apache.poi.hssf.record.FontRecord
258      */

259
260     public void setFontIndex(short index)
261     {
262         field_1_font_index = index;
263     }
264
265     /**
266      * set the index to the Format record (which FORMAT to use 0-based)
267      *
268      *
269      * @param index to the format record
270      * @see org.apache.poi.hssf.record.FormatRecord
271      */

272
273     public void setFormatIndex(short index)
274     {
275         field_2_format_index = index;
276     }
277
278     /**
279      * sets the options bitmask - you can also use corresponding option bit setters
280      * (see other methods that reference this one)
281      *
282      *
283      * @param options bitmask to set
284      *
285      */

286
287     public void setCellOptions(short options)
288     {
289         field_3_cell_options = options;
290     }
291
292     // These are the bit fields in cell options
293

294     /**
295      * set whether the cell is locked or not
296      *
297      *
298      * @param locked - if the cell is locked
299      * @see #setCellOptions(short)
300      */

301
302     public void setLocked(boolean locked)
303     {
304         field_3_cell_options = _locked.setShortBoolean(field_3_cell_options,
305                 locked);
306     }
307
308     /**
309      * set whether the cell is hidden or not
310      *
311      *
312      * @param hidden - if the cell is hidden
313      * @see #setCellOptions(short)
314      */

315
316     public void setHidden(boolean hidden)
317     {
318         field_3_cell_options = _hidden.setShortBoolean(field_3_cell_options,
319                 hidden);
320     }
321
322     /**
323      * set whether the cell is a cell or style XFRecord
324      *
325      *
326      * @param type - cell or style (0/1)
327      * @see #XF_STYLE
328      * @see #XF_CELL
329      * @see #setCellOptions(short)
330      */

331
332     public void setXFType(short type)
333     {
334         field_3_cell_options = _xf_type.setShortValue(field_3_cell_options,
335                 type);
336     }
337
338     /**
339      * set some old holdover from lotus 123. Who cares, its all over for Lotus.
340      * RIP Lotus.
341      *
342      * @param prefix - the lotus thing to set.
343      * @see #setCellOptions(short)
344      */

345
346     public void set123Prefix(boolean prefix)
347     {
348         field_3_cell_options =
349             _123_prefix.setShortBoolean(field_3_cell_options, prefix);
350     }
351
352     // present in both but NULL except in cell records
353

354     /**
355      * for cell XF types this is the parent style (usually 0/normal). For
356      * style this should be NULL.
357      *
358      * @param parent index of parent XF
359      * @see #NULL
360      * @see #setCellOptions(short)
361      */

362
363     public void setParentIndex(short parent)
364     {
365         field_3_cell_options =
366             _parent_index.setShortValue(field_3_cell_options, parent);
367     }
368
369     // end bitfields in cell options
370

371     /**
372      * set the alignment options bitmask. See corresponding bitsetter methods
373      * that reference this one.
374      *
375      *
376      * @param options - the bitmask to set
377      */

378
379     public void setAlignmentOptions(short options)
380     {
381         field_4_alignment_options = options;
382     }
383
384     /**
385      * set the horizontal alignment of the cell.
386      *
387      *
388      * @param align - how to align the cell (see constants)
389      * @see #GENERAL
390      * @see #LEFT
391      * @see #CENTER
392      * @see #RIGHT
393      * @see #FILL
394      * @see #JUSTIFY
395      * @see #CENTER_SELECTION
396      * @see #setAlignmentOptions(short)
397      */

398
399     public void setAlignment(short align)
400     {
401         field_4_alignment_options =
402             _alignment.setShortValue(field_4_alignment_options, align);
403     }
404
405     /**
406      * set whether to wrap the text in the cell
407      *
408      *
409      * @param wrapped - whether or not to wrap the cell text
410      * @see #setAlignmentOptions(short)
411      */

412
413     public void setWrapText(boolean wrapped)
414     {
415         field_4_alignment_options =
416             _wrap_text.setShortBoolean(field_4_alignment_options, wrapped);
417     }
418
419     /**
420      * set the vertical alignment of text in the cell
421      *
422      *
423      * @param align where to align the text
424      * @see #VERTICAL_TOP
425      * @see #VERTICAL_CENTER
426      * @see #VERTICAL_BOTTOM
427      * @see #VERTICAL_JUSTIFY
428      *
429      * @see #setAlignmentOptions(short)
430      */

431
432     public void setVerticalAlignment(short align)
433     {
434         field_4_alignment_options =
435             _vertical_alignment.setShortValue(field_4_alignment_options,
436                                               align);
437     }
438
439     /**
440      * Dunno. Docs just say this is for far east versions.. (I'm guessing it
441      * justifies for right-to-left read languages)
442      *
443      *
444      * @param justify
445      * @see #setAlignmentOptions(short)
446      */

447
448     public void setJustifyLast(short justify)
449     { // for far east languages supported only for format always 0 for US
450
field_4_alignment_options =
451             _justify_last.setShortValue(field_4_alignment_options, justify);
452     }
453
454     /**
455      * set the degree of rotation. (I've not actually seen this used anywhere)
456      *
457      *
458      * @param rotation the degree of rotation
459      * @see #setAlignmentOptions(short)
460      */

461
462     public void setRotation(short rotation)
463     {
464         field_4_alignment_options =
465             _rotation.setShortValue(field_4_alignment_options, rotation);
466     }
467
468     /**
469      * set the indent options bitmask (see corresponding bitmask setters that reference
470      * this field)
471      *
472      *
473      * @param options bitmask to set.
474      *
475      */

476
477     public void setIndentionOptions(short options)
478     {
479         field_5_indention_options = options;
480     }
481
482     // set bitfields for indention options
483

484     /**
485      * set indention (not sure of the units, think its spaces)
486      *
487      * @param indent - how far to indent the cell
488      * @see #setIndentionOptions(short)
489      */

490
491     public void setIndent(short indent)
492     {
493         field_5_indention_options =
494             _indent.setShortValue(field_5_indention_options, indent);
495     }
496
497     /**
498      * set whether to shrink the text to fit
499      *
500      *
501      * @param shrink - shrink to fit or not
502      * @see #setIndentionOptions(short)
503      */

504
505     public void setShrinkToFit(boolean shrink)
506     {
507         field_5_indention_options =
508             _shrink_to_fit.setShortBoolean(field_5_indention_options, shrink);
509     }
510
511     /**
512      * set whether to merge cells
513      *
514      *
515      * @param merge - merge cells or not
516      * @see #setIndentionOptions(short)
517      */

518
519     public void setMergeCells(boolean merge)
520     {
521         field_5_indention_options =
522             _merge_cells.setShortBoolean(field_5_indention_options, merge);
523     }
524
525     /**
526      * set the reading order for far east versions (0 - Context, 1 - Left to right,
527      * 2 - right to left) - We could use some help with support for the far east.
528      *
529      * @param order - the reading order (0,1,2)
530      * @see #setIndentionOptions(short)
531      */

532
533     public void setReadingOrder(short order)
534     { // only for far east always 0 in US
535
field_5_indention_options =
536             _reading_order.setShortValue(field_5_indention_options, order);
537     }
538
539     /**
540      * set whether or not to use the format in this XF instead of the parent XF.
541      *
542      *
543      * @param parent - true if this XF has a different format value than its parent,
544      * false otherwise.
545      * @see #setIndentionOptions(short)
546      */

547
548     public void setIndentNotParentFormat(boolean parent)
549     {
550         field_5_indention_options =
551             _indent_not_parent_format
552                 .setShortBoolean(field_5_indention_options, parent);
553     }
554
555     /**
556      * set whether or not to use the font in this XF instead of the parent XF.
557      *
558      *
559      * @param font - true if this XF has a different font value than its parent,
560      * false otherwise.
561      * @see #setIndentionOptions(short)
562      */

563
564     public void setIndentNotParentFont(boolean font)
565     {
566         field_5_indention_options =
567             _indent_not_parent_font.setShortBoolean(field_5_indention_options,
568                                                     font);
569     }
570
571     /**
572      * set whether or not to use the alignment in this XF instead of the parent XF.
573      *
574      *
575      * @param alignment true if this XF has a different alignment value than its parent,
576      * false otherwise.
577      * @see #setIndentionOptions(short)
578      */

579
580     public void setIndentNotParentAlignment(boolean alignment)
581     {
582         field_5_indention_options =
583             _indent_not_parent_alignment
584                 .setShortBoolean(field_5_indention_options, alignment);
585     }
586
587     /**
588      * set whether or not to use the border in this XF instead of the parent XF.
589      *
590      *
591      * @param border - true if this XF has a different border value than its parent,
592      * false otherwise.
593      * @see #setIndentionOptions(short)
594      */

595
596     public void setIndentNotParentBorder(boolean border)
597     {
598         field_5_indention_options =
599             _indent_not_parent_border
600                 .setShortBoolean(field_5_indention_options, border);
601     }
602
603     /**
604      * <p>Sets whether or not to use the pattern in this XF instead of the
605      * parent XF (foreground/background).</p>
606      *
607      * @param pattern <code>true</code> if this XF has a different pattern
608      * value than its parent,</code> false</code> otherwise.
609      * @see #setIndentionOptions(short)
610      */

611
612     public void setIndentNotParentPattern(boolean pattern)
613     {
614         field_5_indention_options =
615             _indent_not_parent_pattern
616                 .setShortBoolean(field_5_indention_options, pattern);
617     }
618
619     /**
620      * set whether or not to use the locking/hidden in this XF instead of the parent XF.
621      *
622      *
623      * @param options true if this XF has a different locking or hidden value than its parent,
624      * false otherwise.
625      * @see #setIndentionOptions(short)
626      */

627
628     public void setIndentNotParentCellOptions(boolean options)
629     {
630         field_5_indention_options =
631             _indent_not_parent_cell_options
632                 .setShortBoolean(field_5_indention_options, options);
633     }
634
635     // end indention options bitmask sets
636

637     /**
638      * set the border options bitmask (see the corresponding bitsetter methods
639      * that reference back to this one)
640      *
641      * @param options - the bit mask to set
642      *
643      */

644
645     public void setBorderOptions(short options)
646     {
647         field_6_border_options = options;
648     }
649
650     // border options bitfields
651

652     /**
653      * set the borderline style for the left border
654      *
655      *
656      * @param border - type of border for the left side of the cell
657      * @see #NONE
658      * @see #THIN
659      * @see #MEDIUM
660      * @see #DASHED
661      * @see #DOTTED
662      * @see #THICK
663      * @see #DOUBLE
664      * @see #HAIR
665      * @see #MEDIUM_DASHED
666      * @see #DASH_DOT
667      * @see #MEDIUM_DASH_DOT
668      * @see #DASH_DOT_DOT
669      * @see #MEDIUM_DASH_DOT_DOT
670      * @see #SLANTED_DASH_DOT
671      * @see #setBorderOptions(short)
672      */

673
674     public void setBorderLeft(short border)
675     {
676         field_6_border_options =
677             _border_left.setShortValue(field_6_border_options, border);
678     }
679
680     /**
681      * set the border line style for the right border
682      *
683      *
684      * @param border - type of border for the right side of the cell
685      * @see #NONE
686      * @see #THIN
687      * @see #MEDIUM
688      * @see #DASHED
689      * @see #DOTTED
690      * @see #THICK
691      * @see #DOUBLE
692      * @see #HAIR
693      * @see #MEDIUM_DASHED
694      * @see #DASH_DOT
695      * @see #MEDIUM_DASH_DOT
696      * @see #DASH_DOT_DOT
697      * @see #MEDIUM_DASH_DOT_DOT
698      * @see #SLANTED_DASH_DOT
699      * @see #setBorderOptions(short)
700      */

701
702     public void setBorderRight(short border)
703     {
704         field_6_border_options =
705             _border_right.setShortValue(field_6_border_options, border);
706     }
707
708     /**
709      * set the border line style for the top border
710      *
711      *
712      * @param border - type of border for the top of the cell
713      * @see #NONE
714      * @see #THIN
715      * @see #MEDIUM
716      * @see #DASHED
717      * @see #DOTTED
718      * @see #THICK
719      * @see #DOUBLE
720      * @see #HAIR
721      * @see #MEDIUM_DASHED
722      * @see #DASH_DOT
723      * @see #MEDIUM_DASH_DOT
724      * @see #DASH_DOT_DOT
725      * @see #MEDIUM_DASH_DOT_DOT
726      * @see #SLANTED_DASH_DOT
727      * @see #setBorderOptions(short)
728      */

729
730     public void setBorderTop(short border)
731     {
732         field_6_border_options =
733             _border_top.setShortValue(field_6_border_options, border);
734     }
735
736     /**
737      * set the border line style for the bottom border
738      *
739      *
740      * @param border - type of border for the bottom of the cell
741      * @see #NONE
742      * @see #THIN
743      * @see #MEDIUM
744      * @see #DASHED
745      * @see #DOTTED
746      * @see #THICK
747      * @see #DOUBLE
748      * @see #HAIR
749      * @see #MEDIUM_DASHED
750      * @see #DASH_DOT
751      * @see #MEDIUM_DASH_DOT
752      * @see #DASH_DOT_DOT
753      * @see #MEDIUM_DASH_DOT_DOT
754      * @see #SLANTED_DASH_DOT
755      * @see #setBorderOptions(short)
756      */

757
758     public void setBorderBottom(short border)
759     {
760         field_6_border_options =
761             _border_bottom.setShortValue(field_6_border_options, border);
762     }
763
764     // end border option bitfields
765

766     /**
767      * set the palette options bitmask (see the individual bitsetter methods that
768      * reference this one)
769      *
770      *
771      * @param options - the bitmask to set
772      *
773      */

774
775     public void setPaletteOptions(short options)
776     {
777         field_7_palette_options = options;
778     }
779
780     // bitfields for palette options
781

782     /**
783      * set the palette index for the left border color
784      *
785      *
786      * @param border - palette index
787      * @see #setPaletteOptions(short)
788      */

789
790     public void setLeftBorderPaletteIdx(short border)
791     {
792         field_7_palette_options =
793             _left_border_palette_idx.setShortValue(field_7_palette_options,
794                                                    border);
795     }
796
797     /**
798      * set the palette index for the right border color
799      *
800      *
801      * @param border - palette index
802      * @see #setPaletteOptions(short)
803      */

804
805     public void setRightBorderPaletteIdx(short border)
806     {
807         field_7_palette_options =
808             _right_border_palette_idx.setShortValue(field_7_palette_options,
809                                                     border);
810     }
811
812     // i've no idea.. possible values are 1 for down, 2 for up and 3 for both...0 for none..
813
// maybe a diagnal line?
814

815     /**
816      * Not sure what this is for (maybe fill lines?) 1 = down, 2 = up, 3 = both, 0 for none..
817      *
818      *
819      * @param diag - set whatever it is that this is.
820      * @see #setPaletteOptions(short)
821      */

822
823     public void setDiag(short diag)
824     {
825         field_7_palette_options = _diag.setShortValue(field_7_palette_options,
826                 diag);
827     }
828
829     // end of palette options
830

831     /**
832      * set the additional palette options bitmask (see individual bitsetter methods
833      * that reference this method)
834      *
835      *
836      * @param options - bitmask to set
837      *
838      */

839
840     public void setAdtlPaletteOptions(short options)
841     {
842         field_8_adtl_palette_options = options;
843     }
844
845     // bitfields for additional palette options
846

847     /**
848      * set the palette index for the top border
849      *
850      *
851      * @param border - palette index
852      * @see #setAdtlPaletteOptions(short)
853      */

854
855     public void setTopBorderPaletteIdx(short border)
856     {
857         field_8_adtl_palette_options =
858             _top_border_palette_idx.setValue(field_8_adtl_palette_options,
859                                              border);
860     }
861
862     /**
863      * set the palette index for the bottom border
864      *
865      *
866      * @param border - palette index
867      * @see #setAdtlPaletteOptions(short)
868      */

869
870     public void setBottomBorderPaletteIdx(short border)
871     {
872         field_8_adtl_palette_options =
873             _bottom_border_palette_idx.setValue(field_8_adtl_palette_options,
874                                                 border);
875     }
876
877     /**
878      * set for diagonal borders? No idea (its a palette color for the other function
879      * we didn't know what was?)
880      *
881      *
882      * @param diag - the palette index?
883      * @see #setAdtlPaletteOptions(short)
884      */

885
886     public void setAdtlDiag(short diag)
887     {
888         field_8_adtl_palette_options =
889             _adtl_diag.setValue(field_8_adtl_palette_options, diag);
890     }
891
892     /**
893      * set the diagonal border line style? Who the heck ever heard of a diagonal border?
894      *
895      *
896      * @param diag - the line style
897      * @see #NONE
898      * @see #THIN
899      * @see #MEDIUM
900      * @see #DASHED
901      * @see #DOTTED
902      * @see #THICK
903      * @see #DOUBLE
904      * @see #HAIR
905      * @see #MEDIUM_DASHED
906      * @see #DASH_DOT
907      * @see #MEDIUM_DASH_DOT
908      * @see #DASH_DOT_DOT
909      * @see #MEDIUM_DASH_DOT_DOT
910      * @see #SLANTED_DASH_DOT
911      * @see #setAdtlPaletteOptions(short)
912      */

913
914     public void setAdtlDiagLineStyle(short diag)
915     {
916         field_8_adtl_palette_options =
917             _adtl_diag_line_style.setValue(field_8_adtl_palette_options,
918                                            diag);
919     }
920
921     /**
922      * set the fill pattern
923      *
924      * @see #NO_FILL
925      * @see #SOLID_FILL
926      * @see #FINE_DOTS
927      * @see #ALT_BARS
928      * @see #SPARSE_DOTS
929      * @see #THICK_HORZ_BANDS
930      * @see #THICK_VERT_BANDS
931      * @see #THICK_BACKWARD_DIAG
932      * @see #THICK_FORWARD_DIAG
933      * @see #BIG_SPOTS
934      * @see #BRICKS
935      * @see #THIN_HORZ_BANDS
936      * @see #THIN_VERT_BANDS
937      * @see #THIN_BACKWARD_DIAG
938      * @see #THIN_FORWARD_DIAG
939      * @see #SQUARES
940      * @see #DIAMONDS
941      *
942      * @param fill - fill pattern??
943      * @see #setAdtlPaletteOptions(short)
944      */

945
946     public void setAdtlFillPattern(short fill)
947     {
948         field_8_adtl_palette_options =
949             _adtl_fill_pattern.setValue(field_8_adtl_palette_options, fill);
950     }
951
952     // end bitfields for additional palette options
953

954     /**
955      * set the fill palette options bitmask (see
956      *
957      *
958      * @param options
959      *
960      */

961
962     public void setFillPaletteOptions(short options)
963     {
964         field_9_fill_palette_options = options;
965     }
966
967     /**
968      * set the foreground palette color index
969      *
970      *
971      * @param color - palette index
972      * @see #setFillPaletteOptions(short)
973      */

974
975     public void setFillForeground(short color)
976     {
977         field_9_fill_palette_options =
978             _fill_foreground.setShortValue(field_9_fill_palette_options,
979                                            color);
980     }
981
982     /**
983      * set the background palette color index
984      *
985      *
986      * @param color - palette index
987      * @see #setFillPaletteOptions(short)
988      */

989
990     public void setFillBackground(short color)
991     {
992         field_9_fill_palette_options =
993             _fill_background.setShortValue(field_9_fill_palette_options,
994                                            color);
995     }
996
997     /**
998      * get the index to the FONT record (which font to use 0 based)
999      *
1000     *
1001     * @return index to the font
1002     * @see org.apache.poi.hssf.record.FontRecord
1003     */

1004
1005    public short getFontIndex()
1006    {
1007        return field_1_font_index;
1008    }
1009
1010    /**
1011     * get the index to the Format record (which FORMAT to use 0-based)
1012     *
1013     *
1014     * @return index to the format record
1015     * @see org.apache.poi.hssf.record.FormatRecord
1016     */

1017
1018    public short getFormatIndex()
1019    {
1020        return field_2_format_index;
1021    }
1022
1023    /**
1024     * gets the options bitmask - you can also use corresponding option bit getters
1025     * (see other methods that reference this one)
1026     *
1027     *
1028     * @return options bitmask
1029     *
1030     */

1031
1032    public short getCellOptions()
1033    {
1034        return field_3_cell_options;
1035    }
1036
1037    // These are the bit fields in cell options
1038

1039    /**
1040     * get whether the cell is locked or not
1041     *
1042     *
1043     * @return locked - if the cell is locked
1044     * @see #getCellOptions()
1045     */

1046
1047    public boolean isLocked()
1048    {
1049        return _locked.isSet(field_3_cell_options);
1050    }
1051
1052    /**
1053     * get whether the cell is hidden or not
1054     *
1055     *
1056     * @return hidden - if the cell is hidden
1057     * @see #getCellOptions()
1058     */

1059
1060    public boolean isHidden()
1061    {
1062        return _hidden.isSet(field_3_cell_options);
1063    }
1064
1065    /**
1066     * get whether the cell is a cell or style XFRecord
1067     *
1068     *
1069     * @return type - cell or style (0/1)
1070     * @see #XF_STYLE
1071     * @see #XF_CELL
1072     * @see #getCellOptions()
1073     */

1074
1075    public short getXFType()
1076    {
1077        return _xf_type.getShortValue(field_3_cell_options);
1078    }
1079
1080    /**
1081     * get some old holdover from lotus 123. Who cares, its all over for Lotus.
1082     * RIP Lotus.
1083     *
1084     * @return prefix - the lotus thing
1085     * @see #getCellOptions()
1086     */

1087
1088    public boolean get123Prefix()
1089    {
1090        return _123_prefix.isSet(field_3_cell_options);
1091    }
1092
1093    /**
1094     * for cell XF types this is the parent style (usually 0/normal). For
1095     * style this should be NULL.
1096     *
1097     * @return index of parent XF
1098     * @see #NULL
1099     * @see #getCellOptions()
1100     */

1101
1102    public short getParentIndex()
1103    {
1104        return _parent_index.getShortValue(field_3_cell_options);
1105    }
1106
1107    // end bitfields in cell options
1108

1109    /**
1110     * get the alignment options bitmask. See corresponding bitgetter methods
1111     * that reference this one.
1112     *
1113     *
1114     * @return options - the bitmask
1115     */

1116
1117    public short getAlignmentOptions()
1118    {
1119        return field_4_alignment_options;
1120    }
1121
1122    // bitfields in alignment options
1123

1124    /**
1125     * get the horizontal alignment of the cell.
1126     *
1127     *
1128     * @return align - how to align the cell (see constants)
1129     * @see #GENERAL
1130     * @see #LEFT
1131     * @see #CENTER
1132     * @see #RIGHT
1133     * @see #FILL
1134     * @see #JUSTIFY
1135     * @see #CENTER_SELECTION
1136     * @see #getAlignmentOptions()
1137     */

1138
1139    public short getAlignment()
1140    {
1141        return _alignment.getShortValue(field_4_alignment_options);
1142    }
1143
1144    /**
1145     * get whether to wrap the text in the cell
1146     *
1147     *
1148     * @return wrapped - whether or not to wrap the cell text
1149     * @see #getAlignmentOptions()
1150     */

1151
1152    public boolean getWrapText()
1153    {
1154        return _wrap_text.isSet(field_4_alignment_options);
1155    }
1156
1157    /**
1158     * get the vertical alignment of text in the cell
1159     *
1160     *
1161     * @return where to align the text
1162     * @see #VERTICAL_TOP
1163     * @see #VERTICAL_CENTER
1164     * @see #VERTICAL_BOTTOM
1165     * @see #VERTICAL_JUSTIFY
1166     *
1167     * @see #getAlignmentOptions()
1168     */

1169
1170    public short getVerticalAlignment()
1171    {
1172        return _vertical_alignment.getShortValue(field_4_alignment_options);
1173    }
1174
1175    /**
1176     * Dunno. Docs just say this is for far east versions.. (I'm guessing it
1177     * justifies for right-to-left read languages)
1178     *
1179     *
1180     * @return justify
1181     * @see #getAlignmentOptions()
1182     */

1183
1184    public short getJustifyLast()
1185    { // for far east languages supported only for format always 0 for US
1186
return _justify_last.getShortValue(field_4_alignment_options);
1187    }
1188
1189    /**
1190     * get the degree of rotation. (I've not actually seen this used anywhere)
1191     *
1192     *
1193     * @return rotation - the degree of rotation
1194     * @see #getAlignmentOptions()
1195     */

1196
1197    public short getRotation()
1198    {
1199        return _rotation.getShortValue(field_4_alignment_options);
1200    }
1201
1202    // end alignment options bitfields
1203

1204    /**
1205     * get the indent options bitmask (see corresponding bit getters that reference
1206     * this field)
1207     *
1208     *
1209     * @return options bitmask
1210     *
1211     */

1212
1213    public short getIndentionOptions()
1214    {
1215        return field_5_indention_options;
1216    }
1217
1218    // bitfields for indention options
1219

1220    /**
1221     * get indention (not sure of the units, think its spaces)
1222     *
1223     * @return indent - how far to indent the cell
1224     * @see #getIndentionOptions()
1225     */

1226
1227    public short getIndent()
1228    {
1229        return _indent.getShortValue(field_5_indention_options);
1230    }
1231
1232    /**
1233     * get whether to shrink the text to fit
1234     *
1235     *
1236     * @return shrink - shrink to fit or not
1237     * @see #getIndentionOptions()
1238     */

1239
1240    public boolean getShrinkToFit()
1241    {
1242        return _shrink_to_fit.isSet(field_5_indention_options);
1243    }
1244
1245    /**
1246     * get whether to merge cells
1247     *
1248     *
1249     * @return merge - merge cells or not
1250     * @see #getIndentionOptions()
1251     */

1252
1253    public boolean getMergeCells()
1254    {
1255        return _merge_cells.isSet(field_5_indention_options);
1256    }
1257
1258    /**
1259     * get the reading order for far east versions (0 - Context, 1 - Left to right,
1260     * 2 - right to left) - We could use some help with support for the far east.
1261     *
1262     * @return order - the reading order (0,1,2)
1263     * @see #getIndentionOptions()
1264     */

1265
1266    public short getReadingOrder()
1267    { // only for far east always 0 in US
1268
return _reading_order.getShortValue(field_5_indention_options);
1269    }
1270
1271    /**
1272     * get whether or not to use the format in this XF instead of the parent XF.
1273     *
1274     *
1275     * @return parent - true if this XF has a different format value than its parent,
1276     * false otherwise.
1277     * @see #getIndentionOptions()
1278     */

1279
1280    public boolean isIndentNotParentFormat()
1281    {
1282        return _indent_not_parent_format.isSet(field_5_indention_options);
1283    }
1284
1285    /**
1286     * get whether or not to use the font in this XF instead of the parent XF.
1287     *
1288     *
1289     * @return font - true if this XF has a different font value than its parent,
1290     * false otherwise.
1291     * @see #getIndentionOptions()
1292     */

1293
1294    public boolean isIndentNotParentFont()
1295    {
1296        return _indent_not_parent_font.isSet(field_5_indention_options);
1297    }
1298
1299    /**
1300     * get whether or not to use the alignment in this XF instead of the parent XF.
1301     *
1302     *
1303     * @return alignment true if this XF has a different alignment value than its parent,
1304     * false otherwise.
1305     * @see #getIndentionOptions()
1306     */

1307
1308    public boolean isIndentNotParentAlignment()
1309    {
1310        return _indent_not_parent_alignment.isSet(field_5_indention_options);
1311    }
1312
1313    /**
1314     * get whether or not to use the border in this XF instead of the parent XF.
1315     *
1316     *
1317     * @return border - true if this XF has a different border value than its parent,
1318     * false otherwise.
1319     * @see #getIndentionOptions()
1320     */

1321
1322    public boolean isIndentNotParentBorder()
1323    {
1324        return _indent_not_parent_border.isSet(field_5_indention_options);
1325    }
1326
1327    /**
1328     * get whether or not to use the pattern in this XF instead of the parent XF.
1329     * (foregrount/background)
1330     *
1331     * @return pattern- true if this XF has a different pattern value than its parent,
1332     * false otherwise.
1333     * @see #getIndentionOptions()
1334     */

1335
1336    public boolean isIndentNotParentPattern()
1337    {
1338        return _indent_not_parent_pattern.isSet(field_5_indention_options);
1339    }
1340
1341    /**
1342     * get whether or not to use the locking/hidden in this XF instead of the parent XF.
1343     *
1344     *
1345     * @return options- true if this XF has a different locking or hidden value than its parent,
1346     * false otherwise.
1347     * @see #getIndentionOptions()
1348     */

1349
1350    public boolean isIndentNotParentCellOptions()
1351    {
1352        return _indent_not_parent_cell_options
1353            .isSet(field_5_indention_options);
1354    }
1355
1356    // end of bitfields for indention options
1357
// border options
1358

1359    /**
1360     * get the border options bitmask (see the corresponding bit getter methods
1361     * that reference back to this one)
1362     *
1363     * @return options - the bit mask to set
1364     *
1365     */

1366
1367    public short getBorderOptions()
1368    {
1369        return field_6_border_options;
1370    }
1371
1372    // bitfields for border options
1373

1374    /**
1375     * get the borderline style for the left border
1376     *
1377     *
1378     * @return border - type of border for the left side of the cell
1379     * @see #NONE
1380     * @see #THIN
1381     * @see #MEDIUM
1382     * @see #DASHED
1383     * @see #DOTTED
1384     * @see #THICK
1385     * @see #DOUBLE
1386     * @see #HAIR
1387     * @see #MEDIUM_DASHED
1388     * @see #DASH_DOT
1389     * @see #MEDIUM_DASH_DOT
1390     * @see #DASH_DOT_DOT
1391     * @see #MEDIUM_DASH_DOT_DOT
1392     * @see #SLANTED_DASH_DOT
1393     * @see #getBorderOptions()
1394     */

1395
1396    public short getBorderLeft()
1397    {
1398        return _border_left.getShortValue(field_6_border_options);
1399    }
1400
1401    /**
1402     * get the borderline style for the right border
1403     *
1404     *
1405     * @return border - type of border for the right side of the cell
1406     * @see #NONE
1407     * @see #THIN
1408     * @see #MEDIUM
1409     * @see #DASHED
1410     * @see #DOTTED
1411     * @see #THICK
1412     * @see #DOUBLE
1413     * @see #HAIR
1414     * @see #MEDIUM_DASHED
1415     * @see #DASH_DOT
1416     * @see #MEDIUM_DASH_DOT
1417     * @see #DASH_DOT_DOT
1418     * @see #MEDIUM_DASH_DOT_DOT
1419     * @see #SLANTED_DASH_DOT
1420     * @see #getBorderOptions()
1421     */

1422
1423    public short getBorderRight()
1424    {
1425        return _border_right.getShortValue(field_6_border_options);
1426    }
1427
1428    /**
1429     * get the borderline style for the top border
1430     *
1431     *
1432     * @return border - type of border for the top of the cell
1433     * @see #NONE
1434     * @see #THIN
1435     * @see #MEDIUM
1436     * @see #DASHED
1437     * @see #DOTTED
1438     * @see #THICK
1439     * @see #DOUBLE
1440     * @see #HAIR
1441     * @see #MEDIUM_DASHED
1442     * @see #DASH_DOT
1443     * @see #MEDIUM_DASH_DOT
1444     * @see #DASH_DOT_DOT
1445     * @see #MEDIUM_DASH_DOT_DOT
1446     * @see #SLANTED_DASH_DOT
1447     * @see #getBorderOptions()
1448     */

1449
1450    public short getBorderTop()
1451    {
1452        return _border_top.getShortValue(field_6_border_options);
1453    }
1454
1455    /**
1456     * get the borderline style for the bottom border
1457     *
1458     *
1459     * @return border - type of border for the bottom of the cell
1460     * @see #NONE
1461     * @see #THIN
1462     * @see #MEDIUM
1463     * @see #DASHED
1464     * @see #DOTTED
1465     * @see #THICK
1466     * @see #DOUBLE
1467     * @see #HAIR
1468     * @see #MEDIUM_DASHED
1469     * @see #DASH_DOT
1470     * @see #MEDIUM_DASH_DOT
1471     * @see #DASH_DOT_DOT
1472     * @see #MEDIUM_DASH_DOT_DOT
1473     * @see #SLANTED_DASH_DOT
1474     * @see #getBorderOptions()
1475     */

1476
1477    public short getBorderBottom()
1478    {
1479        return _border_bottom.getShortValue(field_6_border_options);
1480    }
1481
1482    // record types -- palette options
1483

1484    /**
1485     * get the palette options bitmask (see the individual bit getter methods that
1486     * reference this one)
1487     *
1488     *
1489     * @return options - the bitmask
1490     *
1491     */

1492
1493    public short getPaletteOptions()
1494    {
1495        return field_7_palette_options;
1496    }
1497
1498    // bitfields for palette options
1499

1500    /**
1501     * get the palette index for the left border color
1502     *
1503     *
1504     * @return border - palette index
1505     * @see #getPaletteOptions()
1506     */

1507
1508    public short getLeftBorderPaletteIdx()
1509    {
1510        return _left_border_palette_idx
1511            .getShortValue(field_7_palette_options);
1512    }
1513
1514    /**
1515     * get the palette index for the right border color
1516     *
1517     *
1518     * @return border - palette index
1519     * @see #getPaletteOptions()
1520     */

1521
1522    public short getRightBorderPaletteIdx()
1523    {
1524        return _right_border_palette_idx
1525            .getShortValue(field_7_palette_options);
1526    }
1527
1528    // i've no idea.. possible values are 1 for down, 2 for up and 3 for both...0 for none..
1529
// maybe a diagnal line?
1530

1531    /**
1532     * Not sure what this is for (maybe fill lines?) 1 = down, 2 = up, 3 = both, 0 for none..
1533     *
1534     *
1535     * @return diag - whatever it is that this is.
1536     * @see #getPaletteOptions()
1537     */

1538
1539    public short getDiag()
1540    {
1541        return _diag.getShortValue(field_7_palette_options);
1542    }
1543
1544    // end of style palette options
1545
// additional palette options
1546

1547    /**
1548     * get the additional palette options bitmask (see individual bit getter methods
1549     * that reference this method)
1550     *
1551     *
1552     * @return options - bitmask to set
1553     *
1554     */

1555
1556    public int getAdtlPaletteOptions()
1557    {
1558        return field_8_adtl_palette_options;
1559    }
1560
1561    // bitfields for additional palette options
1562

1563    /**
1564     * get the palette index for the top border
1565     *
1566     *
1567     * @return border - palette index
1568     * @see #getAdtlPaletteOptions()
1569     */

1570
1571    public short getTopBorderPaletteIdx()
1572    {
1573        return ( short ) _top_border_palette_idx
1574            .getValue(field_8_adtl_palette_options);
1575    }
1576
1577    /**
1578     * get the palette index for the bottom border
1579     *
1580     *
1581     * @return border - palette index
1582     * @see #getAdtlPaletteOptions()
1583     */

1584
1585    public short getBottomBorderPaletteIdx()
1586    {
1587        return ( short ) _bottom_border_palette_idx
1588            .getValue(field_8_adtl_palette_options);
1589    }
1590
1591    /**
1592     * get for diagonal borders? No idea (its a palette color for the other function
1593     * we didn't know what was?)
1594     *
1595     *
1596     * @return diag - the palette index?
1597     * @see #getAdtlPaletteOptions()
1598     */

1599
1600    public short getAdtlDiag()
1601    {
1602        return ( short ) _adtl_diag.getValue(field_8_adtl_palette_options);
1603    }
1604
1605    /**
1606     * get the diagonal border line style? Who the heck ever heard of a diagonal border?
1607     *
1608     *
1609     * @return diag - the line style
1610     * @see #NONE
1611     * @see #THIN
1612     * @see #MEDIUM
1613     * @see #DASHED
1614     * @see #DOTTED
1615     * @see #THICK
1616     * @see #DOUBLE
1617     * @see #HAIR
1618     * @see #MEDIUM_DASHED
1619     * @see #DASH_DOT
1620     * @see #MEDIUM_DASH_DOT
1621     * @see #DASH_DOT_DOT
1622     * @see #MEDIUM_DASH_DOT_DOT
1623     * @see #SLANTED_DASH_DOT
1624     * @see #getAdtlPaletteOptions()
1625     */

1626
1627    public short getAdtlDiagLineStyle()
1628    {
1629        return ( short ) _adtl_diag_line_style
1630            .getValue(field_8_adtl_palette_options);
1631    }
1632
1633    /**
1634     * get the additional fill pattern
1635     *
1636     * @see #NO_FILL
1637     * @see #SOLID_FILL
1638     * @see #FINE_DOTS
1639     * @see #ALT_BARS
1640     * @see #SPARSE_DOTS
1641     * @see #THICK_HORZ_BANDS
1642     * @see #THICK_VERT_BANDS
1643     * @see #THICK_BACKWARD_DIAG
1644     * @see #THICK_FORWARD_DIAG
1645     * @see #BIG_SPOTS
1646     * @see #BRICKS
1647     * @see #THIN_HORZ_BANDS
1648     * @see #THIN_VERT_BANDS
1649     * @see #THIN_BACKWARD_DIAG
1650     * @see #THIN_FORWARD_DIAG
1651     * @see #SQUARES
1652     * @see #DIAMONDS
1653     *
1654     * @return fill - fill pattern??
1655     * @see #getAdtlPaletteOptions()
1656     */

1657
1658    public short getAdtlFillPattern()
1659    {
1660        return ( short ) _adtl_fill_pattern
1661            .getValue(field_8_adtl_palette_options);
1662    }
1663
1664    // end bitfields for additional palette options
1665
// fill palette options
1666

1667    /**
1668     * get the fill palette options bitmask (see indivdual bit getters that
1669     * reference this method)
1670     *
1671     * @return options
1672     *
1673     */

1674
1675    public short getFillPaletteOptions()
1676    {
1677        return field_9_fill_palette_options;
1678    }
1679
1680    // bitfields for fill palette options
1681

1682    /**
1683     * get the foreground palette color index
1684     *
1685     *
1686     * @return color - palette index
1687     * @see #getFillPaletteOptions()
1688     */

1689
1690    public short getFillForeground()
1691    {
1692        return _fill_foreground.getShortValue(field_9_fill_palette_options);
1693    }
1694
1695    /**
1696     * get the background palette color index
1697     *
1698     * @return color palette index
1699     * @see #getFillPaletteOptions()
1700     */

1701
1702    public short getFillBackground()
1703    {
1704        return _fill_background.getShortValue(field_9_fill_palette_options);
1705    }
1706
1707    public String JavaDoc toString()
1708    {
1709        StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
1710
1711        buffer.append("[EXTENDEDFORMAT]\n");
1712        if (getXFType() == XF_STYLE)
1713        {
1714            buffer.append(" STYLE_RECORD_TYPE\n");
1715        }
1716        else if (getXFType() == XF_CELL)
1717        {
1718            buffer.append(" CELL_RECORD_TYPE\n");
1719        }
1720        buffer.append(" .fontindex = ")
1721            .append(Integer.toHexString(getFontIndex())).append("\n");
1722        buffer.append(" .formatindex = ")
1723            .append(Integer.toHexString(getFormatIndex())).append("\n");
1724        buffer.append(" .celloptions = ")
1725            .append(Integer.toHexString(getCellOptions())).append("\n");
1726        buffer.append(" .islocked = ").append(isLocked())
1727            .append("\n");
1728        buffer.append(" .ishidden = ").append(isHidden())
1729            .append("\n");
1730        buffer.append(" .recordtype= ")
1731            .append(Integer.toHexString(getXFType())).append("\n");
1732        buffer.append(" .parentidx = ")
1733            .append(Integer.toHexString(getParentIndex())).append("\n");
1734        buffer.append(" .alignmentoptions= ")
1735            .append(Integer.toHexString(getAlignmentOptions())).append("\n");
1736        buffer.append(" .alignment = ").append(getAlignment())
1737            .append("\n");
1738        buffer.append(" .wraptext = ").append(getWrapText())
1739            .append("\n");
1740        buffer.append(" .valignment= ")
1741            .append(Integer.toHexString(getVerticalAlignment())).append("\n");
1742        buffer.append(" .justlast = ")
1743            .append(Integer.toHexString(getJustifyLast())).append("\n");
1744        buffer.append(" .rotation = ")
1745            .append(Integer.toHexString(getRotation())).append("\n");
1746        buffer.append(" .indentionoptions= ")
1747            .append(Integer.toHexString(getIndentionOptions())).append("\n");
1748        buffer.append(" .indent = ")
1749            .append(Integer.toHexString(getIndent())).append("\n");
1750        buffer.append(" .shrinktoft= ").append(getShrinkToFit())
1751            .append("\n");
1752        buffer.append(" .mergecells= ").append(getMergeCells())
1753            .append("\n");
1754        buffer.append(" .readngordr= ")
1755            .append(Integer.toHexString(getReadingOrder())).append("\n");
1756        buffer.append(" .formatflag= ")
1757            .append(isIndentNotParentFormat()).append("\n");
1758        buffer.append(" .fontflag = ")
1759            .append(isIndentNotParentFont()).append("\n");
1760        buffer.append(" .prntalgnmt= ")
1761            .append(isIndentNotParentAlignment()).append("\n");
1762        buffer.append(" .borderflag= ")
1763            .append(isIndentNotParentBorder()).append("\n");
1764        buffer.append(" .paternflag= ")
1765            .append(isIndentNotParentPattern()).append("\n");
1766        buffer.append(" .celloption= ")
1767            .append(isIndentNotParentCellOptions()).append("\n");
1768        buffer.append(" .borderoptns = ")
1769            .append(Integer.toHexString(getBorderOptions())).append("\n");
1770        buffer.append(" .lftln = ")
1771            .append(Integer.toHexString(getBorderLeft())).append("\n");
1772        buffer.append(" .rgtln = ")
1773            .append(Integer.toHexString(getBorderRight())).append("\n");
1774        buffer.append(" .topln = ")
1775            .append(Integer.toHexString(getBorderTop())).append("\n");
1776        buffer.append(" .btmln = ")
1777            .append(Integer.toHexString(getBorderBottom())).append("\n");
1778        buffer.append(" .paleteoptns = ")
1779            .append(Integer.toHexString(getPaletteOptions())).append("\n");
1780        buffer.append(" .leftborder= ")
1781            .append(Integer.toHexString(getLeftBorderPaletteIdx()))
1782            .append("\n");
1783        buffer.append(" .rghtborder= ")
1784            .append(Integer.toHexString(getRightBorderPaletteIdx()))
1785            .append("\n");
1786        buffer.append(" .diag = ")
1787            .append(Integer.toHexString(getDiag())).append("\n");
1788        buffer.append(" .paleteoptn2 = ")
1789            .append(Integer.toHexString(getAdtlPaletteOptions()))
1790            .append("\n");
1791        buffer.append(" .topborder = ")
1792            .append(Integer.toHexString(getTopBorderPaletteIdx()))
1793            .append("\n");
1794        buffer.append(" .botmborder= ")
1795            .append(Integer.toHexString(getBottomBorderPaletteIdx()))
1796            .append("\n");
1797        buffer.append(" .adtldiag = ")
1798            .append(Integer.toHexString(getAdtlDiag())).append("\n");
1799        buffer.append(" .diaglnstyl= ")
1800            .append(Integer.toHexString(getAdtlDiagLineStyle())).append("\n");
1801        buffer.append(" .fillpattrn= ")
1802            .append(Integer.toHexString(getAdtlFillPattern())).append("\n");
1803        buffer.append(" .fillpaloptn = ")
1804            .append(Integer.toHexString(getFillPaletteOptions()))
1805            .append("\n");
1806        buffer.append(" .foreground= ")
1807            .append(Integer.toHexString(getFillForeground())).append("\n");
1808        buffer.append(" .background= ")
1809            .append(Integer.toHexString(getFillBackground())).append("\n");
1810        buffer.append("[/EXTENDEDFORMAT]\n");
1811        return buffer.toString();
1812    }
1813
1814    public int serialize(int offset, byte [] data)
1815    {
1816        LittleEndian.putShort(data, 0 + offset, sid);
1817        LittleEndian.putShort(data, 2 + offset,
1818                              ( short ) (20)); // 24 - 4(sid/len)
1819
LittleEndian.putShort(data, 4 + offset, getFontIndex());
1820        LittleEndian.putShort(data, 6 + offset, getFormatIndex());
1821        LittleEndian.putShort(data, 8 + offset, getCellOptions());
1822        LittleEndian.putShort(data, 10 + offset, getAlignmentOptions());
1823        LittleEndian.putShort(data, 12 + offset, getIndentionOptions());
1824        LittleEndian.putShort(data, 14 + offset, getBorderOptions());
1825        LittleEndian.putShort(data, 16 + offset, getPaletteOptions());
1826        LittleEndian.putInt(data, 18 + offset, getAdtlPaletteOptions());
1827        LittleEndian.putShort(data, 22 + offset, getFillPaletteOptions());
1828        return getRecordSize();
1829    }
1830
1831    public int getRecordSize()
1832    {
1833        return 24;
1834    }
1835
1836    public short getSid()
1837    {
1838        return this.sid;
1839    }
1840}
1841
Popular Tags