0001: /* ====================================================================
0002: Licensed to the Apache Software Foundation (ASF) under one or more
0003: contributor license agreements. See the NOTICE file distributed with
0004: this work for additional information regarding copyright ownership.
0005: The ASF licenses this file to You under the Apache License, Version 2.0
0006: (the "License"); you may not use this file except in compliance with
0007: the License. You may obtain a copy of the License at
0008:
0009: http://www.apache.org/licenses/LICENSE-2.0
0010:
0011: Unless required by applicable law or agreed to in writing, software
0012: distributed under the License is distributed on an "AS IS" BASIS,
0013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014: See the License for the specific language governing permissions and
0015: limitations under the License.
0016: ==================================================================== */
0017:
0018: package org.apache.poi.hssf.record;
0019:
0020: import org.apache.poi.util.BitField;
0021: import org.apache.poi.util.BitFieldFactory;
0022: import org.apache.poi.util.LittleEndian;
0023:
0024: /**
0025: * Title: Extended Format Record
0026: * Description: Probably one of the more complex records. There are two breeds:
0027: * Style and Cell.
0028: *<P>
0029: * It should be noted that fields in the extended format record are
0030: * somewhat arbitrary. Almost all of the fields are bit-level, but
0031: * we name them as best as possible by functional group. In some
0032: * places this is better than others.
0033: *<P>
0034: *
0035: * REFERENCE: PG 426 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
0036: * @author Andrew C. Oliver (acoliver at apache dot org)
0037: * @version 2.0-pre
0038: */
0039:
0040: public class ExtendedFormatRecord extends Record {
0041: public final static short sid = 0xE0;
0042:
0043: // null constant
0044: public final static short NULL = (short) 0xfff0;
0045:
0046: // xf type
0047: public final static short XF_STYLE = 1;
0048: public final static short XF_CELL = 0;
0049:
0050: // borders
0051: public final static short NONE = 0x0;
0052: public final static short THIN = 0x1;
0053: public final static short MEDIUM = 0x2;
0054: public final static short DASHED = 0x3;
0055: public final static short DOTTED = 0x4;
0056: public final static short THICK = 0x5;
0057: public final static short DOUBLE = 0x6;
0058: public final static short HAIR = 0x7;
0059: public final static short MEDIUM_DASHED = 0x8;
0060: public final static short DASH_DOT = 0x9;
0061: public final static short MEDIUM_DASH_DOT = 0xA;
0062: public final static short DASH_DOT_DOT = 0xB;
0063: public final static short MEDIUM_DASH_DOT_DOT = 0xC;
0064: public final static short SLANTED_DASH_DOT = 0xD;
0065:
0066: // alignment
0067: public final static short GENERAL = 0x0;
0068: public final static short LEFT = 0x1;
0069: public final static short CENTER = 0x2;
0070: public final static short RIGHT = 0x3;
0071: public final static short FILL = 0x4;
0072: public final static short JUSTIFY = 0x5;
0073: public final static short CENTER_SELECTION = 0x6;
0074:
0075: // vertical alignment
0076: public final static short VERTICAL_TOP = 0x0;
0077: public final static short VERTICAL_CENTER = 0x1;
0078: public final static short VERTICAL_BOTTOM = 0x2;
0079: public final static short VERTICAL_JUSTIFY = 0x3;
0080:
0081: // fill
0082: public final static short NO_FILL = 0;
0083: public final static short SOLID_FILL = 1;
0084: public final static short FINE_DOTS = 2;
0085: public final static short ALT_BARS = 3;
0086: public final static short SPARSE_DOTS = 4;
0087: public final static short THICK_HORZ_BANDS = 5;
0088: public final static short THICK_VERT_BANDS = 6;
0089: public final static short THICK_BACKWARD_DIAG = 7;
0090: public final static short THICK_FORWARD_DIAG = 8;
0091: public final static short BIG_SPOTS = 9;
0092: public final static short BRICKS = 10;
0093: public final static short THIN_HORZ_BANDS = 11;
0094: public final static short THIN_VERT_BANDS = 12;
0095: public final static short THIN_BACKWARD_DIAG = 13;
0096: public final static short THIN_FORWARD_DIAG = 14;
0097: public final static short SQUARES = 15;
0098: public final static short DIAMONDS = 16;
0099:
0100: // fields in BOTH style and Cell XF records
0101: private short field_1_font_index; // not bit-mapped
0102: private short field_2_format_index; // not bit-mapped
0103:
0104: // field_3_cell_options bit map
0105: static final private BitField _locked = BitFieldFactory
0106: .getInstance(0x0001);
0107: static final private BitField _hidden = BitFieldFactory
0108: .getInstance(0x0002);
0109: static final private BitField _xf_type = BitFieldFactory
0110: .getInstance(0x0004);
0111: static final private BitField _123_prefix = BitFieldFactory
0112: .getInstance(0x0008);
0113: static final private BitField _parent_index = BitFieldFactory
0114: .getInstance(0xFFF0);
0115: private short field_3_cell_options;
0116:
0117: // field_4_alignment_options bit map
0118: static final private BitField _alignment = BitFieldFactory
0119: .getInstance(0x0007);
0120: static final private BitField _wrap_text = BitFieldFactory
0121: .getInstance(0x0008);
0122: static final private BitField _vertical_alignment = BitFieldFactory
0123: .getInstance(0x0070);
0124: static final private BitField _justify_last = BitFieldFactory
0125: .getInstance(0x0080);
0126: static final private BitField _rotation = BitFieldFactory
0127: .getInstance(0xFF00);
0128: private short field_4_alignment_options;
0129:
0130: // field_5_indention_options
0131: static final private BitField _indent = BitFieldFactory
0132: .getInstance(0x000F);
0133: static final private BitField _shrink_to_fit = BitFieldFactory
0134: .getInstance(0x0010);
0135: static final private BitField _merge_cells = BitFieldFactory
0136: .getInstance(0x0020);
0137: static final private BitField _reading_order = BitFieldFactory
0138: .getInstance(0x00C0);
0139:
0140: // apparently bits 8 and 9 are unused
0141: static final private BitField _indent_not_parent_format = BitFieldFactory
0142: .getInstance(0x0400);
0143: static final private BitField _indent_not_parent_font = BitFieldFactory
0144: .getInstance(0x0800);
0145: static final private BitField _indent_not_parent_alignment = BitFieldFactory
0146: .getInstance(0x1000);
0147: static final private BitField _indent_not_parent_border = BitFieldFactory
0148: .getInstance(0x2000);
0149: static final private BitField _indent_not_parent_pattern = BitFieldFactory
0150: .getInstance(0x4000);
0151: static final private BitField _indent_not_parent_cell_options = BitFieldFactory
0152: .getInstance(0x8000);
0153: private short field_5_indention_options;
0154:
0155: // field_6_border_options bit map
0156: static final private BitField _border_left = BitFieldFactory
0157: .getInstance(0x000F);
0158: static final private BitField _border_right = BitFieldFactory
0159: .getInstance(0x00F0);
0160: static final private BitField _border_top = BitFieldFactory
0161: .getInstance(0x0F00);
0162: static final private BitField _border_bottom = BitFieldFactory
0163: .getInstance(0xF000);
0164: private short field_6_border_options;
0165:
0166: // all three of the following attributes are palette options
0167: // field_7_palette_options bit map
0168: static final private BitField _left_border_palette_idx = BitFieldFactory
0169: .getInstance(0x007F);
0170: static final private BitField _right_border_palette_idx = BitFieldFactory
0171: .getInstance(0x3F80);
0172: static final private BitField _diag = BitFieldFactory
0173: .getInstance(0xC000);
0174: private short field_7_palette_options;
0175:
0176: // field_8_adtl_palette_options bit map
0177: static final private BitField _top_border_palette_idx = BitFieldFactory
0178: .getInstance(0x0000007F);
0179: static final private BitField _bottom_border_palette_idx = BitFieldFactory
0180: .getInstance(0x00003F80);
0181: static final private BitField _adtl_diag = BitFieldFactory
0182: .getInstance(0x001fc000);
0183: static final private BitField _adtl_diag_line_style = BitFieldFactory
0184: .getInstance(0x01e00000);
0185:
0186: // apparently bit 25 is unused
0187: static final private BitField _adtl_fill_pattern = BitFieldFactory
0188: .getInstance(0xfc000000);
0189: private int field_8_adtl_palette_options; // additional to avoid 2
0190:
0191: // field_9_fill_palette_options bit map
0192: static final private BitField _fill_foreground = BitFieldFactory
0193: .getInstance(0x007F);
0194: static final private BitField _fill_background = BitFieldFactory
0195: .getInstance(0x3f80);
0196:
0197: // apparently bits 15 and 14 are unused
0198: private short field_9_fill_palette_options;
0199:
0200: /**
0201: * Constructor ExtendedFormatRecord
0202: *
0203: *
0204: */
0205:
0206: public ExtendedFormatRecord() {
0207: }
0208:
0209: /**
0210: * Constructs an ExtendedFormat record and sets its fields appropriately.
0211: * @param in the RecordInputstream to read the record from
0212: */
0213:
0214: public ExtendedFormatRecord(RecordInputStream in) {
0215: super (in);
0216: }
0217:
0218: protected void validateSid(short id) {
0219: if (id != sid) {
0220: throw new RecordFormatException(
0221: "NOT A EXTENDED FORMAT RECORD");
0222: }
0223: }
0224:
0225: protected void fillFields(RecordInputStream in) {
0226: field_1_font_index = in.readShort();
0227: field_2_format_index = in.readShort();
0228: field_3_cell_options = in.readShort();
0229: field_4_alignment_options = in.readShort();
0230: field_5_indention_options = in.readShort();
0231: field_6_border_options = in.readShort();
0232: field_7_palette_options = in.readShort();
0233: field_8_adtl_palette_options = in.readInt();
0234: field_9_fill_palette_options = in.readShort();
0235: }
0236:
0237: /**
0238: * set the index to the FONT record (which font to use 0 based)
0239: *
0240: *
0241: * @param index to the font
0242: * @see org.apache.poi.hssf.record.FontRecord
0243: */
0244:
0245: public void setFontIndex(short index) {
0246: field_1_font_index = index;
0247: }
0248:
0249: /**
0250: * set the index to the Format record (which FORMAT to use 0-based)
0251: *
0252: *
0253: * @param index to the format record
0254: * @see org.apache.poi.hssf.record.FormatRecord
0255: */
0256:
0257: public void setFormatIndex(short index) {
0258: field_2_format_index = index;
0259: }
0260:
0261: /**
0262: * sets the options bitmask - you can also use corresponding option bit setters
0263: * (see other methods that reference this one)
0264: *
0265: *
0266: * @param options bitmask to set
0267: *
0268: */
0269:
0270: public void setCellOptions(short options) {
0271: field_3_cell_options = options;
0272: }
0273:
0274: // These are the bit fields in cell options
0275:
0276: /**
0277: * set whether the cell is locked or not
0278: *
0279: *
0280: * @param locked - if the cell is locked
0281: * @see #setCellOptions(short)
0282: */
0283:
0284: public void setLocked(boolean locked) {
0285: field_3_cell_options = _locked.setShortBoolean(
0286: field_3_cell_options, locked);
0287: }
0288:
0289: /**
0290: * set whether the cell is hidden or not
0291: *
0292: *
0293: * @param hidden - if the cell is hidden
0294: * @see #setCellOptions(short)
0295: */
0296:
0297: public void setHidden(boolean hidden) {
0298: field_3_cell_options = _hidden.setShortBoolean(
0299: field_3_cell_options, hidden);
0300: }
0301:
0302: /**
0303: * set whether the cell is a cell or style XFRecord
0304: *
0305: *
0306: * @param type - cell or style (0/1)
0307: * @see #XF_STYLE
0308: * @see #XF_CELL
0309: * @see #setCellOptions(short)
0310: */
0311:
0312: public void setXFType(short type) {
0313: field_3_cell_options = _xf_type.setShortValue(
0314: field_3_cell_options, type);
0315: }
0316:
0317: /**
0318: * set some old holdover from lotus 123. Who cares, its all over for Lotus.
0319: * RIP Lotus.
0320: *
0321: * @param prefix - the lotus thing to set.
0322: * @see #setCellOptions(short)
0323: */
0324:
0325: public void set123Prefix(boolean prefix) {
0326: field_3_cell_options = _123_prefix.setShortBoolean(
0327: field_3_cell_options, prefix);
0328: }
0329:
0330: // present in both but NULL except in cell records
0331:
0332: /**
0333: * for cell XF types this is the parent style (usually 0/normal). For
0334: * style this should be NULL.
0335: *
0336: * @param parent index of parent XF
0337: * @see #NULL
0338: * @see #setCellOptions(short)
0339: */
0340:
0341: public void setParentIndex(short parent) {
0342: field_3_cell_options = _parent_index.setShortValue(
0343: field_3_cell_options, parent);
0344: }
0345:
0346: // end bitfields in cell options
0347:
0348: /**
0349: * set the alignment options bitmask. See corresponding bitsetter methods
0350: * that reference this one.
0351: *
0352: *
0353: * @param options - the bitmask to set
0354: */
0355:
0356: public void setAlignmentOptions(short options) {
0357: field_4_alignment_options = options;
0358: }
0359:
0360: /**
0361: * set the horizontal alignment of the cell.
0362: *
0363: *
0364: * @param align - how to align the cell (see constants)
0365: * @see #GENERAL
0366: * @see #LEFT
0367: * @see #CENTER
0368: * @see #RIGHT
0369: * @see #FILL
0370: * @see #JUSTIFY
0371: * @see #CENTER_SELECTION
0372: * @see #setAlignmentOptions(short)
0373: */
0374:
0375: public void setAlignment(short align) {
0376: field_4_alignment_options = _alignment.setShortValue(
0377: field_4_alignment_options, align);
0378: }
0379:
0380: /**
0381: * set whether to wrap the text in the cell
0382: *
0383: *
0384: * @param wrapped - whether or not to wrap the cell text
0385: * @see #setAlignmentOptions(short)
0386: */
0387:
0388: public void setWrapText(boolean wrapped) {
0389: field_4_alignment_options = _wrap_text.setShortBoolean(
0390: field_4_alignment_options, wrapped);
0391: }
0392:
0393: /**
0394: * set the vertical alignment of text in the cell
0395: *
0396: *
0397: * @param align where to align the text
0398: * @see #VERTICAL_TOP
0399: * @see #VERTICAL_CENTER
0400: * @see #VERTICAL_BOTTOM
0401: * @see #VERTICAL_JUSTIFY
0402: *
0403: * @see #setAlignmentOptions(short)
0404: */
0405:
0406: public void setVerticalAlignment(short align) {
0407: field_4_alignment_options = _vertical_alignment.setShortValue(
0408: field_4_alignment_options, align);
0409: }
0410:
0411: /**
0412: * Dunno. Docs just say this is for far east versions.. (I'm guessing it
0413: * justifies for right-to-left read languages)
0414: *
0415: *
0416: * @param justify
0417: * @see #setAlignmentOptions(short)
0418: */
0419:
0420: public void setJustifyLast(short justify) { // for far east languages supported only for format always 0 for US
0421: field_4_alignment_options = _justify_last.setShortValue(
0422: field_4_alignment_options, justify);
0423: }
0424:
0425: /**
0426: * set the degree of rotation. (I've not actually seen this used anywhere)
0427: *
0428: *
0429: * @param rotation the degree of rotation
0430: * @see #setAlignmentOptions(short)
0431: */
0432:
0433: public void setRotation(short rotation) {
0434: field_4_alignment_options = _rotation.setShortValue(
0435: field_4_alignment_options, rotation);
0436: }
0437:
0438: /**
0439: * set the indent options bitmask (see corresponding bitmask setters that reference
0440: * this field)
0441: *
0442: *
0443: * @param options bitmask to set.
0444: *
0445: */
0446:
0447: public void setIndentionOptions(short options) {
0448: field_5_indention_options = options;
0449: }
0450:
0451: // set bitfields for indention options
0452:
0453: /**
0454: * set indention (not sure of the units, think its spaces)
0455: *
0456: * @param indent - how far to indent the cell
0457: * @see #setIndentionOptions(short)
0458: */
0459:
0460: public void setIndent(short indent) {
0461: field_5_indention_options = _indent.setShortValue(
0462: field_5_indention_options, indent);
0463: }
0464:
0465: /**
0466: * set whether to shrink the text to fit
0467: *
0468: *
0469: * @param shrink - shrink to fit or not
0470: * @see #setIndentionOptions(short)
0471: */
0472:
0473: public void setShrinkToFit(boolean shrink) {
0474: field_5_indention_options = _shrink_to_fit.setShortBoolean(
0475: field_5_indention_options, shrink);
0476: }
0477:
0478: /**
0479: * set whether to merge cells
0480: *
0481: *
0482: * @param merge - merge cells or not
0483: * @see #setIndentionOptions(short)
0484: */
0485:
0486: public void setMergeCells(boolean merge) {
0487: field_5_indention_options = _merge_cells.setShortBoolean(
0488: field_5_indention_options, merge);
0489: }
0490:
0491: /**
0492: * set the reading order for far east versions (0 - Context, 1 - Left to right,
0493: * 2 - right to left) - We could use some help with support for the far east.
0494: *
0495: * @param order - the reading order (0,1,2)
0496: * @see #setIndentionOptions(short)
0497: */
0498:
0499: public void setReadingOrder(short order) { // only for far east always 0 in US
0500: field_5_indention_options = _reading_order.setShortValue(
0501: field_5_indention_options, order);
0502: }
0503:
0504: /**
0505: * set whether or not to use the format in this XF instead of the parent XF.
0506: *
0507: *
0508: * @param parent - true if this XF has a different format value than its parent,
0509: * false otherwise.
0510: * @see #setIndentionOptions(short)
0511: */
0512:
0513: public void setIndentNotParentFormat(boolean parent) {
0514: field_5_indention_options = _indent_not_parent_format
0515: .setShortBoolean(field_5_indention_options, parent);
0516: }
0517:
0518: /**
0519: * set whether or not to use the font in this XF instead of the parent XF.
0520: *
0521: *
0522: * @param font - true if this XF has a different font value than its parent,
0523: * false otherwise.
0524: * @see #setIndentionOptions(short)
0525: */
0526:
0527: public void setIndentNotParentFont(boolean font) {
0528: field_5_indention_options = _indent_not_parent_font
0529: .setShortBoolean(field_5_indention_options, font);
0530: }
0531:
0532: /**
0533: * set whether or not to use the alignment in this XF instead of the parent XF.
0534: *
0535: *
0536: * @param alignment true if this XF has a different alignment value than its parent,
0537: * false otherwise.
0538: * @see #setIndentionOptions(short)
0539: */
0540:
0541: public void setIndentNotParentAlignment(boolean alignment) {
0542: field_5_indention_options = _indent_not_parent_alignment
0543: .setShortBoolean(field_5_indention_options, alignment);
0544: }
0545:
0546: /**
0547: * set whether or not to use the border in this XF instead of the parent XF.
0548: *
0549: *
0550: * @param border - true if this XF has a different border value than its parent,
0551: * false otherwise.
0552: * @see #setIndentionOptions(short)
0553: */
0554:
0555: public void setIndentNotParentBorder(boolean border) {
0556: field_5_indention_options = _indent_not_parent_border
0557: .setShortBoolean(field_5_indention_options, border);
0558: }
0559:
0560: /**
0561: * <p>Sets whether or not to use the pattern in this XF instead of the
0562: * parent XF (foreground/background).</p>
0563: *
0564: * @param pattern <code>true</code> if this XF has a different pattern
0565: * value than its parent,</code> false</code> otherwise.
0566: * @see #setIndentionOptions(short)
0567: */
0568:
0569: public void setIndentNotParentPattern(boolean pattern) {
0570: field_5_indention_options = _indent_not_parent_pattern
0571: .setShortBoolean(field_5_indention_options, pattern);
0572: }
0573:
0574: /**
0575: * set whether or not to use the locking/hidden in this XF instead of the parent XF.
0576: *
0577: *
0578: * @param options true if this XF has a different locking or hidden value than its parent,
0579: * false otherwise.
0580: * @see #setIndentionOptions(short)
0581: */
0582:
0583: public void setIndentNotParentCellOptions(boolean options) {
0584: field_5_indention_options = _indent_not_parent_cell_options
0585: .setShortBoolean(field_5_indention_options, options);
0586: }
0587:
0588: // end indention options bitmask sets
0589:
0590: /**
0591: * set the border options bitmask (see the corresponding bitsetter methods
0592: * that reference back to this one)
0593: *
0594: * @param options - the bit mask to set
0595: *
0596: */
0597:
0598: public void setBorderOptions(short options) {
0599: field_6_border_options = options;
0600: }
0601:
0602: // border options bitfields
0603:
0604: /**
0605: * set the borderline style for the left border
0606: *
0607: *
0608: * @param border - type of border for the left side of the cell
0609: * @see #NONE
0610: * @see #THIN
0611: * @see #MEDIUM
0612: * @see #DASHED
0613: * @see #DOTTED
0614: * @see #THICK
0615: * @see #DOUBLE
0616: * @see #HAIR
0617: * @see #MEDIUM_DASHED
0618: * @see #DASH_DOT
0619: * @see #MEDIUM_DASH_DOT
0620: * @see #DASH_DOT_DOT
0621: * @see #MEDIUM_DASH_DOT_DOT
0622: * @see #SLANTED_DASH_DOT
0623: * @see #setBorderOptions(short)
0624: */
0625:
0626: public void setBorderLeft(short border) {
0627: field_6_border_options = _border_left.setShortValue(
0628: field_6_border_options, border);
0629: }
0630:
0631: /**
0632: * set the border line style for the right border
0633: *
0634: *
0635: * @param border - type of border for the right side of the cell
0636: * @see #NONE
0637: * @see #THIN
0638: * @see #MEDIUM
0639: * @see #DASHED
0640: * @see #DOTTED
0641: * @see #THICK
0642: * @see #DOUBLE
0643: * @see #HAIR
0644: * @see #MEDIUM_DASHED
0645: * @see #DASH_DOT
0646: * @see #MEDIUM_DASH_DOT
0647: * @see #DASH_DOT_DOT
0648: * @see #MEDIUM_DASH_DOT_DOT
0649: * @see #SLANTED_DASH_DOT
0650: * @see #setBorderOptions(short)
0651: */
0652:
0653: public void setBorderRight(short border) {
0654: field_6_border_options = _border_right.setShortValue(
0655: field_6_border_options, border);
0656: }
0657:
0658: /**
0659: * set the border line style for the top border
0660: *
0661: *
0662: * @param border - type of border for the top of the cell
0663: * @see #NONE
0664: * @see #THIN
0665: * @see #MEDIUM
0666: * @see #DASHED
0667: * @see #DOTTED
0668: * @see #THICK
0669: * @see #DOUBLE
0670: * @see #HAIR
0671: * @see #MEDIUM_DASHED
0672: * @see #DASH_DOT
0673: * @see #MEDIUM_DASH_DOT
0674: * @see #DASH_DOT_DOT
0675: * @see #MEDIUM_DASH_DOT_DOT
0676: * @see #SLANTED_DASH_DOT
0677: * @see #setBorderOptions(short)
0678: */
0679:
0680: public void setBorderTop(short border) {
0681: field_6_border_options = _border_top.setShortValue(
0682: field_6_border_options, border);
0683: }
0684:
0685: /**
0686: * set the border line style for the bottom border
0687: *
0688: *
0689: * @param border - type of border for the bottom of the cell
0690: * @see #NONE
0691: * @see #THIN
0692: * @see #MEDIUM
0693: * @see #DASHED
0694: * @see #DOTTED
0695: * @see #THICK
0696: * @see #DOUBLE
0697: * @see #HAIR
0698: * @see #MEDIUM_DASHED
0699: * @see #DASH_DOT
0700: * @see #MEDIUM_DASH_DOT
0701: * @see #DASH_DOT_DOT
0702: * @see #MEDIUM_DASH_DOT_DOT
0703: * @see #SLANTED_DASH_DOT
0704: * @see #setBorderOptions(short)
0705: */
0706:
0707: public void setBorderBottom(short border) {
0708: field_6_border_options = _border_bottom.setShortValue(
0709: field_6_border_options, border);
0710: }
0711:
0712: // end border option bitfields
0713:
0714: /**
0715: * set the palette options bitmask (see the individual bitsetter methods that
0716: * reference this one)
0717: *
0718: *
0719: * @param options - the bitmask to set
0720: *
0721: */
0722:
0723: public void setPaletteOptions(short options) {
0724: field_7_palette_options = options;
0725: }
0726:
0727: // bitfields for palette options
0728:
0729: /**
0730: * set the palette index for the left border color
0731: *
0732: *
0733: * @param border - palette index
0734: * @see #setPaletteOptions(short)
0735: */
0736:
0737: public void setLeftBorderPaletteIdx(short border) {
0738: field_7_palette_options = _left_border_palette_idx
0739: .setShortValue(field_7_palette_options, border);
0740: }
0741:
0742: /**
0743: * set the palette index for the right border color
0744: *
0745: *
0746: * @param border - palette index
0747: * @see #setPaletteOptions(short)
0748: */
0749:
0750: public void setRightBorderPaletteIdx(short border) {
0751: field_7_palette_options = _right_border_palette_idx
0752: .setShortValue(field_7_palette_options, border);
0753: }
0754:
0755: // i've no idea.. possible values are 1 for down, 2 for up and 3 for both...0 for none..
0756: // maybe a diagnal line?
0757:
0758: /**
0759: * Not sure what this is for (maybe fill lines?) 1 = down, 2 = up, 3 = both, 0 for none..
0760: *
0761: *
0762: * @param diag - set whatever it is that this is.
0763: * @see #setPaletteOptions(short)
0764: */
0765:
0766: public void setDiag(short diag) {
0767: field_7_palette_options = _diag.setShortValue(
0768: field_7_palette_options, diag);
0769: }
0770:
0771: // end of palette options
0772:
0773: /**
0774: * set the additional palette options bitmask (see individual bitsetter methods
0775: * that reference this method)
0776: *
0777: *
0778: * @param options - bitmask to set
0779: *
0780: */
0781:
0782: public void setAdtlPaletteOptions(short options) {
0783: field_8_adtl_palette_options = options;
0784: }
0785:
0786: // bitfields for additional palette options
0787:
0788: /**
0789: * set the palette index for the top border
0790: *
0791: *
0792: * @param border - palette index
0793: * @see #setAdtlPaletteOptions(short)
0794: */
0795:
0796: public void setTopBorderPaletteIdx(short border) {
0797: field_8_adtl_palette_options = _top_border_palette_idx
0798: .setValue(field_8_adtl_palette_options, border);
0799: }
0800:
0801: /**
0802: * set the palette index for the bottom border
0803: *
0804: *
0805: * @param border - palette index
0806: * @see #setAdtlPaletteOptions(short)
0807: */
0808:
0809: public void setBottomBorderPaletteIdx(short border) {
0810: field_8_adtl_palette_options = _bottom_border_palette_idx
0811: .setValue(field_8_adtl_palette_options, border);
0812: }
0813:
0814: /**
0815: * set for diagonal borders? No idea (its a palette color for the other function
0816: * we didn't know what was?)
0817: *
0818: *
0819: * @param diag - the palette index?
0820: * @see #setAdtlPaletteOptions(short)
0821: */
0822:
0823: public void setAdtlDiag(short diag) {
0824: field_8_adtl_palette_options = _adtl_diag.setValue(
0825: field_8_adtl_palette_options, diag);
0826: }
0827:
0828: /**
0829: * set the diagonal border line style? Who the heck ever heard of a diagonal border?
0830: *
0831: *
0832: * @param diag - the line style
0833: * @see #NONE
0834: * @see #THIN
0835: * @see #MEDIUM
0836: * @see #DASHED
0837: * @see #DOTTED
0838: * @see #THICK
0839: * @see #DOUBLE
0840: * @see #HAIR
0841: * @see #MEDIUM_DASHED
0842: * @see #DASH_DOT
0843: * @see #MEDIUM_DASH_DOT
0844: * @see #DASH_DOT_DOT
0845: * @see #MEDIUM_DASH_DOT_DOT
0846: * @see #SLANTED_DASH_DOT
0847: * @see #setAdtlPaletteOptions(short)
0848: */
0849:
0850: public void setAdtlDiagLineStyle(short diag) {
0851: field_8_adtl_palette_options = _adtl_diag_line_style.setValue(
0852: field_8_adtl_palette_options, diag);
0853: }
0854:
0855: /**
0856: * set the fill pattern
0857: *
0858: * @see #NO_FILL
0859: * @see #SOLID_FILL
0860: * @see #FINE_DOTS
0861: * @see #ALT_BARS
0862: * @see #SPARSE_DOTS
0863: * @see #THICK_HORZ_BANDS
0864: * @see #THICK_VERT_BANDS
0865: * @see #THICK_BACKWARD_DIAG
0866: * @see #THICK_FORWARD_DIAG
0867: * @see #BIG_SPOTS
0868: * @see #BRICKS
0869: * @see #THIN_HORZ_BANDS
0870: * @see #THIN_VERT_BANDS
0871: * @see #THIN_BACKWARD_DIAG
0872: * @see #THIN_FORWARD_DIAG
0873: * @see #SQUARES
0874: * @see #DIAMONDS
0875: *
0876: * @param fill - fill pattern??
0877: * @see #setAdtlPaletteOptions(short)
0878: */
0879:
0880: public void setAdtlFillPattern(short fill) {
0881: field_8_adtl_palette_options = _adtl_fill_pattern.setValue(
0882: field_8_adtl_palette_options, fill);
0883: }
0884:
0885: // end bitfields for additional palette options
0886:
0887: /**
0888: * set the fill palette options bitmask (see
0889: *
0890: *
0891: * @param options
0892: *
0893: */
0894:
0895: public void setFillPaletteOptions(short options) {
0896: field_9_fill_palette_options = options;
0897: }
0898:
0899: /**
0900: * set the foreground palette color index
0901: *
0902: *
0903: * @param color - palette index
0904: * @see #setFillPaletteOptions(short)
0905: */
0906:
0907: public void setFillForeground(short color) {
0908: field_9_fill_palette_options = _fill_foreground.setShortValue(
0909: field_9_fill_palette_options, color);
0910: }
0911:
0912: /**
0913: * set the background palette color index
0914: *
0915: *
0916: * @param color - palette index
0917: * @see #setFillPaletteOptions(short)
0918: */
0919:
0920: public void setFillBackground(short color) {
0921: field_9_fill_palette_options = _fill_background.setShortValue(
0922: field_9_fill_palette_options, color);
0923: }
0924:
0925: /**
0926: * get the index to the FONT record (which font to use 0 based)
0927: *
0928: *
0929: * @return index to the font
0930: * @see org.apache.poi.hssf.record.FontRecord
0931: */
0932:
0933: public short getFontIndex() {
0934: return field_1_font_index;
0935: }
0936:
0937: /**
0938: * get the index to the Format record (which FORMAT to use 0-based)
0939: *
0940: *
0941: * @return index to the format record
0942: * @see org.apache.poi.hssf.record.FormatRecord
0943: */
0944:
0945: public short getFormatIndex() {
0946: return field_2_format_index;
0947: }
0948:
0949: /**
0950: * gets the options bitmask - you can also use corresponding option bit getters
0951: * (see other methods that reference this one)
0952: *
0953: *
0954: * @return options bitmask
0955: *
0956: */
0957:
0958: public short getCellOptions() {
0959: return field_3_cell_options;
0960: }
0961:
0962: // These are the bit fields in cell options
0963:
0964: /**
0965: * get whether the cell is locked or not
0966: *
0967: *
0968: * @return locked - if the cell is locked
0969: * @see #getCellOptions()
0970: */
0971:
0972: public boolean isLocked() {
0973: return _locked.isSet(field_3_cell_options);
0974: }
0975:
0976: /**
0977: * get whether the cell is hidden or not
0978: *
0979: *
0980: * @return hidden - if the cell is hidden
0981: * @see #getCellOptions()
0982: */
0983:
0984: public boolean isHidden() {
0985: return _hidden.isSet(field_3_cell_options);
0986: }
0987:
0988: /**
0989: * get whether the cell is a cell or style XFRecord
0990: *
0991: *
0992: * @return type - cell or style (0/1)
0993: * @see #XF_STYLE
0994: * @see #XF_CELL
0995: * @see #getCellOptions()
0996: */
0997:
0998: public short getXFType() {
0999: return _xf_type.getShortValue(field_3_cell_options);
1000: }
1001:
1002: /**
1003: * get some old holdover from lotus 123. Who cares, its all over for Lotus.
1004: * RIP Lotus.
1005: *
1006: * @return prefix - the lotus thing
1007: * @see #getCellOptions()
1008: */
1009:
1010: public boolean get123Prefix() {
1011: return _123_prefix.isSet(field_3_cell_options);
1012: }
1013:
1014: /**
1015: * for cell XF types this is the parent style (usually 0/normal). For
1016: * style this should be NULL.
1017: *
1018: * @return index of parent XF
1019: * @see #NULL
1020: * @see #getCellOptions()
1021: */
1022:
1023: public short getParentIndex() {
1024: return _parent_index.getShortValue(field_3_cell_options);
1025: }
1026:
1027: // end bitfields in cell options
1028:
1029: /**
1030: * get the alignment options bitmask. See corresponding bitgetter methods
1031: * that reference this one.
1032: *
1033: *
1034: * @return options - the bitmask
1035: */
1036:
1037: public short getAlignmentOptions() {
1038: return field_4_alignment_options;
1039: }
1040:
1041: // bitfields in alignment options
1042:
1043: /**
1044: * get the horizontal alignment of the cell.
1045: *
1046: *
1047: * @return align - how to align the cell (see constants)
1048: * @see #GENERAL
1049: * @see #LEFT
1050: * @see #CENTER
1051: * @see #RIGHT
1052: * @see #FILL
1053: * @see #JUSTIFY
1054: * @see #CENTER_SELECTION
1055: * @see #getAlignmentOptions()
1056: */
1057:
1058: public short getAlignment() {
1059: return _alignment.getShortValue(field_4_alignment_options);
1060: }
1061:
1062: /**
1063: * get whether to wrap the text in the cell
1064: *
1065: *
1066: * @return wrapped - whether or not to wrap the cell text
1067: * @see #getAlignmentOptions()
1068: */
1069:
1070: public boolean getWrapText() {
1071: return _wrap_text.isSet(field_4_alignment_options);
1072: }
1073:
1074: /**
1075: * get the vertical alignment of text in the cell
1076: *
1077: *
1078: * @return where to align the text
1079: * @see #VERTICAL_TOP
1080: * @see #VERTICAL_CENTER
1081: * @see #VERTICAL_BOTTOM
1082: * @see #VERTICAL_JUSTIFY
1083: *
1084: * @see #getAlignmentOptions()
1085: */
1086:
1087: public short getVerticalAlignment() {
1088: return _vertical_alignment
1089: .getShortValue(field_4_alignment_options);
1090: }
1091:
1092: /**
1093: * Dunno. Docs just say this is for far east versions.. (I'm guessing it
1094: * justifies for right-to-left read languages)
1095: *
1096: *
1097: * @return justify
1098: * @see #getAlignmentOptions()
1099: */
1100:
1101: public short getJustifyLast() { // for far east languages supported only for format always 0 for US
1102: return _justify_last.getShortValue(field_4_alignment_options);
1103: }
1104:
1105: /**
1106: * get the degree of rotation. (I've not actually seen this used anywhere)
1107: *
1108: *
1109: * @return rotation - the degree of rotation
1110: * @see #getAlignmentOptions()
1111: */
1112:
1113: public short getRotation() {
1114: return _rotation.getShortValue(field_4_alignment_options);
1115: }
1116:
1117: // end alignment options bitfields
1118:
1119: /**
1120: * get the indent options bitmask (see corresponding bit getters that reference
1121: * this field)
1122: *
1123: *
1124: * @return options bitmask
1125: *
1126: */
1127:
1128: public short getIndentionOptions() {
1129: return field_5_indention_options;
1130: }
1131:
1132: // bitfields for indention options
1133:
1134: /**
1135: * get indention (not sure of the units, think its spaces)
1136: *
1137: * @return indent - how far to indent the cell
1138: * @see #getIndentionOptions()
1139: */
1140:
1141: public short getIndent() {
1142: return _indent.getShortValue(field_5_indention_options);
1143: }
1144:
1145: /**
1146: * get whether to shrink the text to fit
1147: *
1148: *
1149: * @return shrink - shrink to fit or not
1150: * @see #getIndentionOptions()
1151: */
1152:
1153: public boolean getShrinkToFit() {
1154: return _shrink_to_fit.isSet(field_5_indention_options);
1155: }
1156:
1157: /**
1158: * get whether to merge cells
1159: *
1160: *
1161: * @return merge - merge cells or not
1162: * @see #getIndentionOptions()
1163: */
1164:
1165: public boolean getMergeCells() {
1166: return _merge_cells.isSet(field_5_indention_options);
1167: }
1168:
1169: /**
1170: * get the reading order for far east versions (0 - Context, 1 - Left to right,
1171: * 2 - right to left) - We could use some help with support for the far east.
1172: *
1173: * @return order - the reading order (0,1,2)
1174: * @see #getIndentionOptions()
1175: */
1176:
1177: public short getReadingOrder() { // only for far east always 0 in US
1178: return _reading_order.getShortValue(field_5_indention_options);
1179: }
1180:
1181: /**
1182: * get whether or not to use the format in this XF instead of the parent XF.
1183: *
1184: *
1185: * @return parent - true if this XF has a different format value than its parent,
1186: * false otherwise.
1187: * @see #getIndentionOptions()
1188: */
1189:
1190: public boolean isIndentNotParentFormat() {
1191: return _indent_not_parent_format
1192: .isSet(field_5_indention_options);
1193: }
1194:
1195: /**
1196: * get whether or not to use the font in this XF instead of the parent XF.
1197: *
1198: *
1199: * @return font - true if this XF has a different font value than its parent,
1200: * false otherwise.
1201: * @see #getIndentionOptions()
1202: */
1203:
1204: public boolean isIndentNotParentFont() {
1205: return _indent_not_parent_font.isSet(field_5_indention_options);
1206: }
1207:
1208: /**
1209: * get whether or not to use the alignment in this XF instead of the parent XF.
1210: *
1211: *
1212: * @return alignment true if this XF has a different alignment value than its parent,
1213: * false otherwise.
1214: * @see #getIndentionOptions()
1215: */
1216:
1217: public boolean isIndentNotParentAlignment() {
1218: return _indent_not_parent_alignment
1219: .isSet(field_5_indention_options);
1220: }
1221:
1222: /**
1223: * get whether or not to use the border in this XF instead of the parent XF.
1224: *
1225: *
1226: * @return border - true if this XF has a different border value than its parent,
1227: * false otherwise.
1228: * @see #getIndentionOptions()
1229: */
1230:
1231: public boolean isIndentNotParentBorder() {
1232: return _indent_not_parent_border
1233: .isSet(field_5_indention_options);
1234: }
1235:
1236: /**
1237: * get whether or not to use the pattern in this XF instead of the parent XF.
1238: * (foregrount/background)
1239: *
1240: * @return pattern- true if this XF has a different pattern value than its parent,
1241: * false otherwise.
1242: * @see #getIndentionOptions()
1243: */
1244:
1245: public boolean isIndentNotParentPattern() {
1246: return _indent_not_parent_pattern
1247: .isSet(field_5_indention_options);
1248: }
1249:
1250: /**
1251: * get whether or not to use the locking/hidden in this XF instead of the parent XF.
1252: *
1253: *
1254: * @return options- true if this XF has a different locking or hidden value than its parent,
1255: * false otherwise.
1256: * @see #getIndentionOptions()
1257: */
1258:
1259: public boolean isIndentNotParentCellOptions() {
1260: return _indent_not_parent_cell_options
1261: .isSet(field_5_indention_options);
1262: }
1263:
1264: // end of bitfields for indention options
1265: // border options
1266:
1267: /**
1268: * get the border options bitmask (see the corresponding bit getter methods
1269: * that reference back to this one)
1270: *
1271: * @return options - the bit mask to set
1272: *
1273: */
1274:
1275: public short getBorderOptions() {
1276: return field_6_border_options;
1277: }
1278:
1279: // bitfields for border options
1280:
1281: /**
1282: * get the borderline style for the left border
1283: *
1284: *
1285: * @return border - type of border for the left side of the cell
1286: * @see #NONE
1287: * @see #THIN
1288: * @see #MEDIUM
1289: * @see #DASHED
1290: * @see #DOTTED
1291: * @see #THICK
1292: * @see #DOUBLE
1293: * @see #HAIR
1294: * @see #MEDIUM_DASHED
1295: * @see #DASH_DOT
1296: * @see #MEDIUM_DASH_DOT
1297: * @see #DASH_DOT_DOT
1298: * @see #MEDIUM_DASH_DOT_DOT
1299: * @see #SLANTED_DASH_DOT
1300: * @see #getBorderOptions()
1301: */
1302:
1303: public short getBorderLeft() {
1304: return _border_left.getShortValue(field_6_border_options);
1305: }
1306:
1307: /**
1308: * get the borderline style for the right border
1309: *
1310: *
1311: * @return border - type of border for the right side of the cell
1312: * @see #NONE
1313: * @see #THIN
1314: * @see #MEDIUM
1315: * @see #DASHED
1316: * @see #DOTTED
1317: * @see #THICK
1318: * @see #DOUBLE
1319: * @see #HAIR
1320: * @see #MEDIUM_DASHED
1321: * @see #DASH_DOT
1322: * @see #MEDIUM_DASH_DOT
1323: * @see #DASH_DOT_DOT
1324: * @see #MEDIUM_DASH_DOT_DOT
1325: * @see #SLANTED_DASH_DOT
1326: * @see #getBorderOptions()
1327: */
1328:
1329: public short getBorderRight() {
1330: return _border_right.getShortValue(field_6_border_options);
1331: }
1332:
1333: /**
1334: * get the borderline style for the top border
1335: *
1336: *
1337: * @return border - type of border for the top of the cell
1338: * @see #NONE
1339: * @see #THIN
1340: * @see #MEDIUM
1341: * @see #DASHED
1342: * @see #DOTTED
1343: * @see #THICK
1344: * @see #DOUBLE
1345: * @see #HAIR
1346: * @see #MEDIUM_DASHED
1347: * @see #DASH_DOT
1348: * @see #MEDIUM_DASH_DOT
1349: * @see #DASH_DOT_DOT
1350: * @see #MEDIUM_DASH_DOT_DOT
1351: * @see #SLANTED_DASH_DOT
1352: * @see #getBorderOptions()
1353: */
1354:
1355: public short getBorderTop() {
1356: return _border_top.getShortValue(field_6_border_options);
1357: }
1358:
1359: /**
1360: * get the borderline style for the bottom border
1361: *
1362: *
1363: * @return border - type of border for the bottom of the cell
1364: * @see #NONE
1365: * @see #THIN
1366: * @see #MEDIUM
1367: * @see #DASHED
1368: * @see #DOTTED
1369: * @see #THICK
1370: * @see #DOUBLE
1371: * @see #HAIR
1372: * @see #MEDIUM_DASHED
1373: * @see #DASH_DOT
1374: * @see #MEDIUM_DASH_DOT
1375: * @see #DASH_DOT_DOT
1376: * @see #MEDIUM_DASH_DOT_DOT
1377: * @see #SLANTED_DASH_DOT
1378: * @see #getBorderOptions()
1379: */
1380:
1381: public short getBorderBottom() {
1382: return _border_bottom.getShortValue(field_6_border_options);
1383: }
1384:
1385: // record types -- palette options
1386:
1387: /**
1388: * get the palette options bitmask (see the individual bit getter methods that
1389: * reference this one)
1390: *
1391: *
1392: * @return options - the bitmask
1393: *
1394: */
1395:
1396: public short getPaletteOptions() {
1397: return field_7_palette_options;
1398: }
1399:
1400: // bitfields for palette options
1401:
1402: /**
1403: * get the palette index for the left border color
1404: *
1405: *
1406: * @return border - palette index
1407: * @see #getPaletteOptions()
1408: */
1409:
1410: public short getLeftBorderPaletteIdx() {
1411: return _left_border_palette_idx
1412: .getShortValue(field_7_palette_options);
1413: }
1414:
1415: /**
1416: * get the palette index for the right border color
1417: *
1418: *
1419: * @return border - palette index
1420: * @see #getPaletteOptions()
1421: */
1422:
1423: public short getRightBorderPaletteIdx() {
1424: return _right_border_palette_idx
1425: .getShortValue(field_7_palette_options);
1426: }
1427:
1428: // i've no idea.. possible values are 1 for down, 2 for up and 3 for both...0 for none..
1429: // maybe a diagnal line?
1430:
1431: /**
1432: * Not sure what this is for (maybe fill lines?) 1 = down, 2 = up, 3 = both, 0 for none..
1433: *
1434: *
1435: * @return diag - whatever it is that this is.
1436: * @see #getPaletteOptions()
1437: */
1438:
1439: public short getDiag() {
1440: return _diag.getShortValue(field_7_palette_options);
1441: }
1442:
1443: // end of style palette options
1444: // additional palette options
1445:
1446: /**
1447: * get the additional palette options bitmask (see individual bit getter methods
1448: * that reference this method)
1449: *
1450: *
1451: * @return options - bitmask to set
1452: *
1453: */
1454:
1455: public int getAdtlPaletteOptions() {
1456: return field_8_adtl_palette_options;
1457: }
1458:
1459: // bitfields for additional palette options
1460:
1461: /**
1462: * get the palette index for the top border
1463: *
1464: *
1465: * @return border - palette index
1466: * @see #getAdtlPaletteOptions()
1467: */
1468:
1469: public short getTopBorderPaletteIdx() {
1470: return (short) _top_border_palette_idx
1471: .getValue(field_8_adtl_palette_options);
1472: }
1473:
1474: /**
1475: * get the palette index for the bottom border
1476: *
1477: *
1478: * @return border - palette index
1479: * @see #getAdtlPaletteOptions()
1480: */
1481:
1482: public short getBottomBorderPaletteIdx() {
1483: return (short) _bottom_border_palette_idx
1484: .getValue(field_8_adtl_palette_options);
1485: }
1486:
1487: /**
1488: * get for diagonal borders? No idea (its a palette color for the other function
1489: * we didn't know what was?)
1490: *
1491: *
1492: * @return diag - the palette index?
1493: * @see #getAdtlPaletteOptions()
1494: */
1495:
1496: public short getAdtlDiag() {
1497: return (short) _adtl_diag
1498: .getValue(field_8_adtl_palette_options);
1499: }
1500:
1501: /**
1502: * get the diagonal border line style? Who the heck ever heard of a diagonal border?
1503: *
1504: *
1505: * @return diag - the line style
1506: * @see #NONE
1507: * @see #THIN
1508: * @see #MEDIUM
1509: * @see #DASHED
1510: * @see #DOTTED
1511: * @see #THICK
1512: * @see #DOUBLE
1513: * @see #HAIR
1514: * @see #MEDIUM_DASHED
1515: * @see #DASH_DOT
1516: * @see #MEDIUM_DASH_DOT
1517: * @see #DASH_DOT_DOT
1518: * @see #MEDIUM_DASH_DOT_DOT
1519: * @see #SLANTED_DASH_DOT
1520: * @see #getAdtlPaletteOptions()
1521: */
1522:
1523: public short getAdtlDiagLineStyle() {
1524: return (short) _adtl_diag_line_style
1525: .getValue(field_8_adtl_palette_options);
1526: }
1527:
1528: /**
1529: * get the additional fill pattern
1530: *
1531: * @see #NO_FILL
1532: * @see #SOLID_FILL
1533: * @see #FINE_DOTS
1534: * @see #ALT_BARS
1535: * @see #SPARSE_DOTS
1536: * @see #THICK_HORZ_BANDS
1537: * @see #THICK_VERT_BANDS
1538: * @see #THICK_BACKWARD_DIAG
1539: * @see #THICK_FORWARD_DIAG
1540: * @see #BIG_SPOTS
1541: * @see #BRICKS
1542: * @see #THIN_HORZ_BANDS
1543: * @see #THIN_VERT_BANDS
1544: * @see #THIN_BACKWARD_DIAG
1545: * @see #THIN_FORWARD_DIAG
1546: * @see #SQUARES
1547: * @see #DIAMONDS
1548: *
1549: * @return fill - fill pattern??
1550: * @see #getAdtlPaletteOptions()
1551: */
1552:
1553: public short getAdtlFillPattern() {
1554: return (short) _adtl_fill_pattern
1555: .getValue(field_8_adtl_palette_options);
1556: }
1557:
1558: // end bitfields for additional palette options
1559: // fill palette options
1560:
1561: /**
1562: * get the fill palette options bitmask (see indivdual bit getters that
1563: * reference this method)
1564: *
1565: * @return options
1566: *
1567: */
1568:
1569: public short getFillPaletteOptions() {
1570: return field_9_fill_palette_options;
1571: }
1572:
1573: // bitfields for fill palette options
1574:
1575: /**
1576: * get the foreground palette color index
1577: *
1578: *
1579: * @return color - palette index
1580: * @see #getFillPaletteOptions()
1581: */
1582:
1583: public short getFillForeground() {
1584: return _fill_foreground
1585: .getShortValue(field_9_fill_palette_options);
1586: }
1587:
1588: /**
1589: * get the background palette color index
1590: *
1591: * @return color palette index
1592: * @see #getFillPaletteOptions()
1593: */
1594:
1595: public short getFillBackground() {
1596: return _fill_background
1597: .getShortValue(field_9_fill_palette_options);
1598: }
1599:
1600: public String toString() {
1601: StringBuffer buffer = new StringBuffer();
1602:
1603: buffer.append("[EXTENDEDFORMAT]\n");
1604: if (getXFType() == XF_STYLE) {
1605: buffer.append(" STYLE_RECORD_TYPE\n");
1606: } else if (getXFType() == XF_CELL) {
1607: buffer.append(" CELL_RECORD_TYPE\n");
1608: }
1609: buffer.append(" .fontindex = ").append(
1610: Integer.toHexString(getFontIndex())).append("\n");
1611: buffer.append(" .formatindex = ").append(
1612: Integer.toHexString(getFormatIndex())).append("\n");
1613: buffer.append(" .celloptions = ").append(
1614: Integer.toHexString(getCellOptions())).append("\n");
1615: buffer.append(" .islocked = ").append(isLocked())
1616: .append("\n");
1617: buffer.append(" .ishidden = ").append(isHidden())
1618: .append("\n");
1619: buffer.append(" .recordtype= ").append(
1620: Integer.toHexString(getXFType())).append("\n");
1621: buffer.append(" .parentidx = ").append(
1622: Integer.toHexString(getParentIndex())).append("\n");
1623: buffer.append(" .alignmentoptions= ").append(
1624: Integer.toHexString(getAlignmentOptions()))
1625: .append("\n");
1626: buffer.append(" .alignment = ").append(getAlignment())
1627: .append("\n");
1628: buffer.append(" .wraptext = ").append(getWrapText())
1629: .append("\n");
1630: buffer.append(" .valignment= ").append(
1631: Integer.toHexString(getVerticalAlignment())).append(
1632: "\n");
1633: buffer.append(" .justlast = ").append(
1634: Integer.toHexString(getJustifyLast())).append("\n");
1635: buffer.append(" .rotation = ").append(
1636: Integer.toHexString(getRotation())).append("\n");
1637: buffer.append(" .indentionoptions= ").append(
1638: Integer.toHexString(getIndentionOptions()))
1639: .append("\n");
1640: buffer.append(" .indent = ").append(
1641: Integer.toHexString(getIndent())).append("\n");
1642: buffer.append(" .shrinktoft= ").append(
1643: getShrinkToFit()).append("\n");
1644: buffer.append(" .mergecells= ")
1645: .append(getMergeCells()).append("\n");
1646: buffer.append(" .readngordr= ").append(
1647: Integer.toHexString(getReadingOrder())).append("\n");
1648: buffer.append(" .formatflag= ").append(
1649: isIndentNotParentFormat()).append("\n");
1650: buffer.append(" .fontflag = ").append(
1651: isIndentNotParentFont()).append("\n");
1652: buffer.append(" .prntalgnmt= ").append(
1653: isIndentNotParentAlignment()).append("\n");
1654: buffer.append(" .borderflag= ").append(
1655: isIndentNotParentBorder()).append("\n");
1656: buffer.append(" .paternflag= ").append(
1657: isIndentNotParentPattern()).append("\n");
1658: buffer.append(" .celloption= ").append(
1659: isIndentNotParentCellOptions()).append("\n");
1660: buffer.append(" .borderoptns = ").append(
1661: Integer.toHexString(getBorderOptions())).append("\n");
1662: buffer.append(" .lftln = ").append(
1663: Integer.toHexString(getBorderLeft())).append("\n");
1664: buffer.append(" .rgtln = ").append(
1665: Integer.toHexString(getBorderRight())).append("\n");
1666: buffer.append(" .topln = ").append(
1667: Integer.toHexString(getBorderTop())).append("\n");
1668: buffer.append(" .btmln = ").append(
1669: Integer.toHexString(getBorderBottom())).append("\n");
1670: buffer.append(" .paleteoptns = ").append(
1671: Integer.toHexString(getPaletteOptions())).append("\n");
1672: buffer.append(" .leftborder= ").append(
1673: Integer.toHexString(getLeftBorderPaletteIdx())).append(
1674: "\n");
1675: buffer.append(" .rghtborder= ").append(
1676: Integer.toHexString(getRightBorderPaletteIdx()))
1677: .append("\n");
1678: buffer.append(" .diag = ").append(
1679: Integer.toHexString(getDiag())).append("\n");
1680: buffer.append(" .paleteoptn2 = ").append(
1681: Integer.toHexString(getAdtlPaletteOptions())).append(
1682: "\n");
1683: buffer.append(" .topborder = ").append(
1684: Integer.toHexString(getTopBorderPaletteIdx())).append(
1685: "\n");
1686: buffer.append(" .botmborder= ").append(
1687: Integer.toHexString(getBottomBorderPaletteIdx()))
1688: .append("\n");
1689: buffer.append(" .adtldiag = ").append(
1690: Integer.toHexString(getAdtlDiag())).append("\n");
1691: buffer.append(" .diaglnstyl= ").append(
1692: Integer.toHexString(getAdtlDiagLineStyle())).append(
1693: "\n");
1694: buffer.append(" .fillpattrn= ").append(
1695: Integer.toHexString(getAdtlFillPattern())).append("\n");
1696: buffer.append(" .fillpaloptn = ").append(
1697: Integer.toHexString(getFillPaletteOptions())).append(
1698: "\n");
1699: buffer.append(" .foreground= ").append(
1700: Integer.toHexString(getFillForeground())).append("\n");
1701: buffer.append(" .background= ").append(
1702: Integer.toHexString(getFillBackground())).append("\n");
1703: buffer.append("[/EXTENDEDFORMAT]\n");
1704: return buffer.toString();
1705: }
1706:
1707: public int serialize(int offset, byte[] data) {
1708: LittleEndian.putShort(data, 0 + offset, sid);
1709: LittleEndian.putShort(data, 2 + offset, (short) (20)); // 24 - 4(sid/len)
1710: LittleEndian.putShort(data, 4 + offset, getFontIndex());
1711: LittleEndian.putShort(data, 6 + offset, getFormatIndex());
1712: LittleEndian.putShort(data, 8 + offset, getCellOptions());
1713: LittleEndian.putShort(data, 10 + offset, getAlignmentOptions());
1714: LittleEndian.putShort(data, 12 + offset, getIndentionOptions());
1715: LittleEndian.putShort(data, 14 + offset, getBorderOptions());
1716: LittleEndian.putShort(data, 16 + offset, getPaletteOptions());
1717: LittleEndian.putInt(data, 18 + offset, getAdtlPaletteOptions());
1718: LittleEndian.putShort(data, 22 + offset,
1719: getFillPaletteOptions());
1720: return getRecordSize();
1721: }
1722:
1723: public int getRecordSize() {
1724: return 24;
1725: }
1726:
1727: public short getSid() {
1728: return sid;
1729: }
1730: }
|