Logo Search packages:      
Sourcecode: jexcelapi version File versions  Download package

jxl::biff::XFRecord::XFRecord ( CellFormat  cellFormat  )  [inline, protected]

A public copy constructor which can be used for copy formats between different sheets. Unlike the the other copy constructor, this version does a deep copy

cellFormat the format to copy

Definition at line 517 of file XFRecord.java.

References align, backgroundColour, biffType, bottomBorder, bottomBorderColour, copied, excelFormat, font, format, formatInfoInitialized, getFont(), getFormat(), hidden, indentation, initialized, initializeFormatInformation(), jxl::biff::DisplayFormat::isBuiltIn(), leftBorder, leftBorderColour, locked, orientation, parentFormat, pattern, read, rightBorder, rightBorderColour, shrinkToFit, topBorder, topBorderColour, valign, wrap, and xfFormatType.


    Assert.verify(cellFormat != null);
    Assert.verify(cellFormat instanceof XFRecord);
    XFRecord fmt = (XFRecord) cellFormat;

    if (!fmt.formatInfoInitialized)

    locked             = fmt.locked;
    hidden             = fmt.hidden;
    align              = fmt.align;
    valign             = fmt.valign;
    orientation        = fmt.orientation;
    wrap               = fmt.wrap;
    leftBorder         = fmt.leftBorder;
    rightBorder        = fmt.rightBorder;
    topBorder          = fmt.topBorder;
    bottomBorder       = fmt.bottomBorder;
    leftBorderColour   = fmt.leftBorderColour;
    rightBorderColour  = fmt.rightBorderColour;
    topBorderColour    = fmt.topBorderColour;
    bottomBorderColour = fmt.bottomBorderColour;
    pattern            = fmt.pattern;
    xfFormatType       = fmt.xfFormatType;
    parentFormat       = fmt.parentFormat;
    indentation        = fmt.indentation;
    shrinkToFit        = fmt.shrinkToFit;
    backgroundColour   = fmt.backgroundColour;

    // Deep copy of the font
    font = new FontRecord(fmt.getFont());

    // Copy the format
    if (fmt.getFormat() == null)
      // format is writable
      if (fmt.format.isBuiltIn())
        format = fmt.format;
        // Format is not built in, so do a deep copy
        format = new FormatRecord((FormatRecord) fmt.format);
    else if (fmt.getFormat() instanceof BuiltInFormat)
      // read excel format is built in
      excelFormat = (BuiltInFormat) fmt.excelFormat;
      format = (BuiltInFormat) fmt.excelFormat;
      // read excel format is user defined

      // in this case FormattingRecords should initialize the excelFormat
      // field with an instance of FormatRecord
      Assert.verify(fmt.excelFormat instanceof FormatRecord);

      // Format is not built in, so do a deep copy
      FormatRecord fr = new FormatRecord((FormatRecord) fmt.excelFormat);

      // Set both format fields to be the same object, since
      // FormatRecord implements all the necessary interfaces
      excelFormat = fr;
      format = fr;

    biffType = biff8;

    // The format info should be all OK by virtue of the deep copy
    formatInfoInitialized = true;

    // This format was not read in
    read = false;

    // Treat this as a new cell record, so set the copied flag to false
    copied = false;

    // The font or format indexes need to be set, so set initialized to false
    initialized = false;

Generated by  Doxygen 1.6.0   Back to index